From owner-svn-ports-all@freebsd.org Thu Feb 25 20:09:58 2016 Return-Path: Delivered-To: svn-ports-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C2A8CAB48AB; Thu, 25 Feb 2016 20:09:58 +0000 (UTC) (envelope-from ohauer@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9A0A3C86; Thu, 25 Feb 2016 20:09:58 +0000 (UTC) (envelope-from ohauer@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u1PK9v8i067205; Thu, 25 Feb 2016 20:09:57 GMT (envelope-from ohauer@FreeBSD.org) Received: (from ohauer@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u1PK9vrm067200; Thu, 25 Feb 2016 20:09:57 GMT (envelope-from ohauer@FreeBSD.org) Message-Id: <201602252009.u1PK9vrm067200@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ohauer set sender to ohauer@FreeBSD.org using -f From: Olli Hauer Date: Thu, 25 Feb 2016 20:09:57 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r409551 - in head/mail/postfix: . files X-SVN-Group: ports-head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Feb 2016 20:09:58 -0000 Author: ohauer Date: Thu Feb 25 20:09:56 2016 New Revision: 409551 URL: https://svnweb.freebsd.org/changeset/ports/409551 Log: - rework SASL OPTIONS Dovecot SASL does not need any dependency, from now it will be always build into postfix and the default SASL unless Cyrus is also added (there is no conflict between them) - add support for FreeBSD 10.3 mailwrapper (install mailer.conf into LOCALBASE/mail instead /etc/mail) - add better reload support to rc script - display correct path in pkg-message - add support for postfix-sasl slave port - bump PORTREVISION Many Thanks to all testers! PR: 195662 PR: 205162 Added: head/mail/postfix/pkg-help (contents, props changed) Modified: head/mail/postfix/Makefile head/mail/postfix/files/pkg-install.in head/mail/postfix/files/pkg-message.in head/mail/postfix/files/postfix.in Modified: head/mail/postfix/Makefile ============================================================================== --- head/mail/postfix/Makefile Thu Feb 25 20:06:28 2016 (r409550) +++ head/mail/postfix/Makefile Thu Feb 25 20:09:56 2016 (r409551) @@ -3,7 +3,7 @@ PORTNAME= postfix PORTVERSION= 2.11.7 -PORTREVISION= 1 +PORTREVISION= 2 PORTEPOCH= 1 CATEGORIES= mail ipv6 MASTER_SITES= ftp://ftp.porcupine.org/mirrors/postfix-release/ \ @@ -27,9 +27,8 @@ PORTSCOUT= limit:^2\.11\. VDAVERSION= 2.10.0 CONFLICTS_INSTALL?= courier-0.* opensmtpd-[0-9]* \ - postfix2?-* postfix210-* postfix-3.* \ - postfix-current-[23].* postfix-current-base-[23].* \ - sendmail-8.* sendmail+*-8.* smail-3.* zmailer-2.* + sendmail-8.* sendmail+*-8.* smail-3.* zmailer-2.* \ + postfix2?-* postfix-3.* postfix-current-* USERS= postfix GROUPS= mail maildrop postfix @@ -45,9 +44,8 @@ OPTIONS_SUB= yes OPTIONS_DEFINE= BDB CDB DOCS INST_BASE LDAP LDAP_SASL LMDB MYSQL \ NIS PCRE PGSQL SASL SPF SQLITE TEST TLS VDA -OPTIONS_RADIO= RG1 RG2 -OPTIONS_RADIO_RG1= DOVECOT DOVECOT2 -OPTIONS_RADIO_RG2= SASLKRB5 SASLKMIT +OPTIONS_RADIO= RG1 +OPTIONS_RADIO_RG1= SASLKRB5 SASLKMIT OPTIONS_DEFAULT= PCRE TLS BDB_USE= BDB=yes @@ -72,10 +70,8 @@ SPF_DESC= SPF support (via libspf2 1.2.x TEST_DESC= SMTP/LMTP test server and generator VDA_DESC= VDA (Virtual Delivery Agent) -RG1_DESC= Dovecot SASL authentication methods -DOVECOT_DESC= Dovecot 1.x SASL authentication method -DOVECOT2_DESC= Dovecot 2.x SASL authentication method -RG2_DESC= Kerberos network authentication protocol type +SASL_DESC= Cyrus SASL support (Dovecot SASL is always build in) +RG1_DESC= Kerberos network authentication protocol type SASLKRB5_DESC= If your SASL req. Kerberos5, select this SASLKMIT_DESC= If your SASL req. MIT Kerberos5, select this @@ -102,7 +98,11 @@ MAKEFILEFLAGS+= DEBUG= MAKEFILEFLAGS+= CC="${CC}" OPT="${CFLAGS}" .if ${PORT_OPTIONS:MINST_BASE} +.if defined(SASL_SLAVE) +PKGNAMESUFFIX= -base-sasl +.else PKGNAMESUFFIX= -base +.endif PREFIX= /usr ETCDIR= /etc/postfix PLIST_SUB+= BMAN="share/" @@ -112,6 +112,13 @@ PLIST_SUB+= BMAN="" PLIST_SUB+= PFETC=${ETCDIR} +# check if mailwrapper supports $LOCALBASE +.if ${OPSYS} == FreeBSD && (${OSVERSION} >= 1002506 || ${OSVERSION} >= 1100094) +SUB_LIST+= USE_LOCALBASE_MAILER_CONF="yes" MC_PREFIX=${LOCALBASE} +.else +SUB_LIST+= USE_LOCALBASE_MAILER_CONF="no" MC_PREFIX="" +.endif + .if ${PORT_OPTIONS:MDOCS} PORTDOCS= * READMEDIR= ${DOCSDIR} @@ -141,7 +148,11 @@ POSTFIX_CCARGS+= -DDEF_CONFIG_DIR=\\\"${ -Wmissing-prototypes -Wformat -Wno-comment # Default requirement for postfix rc script -_REQUIRE= LOGIN cleanvar +_REQUIRE= LOGIN cleanvar dovecot + +# Always build with Dovecot SASL support, Cyrus is optional +# see Postfix HISTORY 20051222 +POSTFIX_CCARGS+= -DUSE_SASL_AUTH .if ${PORT_OPTIONS:MPCRE} POSTFIX_CCARGS+= -DHAS_PCRE -I${LOCALBASE}/include @@ -151,18 +162,10 @@ POSTFIX_CCARGS+= -DNO_PCRE .endif .if ${PORT_OPTIONS:MSASL} -POSTFIX_CCARGS+= -DUSE_SASL_AUTH -DUSE_CYRUS_SASL -I${LOCALBASE}/include -I${LOCALBASE}/include/sasl +POSTFIX_CCARGS+= -DUSE_CYRUS_SASL -I${LOCALBASE}/include -I${LOCALBASE}/include/sasl POSTFIX_AUXLIBS+= -L${LOCALBASE}/lib -lsasl2 -lpam -lcrypt -.endif - -.if ${PORT_OPTIONS:MDOVECOT} || ${PORT_OPTIONS:MDOVECOT2} -.if ${PORT_OPTIONS:MDOVECOT} -RUN_DEPENDS+= dovecot:${PORTSDIR}/mail/dovecot .else -RUN_DEPENDS+= dovecot:${PORTSDIR}/mail/dovecot2 -.endif -POSTFIX_CCARGS+= -DUSE_SASL_AUTH -DDEF_SERVER_SASL_TYPE=\\\"dovecot\\\" -_REQUIRE+= dovecot +POSTFIX_CCARGS+= -DDEF_SERVER_SASL_TYPE=\\\"dovecot\\\" .endif .if ${PORT_OPTIONS:MSASLKRB5} Modified: head/mail/postfix/files/pkg-install.in ============================================================================== --- head/mail/postfix/files/pkg-install.in Thu Feb 25 20:06:28 2016 (r409550) +++ head/mail/postfix/files/pkg-install.in Thu Feb 25 20:09:56 2016 (r409551) @@ -16,8 +16,13 @@ PREFIX="%%PREFIX%%" ETCDIR="%%ETCDIR%%" DAEMONDIR="%%DAEMONDIR%%" READMEDIR="%%READMEDIR%%" -MCP="%%DATADIR%%/mailer.conf.postfix" -MC="/etc/mail/mailer.conf" +MC_TEMPLATE="%%DATADIR%%/mailer.conf.postfix" + +# FreeBSD <= 10.3 +MC_BASE="/etc/mail/mailer.conf" +# FreeBSD >= 10.3 (and current) +MC_LOCALBASE="%%LOCALBASE%%/etc/mail/mailer.conf" +USE_LOCALBASE_MAILER_CONF="%%USE_LOCALBASE_MAILER_CONF%%" if [ "${POSTFIX_DEFAULT_MTA}" = "no" ]; then DEFAULT_REPLACE_MAILERCONF=n @@ -54,25 +59,79 @@ yesno() { done } -install_mailer_conf() { - echo "Activate Postfix in ${MC}" - /bin/mv -f ${MC} ${MC}.old - /usr/bin/install -m 644 ${MCP} ${MC} +# ============================================================================== +# Respect POSTFIX_DEFAULT_MTA, do not ask for confirmation! +# (This helps tools like salt, ansible or puppet on new installations) +# ============================================================================== +install_choise(){ + local mailerconf + mailerconf=$1 + + if [ "${DEFAULT_REPLACE_MAILERCONF}" = "y" ]; then + install_mailer_conf ${mailerconf} + elif [ "${DEFAULT_REPLACE_MAILERCONF}" = "n" -a -t 0 ]; then + if yesno "Would you like to activate Postfix in ${mailerconf}" ${DEFAULT_REPLACE_MAILERCONF:="n"}; then + install_mailer_conf ${mailerconf} + else + show_not_activated_msg ${mailerconf} + fi + else + show_not_activated_msg ${mailerconf} + fi } show_not_activated_msg() { + local mailerconf + + mailerconf=$1 echo echo "===============================================================" - echo "Postfix was *not* activated in /etc/mail/mailer.conf! " + echo "Postfix was *not* activated in ${mailerconf}! " echo echo "To finish installation run the following commands:" echo - echo " mv ${MC} ${MC}.old" - echo " install -m 0644 ${MCP} ${MC}" + if [ "${USE_LOCALBASE_MAILER_CONF}" = "yes" ]; then + echo " mkdir -p %%LOCALBASE%%/etc/mail" + else + echo " mv -f ${mailerconf} ${mailerconf}.old" + fi + echo " install -m 0644 ${MC_TEMPLATE} ${mailerconf}" echo "===============================================================" echo } +show_activated_msg() { + local mailerconf + + mailerconf=$1 + echo "===============================================================" + echo "Postfix already activated in ${mailerconf}" + echo "===============================================================" +} + +cmp_mailer() { + local mailerconf + + mailerconf=$1 + cmp -s ${mailerconf} ${MC_TEMPLATE} + return $? +} + +install_mailer_conf() { + local mailerconf + + mailerconf=$1 + echo "Activate Postfix in ${mailerconf}" + if [ "${USE_LOCALBASE_MAILER_CONF}" = "yes" ]; then + [ -d %%LOCALBASE%%/etc/mail ] || mkdir -p %%LOCALBASE%%/etc/mail + fi + [ -f ${mailerconf} ] && mv -f ${mailerconf} ${mailerconf}.old + install -m 644 ${MC_TEMPLATE} ${mailerconf} +} + +# ============================================================================== +# Run postfix post-install to fix permissions and new config values +# ============================================================================== if [ "$2" = "POST-INSTALL" ]; then /bin/sh ${DAEMONDIR}/post-install tempdir=/tmp \ daemon_directory=${DAEMONDIR} \ @@ -81,29 +140,35 @@ if [ "$2" = "POST-INSTALL" ]; then upgrade-package fi -if [ "$2" = "POST-INSTALL" -a -z "${PACKAGE_BUILDING}" -a -f "${MC}" ]; then - egrep -q "^sendmail.*${PREFIX}/sbin/sendmail" ${MC} && \ - egrep -q "^send-mail.*${PREFIX}/sbin/sendmail" ${MC} && \ - egrep -q "^mailq.*${PREFIX}/sbin/sendmail" ${MC} && \ - egrep -q "^newaliases.*${PREFIX}/sbin/sendmail" ${MC} - ret=$? - if [ ${ret} -ne 0 ]; then - # Respect POSTFIX_DEFAULT_MTA, do not ask for confirmation! - # (This helps tools like salt, ansible or puppet on new installations) - if [ "${DEFAULT_REPLACE_MAILERCONF}" = "y" ]; then - install_mailer_conf - elif [ "${DEFAULT_REPLACE_MAILERCONF}" = "n" -a -t 0 ]; then - if yesno "Would you like to activate Postfix in ${MC}" ${DEFAULT_REPLACE_MAILERCONF:="n"}; then - install_mailer_conf - else - show_not_activated_msg - fi +# ============================================================================== +# If FreeBSD <= 10.2 is deprecated check only LOCALBASE and remove BASE checks, +# regardless if installed in BASE or LOCALBASE +# Iff postfix is activated in BASE, also activate postfix in LOCALBASE! +# ============================================================================== +if [ "$2" = "POST-INSTALL" -a -z "${PACKAGE_BUILDING}" ]; then +if [ -f "${MC_BASE}" ]; then + if [ "${USE_LOCALBASE_MAILER_CONF}" = "yes" ]; then + cmp_mailer ${MC_BASE} + if [ $? -eq 0 ]; then + show_activated_msg ${MC_BASE} + cmp_mailer ${MC_LOCALBASE} || install_mailer_conf ${MC_LOCALBASE} else - show_not_activated_msg + cmp_mailer ${MC_LOCALBASE} || install_choise ${MC_LOCALBASE} fi else - echo "===============================================================" - echo "Postfix already activated in ${MC}" - echo "===============================================================" + cmp_mailer ${MC_BASE} + if [ $? -ne 0 ]; then + install_choise ${MC_BASE} + else + show_activated_msg ${MC_BASE} + fi fi -fi + +else + if [ "${USE_LOCALBASE_MAILER_CONF}" = "yes" ]; then + show_not_activated_msg ${MC_LOCALBASE} + else + show_not_activated_msg ${MC_BASE} + fi +fi # -f "${MC_BASE}" +fi # "$2" = "POST-INSTALL" -a -z "${PACKAGE_BUILDING}" Modified: head/mail/postfix/files/pkg-message.in ============================================================================== --- head/mail/postfix/files/pkg-message.in Thu Feb 25 20:06:28 2016 (r409550) +++ head/mail/postfix/files/pkg-message.in Thu Feb 25 20:09:56 2016 (r409551) @@ -5,9 +5,9 @@ Run the following commands to enable pos - sysrc postfix_enable="YES" - sysrc sendmail_enable="NONE" -If postfix is *not* already activated in /etc/mail/mailer.conf - - mv /etc/mail/mailer.conf /etc/mail/mailer.conf.old - - install -m 0644 %%DAEMONDIR%%/mailer.conf.postfix /etc/mail/mailer.conf +If postfix is *not* already activated in %%MC_PREFIX%%/etc/mail/mailer.conf + - mv %%MC_PREFIX%%/etc/mail/mailer.conf %%MC_PREFIX%%/etc/mail/mailer.conf.old + - install -m 0644 %%DATADIR%%/mailer.conf.postfix %%MC_PREFIX%%/etc/mail/mailer.conf Disable sendmail(8) specific tasks, add the following lines to /etc/periodic.conf(.local): Modified: head/mail/postfix/files/postfix.in ============================================================================== --- head/mail/postfix/files/postfix.in Thu Feb 25 20:06:28 2016 (r409550) +++ head/mail/postfix/files/postfix.in Thu Feb 25 20:09:56 2016 (r409551) @@ -32,6 +32,7 @@ load_rc_config $name start_cmd=${name}_start stop_cmd=${name}_stop extra_commands="reload" +reload_cmd="${name}_reload" pidfile=${postfix_pidfile} procname=${postfix_procname} @@ -44,4 +45,8 @@ postfix_stop() { %%PREFIX%%/sbin/postfix ${postfix_flags} stop } +postfix_reload() { + %%PREFIX%%/sbin/postfix ${postfix_flags} reload +} + run_rc_command "$1" Added: head/mail/postfix/pkg-help ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/mail/postfix/pkg-help Thu Feb 25 20:09:56 2016 (r409551) @@ -0,0 +1,15 @@ +Readme SASL: + +Dovecot uses its own daemon process for authentication. Because there is no +need to link extra libraries into Postfix, Dovecot SASL will be build into +Postfix by default. + +Cyrus SASL is optional and will be the default if build with SASL=on + +To find out what SASL implementations are compiled into Postfix, use the +following commands: + + % postconf -a (SASL support in the SMTP server) + % postconf -A (SASL support in the SMTP+LMTP client) + % postconf smtpd_sasl_type (show default SASL) +