diff options
author | tobez <tobez@FreeBSD.org> | 2004-10-28 03:54:46 +0800 |
---|---|---|
committer | tobez <tobez@FreeBSD.org> | 2004-10-28 03:54:46 +0800 |
commit | 73400b5dc0a9ab6cbb1f71dbda66067df181528c (patch) | |
tree | 074bdec71a29098e36fa2a5f38f775cdb4134d79 /net | |
parent | d940945c2645058795f0b098d99e58b99a170c9b (diff) | |
download | freebsd-ports-gnome-73400b5dc0a9ab6cbb1f71dbda66067df181528c.tar.gz freebsd-ports-gnome-73400b5dc0a9ab6cbb1f71dbda66067df181528c.tar.zst freebsd-ports-gnome-73400b5dc0a9ab6cbb1f71dbda66067df181528c.zip |
Add bld 0.2.4, a blacklisting daemon.
PR: 72598
Submitted by: ob
Diffstat (limited to 'net')
-rw-r--r-- | net/Makefile | 1 | ||||
-rw-r--r-- | net/bld/Makefile | 46 | ||||
-rw-r--r-- | net/bld/distinfo | 2 | ||||
-rw-r--r-- | net/bld/files/bld.sh | 30 | ||||
-rw-r--r-- | net/bld/pkg-descr | 13 | ||||
-rw-r--r-- | net/bld/pkg-install | 112 | ||||
-rw-r--r-- | net/bld/pkg-plist | 7 |
7 files changed, 211 insertions, 0 deletions
diff --git a/net/Makefile b/net/Makefile index 6b5f861f8ba0..a8736231e507 100644 --- a/net/Makefile +++ b/net/Makefile @@ -41,6 +41,7 @@ SUBDIR += bfilter SUBDIR += bing SUBDIR += binkd + SUBDIR += bld SUBDIR += bmon SUBDIR += bnbt SUBDIR += boclient diff --git a/net/bld/Makefile b/net/bld/Makefile new file mode 100644 index 000000000000..2639cb1821d1 --- /dev/null +++ b/net/bld/Makefile @@ -0,0 +1,46 @@ +# New ports collection makefile for: bld +# Date created: 12 October 2004 +# Whom: ob +# +# $FreeBSD$ +# + +PORTNAME= bld +PORTVERSION= 0.2.4 +CATEGORIES= net +MASTER_SITES= http://www.online.redhate.org/bld/ + +MAINTAINER= obld@r14.freenix.org +COMMENT= A blacklisting daemon + +USE_RC_SUBR= yes +MANCOMPRESSED= yes +GNU_CONFIGURE= yes + +PORTDOCS= README +MAN5= bld_whitelist.conf.5 bld_acl.conf.5 +MAN8= bldsubmit.8 bld.8 bldquery.8 bldread.8 + +SED_SCRIPT= -e 's|%%PREFIX%%|${PREFIX}|g' +RC_DIR= ${PREFIX}/etc/rc.d +RC_SUFX= .sh +SED_SCRIPT+= -e 's|%%RC_SUBR%%|${RC_SUBR}|g' \ + -e 's|%%RC_DIR%%|${RC_DIR}|g' \ + -e 's|%%RC_SUFX%%|${RC_SUFX}|g' + +post-build: + ${SED} ${SED_SCRIPT} ${FILESDIR}/bld.sh \ + >${WRKDIR}/bld.sh + +post-install: +.if !defined(NOPORTDOCS) + @${MKDIR} ${DOCSDIR} +.for doc in ${PORTDOCS} + ${INSTALL_DATA} ${WRKSRC}/${doc} ${DOCSDIR} +.endfor +.endif + @${INSTALL_SCRIPT} ${WRKDIR}/bld.sh \ + ${RC_DIR}/bld${RC_SUFX} + ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL + +.include <bsd.port.mk> diff --git a/net/bld/distinfo b/net/bld/distinfo new file mode 100644 index 000000000000..006a1901a46d --- /dev/null +++ b/net/bld/distinfo @@ -0,0 +1,2 @@ +MD5 (bld-0.2.4.tar.gz) = 5add7fcdae1344bdb9cd9349e05240b2 +SIZE (bld-0.2.4.tar.gz) = 52915 diff --git a/net/bld/files/bld.sh b/net/bld/files/bld.sh new file mode 100644 index 000000000000..b0371b5de11b --- /dev/null +++ b/net/bld/files/bld.sh @@ -0,0 +1,30 @@ +#!/bin/sh + +# PROVIDE: bld +# REQUIRE: LOGIN +# BEFORE: mail +# KEYWORD: FreeBSD shutdown + +# +# Add the following lines to /etc/rc.conf to enable bld: +# +#bld_enable="YES" +# +# See bld(8) for flags +# + +. %%RC_SUBR%% + +name=bld +rcvar=`set_rcvar` + +command=%%PREFIX%%/sbin/bld +required_dirs=/var/run/bld + +# set defaults + +bld_enable=${bld_enable:-"NO"} +bld_flags=${bld_flags:-""} + +load_rc_config $name +run_rc_command "$1" diff --git a/net/bld/pkg-descr b/net/bld/pkg-descr new file mode 100644 index 000000000000..94496f279688 --- /dev/null +++ b/net/bld/pkg-descr @@ -0,0 +1,13 @@ +BLD stands for "black list daemon" and is intended to build blacklists +using simple rules based on a maximum number of submissions of the same +IP address during a minimum time interval. BLD was primarily designed to +fight against dictionnary-based spams (by making the MTA report to BLD +any host that tries to send a mail to an unknown user) but can be used +by any application that needs a blacklist based on connection rate +limits. + +See homepage for more infos: + +WWW: http://www.online.redhate.org/bld/ + +Olivier Beyssac <obld@r14.freenix.org> diff --git a/net/bld/pkg-install b/net/bld/pkg-install new file mode 100644 index 000000000000..b857c55b1b33 --- /dev/null +++ b/net/bld/pkg-install @@ -0,0 +1,112 @@ +#!/bin/sh + +if [ $2 != "POST-INSTALL" ] +then + exit +fi + +varrun=/var/run/bld +user=bld +group=bld + +ask() { + local question default answer + + question=$1 + default=$2 + if [ -z "${PACKAGE_BUILDING}" ]; then + read -p "${question} [${default}]? " answer + fi + if [ x${answer} = x ]; then + answer=${default} + fi + echo ${answer} +} + +yesno() { + local dflt question answer + + question=$1 + dflt=$2 + while :; do + answer=$(ask "${question}" "${dflt}") + case "${answer}" in + [Yy]*) return 0;; + [Nn]*) return 1;; + esac + echo "Please answer yes or no." + done +} + +make_account() { + local u g gcos homeopt home + + u=$1 + g=$2 + gcos=$3 + homeopt=${4:+"-d $4"} + + if pw group show "${g}" >/dev/null 2>&1; then + echo "You already have a group \"${g}\", so I will use it." + else + echo "You need a group \"${g}\"." + pw groupadd ${g} || exit + echo "Done." + fi + + if pw user show "${u}" >/dev/null 2>&1; then + echo "You already have a user \"${u}\", so I will use it." + else + echo "You need a user \"${u}\"." + pw useradd ${u} -g ${g} -h - ${homeopt} \ + -s /nonexistent -c "${gcos}" || exit + echo "Done." + fi + + if [ x"$homeopt" = x ]; then + eval home=~${u} + if [ ! -d "${home}" ]; then + mkdir -p ${home}/.cvsup || exit + touch ${home}/.cvsup/auth || exit + chown -R ${u}:${g} ${home} || exit + chmod -R go= ${home} || exit + fi + fi +} + +if [ ! -d "${varrun}" ] +then + mkdir ${varrun} || exit +fi + +echo "" +make_account ${user} ${group} "Blacklist Daemon" "/nonexistent" +chmod 700 ${varrun} +chown bld ${varrun} + +if grep -q "^[^#]*${facility}.*/var/log/bld.log" /etc/syslog.conf; then + echo -n "It looks like you already have some logging set up, so I " + echo "will use it." +else + echo "Setting up server logging in \"/etc/syslog.conf\"." + cat <<EOF >>/etc/syslog.conf +!bld +*.* /var/log/bld.log +EOF + + if [ ! -f /var/log/bld.log ]; then + echo "Creating \"/var/log/bld.log\"." + cp /dev/null /var/log/bld.log + fi + + if [ -f /var/run/syslog.pid ]; then + echo "Giving syslogd a kick in the pants." + kill -HUP $(cat /var/run/syslog.pid) + fi + + echo "Adding bld log entry to \"/etc/newsyslog.conf\"." + cat <<EOF >>/etc/newsyslog.conf +/var/log/bld.log 664 7 * 24 Z +EOF + echo "Done." +fi diff --git a/net/bld/pkg-plist b/net/bld/pkg-plist new file mode 100644 index 000000000000..196f7dd2d6f1 --- /dev/null +++ b/net/bld/pkg-plist @@ -0,0 +1,7 @@ +sbin/bld +sbin/bldsubmit +sbin/bldread +sbin/bldquery +etc/rc.d/bld.sh +%%PORTDOCS%%@unexec %D/%%DOCSDIR%% 2>/dev/null || true +@unexec rmdir /var/run/bld || (echo ; echo "Remove dumps from /var/run/bld/* if you don't want to keep them" ; echo) && true |