diff options
author | schmonz <schmonz@pkgsrc.org> | 2017-05-31 07:08:04 +0000 |
---|---|---|
committer | schmonz <schmonz@pkgsrc.org> | 2017-05-31 07:08:04 +0000 |
commit | dccfc36bc4e3f8f2f1f4e719e46d7c0bad4b1489 (patch) | |
tree | 47a7a63a80c20f7f2c9ef842676bff40f22ad2aa /mail | |
parent | a7203c03b7482d4601edaf6c2d3a62e4628682d1 (diff) | |
download | pkgsrc-dccfc36bc4e3f8f2f1f4e719e46d7c0bad4b1489.tar.gz |
Add dependency on qmail-qfilter. Deprecate qmail-qfilter-queue in favor
of qmail-qfilter-{ofmipd,smtpd}-queue, and document how to enable
filtering for incoming and submitted messages. Bump version.
Diffstat (limited to 'mail')
-rw-r--r-- | mail/qmail-run/MESSAGE | 19 | ||||
-rw-r--r-- | mail/qmail-run/Makefile | 20 | ||||
-rw-r--r-- | mail/qmail-run/PLIST | 4 | ||||
-rw-r--r-- | mail/qmail-run/files/qmail-qfilter-queue.sh | 74 |
4 files changed, 83 insertions, 34 deletions
diff --git a/mail/qmail-run/MESSAGE b/mail/qmail-run/MESSAGE index 7101844882c..99bbd56b3fc 100644 --- a/mail/qmail-run/MESSAGE +++ b/mail/qmail-run/MESSAGE @@ -1,8 +1,11 @@ =========================================================================== -$NetBSD: MESSAGE,v 1.4 2017/01/09 04:58:09 schmonz Exp $ +$NetBSD: MESSAGE,v 1.5 2017/05/31 07:08:04 schmonz Exp $ Please read ${PREFIX}/share/doc/qmail-run/README.pkgsrc. +NOTE: qmail-qfilter-queue is deprecated and will be removed in 2017Q3. +Please migrate to qmail-qfilter-{ofmipd,smtpd}-queue. + To enable qmail for... Local and outgoing deliveries: @@ -24,8 +27,20 @@ Outgoing submissions with SMTP AUTH over TLS: POP3 (only for Maildirs): - Set qmailpop3d=YES in /etc/rc.conf. -To make the queue visible to local non-root users: +Local non-root users to see the queue: - Set qmailqread=YES in /etc/rc.conf. - Change the mailq entry in /etc/mailer.conf to qmail-qread-client. +Filtering incoming messages arriving via SMTP: +- Set QMAILQUEUE="${PREFIX}/bin/qmail-qfilter-smtpd-queue" in tcp.smtp. +- Reload the cdb: /etc/rc.d/qmailsmtpd cdb +- Consult qmail-qfilter(1) and see share/examples/qmail-qfilter. +- Place executable filters named 'smtpd-*' in ${PKG_SYSCONFDIR}/filters. + +Filtering outgoing messages submitted via OFMIP: +- Set QMAILQUEUE="${PREFIX}/bin/qmail-qfilter-ofmipd-queue" in tcp.ofmip. +- Reload the cdb: /etc/rc.d/qmailofmipd cdb +- Consult qmail-qfilter(1) and see share/examples/qmail-qfilter. +- Place executable filters named 'ofmipd-*' in ${PKG_SYSCONFDIR}/filters. + =========================================================================== diff --git a/mail/qmail-run/Makefile b/mail/qmail-run/Makefile index e15d591cb4f..d49db66e14f 100644 --- a/mail/qmail-run/Makefile +++ b/mail/qmail-run/Makefile @@ -1,7 +1,7 @@ -# $NetBSD: Makefile,v 1.35 2017/04/11 14:04:37 schmonz Exp $ +# $NetBSD: Makefile,v 1.36 2017/05/31 07:08:04 schmonz Exp $ # -DISTNAME= qmail-run-20170411 +DISTNAME= qmail-run-20170531 CATEGORIES= mail MASTER_SITES= # empty DISTFILES= # empty @@ -12,8 +12,7 @@ LICENSE= 2-clause-bsd DEPENDS_QMAIL= qmail>=1.03nb8:../../mail/qmail DEPENDS+= ${DEPENDS_QMAIL} - -CONFLICTS+= qmail-qfilter-1.5nb1 +DEPENDS+= qmail-qfilter>1.5nb1:../../mail/qmail-qfilter WRKSRC= ${WRKDIR} NO_BUILD= yes @@ -24,12 +23,12 @@ FILES_SUBST+= QMAIL_LOG_USER=${QMAIL_LOG_USER:Q} FILES_SUBST+= QMAIL_SEND_USER=${QMAIL_SEND_USER:Q} FILES_SUBST+= QMAIL_QUEUE_EXTRA=${QMAIL_QUEUE_EXTRA:Q} FILES_SUBST+= PKGNAME=${PKGNAME:Q} -MESSAGE_SUBST+= PKG_SYSCONFBASE=${PKG_SYSCONFBASE} +MESSAGE_SUBST+= PKG_SYSCONFBASE=${PKG_SYSCONFBASE:Q} RCD_SCRIPTS= qmail qmailofmipd qmailpop3d qmailqread qmailsend qmailsmtpd INSTALLATION_DIRS= bin share/doc/qmail-run share/examples/qmail-run BUILD_DEFS+= QMAIL_DAEMON_USER QMAIL_LOG_USER QMAIL_SEND_USER -BUILD_DEFS+= QMAIL_QUEUE_EXTRA +BUILD_DEFS+= QMAIL_QUEUE_EXTRA PKG_SYSCONFBASE .include "../../mk/bsd.prefs.mk" @@ -71,9 +70,12 @@ post-extract: done do-install: - ${INSTALL_SCRIPT} ${WRKDIR}/qmail-procmail ${DESTDIR}${PREFIX}/bin - ${INSTALL_SCRIPT} ${WRKDIR}/qmail-qfilter-queue ${DESTDIR}${PREFIX}/bin - ${INSTALL_SCRIPT} ${WRKDIR}/qmail-qread-client ${DESTDIR}${PREFIX}/bin + for f in qmail-procmail qmail-qfilter-queue qmail-qread-client; do \ + ${INSTALL_SCRIPT} ${WRKDIR}/$$f ${DESTDIR}${PREFIX}/bin; \ + done + for f in qmail-qfilter-ofmipd-queue qmail-qfilter-smtpd-queue; do \ + ${INSTALL_SCRIPT} ${WRKDIR}/qmail-qfilter-queue ${DESTDIR}${PREFIX}/bin/$$f; \ + done ${INSTALL_DATA} ${WRKDIR}/README.pkgsrc \ ${DESTDIR}${PREFIX}/share/doc/qmail-run ${INSTALL_DATA} ${WRKDIR}/mailer.conf \ diff --git a/mail/qmail-run/PLIST b/mail/qmail-run/PLIST index 968e6eb656d..149fa8cd87f 100644 --- a/mail/qmail-run/PLIST +++ b/mail/qmail-run/PLIST @@ -1,6 +1,8 @@ -@comment $NetBSD: PLIST,v 1.7 2017/01/09 04:58:09 schmonz Exp $ +@comment $NetBSD: PLIST,v 1.8 2017/05/31 07:08:04 schmonz Exp $ bin/qmail-procmail +bin/qmail-qfilter-ofmipd-queue bin/qmail-qfilter-queue +bin/qmail-qfilter-smtpd-queue bin/qmail-qread-client share/doc/qmail-run/README.pkgsrc share/examples/qmail-run/mailer.conf diff --git a/mail/qmail-run/files/qmail-qfilter-queue.sh b/mail/qmail-run/files/qmail-qfilter-queue.sh index 1e715e43de2..d21c06ef60a 100644 --- a/mail/qmail-run/files/qmail-qfilter-queue.sh +++ b/mail/qmail-run/files/qmail-qfilter-queue.sh @@ -5,31 +5,61 @@ # # Using this wrapper, executable filters: # * Must be placed in @PKG_SYSCONFDIR@/filters -# * Must have filenames matching "qfilter-*" +# * Must have filenames matching "ofmipd-*" or "smtpd-*" # * Will be executed with no arguments # * Will be executed in sort(1) order -# -# To use this script to filter messages arriving via SMTP, set the -# QMAILQUEUE environment variable in tcp.smtp like so: -# -# :allow,QMAILQUEUE="@PREFIX@/bin/qmail-qfilter-queue" -# -# Then rebuild the cdb. -possible_qfilters=`@ECHO@ @PKG_SYSCONFDIR@/filters/qfilter-* | @SORT@` -qfilters="" +CAT=@CAT@ +ECHO=@ECHO@ +PKG_SYSCONFDIR=@PKG_SYSCONFDIR@ +PREFIX=@PREFIX@ +SED=@SED@ +SORT=@SORT@ + +warn() { + ${ECHO} >&2 "$@" +} + +choose_glob() { + local _progname _glob + _progname="$1" + case "${_progname}" in + qmail-qfilter-ofmipd-queue) _glob='ofmipd-*' ;; + qmail-qfilter-smtpd-queue) _glob='smtpd-*' ;; + qmail-qfilter-queue) _glob='qfilter-*' ;; + esac + ${ECHO} "${_glob}" +} + +choose_filters() { + local _glob _filters _possible_filters _filter + _glob="$1" + _possible_filters=$(${ECHO} ${PKG_SYSCONFDIR}/filters/${_glob} | ${SORT}) + if [ "${_possible_filters}" = "${PKG_SYSCONFDIR}/filters/${_glob}" ]; then + _filters="${CAT}" + else + for _filter in ${_possible_filters}; do + [ -x "${_filter}" ] && _filters="${_filters} ${_filter}" + done + [ -z "${_filters}" ] && _filters="${CAT}" + fi + ${ECHO} "${_filters}" +} -if [ "${possible_qfilters}" = "@PKG_SYSCONFDIR@/filters/qfilter-*" ]; then - qfilters="@CAT@" -else - for qfilter in ${possible_qfilters}; do - if [ -x "${qfilter}" ]; then - qfilters="${qfilters} ${qfilter}" - fi - done - [ -z "${qfilters}" ] && qfilters="@CAT@" -fi +qfilter_args() { + local _filters + _filters="$1" + ${ECHO} ${_filters} | ${SED} -e 's| | -- |g' +} -qfilter_cmd="@PREFIX@/bin/qmail-qfilter `@ECHO@ ${qfilters} | @SED@ -e 's| | -- |g'`" +main() { + local _progname _glob _filters _args _cmd + _progname=$(basename "$0") + _glob=$(choose_glob "${_progname}") + _filters=$(choose_filters "${_glob}") + _args=$(qfilter_args "${_filters}") + _cmd="${PREFIX}/bin/qmail-qfilter ${_args}" + exec ${_cmd} +} -exec ${qfilter_cmd} +main "$@" |