1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-10-21 20:38:45 +00:00

Add bld 0.2.4, a blacklisting daemon.

PR:		72598
Submitted by:	ob
This commit is contained in:
Anton Berezin 2004-10-27 19:54:46 +00:00
parent a895297c71
commit 1240a58212
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=120337
7 changed files with 211 additions and 0 deletions

View File

@ -41,6 +41,7 @@
SUBDIR += bfilter
SUBDIR += bing
SUBDIR += binkd
SUBDIR += bld
SUBDIR += bmon
SUBDIR += bnbt
SUBDIR += boclient

46
net/bld/Makefile Normal file
View File

@ -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>

2
net/bld/distinfo Normal file
View File

@ -0,0 +1,2 @@
MD5 (bld-0.2.4.tar.gz) = 5add7fcdae1344bdb9cd9349e05240b2
SIZE (bld-0.2.4.tar.gz) = 52915

30
net/bld/files/bld.sh Normal file
View File

@ -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"

13
net/bld/pkg-descr Normal file
View File

@ -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>

112
net/bld/pkg-install Normal file
View File

@ -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

7
net/bld/pkg-plist Normal file
View File

@ -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