Date: Wed, 13 Oct 2004 00:15:53 +0200 (CEST) From: Olivier Beyssac <obld@r14.freenix.org> To: FreeBSD-gnats-submit@FreeBSD.org Subject: ports/72598: Port submission Message-ID: <20041012221553.746725CC3@r14.redhate.org> Resent-Message-ID: <200410122220.i9CMKQFg074653@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 72598 >Category: ports >Synopsis: Port submission >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Tue Oct 12 22:20:26 GMT 2004 >Closed-Date: >Last-Modified: >Originator: Olivier Beyssac >Release: FreeBSD 5.3-BETA7 i386 >Organization: >Environment: System: FreeBSD r14.redhate.org 5.3-BETA7 FreeBSD 5.3-BETA7 #0: Mon Oct 11 13:07:37 CEST 2004 ob@r14.redhate.org:/usr/src/sys/i386/compile/R14 i386 >Description: BLD is a simple and efficient black list daemon >How-To-Repeat: >Fix: # This is a shell archive. Save it in a file, remove anything before # this line, and then unpack it by entering "sh file". Note, it may # create directories; files and directories will be owned by you and # have default permissions. # # This archive contains: # # bld # bld/Makefile # bld/pkg-descr # bld/pkg-plist # bld/distinfo # bld/pkg-install # bld/files # bld/files/bld.sh # echo c - bld mkdir -p bld > /dev/null 2>&1 echo x - bld/Makefile sed 's/^X//' >bld/Makefile << 'END-of-bld/Makefile' X# New ports collection makefile for: bld X# Date created: 12 October 2004 X# Whom: ob X# X# $FreeBSD$ X# X XPORTNAME= bld XPORTVERSION= 0.2.4 XCATEGORIES= net XMASTER_SITES= http://www.online.redhate.org/bld/ X XMAINTAINER= obld@r14.freenix.org XCOMMENT= A blacklisting daemon X XUSE_RC_SUBR= yes XMANCOMPRESSED= yes XGNU_CONFIGURE= yes X XMAN5= bld_whitelist.conf.5 bld_acl.conf.5 XMAN8= bldsubmit.8 bld.8 bldquery.8 bldread.8 X XSED_SCRIPT= -e 's|%%PREFIX%%|${PREFIX}|g' XRC_DIR= ${PREFIX}/etc/rc.d XRC_SUFX= .sh XSED_SCRIPT+= -e 's|%%RC_SUBR%%|${RC_SUBR}|g' \ X -e 's|%%RC_DIR%%|${RC_DIR}|g' \ X -e 's|%%RC_SUFX%%|${RC_SUFX}|g' X Xpre-install: X @${SETENV} PKG_PREFIX=${PREFIX} \ X ${SH} ${PKGINSTALL} ${PREFIX} PRE-INSTALL X Xpost-build: X ${SED} ${SED_SCRIPT} ${FILESDIR}/bld.sh \ X >${WRKDIR}/bld.sh X Xpost-install: X @${INSTALL_SCRIPT} ${WRKDIR}/bld.sh \ X ${RC_DIR}/bld${RC_SUFX} X @${MKDIR} ${DOCSDIR} X ${INSTALL_DATA} ${WRKSRC}/README ${DOCSDIR} X ./pkg-install bld POST-INSTALL X X.include <bsd.port.mk> END-of-bld/Makefile echo x - bld/pkg-descr sed 's/^X//' >bld/pkg-descr << 'END-of-bld/pkg-descr' XBLD stands for "black list daemon" and is intended to build blacklists Xusing simple rules based on a maximum number of submissions of the same XIP address during a minimum time interval. BLD was primarily designed to Xfight against dictionnary-based spams (by making the MTA report to BLD Xany host that tries to send a mail to an unknown user) but can be used Xby any application that needs a blacklist based on connection rate Xlimits. X XSee homepage for more infos: X XWWW: http://www.online.redhate.org/bld/ X XOlivier Beyssac <obld@r14.freenix.org> END-of-bld/pkg-descr echo x - bld/pkg-plist sed 's/^X//' >bld/pkg-plist << 'END-of-bld/pkg-plist' Xsbin/bld Xsbin/bldsubmit Xsbin/bldread Xsbin/bldquery X%%PORTDOCS%%%%DOCSDIR%%/README X@unexec rmdir /var/run/bld || (echo ; echo "Remove dumps from /var/run/bld/* if you don't want to keep them" ; echo) && true END-of-bld/pkg-plist echo x - bld/distinfo sed 's/^X//' >bld/distinfo << 'END-of-bld/distinfo' XMD5 (bld-0.2.4.tar.gz) = 5add7fcdae1344bdb9cd9349e05240b2 XSIZE (bld-0.2.4.tar.gz) = 52915 END-of-bld/distinfo echo x - bld/pkg-install sed 's/^X//' >bld/pkg-install << 'END-of-bld/pkg-install' X#!/bin/sh X Xif [ $2 != "POST-INSTALL" ] Xthen X exit Xfi X Xvarrun=/var/run/bld Xuser=bld Xgroup=bld X Xask() { X local question default answer X X question=$1 X default=$2 X if [ -z "${PACKAGE_BUILDING}" ]; then X read -p "${question} [${default}]? " answer X fi X if [ x${answer} = x ]; then X answer=${default} X fi X echo ${answer} X} X Xyesno() { X local dflt question answer X X question=$1 X dflt=$2 X while :; do X answer=$(ask "${question}" "${dflt}") X case "${answer}" in X [Yy]*) return 0;; X [Nn]*) return 1;; X esac X echo "Please answer yes or no." X done X} X Xmake_account() { X local u g gcos homeopt home X X u=$1 X g=$2 X gcos=$3 X homeopt=${4:+"-d $4"} X X if pw group show "${g}" >/dev/null 2>&1; then X echo "You already have a group \"${g}\", so I will use it." X else X echo "You need a group \"${g}\"." X if which -s pw && yesno "Would you like me to create it" y; then X pw groupadd ${g} || exit X echo "Done." X else X echo "Please create it, and try again." X if ! grep -q "^${u}:" /etc/passwd; then X echo "While you're at it, please create a user \"${u}\" too," X echo "with a default group of \"${g}\"." X fi X exit 1 X fi X fi X X if pw user show "${u}" >/dev/null 2>&1; then X echo "You already have a user \"${u}\", so I will use it." X else X echo "You need a user \"${u}\"." X if which -s pw && yesno "Would you like me to create it" y; then X pw useradd ${u} -g ${g} -h - ${homeopt} \ X -s /nonexistent -c "${gcos}" || exit X echo "Done." X else X echo "Please create it, and try again." X exit 1 X fi X fi X X if [ x"$homeopt" = x ]; then X eval home=~${u} X if [ ! -d "${home}" ]; then X if yesno \ X "Would you like me to create ${u}'s home directory (${home})" y X then X mkdir -p ${home}/.cvsup || exit X touch ${home}/.cvsup/auth || exit X chown -R ${u}:${g} ${home} || exit X chmod -R go= ${home} || exit X else X echo "Please create it, and try again." X exit 1 X fi X fi X fi X} X Xif [ ! -d "${varrun}" ] Xthen X mkdir ${varrun} || exit Xfi X Xecho "" Xmake_account ${user} ${group} "Blacklist Daemon" "/nonexistent" Xchmod 700 ${varrun} Xchown bld ${varrun} X Xif grep -q "^[^#]*${facility}.*/var/log/bld.log" /etc/syslog.conf; then X echo -n "It looks like you already have some logging set up, so I " X echo "will use it." Xelse X if yesno "Would you like me to set up the bld logging" y; then X echo "Setting up server logging in \"/etc/syslog.conf\"." X cat <<EOF >>/etc/syslog.conf X!bld X*.* /var/log/bld.log XEOF X X if [ ! -f /var/log/bld.log ]; then X echo "Creating \"/var/log/bld.log\"." X cp /dev/null /var/log/bld.log X fi X X if [ -f /var/run/syslog.pid ]; then X echo "Giving syslogd a kick in the pants." X kill -HUP $(cat /var/run/syslog.pid) X fi X X echo "Adding bld log entry to \"/etc/newsyslog.conf\"." X cat <<EOF >>/etc/newsyslog.conf X/var/log/bld.log 664 7 * 24 Z XEOF X echo "Done." X X else X cat <<EOF XOK, please remember to do it yourself. The crontab entry should run X"${base}/update.sh" as root. XEOF X fi Xfi END-of-bld/pkg-install echo c - bld/files mkdir -p bld/files > /dev/null 2>&1 echo x - bld/files/bld.sh sed 's/^X//' >bld/files/bld.sh << 'END-of-bld/files/bld.sh' X#!/bin/sh X X# PROVIDE: bld X# REQUIRE: LOGIN X# BEFORE: mail X# KEYWORD: FreeBSD shutdown X X# X# Add the following lines to /etc/rc.conf to enable bld: X# X#bld_enable="YES" X# X# See bld(8) for flags X# X X. %%RC_SUBR%% X Xname=bld Xrcvar=`set_rcvar` X Xcommand=%%PREFIX%%/sbin/bld Xrequired_dirs=/var/run/bld X X# set defaults X Xbld_enable=${bld_enable:-"NO"} Xbld_flags=${bld_flags:-""} X Xload_rc_config $name Xrun_rc_command "$1" END-of-bld/files/bld.sh exit >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20041012221553.746725CC3>