diff --git a/mail/opendkim/Makefile b/mail/opendkim/Makefile index 18cf989dcb06..620252c2fff5 100644 --- a/mail/opendkim/Makefile +++ b/mail/opendkim/Makefile @@ -1,171 +1,171 @@ # Created by: Hirohisa Yamaguchi PORTNAME= opendkim PORTVERSION= 2.10.3 -PORTREVISION= 13 +PORTREVISION= 14 CATEGORIES= mail security MASTER_SITES= SF/${PORTNAME} \ SF/${PORTNAME}/Previous%20Releases \ ftp://ftpmirror.uk/freebsd-ports/${PORTNAME}/ MAINTAINER= freebsd-ports@dan.me.uk COMMENT= DKIM library and milter implementation LICENSE= BSD3CLAUSE SENDMAIL LICENSE_COMB= multi LICENSE_FILE_SENDMAIL= ${WRKSRC}/LICENSE.Sendmail LICENSE_GROUPS_SENDMAIL=FSF OSI LICENSE_NAME_SENDMAIL= Sendmail Open Source License LICENSE_PERMS_SENDMAIL= dist-mirror dist-sell pkg-mirror pkg-sell auto-accept GNU_CONFIGURE= yes NO_OPTIONS_SORT=yes USES= autoreconf cpe libtool perl5 pkgconfig shebangfix ssl USE_PERL5= run SHEBANG_FILES= opendkim/opendkim-genkey* reputation/opendkim-* stats/opendkim-* \ reprrd/opendkim-reprrdimport* USE_LDCONFIG= yes TEST_TARGET= check # XXX: 1 of 30 tests fails PORTDOCS= * CONFIGURE_ARGS+= --without-tre OPTIONS_SUB= yes OPTIONS_SINGLE= RESOLV OPTIONS_SINGLE_RESOLV= STOCK_RESOLVER UNBOUND OPTIONS_DEFINE= FILTER CURL GNUTLS JANSSON LDNS LMDB LUA MEMCACHED \ BDB_BASE OPENDBX OPENLDAP POPAUTH QUERY_CACHE SASL DOCS OPTIONS_DEFAULT= FILTER LUA UNBOUND STOCK_RESOLVER_DESC= Use the stock resolver library UNBOUND_DESC= Use unbound DNS library UNBOUND_CONFIGURE_WITH= unbound UNBOUND_LIB_DEPENDS= libunbound.so:dns/unbound FILTER_DESC= OpenDKIM filter, requires libmilter/Sendmail FILTER_USE= RC_SUBR=milter-opendkim CURL_DESC= Use cURL for web queries CURL_CONFIGURE_WITH= libcurl CURL_LIB_DEPENDS= libcurl.so:ftp/curl GNUTLS_DESC= Use GnuTLS instead of OpenSSL GNUTLS_LIB_DEPENDS= libgnutls.so:security/gnutls GNUTLS_CONFIGURE_WITH= gnutls GNUTLS_CONFIGURE_OFF= --with-openssl=${OPENSSLBASE} JANSSON_DESC= Statistics and other output as JSON data JANSSON_CONFIGURE_WITH= libjansson JANSSON_LIB_DEPENDS= libjansson.so:devel/jansson LDNS_DESC= Use LDNS library for DNS queries LDNS_CONFIGURE_WITH= ldns LDNS_LIB_DEPENDS= libldns.so:dns/ldns LMDB_DESC= Use Lightning Memory-Mapped DB key-value store LMDB_CONFIGURE_WITH= lmdb LMDB_LIB_DEPENDS= liblmdb.so:databases/lmdb LUA_DESC= Describe filter policy with lua LUA_CONFIGURE_WITH= lua LUA_USES= lua MEMCACHED_DESC= Use memcached as a data set MEMCACHED_CONFIGURE_WITH= libmemcached MEMCACHED_LIB_DEPENDS= libmemcached.so:databases/libmemcached BDB_BASE_DESC= Use Berkeley DB from base OPENDBX_DESC= Store filter policies via OpenDBX OPENDBX_CONFIGURE_WITH= odbx OPENDBX_LIB_DEPENDS= libopendbx.so:databases/opendbx OPENLDAP_DESC= Store filter policies in LDAP OPENLDAP_CONFIGURE_WITH=openldap OPENLDAP_USE= OPENLDAP=yes POPAUTH_DESC= Use POP authentication DB POPAUTH_CONFIGURE_ENABLE= popauth QUERY_CACHE_DESC= Cache DNS query results locally QUERY_CACHE_CONFIGURE_ENABLE= query_cache SASL_DESC= Enable SASL authentication with LDAP SASL_CONFIGURE_WITH= sasl MAKE_ARGS+= pkgconfigdir="${PREFIX}/libdata/pkgconfig" MAKE_ENV= INSTALL_STRIP_FLAG=${STRIP} .include "${.CURDIR}/Makefile.options" .include .if ${PORT_OPTIONS:MDEBUG} WITH_DEBUG= yes .endif .if ${PORT_OPTIONS:MFILTER} SUB_FILES= pkg-message WITHOUT_MILTER_CFLAGS= yes WITHOUT_MILTER_LDFLAGS= yes .include "${PORTSDIR}/mail/sendmail/bsd.milter.mk" CONFIGURE_ARGS+= --with-milter=${MILTERBASE} .endif .if ${PORT_OPTIONS:MLUA_ONLY_SIGNING} || \ ${PORT_OPTIONS:MRBL} .if !${PORT_OPTIONS:MLUA} IGNORE= options LUA_ONLY_SIGNING and RBL require LUA as well .endif .endif .if ${PORT_OPTIONS:MREPUTATION} .if !${PORT_OPTIONS:MCURL} || !${PORT_OPTIONS:MJANSSON} IGNORE= option REPUTATION requires CURL and JANSSON as well .endif .endif .if ${PORT_OPTIONS:MSTATSEXT} .if !${PORT_OPTIONS:MSTATS} || !${PORT_OPTIONS:MLUA} IGNORE= option STATSEXT requires STATS and LUA as well .endif .endif .if ${PORT_OPTIONS:MPOPAUTH} \ || ${PORT_OPTIONS:MQUERY_CACHE} \ || ${PORT_OPTIONS:MLDAP_CACHING} \ || ${PORT_OPTIONS:MREPUTATION} \ || ${PORT_OPTIONS:MSTATS} . if ${PORT_OPTIONS:MBDB_BASE} CONFIGURE_ARGS+= --with-db-lib=c . else CONFIGURE_ARGS+= --with-db-incdir=${BDB_INCLUDE_DIR} \ --with-db-libdir=${BDB_LIB_DIR} \ --with-db-lib=${BDB_LIB_NAME} USES+= bdb . endif .endif .if ${PORT_OPTIONS:MCODECOVERAGE} LDFLAGS+= -lpthread .endif pre-configure: ${REINPLACE_CMD} -e '/PKG_CHECK_MODULES/s/lua5\.[0-9]/lua-${LUA_VER}/' \ -e '/PKG_CONFIG/s/cyrussasl/libsasl2/' \ ${WRKSRC}/configure.ac post-patch-LCOV-on: ${CP} ${FILESDIR}/lcov-helper.sh ${WRKSRC}/libopendkim/tests/ ${CP} ${FILESDIR}/lcov-helper.sh ${WRKSRC}/opendkim/tests/ ${FIND} ${WRKSRC} -type f -name \*-helper.sh -exec ${CHMOD} 755 {} + post-install: @${MKDIR} ${STAGEDIR}${PREFIX}/etc/mail ${INSTALL_DATA} ${WRKSRC}/opendkim/opendkim.conf.sample \ ${STAGEDIR}${PREFIX}/etc/mail/ .include diff --git a/mail/opendkim/files/milter-opendkim.in b/mail/opendkim/files/milter-opendkim.in index 930b91ee32d5..8d83197d8884 100644 --- a/mail/opendkim/files/milter-opendkim.in +++ b/mail/opendkim/files/milter-opendkim.in @@ -1,203 +1,199 @@ #!/bin/sh # PROVIDE: milter-opendkim # REQUIRE: DAEMON # BEFORE: mail # KEYWORD: shutdown # Define these milteropendkim_* variables in one of these files: # /etc/rc.conf # /etc/rc.conf.local # /etc/rc.conf.d/milteropendkim # # milteropendkim_enable (bool): Set to "NO" by default. # Set it to "YES" to enable dkim-milter # milteropendkim_uid (str): Set username to run milter. # milteropendkim_gid (str): Set group to run milter. # milteropendkim_profiles (list): Set to "" by default. # Define your profiles here. # milteropendkim_cfgfile (str): Configuration file. See opendkim.conf(5) # # milteropendkim_${profile}_* : Variables per profile. # Sockets must be different from each other. # # milteropendkim_socket_perms (str): # Permissions for local|unix socket. # # all parameters below now can be set in opendkim.conf(5). # milteropendkim_socket (str): Path to the milter socket. # milteropendkim_domain (str): Domainpart of From: in mails to sign. # milteropendkim_key (str): Path to the private key file to sign with. # milteropendkim_selector (str): Selector to use when signing # milteropendkim_alg (str): Algorithm to use when signing # milteropendkim_flags (str): Flags passed to start command. . /etc/rc.subr name="milteropendkim" rcvar=milteropendkim_enable extra_commands="reload" start_precmd="dkim_prepcmd" start_postcmd="dkim_start_postcmd" stop_postcmd="dkim_postcmd" command="%%PREFIX%%/sbin/opendkim" _piddir="/var/run/milteropendkim" pidfile="${_piddir}/pid" sig_reload="USR1" load_rc_config $name # # DO NOT CHANGE THESE DEFAULT VALUES HERE # -: ${milteropendkim_enable="NO"} -: ${milteropendkim_uid="mailnull"} -: ${milteropendkim_gid="mailnull"} -: ${milteropendkim_cfgfile="%%PREFIX%%/etc/mail/opendkim.conf"} -: ${milteropendkim_socket_perms="0755"} +: ${milteropendkim_enable:="NO"} +: ${milteropendkim_uid:="mailnull"} +: ${milteropendkim_gid:="mailnull"} +: ${milteropendkim_cfgfile:="%%PREFIX%%/etc/mail/opendkim.conf"} +: ${milteropendkim_socket_perms:="0755"} # Options other than above can be set with $milteropendkim_flags. # see dkim-milter documentation for detail. +extra_commands="reload" +start_precmd="dkim_prepcmd" +start_postcmd="dkim_start_postcmd" +stop_postcmd="dkim_cleansockets" +command="%%PREFIX%%/sbin/opendkim" +sig_reload="USR1" + +dkim_cleansockets() +{ + rm -f "${milteropendkim_socket##local:}" "${milteropendkim_socket##unix:}" +} + +dkim_get_pidfile() +{ + if get_pidfile_from_conf PidFile ${milteropendkim_cfgfile#-x }; then + pidfile="$_pidfile_from_conf" + else + pidfile="/var/run/milteropendkim/${profile:-pid}" + fi +} + +dkim_prepcmd() +{ + dkim_cleansockets + dkim_get_pidfile + install -d -o ${milteropendkim_uid%:*} -g $milteropendkim_gid \ + -m ${milteropendkim_socket_perms} ${pidfile%/*} +} + +dkim_start_postcmd() +{ + if [ -n "${milteropendkim_socket}" ] ; then + # postcmd is executed too fast and socket is not created before checking... + sleep 1 + chmod -f ${milteropendkim_socket_perms} \ + ${milteropendkim_socket##local:} \ + ${milteropendkim_socket##unix:} + fi +} + if [ -n "$2" ]; then profile="$2" if [ -n "${milteropendkim_profiles}" ]; then pidfile="${_piddir}/${profile}.pid" eval milteropendkim_enable="\${milteropendkim_${profile}_enable:-${milteropendkim_enable}}" eval milteropendkim_socket="\${milteropendkim_${profile}_socket:-}" eval milteropendkim_socket_perms="\${milteropendkim_${profile}_socket_perms:-}" - if [ "x${milteropendkim_socket}" = "x" ];then + if [ -z "${milteropendkim_socket}" ];then echo "You must define a socket (milteropendkim_${profile}_socket)" exit 1 fi eval milteropendkim_cfgfile="\${milteropendkim_${profile}_cfgfile:-${milteropendkim_cfgfile}}" eval milteropendkim_domain="\${milteropendkim_${profile}_domain:-${milteropendkim_domain}}" eval milteropendkim_key="\${milteropendkim_${profile}_key:-${milteropendkim_key}}" eval milteropendkim_selector="\${milteropendkim_${profile}_selector:-${milteropendkim_selector}}" eval milteropendkim_alg="\${milteropendkim_${profile}_alg:-${milteropendkim_alg}}" eval milteropendkim_flags="\${milteropendkim_${profile}_flags:-${milteropendkim_flags}}" if [ -f "${milteropendkim_cfgfile}" ];then milteropendkim_cfgfile="-x ${milteropendkim_cfgfile}" else milteropendkim_cfgfile="" fi if [ -n "${milteropendkim_socket}" ];then _socket_prefix="-p" fi if [ -n "${milteropendkim_uid}" ];then _uid_prefix="-u" if [ -n "${milteropendkim_gid}" ];then milteropendkim_uid=${milteropendkim_uid}:${milteropendkim_gid} fi fi if [ -n "${milteropendkim_domain}" ];then milteropendkim_domain="-d ${milteropendkim_domain}" fi if [ -n "${milteropendkim_key}" ];then milteropendkim_key="-k ${milteropendkim_key}" fi if [ -n "${milteropendkim_selector}" ];then milteropendkim_selector="-s ${milteropendkim_selector}" fi if [ -n "${milteropendkim_alg}" ];then milteropendkim_alg="-S ${milteropendkim_alg}" fi + dkim_get_pidfile command_args="-l ${_socket_prefix} ${milteropendkim_socket} ${_uid_prefix} ${milteropendkim_uid} -P ${pidfile} ${milteropendkim_cfgfile} ${milteropendkim_domain} ${milteropendkim_key} ${milteropendkim_selector} ${milteropendkim_alg}" else echo "$0: extra argument ignored" fi else if [ -n "${milteropendkim_profiles}" ] && [ -n "$1" ]; then if [ "$1" != "restart" ]; then for profile in ${milteropendkim_profiles}; do echo "===> milteropendkim profile: ${profile}" %%PREFIX%%/etc/rc.d/milter-opendkim $1 ${profile} retcode="$?" if [ "${retcode}" -ne 0 ]; then failed="${profile} (${retcode}) ${failed:-}" else success="${profile} ${success:-}" fi done exit 0 else restart_precmd="" fi else if [ -f "${milteropendkim_cfgfile}" ];then milteropendkim_cfgfile="-x ${milteropendkim_cfgfile}" else milteropendkim_cfgfile="" fi if [ -n "${milteropendkim_socket}" ];then _socket_prefix="-p" fi if [ -n "${milteropendkim_uid}" ];then _uid_prefix="-u" if [ -n "${milteropendkim_gid}" ];then milteropendkim_uid=${milteropendkim_uid}:${milteropendkim_gid} fi fi if [ -n "${milteropendkim_domain}" ];then milteropendkim_domain="-d ${milteropendkim_domain}" fi if [ -n "${milteropendkim_key}" ];then milteropendkim_key="-k ${milteropendkim_key}" fi if [ -n "${milteropendkim_selector}" ];then milteropendkim_selector="-s ${milteropendkim_selector}" fi if [ -n "${milteropendkim_alg}" ];then milteropendkim_alg="-S ${milteropendkim_alg}" fi command_args="-l ${_socket_prefix} ${milteropendkim_socket} ${_uid_prefix} ${milteropendkim_uid} -P ${pidfile} ${milteropendkim_cfgfile} ${milteropendkim_domain} ${milteropendkim_key} ${milteropendkim_selector} ${milteropendkim_alg}" fi fi -dkim_prepcmd () -{ - if [ -S "${milteropendkim_socket##local:}" ] ; then - rm -f "${milteropendkim_socket##local:}" - elif [ -S "${milteropendkim_socket##unix:}" ] ; then - rm -f "${milteropendkim_socket##unix:}" - fi - if [ ! -d ${_piddir} ] ; then - mkdir -p ${_piddir} - fi - if [ -n "${milteropendkim_uid}" ] ; then - chown ${milteropendkim_uid} ${_piddir} - fi - if [ -n "${milteropendkim_gid}" ] ; then - chgrp ${milteropendkim_gid} ${_piddir} - fi - chmod ${milteropendkim_socket_perms} ${_piddir} -} - -dkim_start_postcmd () -{ - if [ -n "${milteropendkim_socket}" ] ; then - # postcmd is executed too fast and socket is not created before checking... - sleep 1 - if [ -S "${milteropendkim_socket##local:}" ] ; then - chmod ${milteropendkim_socket_perms} ${milteropendkim_socket##local:} - elif [ -S "${milteropendkim_socket##unix:}" ] ; then - chmod ${milteropendkim_socket_perms} ${milteropendkim_socket##unix:} - fi - fi -} - -dkim_postcmd() -{ - if [ -n "${milteropendkim_socket}" ] ; then - if [ -S "${milteropendkim_socket##local:}" ] ; then - rm -f "${milteropendkim_socket##local:}" - elif [ -S "${milteropendkim_socket##unix:}" ] ; then - rm -f "${milteropendkim_socket##unix:}" - fi - fi - # just if the directory is empty - rmdir ${_piddir} > /dev/null 2>&1 -} - run_rc_command "$1"