diff options
author | Olli Hauer <ohauer@FreeBSD.org> | 2016-02-25 20:09:56 +0000 |
---|---|---|
committer | Olli Hauer <ohauer@FreeBSD.org> | 2016-02-25 20:09:56 +0000 |
commit | 6a09303b9da1678c70f01f5d7dab123c291c68de (patch) | |
tree | 21905ca481aff27d98c4a77c6d4ecd0ad4927ed5 /mail | |
parent | 747e3213315901745cad49c9bdacc49ae72792e2 (diff) | |
download | ports-6a09303b9da1678c70f01f5d7dab123c291c68de.tar.gz ports-6a09303b9da1678c70f01f5d7dab123c291c68de.zip |
Notes
Diffstat (limited to 'mail')
-rw-r--r-- | mail/postfix/Makefile | 47 | ||||
-rw-r--r-- | mail/postfix/files/pkg-install.in | 127 | ||||
-rw-r--r-- | mail/postfix/files/pkg-message.in | 6 | ||||
-rw-r--r-- | mail/postfix/files/postfix.in | 5 | ||||
-rw-r--r-- | mail/postfix/pkg-help | 15 |
5 files changed, 144 insertions, 56 deletions
diff --git a/mail/postfix/Makefile b/mail/postfix/Makefile index 2ad113113176..2de2792e2d43 100644 --- a/mail/postfix/Makefile +++ b/mail/postfix/Makefile @@ -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=\\\"${ETCDIR}\\\" \ -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} diff --git a/mail/postfix/files/pkg-install.in b/mail/postfix/files/pkg-install.in index 326c02880ffa..62733280ef9f 100644 --- a/mail/postfix/files/pkg-install.in +++ b/mail/postfix/files/pkg-install.in @@ -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}" diff --git a/mail/postfix/files/pkg-message.in b/mail/postfix/files/pkg-message.in index 616e627c0a56..6ba402774402 100644 --- a/mail/postfix/files/pkg-message.in +++ b/mail/postfix/files/pkg-message.in @@ -5,9 +5,9 @@ Run the following commands to enable postfix during startup: - 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): diff --git a/mail/postfix/files/postfix.in b/mail/postfix/files/postfix.in index 216a3a5b21f0..74c1550bf984 100644 --- a/mail/postfix/files/postfix.in +++ b/mail/postfix/files/postfix.in @@ -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" diff --git a/mail/postfix/pkg-help b/mail/postfix/pkg-help new file mode 100644 index 000000000000..f28015a0b496 --- /dev/null +++ b/mail/postfix/pkg-help @@ -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) + |