summaryrefslogtreecommitdiff
path: root/mail/proxsmtp/files/proxsmtpd.sh
diff options
context:
space:
mode:
authorjlam <jlam@pkgsrc.org>2004-12-02 04:08:18 +0000
committerjlam <jlam@pkgsrc.org>2004-12-02 04:08:18 +0000
commitfdc4b334af9b50993aefbb97bd45681d90a3aa56 (patch)
tree5ee870ec928f76b3df65a7e2d6f42376ffd57d0a /mail/proxsmtp/files/proxsmtpd.sh
parent222690ede7fb241120dcda7e7a433cd2afc50929 (diff)
downloadpkgsrc-fdc4b334af9b50993aefbb97bd45681d90a3aa56.tar.gz
proxsmtp 0.6 - SMTP proxy content filter
ProxSMTP is a flexible tool that allows you to reject, change or log email based on arbitrary critera. It accepts SMTP connections and forwards the SMTP commands and responses to another SMTP server. The 'DATA' email body is intercepted and filtered before forwarding. ProxSMTP can be used as a transparent proxy to filter an entire network's SMTP traffic at the router.
Diffstat (limited to 'mail/proxsmtp/files/proxsmtpd.sh')
-rw-r--r--mail/proxsmtp/files/proxsmtpd.sh72
1 files changed, 72 insertions, 0 deletions
diff --git a/mail/proxsmtp/files/proxsmtpd.sh b/mail/proxsmtp/files/proxsmtpd.sh
new file mode 100644
index 00000000000..7dc89bbff78
--- /dev/null
+++ b/mail/proxsmtp/files/proxsmtpd.sh
@@ -0,0 +1,72 @@
+#!@RCD_SCRIPTS_SHELL@
+#
+# $NetBSD: proxsmtpd.sh,v 1.1.1.1 2004/12/02 04:08:18 jlam Exp $
+#
+# PROVIDE: proxsmtpd
+# REQUIRE: LOGIN
+# BEFORE: mail
+# KEYWORD: shutdown
+#
+
+if [ -f /etc/rc.subr ]; then
+ . /etc/rc.subr
+fi
+
+name="proxsmtpd"
+rcvar=$name
+command="@PREFIX@/sbin/${name}"
+
+start_precmd="proxsmtpd_prestart"
+stop_postcmd="proxsmtpd_poststop"
+
+user="nobody"
+tempdir="/tmp"
+pidfile=/var/run/${name}.pid
+conffile="@PKG_SYSCONFDIR@/${name}.conf"
+if [ -f "${conffile}" ]; then
+ user=`@AWK@ 'BEGIN {r = "nobody"}; /^User:/ {r = $2}; END {print r}' ${conffile}`
+ tempdir=`@AWK@ 'BEGIN {r = "/tmp"}; /^TempDirectory:/ {r = $2}; END {print r}' ${conffile}`
+
+ case ${tempdir} in
+ /tmp) ;;
+ *) pidfile="${tempdir}/${name}.pid" ;;
+ esac
+fi
+
+command_args="-p ${pidfile}"
+
+proxsmtpd_prestart()
+{
+ case ${tempdir} in
+ /tmp) ;;
+ *) if [ ! -d "${tempdir}" ]; then
+ @MKDIR@ -p ${tempdir}
+ fi
+ @CHOWN@ -R ${user} ${tempdir}
+ @CHMOD@ -R 0700 ${tempdir}
+ ;;
+ esac
+ @TOUCH@ ${pidfile}
+ @CHOWN@ ${user} ${pidfile}
+}
+
+proxsmtpd_poststop()
+{
+ @RM@ -f ${pidfile}
+ case ${tempdir} in
+ /tmp) ;;
+ *) @RMDIR@ -p ${tempdir} 2>/dev/null || @TRUE@
+ esac
+}
+
+if [ -f /etc/rc.subr -a -d /etc/rc.d -a -f /etc/rc.d/DAEMON ]; then
+ load_rc_config $name
+ run_rc_command "$1"
+else
+ if [ -f /etc/rc.conf ]; then
+ . /etc/rc.conf
+ fi
+ @ECHO@ -n " ${name}"
+ eval ${start_precmd}
+ ${command} ${proxsmtpd_flags} ${command_args}
+fi