1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-15 03:14:23 +00:00

- update to 3.0.4

- rework SASL OPTIONS
  Dovecot SASL does not need any dependency, from now it will be always build into postfix

- EAI is now mandantory, else mails can be lost
- 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
- remove nativ SPF support, patch is no longer maintained and there are alternatives in the ports tree
- remove VDA support (seems VDA project is dead and unmaintaned)

Many Thanks to all testers!

PR:	195662
PR: 	205162
This commit is contained in:
Olli Hauer 2016-02-25 20:26:08 +00:00
parent cf5a3df990
commit 0891faea7c
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=409556
6 changed files with 172 additions and 87 deletions

View File

@ -2,8 +2,7 @@
# $FreeBSD$
PORTNAME= postfix
DISTVERSION= 3.0-20151003
PORTREVISION= 1
DISTVERSION= 3.0-20160204
PORTEPOCH= 4
CATEGORIES= mail ipv6
MASTER_SITES= ftp://ftp.porcupine.org/mirrors/postfix-release/ \
@ -14,8 +13,8 @@ MASTER_SITES= ftp://ftp.porcupine.org/mirrors/postfix-release/ \
ftp://postfix.mirrors.pair.com/
#MASTER_SITES:= ${MASTER_SITES:S|$|experimental/|}
MASTER_SITES:= ${MASTER_SITES:S|$|official/|}
PKGNAMESUFFIX= -current
DISTNAME= ${PORTNAME}-3.0.3
PKGNAMESUFFIX?= -current
DISTNAME= ${PORTNAME}-3.0.4
DIST_SUBDIR= ${PORTNAME}
MAINTAINER= ohauer@FreeBSD.org
@ -26,10 +25,11 @@ LICENSE_NAME= IBM PUBLIC LICENSE VERSION 1.0
LICENSE_FILE= ${WRKSRC}/LICENSE
LICENSE_PERMS= dist-mirror dist-sell pkg-mirror pkg-sell auto-accept
LIB_DEPENDS= libicuuc.so:${PORTSDIR}/devel/icu
CONFLICTS_INSTALL?= courier-0.* opensmtpd-[0-9]* \
postfix-2.* postfix-base-2.* \
postfix21?-* postfix-tls-* \
sendmail-8.* sendmail+*-8.* smail-3.* zmailer-2.*
sendmail-8.* sendmail+*-8.* smail-3.* zmailer-2.* \
postfix-2.* postfix-base-2.* postfix21?-*
USERS= postfix
GROUPS= mail maildrop postfix
@ -42,17 +42,15 @@ USE_PERL5= build
SCRIPTS_ENV+= POSTFIX_DEFAULT_MTA="${POSTFIX_DEFAULT_MTA}"
OPTIONS_SUB= yes
OPTIONS_DEFINE= BDB CDB DOCS EAI INST_BASE LDAP LDAP_SASL LMDB MYSQL \
NIS PCRE PGSQL SASL SPF SQLITE TEST TLS VDA
OPTIONS_DEFINE= BDB CDB DOCS INST_BASE LDAP LDAP_SASL LMDB MYSQL \
NIS PCRE PGSQL SASL SQLITE TEST TLS VDA
OPTIONS_RADIO= RG1 RG2
OPTIONS_RADIO_RG1= DOVECOT DOVECOT2
OPTIONS_RADIO_RG2= SASLKRB5 SASLKMIT
OPTIONS_DEFAULT= PCRE TLS EAI
OPTIONS_RADIO= RG1
OPTIONS_RADIO_RG1= SASLKRB5 SASLKMIT
OPTIONS_DEFAULT= PCRE TLS
BDB_USE= BDB=yes
CDB_LIB_DEPENDS= libcdb.so:${PORTSDIR}/databases/tinycdb
EAI_LIB_DEPENDS= libicuuc.so:${PORTSDIR}/devel/icu
LDAP_USE= OPENLDAP=yes
LMDB_LIB_DEPENDS= liblmdb.so:${PORTSDIR}/databases/lmdb
MYSQL_USE= MYSQL=yes
@ -60,24 +58,19 @@ PCRE_LIB_DEPENDS= libpcre.so:${PORTSDIR}/devel/pcre
PGSQL_USES= pgsql
SASLKMIT_LIB_DEPENDS= libkrb5.so:${PORTSDIR}/security/krb5
SASL_LIB_DEPENDS= libsasl2.so:${PORTSDIR}/security/cyrus-sasl2
SPF_LIB_DEPENDS= libspf2.so:${PORTSDIR}/mail/libspf2
SQLITE_USES= sqlite
TLS_USE= OPENSSL=yes
CDB_DESC= CDB maps lookups
EAI_DESC= Email Address Internationalization (EAI, RFC 6531..6533)
INST_BASE_DESC= Install into /usr and /etc/postfix
LDAP_DESC= LDAP maps (uses WITH_OPENLDAP_VER)
LDAP_SASL_DESC= LDAP client-to-server SASL auth
LMDB_DESC= LMDB maps
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
@ -104,7 +97,11 @@ MAKEFILEFLAGS+= DEBUG=
MAKEFILEFLAGS+= pie=yes CC="${CC}" OPT="${CFLAGS}"
.if ${PORT_OPTIONS:MINST_BASE}
PKGNAMESUFFIX= -base
.if defined(SASL_SLAVE)
PKGNAMESUFFIX= -current-base-sasl2
.else
PKGNAMESUFFIX= -current-base
.endif
PREFIX= /usr
ETCDIR= /etc/postfix
PLIST_SUB+= BMAN="share/"
@ -114,6 +111,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}
@ -149,14 +153,16 @@ POSTFIX_CCARGS+= -DDEF_CONFIG_DIR=\\\"${ETCDIR}\\\" \
-Wmissing-prototypes -Wformat -Wno-comment
# Default requirement for postfix rc script
_REQUIRE= LOGIN cleanvar
_REQUIRE= LOGIN cleanvar dovecot
.if ${PORT_OPTIONS:MEAI}
# always build with Dovecot SASL support, Cyrus is optional
# see Postfix HISTORY 20051222
POSTFIX_CCARGS+= -DUSE_SASL_AUTH
# Email Address Internationalization (EAI, RFC 6531..6533)
# This is now mandantory!
POSTFIX_CCARGS+= -DHAS_EAI -I${LOCALBASE}/include
POSTFIX_AUXLIBS+= -L${LOCALBASE}/lib -licuuc
.else
POSTFIX_CCARGS+= -DNO_EAI
.endif
.if ${PORT_OPTIONS:MPCRE}
DYN_EXT+= pcre
@ -167,18 +173,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}
@ -197,14 +195,6 @@ POSTFIX_AUXLIBS+= -L${OPENSSLLIB} ${LDFLAGS} -lssl -lcrypto
POSTFIX_CCARGS+= -DNO_TLS
.endif
.if ${PORT_OPTIONS:MSPF}
BROKEN= At the moment, SPF support is unavailable for ${PORTNAME}-${DISTVERSION}
PATCH_SITES+= LOCAL/mm
PATCHFILES+= postfix-2.8.0-libspf2-1.2.x-0.patch.gz:-p1
POSTFIX_CCARGS+= -DHAVE_NS_TYPE -DHAS_SPF -I${LOCALBASE}/include
POSTFIX_AUXLIBS+= -L${LOCALBASE}/lib -lspf2
.endif
.if ${PORT_OPTIONS:MBDB}
POSTFIX_CCARGS+= -I${BDB_INCLUDE_DIR}
POSTFIX_AUXLIBS+= -L${BDB_LIB_DIR} -l${BDB_LIB_NAME}
@ -323,12 +313,6 @@ post-patch:
@${ECHO} '$$command_directory/posttls-finger:f:root:-:755' \
>> ${WRKSRC}/conf/postfix-files
post-patch-SPF-on:
@${ECHO} '$$readme_directory/SPF_README:f:root:-:644' \
>> ${WRKSRC}/conf/postfix-files
@${REINPLACE_CMD} -E -e '${REINPLACE}' \
${WRKSRC}/README_FILES/SPF_README
do-configure:
(cd ${WRKSRC} && ${MAKE} -f Makefile.init makefiles \
${MAKEFILEFLAGS} CCARGS="${POSTFIX_CCARGS}" \

View File

@ -1,2 +1,2 @@
SHA256 (postfix/postfix-3.0.3.tar.gz) = 401e46ec3450569dcce60d1d8ca22a19ab1f7f817b0cc730cdf4875ba608ac02
SIZE (postfix/postfix-3.0.3.tar.gz) = 4240588
SHA256 (postfix/postfix-3.0.4.tar.gz) = b81ce81176b9df7183ad99b9c98000135f5e88e659493ab50db5d9fe5b8dba0e
SIZE (postfix/postfix-3.0.4.tar.gz) = 4240805

View File

@ -17,8 +17,13 @@ ETCDIR="%%ETCDIR%%"
DAEMONDIR="%%DAEMONDIR%%"
META_DIRECTORY="%%META_DIRECTORY%%"
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
@ -55,25 +60,93 @@ 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 reload
# This is a candidate for a dedicated pkg-post-upgrade script, but it seems
# this not fully implemented in pkg :(see upstream PR 941)
# ==============================================================================
try_reload(){
${PREFIX}/sbin/postfix status 2>/dev/null
if [ $? -eq 0 ]; then
${PREFIX}/sbin/postfix reload
else
echo "postfix not running"
fi
}
# ==============================================================================
# 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} \
@ -83,29 +156,37 @@ 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}
try_reload
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}
try_reload
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}"

View File

@ -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):

View File

@ -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"

View File

@ -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)