Hello community,
here is the log from the commit of package postfix for openSUSE:Factory
checked in at Thu Aug 18 14:05:35 CEST 2011.
--------
--- postfix/postfix.changes 2011-08-09 13:07:18.000000000 +0200
+++ /mounts/work_src_done/STABLE/postfix/postfix.changes 2011-08-18 11:35:15.000000000 +0200
@@ -1,0 +2,20 @@
+Thu Aug 18 09:32:04 UTC 2011 - varkoly@novell.com
+
+- Move SuSEconfig.postfix into /usr/sbin/
+ (FATE#311272: Do not rewrite postfix.cf via SuSEconfig)
+ SuSEconfig.postfix will be executed only once after installation
+ automaticaly. Afterwards only you can start it manually or via
+ yast2 mail module.
+
+-------------------------------------------------------------------
+Fri Aug 12 16:40:40 UTC 2011 - werner@suse.de
+
+- Just the first strep forward to systemd, please test out
+ /etc/postfix/system/update_chroot
+ /etc/postfix/system/wait_qmgr
+ /etc/postfix/system/cond_slp
+ and
+ /lib/systemd/system/postfix.service
+ and also fill out the missing description.
+
+-------------------------------------------------------------------
calling whatdependson for head-i586
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ postfix.spec ++++++
--- /var/tmp/diff_new_pack.iVaErX/_old 2011-08-18 14:04:02.000000000 +0200
+++ /var/tmp/diff_new_pack.iVaErX/_new 2011-08-18 14:04:02.000000000 +0200
@@ -21,7 +21,7 @@
Name: postfix
Summary: A fast, secure, and flexible mailer
Version: 2.8.4
-Release: 3
+Release: 5
License: IBM Public License ..
Group: Productivity/Networking/Email/Servers
Url: http://www.postfix.org/
@@ -225,7 +225,7 @@
rm -f $RPM_BUILD_ROOT/var/adm/fillup-templates/sysconfig.%{name}
sed -e 's;@lib@;%{_lib};g' %{name}-SuSE/sysconfig.%{name} > $RPM_BUILD_ROOT/var/adm/fillup-templates/sysconfig.%{name}
install -m 644 %{name}-SuSE/sysconfig.mail-%{name} $RPM_BUILD_ROOT/var/adm/fillup-templates/sysconfig.mail-%{name}
-rm -f $RPM_BUILD_ROOT/sbin/conf.d/SuSEconfig.%{name}
+test -e $RPM_BUILD_ROOT/sbin/conf.d/SuSEconfig.%{name} && rm -f $RPM_BUILD_ROOT/sbin/conf.d/SuSEconfig.%{name}
sed -e 's;@lib@;%{_lib};g' \
-e 's;@conf_backup_dir@;%{conf_backup_dir};' \
-e 's;@daemon_directory@;%{pf_daemon_directory};' \
@@ -237,8 +237,8 @@
-e 's;@newaliases_path@;%{pf_newaliases_path};' \
-e 's;@sample_directory@;%{pf_sample_directory};' \
-e 's;@mailq_path@;%{pf_mailq_path};' %{name}-SuSE/SuSEconfig.%{name} \
- > $RPM_BUILD_ROOT/sbin/conf.d/SuSEconfig.%{name}
-chmod 755 $RPM_BUILD_ROOT/sbin/conf.d/SuSEconfig.%{name}
+ > $RPM_BUILD_ROOT/usr/sbin/SuSEconfig.%{name}
+chmod 755 $RPM_BUILD_ROOT/usr/sbin/SuSEconfig.%{name}
install -m 644 %{name}-SuSE/dynamicmaps.cf $RPM_BUILD_ROOT/etc/%{name}/dynamicmaps.cf
install -m 644 %{name}-SuSE/ldap_aliases.cf $RPM_BUILD_ROOT/etc/%{name}/ldap_aliases.cf
install -m 644 %{name}-SuSE/helo_access $RPM_BUILD_ROOT/etc/postfix/helo_access
@@ -295,6 +295,14 @@
cp -a examples/* $RPM_BUILD_ROOT%{pf_sample_directory}
cp -a html/* $RPM_BUILD_ROOT%{pf_html_directory}
cp -a auxiliary/ $RPM_BUILD_ROOT%{pf_docdir}/
+%if 0%{?suse_version} >= 1140
+mkdir -p %{buildroot}/lib/systemd/system
+mkdir -p %{buildroot}/etc/postfix/system
+install -m 0644 %{name}-SuSE/postfix.service %{buildroot}/lib/systemd/system/
+install -m 0755 %{name}-SuSE/update_chroot.systemd %{buildroot}/etc/postfix/system/update_chroot
+install -m 0755 %{name}-SuSE/wait_qmgr.systemd %{buildroot}/etc/postfix/system/wait_qmgr
+install -m 0755 %{name}-SuSE/cond_slp.systemd %{buildroot}/etc/postfix/system/cond_slp
+%endif
%if 0%{?suse_version} >= 1100
%fdupes $RPM_BUILD_ROOT%{pf_docdir}
%fdupes $RPM_BUILD_ROOT%{_mandir}
@@ -378,6 +386,11 @@
/usr/sbin/postfix set-permissions
if [ ${1:-0} -gt 1 ]; then
/usr/sbin/postfix upgrade-configuration || :
+else
+ if [ ! -e /sbin/conf.d/SuSEconfig.postfix ]
+ then
+ ln -s /usr/sbin/SuSEconfig.postfix /sbin/conf.d/SuSEconfig.postfix
+ fi
fi
# before fillup we need to fix something
%{__sed} -i \
@@ -419,7 +432,7 @@
%config /etc/pam.d/*
/var/adm/fillup-templates/sysconfig.%{name}
/var/adm/fillup-templates/sysconfig.mail-%{name}
-/sbin/conf.d/SuSEconfig.%{name}
+/usr/sbin/SuSEconfig.%{name}
%config(noreplace) %{omc_dir}/%{name}.xml
%dir /etc/%{name}
%config /etc/%{name}/main.cf.default
@@ -452,6 +465,13 @@
%attr(0644, root, root) %config /etc/%{name}/makedefs.out
/usr/lib/%{name}/%{name}-files
%config %attr(0755,root,root) /etc/init.d/%{name}
+%if 0%{?suse_version} >= 1140
+%dir /etc/postfix/system
+%config %attr(0755,root,root) /etc/postfix/system/update_chroot
+%config %attr(0755,root,root) /etc/postfix/system/wait_qmgr
+%config %attr(0755,root,root) /etc/postfix/system/cond_slp
+%config /lib/systemd/system/postfix.service
+%endif
/usr/bin/mailq
/usr/bin/newaliases
%attr(0755, root, root) /usr/sbin/sendmail
++++++ postfix-SuSE.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/postfix-SuSE/SuSEconfig.postfix new/postfix-SuSE/SuSEconfig.postfix
--- old/postfix-SuSE/SuSEconfig.postfix 2011-07-06 15:08:51.000000000 +0200
+++ new/postfix-SuSE/SuSEconfig.postfix 2011-08-18 11:30:04.000000000 +0200
@@ -1180,6 +1180,16 @@
r=$ROOT
+test -f $r/lib/YaST/SuSEconfig.functions || {
+ echo "ERROR - can not find $r/lib/YaST/SuSEconfig.functions!!"
+ echo "This should not happen. Exit..."
+ exit 1
+}
+
+. $r/lib/YaST/SuSEconfig.functions
+
+echo "Reading $r/etc/sysconfig and updating the system..."
+
test -s $r/etc/sysconfig/postfix || {
echo "No $r/etc/sysconfig/postfix found."
exit 1
@@ -1196,6 +1206,9 @@
# We may need TIMEZONE for chroot setup
test -s $r/etc/sysconfig/clock && . $r/etc/sysconfig/clock
+# installation automaticaly
+test -e /sbin/conf.d/SuSEconfig.postfix && rm /sbin/conf.d/SuSEconfig.postfix
+
# Try to get a valid hostname...
if [ -z "$POSTFIX_MYHOSTNAME" ]; then
test -s "$r/var/run/dhcp-hostname" && . "$r/var/run/dhcp-hostname"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/postfix-SuSE/SuSEconfig.postfix.orig new/postfix-SuSE/SuSEconfig.postfix.orig
--- old/postfix-SuSE/SuSEconfig.postfix.orig 2011-07-06 15:07:26.000000000 +0200
+++ new/postfix-SuSE/SuSEconfig.postfix.orig 1970-01-01 01:00:00.000000000 +0100
@@ -1,1257 +0,0 @@
-#! /bin/bash
-# Copyright (c) 1999-2001 SuSE GmbH Nuernberg, Germany.
-# Copyright (c) 2002-2004 SuSE Linux AG
-#
-# Author: Carsten Hoeger
-
-export LC_ALL=POSIX
-
-cpifnewer(){
- # remove files, that do no longer exist
- if [ -d $2 -a "$(echo $2/*)" != "$2/*" ]; then
- for i in $2/*; do
- if [ ! -e "/$i" ]; then
- echo "removing old or no longer used $i"
- rm -f $i
- fi
- done
- fi
- test -d $2 || mkdir -p $2
- for i in $1; do
- dst=$2/$(basename $i)
-
- if [ ! -f $dst -a ! -d $dst -a -e $i ]; then
- echo "copying missing $dst from $i"
- cp -af $i $dst
- elif [ ! -d $dst -a $i -nt $dst -o $i -ot $dst ]; then
- echo "updating $dst from $i"
- cp -af $i $dst
- fi
- done
-}
-
-update_db() {
- while test "x$1" != "x" ; do
- pfmap=/etc/postfix/${1%:*}
- mode=${1#*:}
- if [ "$mode" == "$1" ]; then
- mode=644
- fi
- chmod $mode ${pfmap}
- test -e $pfmap && \
- if test $pfmap -nt ${pfmap}.db -o ! -e ${pfmap}.db ; then
- echo "rebuilding ${pfmap}.db"
- postmap ${pfmap}
- fi
- chmod $mode ${pfmap}.db
- shift
- done
-}
-
-get_alias_maps(){
- test -d /etc/aliases.d && test "$(echo /etc/aliases.d/*)" != "/etc/aliases.d/*" && \
- for i in $(find /etc/aliases.d -maxdepth 1 -type f \
- '!' -regex ".*\.\(db\|rpmsave\|rpmorig\)" \
- '!' -regex ".*/\(\.\|#\).*" \
- '!' -regex ".*~$") ; do
- echo -n "$i ";
- done
-}
-
-warn_user(){
- tput bold
- echo -e "\t*** WARNING ***"
- echo -e $1
- echo -e "\t*** WARNING ***"
- tput sgr0
-}
-
-mkchroot(){
-
- PF_CHROOT="/var/spool/postfix"
-
- if [ ! -d "$PF_CHROOT" ]; then
- warn_user "\t$PF_CHROOT does not exist!!!\n\
-\tThis should not happen!\n\
-\tPlease reinstall package postfix or create this directory!"
- exit 1
- fi
- cd "$PF_CHROOT"
-
- if [ "$(echo "$POSTFIX_MYSQL_CONN" | tr 'A-Z' 'a-z' )" == "socket" -a \
- "$(echo "$POSTFIX_WITH_MYSQL" | tr 'A-Z' 'a-z' )" != "no" ]; then
- if [ -n "$(my_print_defaults mysqld)" ]; then
- MYSQL_SOCKET=$(my_print_defaults mysqld | grep -e '--socket[[:blank:]=]' | awk -F"=" '{print $2}')
- MYSQL_SOCKET_DIR=$(dirname $MYSQL_SOCKET)
- CHR_MYSQL_SOCKET=$(echo $MYSQL_SOCKET | sed -e "s,/,,")
- CHR_MYSQL_SOCKET_DIR=$(dirname $CHR_MYSQL_SOCKET)
- else
- warn_user "\t/etc/my.cnf does not exist!!\n\
-\tThis should not happen!\n\
-\tPlease check if postfix-mysql is installed and check for package mysql."
- fi
- fi
- if [ "$(echo "$POSTFIX_CHROOT" | tr 'A-Z' 'a-z' )" != "yes" -a \
- "$(echo "$POSTFIX_UPDATE_CHROOT_JAIL" | tr 'A-Z' 'a-z' )" != "no" ]; then
- if [ -d etc ]; then
- echo "removing postfix chroot environment..."
- fi
-
- if grep "$PF_CHROOT"/proc /proc/mounts &> /dev/null; then
- umount "$PF_CHROOT"/proc
- fi
-
- if [ -n "$CHR_MYSQL_SOCKET_DIR" ]; then
- if grep "$PF_CHROOT"/$CHR_MYSQL_SOCKET_DIR /proc/mounts &> /dev/null; then
- umount "$PF_CHROOT"/$CHR_MYSQL_SOCKET_DIR
- fi
- fi
-
- rm -rvf etc @lib@ usr var proc
- elif [ "$(echo "$POSTFIX_UPDATE_CHROOT_JAIL" | tr 'A-Z' 'a-z' )" != "no" ]; then
- echo "checking postfix chroot environment..."
-
- if [ -e /lib/security/pam_ldap.so ]; then
- cpifnewer /etc/openldap/ldap.conf etc/openldap
- fi
-
- mkdir -p "$PF_CHROOT"/proc
- if ! grep "$PF_CHROOT"/proc /proc/mounts &> /dev/null; then
- mount -t proc proc "$PF_CHROOT"/proc
- fi
-
- if [ "$(echo "$POSTFIX_WITH_MYSQL" | tr 'A-Z' 'a-z' )" != "yes" ]; then
- if [ -n "$CHR_MYSQL_SOCKET_DIR" ]; then
- if grep "$PF_CHROOT"/$CHR_MYSQL_SOCKET_DIR /proc/mounts &> /dev/null; then
- umount "$PF_CHROOT"/$CHR_MYSQL_SOCKET_DIR
- fi
- fi
- fi
-
- if [ "$(echo "$POSTFIX_MYSQL_CONN" | tr 'A-Z' 'a-z' )" == "socket" -a \
- "$(echo "$POSTFIX_WITH_MYSQL" | tr 'A-Z' 'a-z' )" != "no" ]; then
- if [ ! -d $CHR_MYSQL_SOCKET_DIR ]; then
- mkdir -p $CHR_MYSQL_SOCKET_DIR
- fi
- if ! grep $CHR_MYSQL_SOCKET_DIR /proc/mounts &> /dev/null; then
- mount -o bind $MYSQL_SOCKET_DIR "$PF_CHROOT"/$CHR_MYSQL_SOCKET_DIR
- fi
- fi
-
- # smtpd_tls_CApath
- CAPATH=`postconf -h smtpd_tls_CApath`
- if [ "$CAPATH" ]
- then
- cpifnewer "$CAPATH/*" ./$CAPATH
- mkdir ./etc/ssl
- rsync -avH /etc/ssl/certs ./etc/ssl
- fi
- # smtpd_tls_CAfile
- smtpd_tls_CAfile=`postconf -h smtpd_tls_CAfile`
- if [ "$smtpd_tls_CAfile" ]
- then
- DIR=`dirname $smtpd_tls_CAfile`
- cpifnewer $smtpd_tls_CAfile ./$DIR
- fi
- # smtpd_tls_cert_file
- smtpd_tls_cert_file=`postconf -h smtpd_tls_cert_file`
- if [ "$smtpd_tls_cert_file" ]
- then
- DIR=`dirname $smtpd_tls_cert_file`
- cpifnewer $smtpd_tls_cert_file ./$DIR
- fi
- # smtpd_tls_key_file
- smtpd_tls_key_file=`postconf -h smtpd_tls_key_file`
- if [ "$smtpd_tls_key_file" -a $smtpd_tls_key_file != '$smtpd_tls_cert_file' ]
- then
- DIR=`dirname $smtpd_tls_key_file`
- cpifnewer $smtpd_tls_key_file ./$DIR
- fi
-
- # PAM
- cpifnewer "/etc/pam.d/*" etc/pam.d
- cpifnewer "/@lib@/security/*" @lib@/security
- cpifnewer "/@lib@/libpam*" @lib@
- cpifnewer "/usr/@lib@/libcrack.so*" usr/@lib@
-
- # SASL
- cpifnewer /etc/sasldb2 etc
- cpifnewer "/etc/sasl2/*" etc/sasl2
- cpifnewer "/usr/@lib@/sasl2/*" usr/@lib@/sasl2
- cpifnewer "/usr/@lib@/libsasl2*" usr/@lib@
- mkdir -p var/run/sasl2
- ln -f /var/run/sasl2/mux var/run/sasl2/mux
- # CYRUS
- mkdir -p var/lib/imap/socket/
- ln -f /var/lib/imap/socket/lmtp var/lib/imap/socket/lmtp
-
- cpifnewer "/@lib@/libnss*" @lib@
- cpifnewer "/@lib@/libresolv*" @lib@
- cpifnewer "/@lib@/libdb*" @lib@
- cpifnewer "/@lib@/libxcrypt*" @lib@
-
- cpifnewer /etc/host.conf etc
- cpifnewer /etc/nsswitch.conf etc
- cpifnewer /etc/resolv.conf etc
- cpifnewer /etc/services etc
- cpifnewer /etc/hosts etc
- cpifnewer /etc/passwd etc
-
- if [ -L /etc/localtime ]; then
- if [ -z "$TIMEZONE" -o "$TIMEZONE" == "YAST_ASK" ]; then
- warn_user "\tUnable to setup your timezone!\n\
-\tThe logging of the current time in /var/log/mail may be wrong!\n\
-\tPlease set the variable TIMEZONE in /etc/sysconfig/clock!"
- else
- mkdir -p usr/share/zoneinfo/$(dirname $TIMEZONE)
- if [ ! -e /usr/share/zoneinfo/$TIMEZONE ]; then
- warn_user "\t$TIMEZONE is not a regular timezone or the corresponding\n\
-\tfile at /usr/share/zoneinfo does not exist"
- else
- cp -af /usr/share/zoneinfo/$TIMEZONE usr/share/zoneinfo/$TIMEZONE
- ln -sf ../usr/share/zoneinfo/$TIMEZONE etc/localtime
- fi
- fi
- else
- cpifnewer /etc/localtime etc
- fi
-
- # do not chown -R root /var/spool/postfix/var
- # this will break ownership for mysql on suse < 1120
- if [ "$(echo "$POSTFIX_WITH_MYSQL" | tr 'A-Z' 'a-z' )" != "no" ]; then
- chown -R root "$PF_CHROOT"/{etc,@lib@,usr}
- else
- chown -R root "$PF_CHROOT"/{etc,@lib@,usr,var}
- fi
-
- fi
-}
-
-gen_main_cf(){
- TMPDIR=$(mktemp -d /tmp/SuSEconfig.postfix.XXXXXX) || exit 1
- PCONF="/usr/sbin/postconf -c $TMPDIR"
-
- # needed when for WITH_LDAP
- export POSTFIX_WITH_LDAP
- # needed when for WITH_MYSQL
- export POSTFIX_WITH_MYSQL
- MCF_DIR=$TMPDIR
- export MCF_DIR
-
- if [ $? -ne 0 ]; then
- warn_user "Can't create temp directory, exiting..."
- exit 1
- fi
- cp -f /etc/postfix/main.cf $TMPDIR/main.cf
-
- # Some default settings, that seem to be useable, at least to me
- $PCONF -e "mail_spool_directory = /var/mail"
- $PCONF -e "canonical_maps = hash:/etc/postfix/canonical"
- $PCONF -e "virtual_alias_domains = hash:/etc/postfix/virtual"
- $PCONF -e "relocated_maps = hash:/etc/postfix/relocated"
- if [ "$(echo "$POSTFIX_TRANSPORT_MAPS" | tr 'A-Z' 'a-z' )" != "" ]; then
- $PCONF -e "transport_maps = $POSTFIX_TRANSPORT_MAPS"
- else
- $PCONF -e "transport_maps = hash:/etc/postfix/transport"
- fi
- $PCONF -e "sender_canonical_maps = hash:/etc/postfix/sender_canonical"
- $PCONF -e "masquerade_exceptions = root"
- $PCONF -e "masquerade_classes = envelope_sender, header_sender, header_recipient"
- $PCONF -e "myhostname = $FQHOSTNAME"
- $PCONF -e "delay_warning_time = 1h"
- $PCONF -e 'message_strip_characters = \0'
-
- # to be on the save side
- $PCONF -e "daemon_directory = @daemon_directory@"
- $PCONF -e "program_directory = @daemon_directory@"
- $PCONF -e "readme_directory = @readme_directory@"
- $PCONF -e "html_directory = @html_directory@"
- $PCONF -e "sample_directory = @sample_directory@"
- $PCONF -e "sendmail_path = @sendmail_path@"
- $PCONF -e "setgid_group = @setgid_group@"
- $PCONF -e "manpage_directory = @manpage_directory@"
- $PCONF -e "newaliases_path = @newaliases_path@"
- $PCONF -e "mailq_path = @mailq_path@"
- if [ "$(echo "$POSTFIX_INET_PROTO" | tr 'A-Z' 'a-z' )" != "" ]; then
- $PCONF -e "inet_protocols = $POSTFIX_INET_PROTO"
- else
- if [ "$( ip addr show dev lo | grep inet6 )" ]; then
- $PCONF -e "inet_protocols = all"
- else
- $PCONF -e "inet_protocols = ipv4"
- fi
- fi
- if test "$SMTPD_LISTEN_REMOTE" == "yes" ; then
- if [ "$(echo "$POSTFIX_LISTEN" | tr 'A-Z' 'a-z' )" != "" ]; then
- $PCONF -e "inet_interfaces = $POSTFIX_LISTEN"
- else
- $PCONF -e "inet_interfaces = all"
- fi
- else
- $PCONF -e "inet_interfaces = localhost"
- fi
- test -n "$POSTFIX_MASQUERADE_DOMAIN" && \
- MASQ_DOMS=$POSTFIX_MASQUERADE_DOMAIN
- if [ -n "$FROM_HEADER" -a "$FROM_HEADER" != "YAST_ASK" ]; then
- if [ -n "$MASQ_DOMS" ]; then
- MASQ_DOMS="$MASQ_DOMS, $FROM_HEADER"
- else
- MASQ_DOMS="$FROM_HEADER"
- fi
- fi
- $PCONF -e "masquerade_domains = $MASQ_DOMS"
-
- if test -z "$POSTFIX_LOCALDOMAINS"; then
- $PCONF -e 'mydestination = $myhostname, localhost.$mydomain'
- else
- $PCONF -e "mydestination = $POSTFIX_LOCALDOMAINS"
- fi
-
- # this overrides the previous
- if test "$POSTFIX_NULLCLIENT" == "yes"; then
- $PCONF -e "mydestination = "
- fi
-
- if test "$POSTFIX_DIALUP" == "yes"; then
- $PCONF -e "defer_transports = smtp"
- $PCONF -e "mynetworks_style = host"
- else
- $PCONF -e "defer_transports = "
- if test -n "$POSTFIX_ADD_MYNETWORKS_STYLE"
- then
- $PCONF -e "mynetworks_style = $POSTFIX_ADD_MYNETWORKS_STYLE"
- fi
- fi
-
- if test "$POSTFIX_NODNS" == "yes"; then
- $PCONF -e "disable_dns_lookups = yes"
- else
- $PCONF -e "disable_dns_lookups = no"
- fi
- if test -n "$POSTFIX_RELAYHOST"; then
- $PCONF -e "relayhost = $POSTFIX_RELAYHOST"
- else
- $PCONF -e "relayhost = "
- fi
- if [ "$(echo "$USE_AMAVIS" | tr 'A-Z' 'a-z' )" != "yes" ]; then
- $PCONF -e "content_filter = "
- else
- $PCONF -e "content_filter = amavis:[127.0.0.1]:10024"
- fi
-
- case "$POSTFIX_MDA" in
- procmail)
- echo 1>&2 "Setting up procmail as MDA..."
- if [ ! -x /usr/bin/procmail ]; then
- warn_user 1>&2 "procmail is not installed, using local as MDA!"
- $PCONF -e "mailbox_command = "
- $PCONF -e "mailbox_transport = "
- else
- $PCONF -e "mailbox_command = /usr/bin/procmail"
- $PCONF -e "mailbox_transport = "
- fi
- $PCONF -e "disable_mime_output_conversion = no"
- ;;
- cyrus)
- echo 1>&2 "Setting up cyrus-imapd via lmtp as MDA..."
- if [ ! -x /usr/lib/cyrus/bin/lmtpd ]; then
- warn_user 1>&2 "cyrus-imapd is not installed, using local as MDA!"
- $PCONF -e "mailbox_command = "
- $PCONF -e "mailbox_transport = "
- else
- LMTPUNIX=$(grep -E "^[[:space:]]*lmtpunix.*" /etc/cyrus.conf)
- if [ -z "$LMTPUNIX" ]; then
- warn_user 1>&2 "you have to add\n\
-lmtpunix cmd=\"lmtpd\" listen=\"/var/lib/imap/socket/lmtp\" prefork=1\n\
-to /etc/cyrus.conf"
- else
- if [ -z "$(echo $LMTPUNIX | grep -E '/var/lib/imap/socket/lmtp')" ]; then
- warn_user 1>&2 "the socket to listen on is wrong in /etc/cyrus.conf\n\
-use listen=\"/var/lib/imap/socket/lmtp\" instead!"
- fi
- fi
- $PCONF -e "mailbox_command = "
- $PCONF -e "mailbox_transport = lmtp:unix:/var/lib/imap/socket/lmtp"
- $PCONF -e "disable_mime_output_conversion = no"
- if [ -z "$(id postfix | grep -E 'groups=.*mail')" ]; then
- warn_user 1>&2 "adding postfix user to group mail"
- usermod -G mail postfix
- fi
- fi
- ;;
- dovecot)
- echo 1>&2 "Setting up dovecot as MDA..."
- if [ ! -x /usr/lib/dovecot/deliver ]; then
- warn_user 1>&2 "dovecot is not installed, using local as MDA!"
- $PCONF -e "mailbox_command = "
- $PCONF -e "mailbox_transport = "
- else
- $PCONF -e "mailbox_command = /usr/lib/dovecot/deliver"
- $PCONF -e "mailbox_transport = "
- fi
- $PCONF -e "disable_mime_output_conversion = no"
- ;;
- local|*)
- echo 1>&2 "Setting up postfix local as MDA..."
- $PCONF -e "mailbox_command = "
- $PCONF -e "mailbox_transport = "
- $PCONF -e "disable_mime_output_conversion = no"
- ;;
- esac
-
- case "$POSTFIX_BASIC_SPAM_PREVENTION" in
- medium)
- echo 1>&2 "Setting up medium SPAM protection..."
- $PCONF -e "smtpd_sender_restrictions = hash:/etc/postfix/access, reject_unknown_sender_domain"
- if test -n "$POSTFIX_RBL_HOSTS"; then
- rblhosts=$(echo ${POSTFIX_RBL_HOSTS//,/ })
- clnt_restrictions=""
- for i in $rblhosts; do
- if [ -z "$clnt_restrictions" ]; then
- clnt_restrictions="reject_rbl_client $i"
- else
- clnt_restrictions="$clnt_restrictions, reject_rbl_client $i"
- fi
- done
- $PCONF -e "smtpd_client_restrictions = $clnt_restrictions"
- else
- $PCONF -e "smtpd_client_restrictions ="
- fi
- $PCONF -e "smtpd_helo_required = yes"
- $PCONF -e "smtpd_helo_restrictions = "
- $PCONF -e "strict_rfc821_envelopes = no"
- $PCONF -e "smtpd_recipient_restrictions = permit_mynetworks, reject_unauth_destination "
- ;;
- hard)
- echo 1>&2 "Setting up hard SPAM protection..."
- $PCONF -e "smtpd_sender_restrictions = hash:/etc/postfix/access, reject_unknown_sender_domain"
- if test -n "$POSTFIX_RBL_HOSTS"; then
- rblhosts=$(echo ${POSTFIX_RBL_HOSTS//,/ })
- clnt_restrictions=""
- for i in $rblhosts; do
- if [ -z "$clnt_restrictions" ]; then
- clnt_restrictions="reject_rbl_client $i"
- else
- clnt_restrictions="$clnt_restrictions, reject_rbl_client $i"
- fi
- done
- $PCONF -e "smtpd_client_restrictions = permit_mynetworks, $clnt_restrictions, reject_unknown_client"
-
- else
- $PCONF -e \
- "smtpd_client_restrictions = permit_mynetworks, reject_unknown_client"
- fi
- $PCONF -e "smtpd_helo_required = yes"
- $PCONF -e "smtpd_helo_restrictions = permit_mynetworks, reject_invalid_hostname"
- $PCONF -e "strict_rfc821_envelopes = yes"
- $PCONF -e "smtpd_recipient_restrictions = permit_mynetworks, reject_unauth_destination"
- ;;
- custom)
- echo 1>&2 "Setting up custom SPAM protection..."
- $PCONF -e "smtpd_helo_required = yes"
- $PCONF -e "strict_rfc821_envelopes = no"
- if [ -n "$POSTFIX_SMTPD_CLIENT_RESTRICTIONS" ]; then
- s_clnt_restrictions=$(echo ${POSTFIX_SMTPD_CLIENT_RESTRICTIONS/\ \+/,/ })
- else
- echo 1>&2 "No smtpd_client_restrictions defined ... setting to medium ..."
- s_clnt_restrictions="reject_unauth_pipelining, reject_unknown_client"
- fi
- if [ -n "$POSTFIX_RBL_HOSTS" ]; then
- rblhosts=$(echo ${POSTFIX_RBL_HOSTS//,/ })
- maps_rbl=""
- for i in $rblhosts; do
- if [ -z "$maps_rbl" ]; then
- maps_rbl="reject_rbl_client $i"
- else
- maps_rbl="$maps_rbl, reject_rbl_client $i"
- fi
- done
- $PCONF -e "smtpd_client_restrictions = $s_clnt_restrictions, $maps_rbl"
- else
- $PCONF -e "smtpd_client_restrictions = $s_clnt_restrictions"
- fi
- if [ -n "$POSTFIX_SMTPD_HELO_RESTRICTIONS" ]; then
- helo_restrictions=$(echo ${POSTFIX_SMTPD_HELO_RESTRICTIONS/\ \+/,/ })
- $PCONF -e "smtpd_helo_restrictions = $helo_restrictions"
- else
- $PCONF -e "smtpd_helo_restrictions = reject_unauth_pipelining, reject_unknown_client"
- fi
- if [ -n "$POSTFIX_SMTPD_SENDER_RESTRICTIONS" ]; then
- sender_restrictions=$(echo ${POSTFIX_SMTPD_SENDER_RESTRICTIONS/\ \+/,/ })
- $PCONF -e "smtpd_sender_restrictions = $sender_restrictions"
- else
- $PCONF -e "smtpd_sender_restrictions = hash:/etc/postfix/access, reject_unknown_sender_domain"
- fi
- if [ -n "$POSTFIX_SMTPD_RECIPIENT_RESTRICTIONS" ]; then
- rcpt_restrictions=$(echo ${POSTFIX_SMTPD_RECIPIENT_RESTRICTIONS/\ \+/,/ })
- fi
- if [ -z "$POSTFIX_SMTPD_RECIPIENT_RESTRICTIONS" ]; then
- echo 1>&2 "No smtp_recipient_restrictions defined ... setting to medium ..."
- $PCONF -e "smtpd_recipient_restrictions = permit_mynetworks, reject_unauth_destination"
- else
- $PCONF -e "smtpd_recipient_restrictions = $rcpt_restrictions"
- fi
- ;;
- *)
- if test "$POSTFIX_BASIC_SPAM_PREVENTION" != "off"; then
- warn_user 1>&2 "$POSTFIX_BASIC_SPAM_PREVENTION is an invalid value for POSTFIX_BASIC_SPAM_PREVENTION\n\
-using \"off\" instead!"
- fi
- echo 1>&2 "Setting SPAM protection to \"off\"..."
- $PCONF -e "smtpd_sender_restrictions = hash:/etc/postfix/access"
- $PCONF -e "smtpd_client_restrictions ="
- $PCONF -e "smtpd_helo_required = no"
- $PCONF -e "smtpd_helo_restrictions ="
- $PCONF -e "strict_rfc821_envelopes = no"
- $PCONF -e "smtpd_recipient_restrictions = permit_mynetworks,reject_unauth_destination"
- ;;
- esac
-
- if test "$POSTFIX_SMTP_AUTH" == "yes"; then
- $PCONF -e "smtp_sasl_auth_enable = yes"
- $PCONF -e "smtp_sasl_security_options = $POSTFIX_SMTP_AUTH_OPTIONS"
- $PCONF -e "smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd"
- else
- $PCONF -e "smtp_sasl_auth_enable = no"
- fi
-
- if test "$POSTFIX_SMTP_AUTH_SERVER" == "yes"; then
- if [ -f /etc/sasl2/smtpd.conf ]; then
- grep saslauthd /etc/sasl2/smtpd.conf >/dev/null && {
- checkproc -p /var/run/sasl2/saslauthd.pid /usr/sbin/saslauthd || {
- warn_user 1>&2 "You are using saslauthd as pwcheck_method in /etc/sasl2/smtpd.conf,\n\
-but saslauthd is not running."
- }
- }
- elif [ -f /usr/@lib@/sasl2/smtpd.conf ]; then
- grep saslauthd /usr/@lib@/sasl2/smtpd.conf >/dev/null && {
- checkproc -p /var/run/sasl2/saslauthd.pid /usr/sbin/saslauthd || {
- warn_user 1>&2 "You are using saslauthd as pwcheck_method in /usr/@lib@/sasl2/smtpd.conf,\n\
-but saslauthd is not running."
- }
- }
- else
- warn_user 1>&2 "You have activated POSTFIX_SMTP_AUTH_SERVER, but you don't have /etc/sasl2/smtpd.conf (nor /usr/@lib@/sasl2/smtpd.conf)"
- fi
- $PCONF -e "smtpd_sasl_auth_enable= yes"
- touch -m -d "1 minute ago" $TMPDIR/main.cf
- CURRENT=$($PCONF -h smtpd_client_restrictions)
- $PCONF -e "smtpd_client_restrictions= permit_sasl_authenticated, $CURRENT"
- touch -m -d "1 minute ago" $TMPDIR/main.cf
- CURRENT=$($PCONF -h smtpd_recipient_restrictions)
- $PCONF -e "smtpd_recipient_restrictions= permit_sasl_authenticated, $CURRENT"
- else
- $PCONF -e "smtpd_sasl_auth_enable= no"
- fi
-
-
- if test "$POSTFIX_SMTP_TLS_SERVER_LEGACY_SUPPORT" == "yes"; then
- grep -E '^smtps' /etc/services >/dev/null || {
- warn_user 1>&2 "adding service \"smtps\" to /etc/services"
- echo "smtps 465/tcp # smtp over SSL" >> /etc/services
- }
- fi
- if test "$POSTFIX_SMTP_TLS_SERVER" == "yes" -o "$POSTFIX_SMTP_TLS_SERVER_LEGACY_SUPPORT" == "yes"; then
- $PCONF -e "smtpd_use_tls = yes"
- $PCONF -e "smtpd_tls_CAfile = $POSTFIX_SSL_PATH/$POSTFIX_TLS_CAFILE"
- $PCONF -e "smtpd_tls_cert_file = $POSTFIX_SSL_PATH/$POSTFIX_TLS_CERTFILE"
- $PCONF -e "smtpd_tls_key_file = $POSTFIX_SSL_PATH/$POSTFIX_TLS_KEYFILE"
- $PCONF -e "smtpd_tls_received_header = yes"
- $PCONF -e "tls_daemon_random_source = dev:/dev/urandom"
- $PCONF -e "tls_random_source = dev:/dev/urandom"
- $PCONF -e "relay_clientcerts = hash:/etc/postfix/relay_ccerts"
- $PCONF -e "smtpd_tls_ask_ccert = yes"
- touch -m -d "1 minute ago" $TMPDIR/main.cf
- CURRENT=$($PCONF -h smtpd_recipient_restrictions)
- $PCONF -e "smtpd_recipient_restrictions = permit_tls_clientcerts, $CURRENT"
- else
- $PCONF -e "smtpd_use_tls = no"
- fi
-
- if test "$POSTFIX_SMTP_TLS_CLIENT" == "no"; then
- $PCONF -e "smtp_use_tls = no"
- $PCONF -e "smtp_enforce_tls = no"
- fi
- if test "$POSTFIX_SMTP_TLS_CLIENT" == "yes"; then
- $PCONF -e "smtp_use_tls = yes"
- $PCONF -e "smtp_enforce_tls = no"
- fi
- if test "$POSTFIX_SMTP_TLS_CLIENT" == "must"; then
- $PCONF -e "smtp_use_tls = yes"
- $PCONF -e "smtp_enforce_tls = yes"
- fi
- if test "$POSTFIX_SMTP_TLS_CLIENT" = "yes" -o "$POSTFIX_SMTP_TLS_CLIENT" = "must" ; then
- test -s "$POSTFIX_SSL_PATH/$POSTFIX_TLS_CAFILE" && \
- $PCONF -e "smtp_tls_CAfile = $POSTFIX_SSL_PATH/$POSTFIX_TLS_CAFILE"
- test -s "$POSTFIX_SSL_PATH/$POSTFIX_TLS_CERTFILE" && \
- $PCONF -e "smtp_tls_cert_file = $POSTFIX_SSL_PATH/$POSTFIX_TLS_CERTFILE"
- test -s "$POSTFIX_SSL_PATH/$POSTFIX_TLS_KEYFILE" && \
- $PCONF -e "smtp_tls_key_file = $POSTFIX_SSL_PATH/$POSTFIX_TLS_KEYFILE"
- $PCONF -e "smtp_tls_session_cache_timeout = 3600s"
- $PCONF -e "smtp_tls_session_cache_database = btree:/var/lib/postfix/smtpd_tls_session_cache"
- else
- $PCONF -e "smtp_use_tls = no"
- fi
-
- ALLMAPS="hash:/etc/aliases"
- for i in $(get_alias_maps); do
- ALLMAPS="${ALLMAPS}, hash:$i"
- done
- $PCONF -e "alias_maps = $ALLMAPS"
-
- for i in $(echo ${!POSTFIX_ADD_*}); do
- touch -m -d "1 minute ago" $TMPDIR/main.cf
- pfkey=$(echo ${i#POSTFIX_ADD_})
- pfval=$(eval "echo \$$i")
- if [ -z "$($PCONF $pfkey 2>/dev/null)" ]; then
- pfkey=$(echo ${i#POSTFIX_ADD_} | tr '[:upper:]' '[:lower:]')
- if [ -z "$($PCONF $pfkey 2>/dev/null)" ]; then
- warn_user 1>&2 "unknown parameter $i ignored"
- else
- #old style uppercase written variable
- $PCONF -e "$pfkey = $pfval"
- fi
- else
- $PCONF -e "$pfkey = $pfval"
- fi
- done
-
- perl -e 'use strict;
-
-my $mncf = "$ENV{MCF_DIR}/main.cf";
-my $line;
-
-my $with_ldap =
- defined $ENV{POSTFIX_WITH_LDAP} ? $ENV{POSTFIX_WITH_LDAP} : "no";
-
-$with_ldap = lc($with_ldap);
-
-my $with_mysql =
- defined $ENV{POSTFIX_WITH_MYSQL} ? $ENV{POSTFIX_WITH_MYSQL} : "no";
-
-$with_mysql = lc($with_mysql);
-
-open(MNCF,"<$mncf") || die "unable to open $mncf: $!";
-
-while( <MNCF> ) {
- chomp;
-
- if( /\#?(virtual_alias_maps\s=\s).*/ ) {
- if ($with_mysql ne "yes" && $with_ldap ne "yes") {
- $line = $1."hash:/etc/postfix/virtual";
- } elsif ($with_ldap eq "yes" && $with_mysql ne "yes") {
- $line = $1."hash:/etc/postfix/virtual ldap:/etc/postfix/ldap_aliases.cf";
- } elsif ($with_mysql eq "yes" && $with_ldap ne "yes") {
- $line = $1."hash:/etc/postfix/virtual mysql:/etc/postfix/mysql_virtual_alias_maps.cf";
- } elsif ($with_mysql eq "yes" && $with_ldap eq "yes") {
- $line = $1."hash:/etc/postfix/virtual ldap:/etc/postfix/ldap_aliases.cf mysql:/etc/postfix/mysql_virtual_alias_maps.cf";
- }
- } elsif( /\#?(virtual_uid_maps\s=.*)/ ) {
- if ($with_mysql ne "yes") {
- $line = "#".$1;
- } else {
- $line = $1;
- }
- } elsif ( /\#?(virtual_gid_maps\s=.*)/ ) {
- if ($with_mysql ne "yes") {
- $line = "#".$1;
- } else {
- $line = $1;
- }
- } elsif ( /\#?(virtual_minimum_uid\s=.*)/ ) {
- if ($with_mysql ne "yes") {
- $line = "#".$1;
- } else {
- $line = $1;
- }
- } elsif ( /\#?(virtual_mailbox_base\s=.*)/ ) {
- if ($with_mysql ne "yes") {
- $line = "#".$1;
- } else {
- $line = $1;
- }
- } elsif ( /\#?(virtual_mailbox_domains\s=.*)/ ) {
- if ($with_mysql ne "yes") {
- $line = "#".$1;
- } else {
- $line = $1;
- }
- } elsif ( /\#?(virtual_mailbox_limit\s=.*)/ ) {
- if ($with_mysql ne "yes") {
- $line = "#".$1;
- } else {
- $line = $1;
- }
- } elsif ( /\#?(virtual_mailbox_maps\s=.*)/ ) {
- if ($with_mysql ne "yes") {
- $line = "#".$1;
- } else {
- $line = $1;
- }
- } elsif ( /\#?(virtual_transport\s=.*)/ ) {
- if ($with_mysql ne "yes") {
- $line = "#".$1;
- } else {
- $line = $1;
- }
- } elsif ( /\#?(virtual_create_maildirsize\s=.*)/ ) {
- if ($with_mysql ne "yes") {
- $line = "#".$1;
- } else {
- $line = $1;
- }
- } elsif ( /\#?(virtual_mailbox_extended\s=.*)/ ) {
- if ($with_mysql ne "yes") {
- $line = "#".$1;
- } else {
- $line = $1;
- }
- } elsif ( /\#?(virtual_mailbox_limit_maps\s=.*)/ ) {
- if ($with_mysql ne "yes") {
- $line = "#".$1;
- } else {
- $line = $1;
- }
- } elsif ( /\#?(virtual_mailbox_limit_override\s=.*)/ ) {
- if ($with_mysql ne "yes") {
- $line = "#".$1;
- } else {
- $line = $1;
- }
- } elsif ( /\#?(virtual_maildir_limit_message\s=.*)/ ) {
- if ($with_mysql ne "yes") {
- $line = "#".$1;
- } else {
- $line = $1;
- }
- } elsif ( /\#?(virtual_overquota_bounce\s=.*)/ ) {
- if ($with_mysql ne "yes") {
- $line = "#".$1;
- } else {
- $line = $1;
- }
- } elsif ( /^(relay_domains\s=\s).*/ ) {
- if ($with_mysql ne "yes") {
- $line = $1."\$mydestination, hash:/etc/postfix/relay";
- } else {
- $line = $1."\$mydestination, hash:/etc/postfix/relay, mysql:/etc/postfix/mysql_relay_domains_maps.cf";
- }
- } else {
- $line = $_;
- }
-
- if( $line =~ /^\#/ ) {
- print $line."\n";
- next;
- }
-
- print $line."\n";
-
-}' > $TMPDIR/new.cf
-
- mv $TMPDIR/new.cf $TMPDIR/main.cf
- cat $TMPDIR/main.cf
- rm -rf $TMPDIR
-}
-
-gen_amavisd_cf(){
- cp /etc/amavisd.conf /etc/amavisd.conf.back
- export FQHOSTNAME
- perl -e 'use strict;
-open(ACF,"/etc/amavisd.conf");
-print OUT @CONF;
-close(OUT);
-'
-}
-
-gen_master_cf(){
- export POSTFIX_LAPTOP
- export POSTFIX_CHROOT
- export POSTFIX_NULLCLIENT
- export USE_AMAVIS
- export POSTFIX_SMTP_TLS_SERVER
- export POSTFIX_SMTP_TLS_SERVER_LEGACY_SUPPORT
- export POSTFIX_SMTP_TLS_CLIENT
-
- perl -e 'use strict;
-
-my $mcf = "/etc/postfix/master.cf";
-my $line;
-
-my $laptop =
- defined $ENV{POSTFIX_LAPTOP} ? $ENV{POSTFIX_LAPTOP} : "no";
-my $nullclient =
- defined $ENV{POSTFIX_NULLCLIENT} ? $ENV{POSTFIX_NULLCLIENT} : "no";
-my $chroot =
- defined $ENV{POSTFIX_CHROOT} ? $ENV{POSTFIX_CHROOT} : "yes";
-my $use_amavis =
- defined $ENV{USE_AMAVIS} ? $ENV{USE_AMAVIS} : "no";
-my $tlsserver =
- defined $ENV{POSTFIX_SMTP_TLS_SERVER} ? $ENV{POSTFIX_SMTP_TLS_SERVER} : "no";
-my $sslserver =
- defined $ENV{POSTFIX_SMTP_TLS_SERVER_LEGACY_SUPPORT} ? $ENV{POSTFIX_SMTP_TLS_SERVER_LEGACY_SUPPORT} : "no";
-my $tlsclient =
- defined $ENV{POSTFIX_SMTP_TLS_CLIENT} ? $ENV{POSTFIX_SMTP_TLS_CLIENT} : "no";
-my $normalize = {};
-
-
-$laptop = lc($laptop);
-$chroot = lc($chroot);
-$nullclient = lc($nullclient);
-$use_amavis = lc($use_amavis);
-$tlsserver = lc($tlsserver);
-$tlsclient = lc($tlsclient);
-
-open(MCF,"<$mcf") || die "unable to open $mcf: $!";
-
-while( <MCF> ) {
- chomp;
-
- if( /\#?\s*(smtp\s+inet.*?smtpd)/ ) {
- if( defined $normalize->{$1} ) { next; } else { $normalize->{$1} = 1; }
- if ($nullclient eq "yes") {
- $line = "#".$1;
- } else {
- $line = $1;
- }
- if ( $use_amavis eq "yes" ) {
- $line =~ /(\#?\s*smtp\s+inet\s+[yn-]?\s+[yn-]?\s+[yn-]?\s+[0-9?yn-]?\s+)[0-9-]+(.*)/;
- $line = $1."-".$2;
- } else {
- $line =~ /(\#?\s*smtp\s+inet\s+[yn-]?\s+[yn-]?\s+[yn-]?\s+[0-9?yn-]?\s+)[0-9-]+(.*)/;
- $line = $1."-".$2;
- }
- } elsif( /\#?\s*(amavis\s+unix.*)/ ) {
- if ($use_amavis ne "yes") {
- $line = "#".$1;
- } else {
- $line = $1;
- }
- } elsif ( /\#?\s\s(-o\s+smtp_data_done_timeout=.*)/ ) {
- if ( $use_amavis ne "yes" ) {
- $line = "# ".$1;
- } else {
- $line = " ".$1;
- }
- } elsif ( /\#?\s\s(-o\s+smtp_send_xforward_command=.*)/ ) {
- if ( $use_amavis ne "yes" ) {
- $line = "# ".$1;
- } else {
- $line = " ".$1;
- }
- } elsif ( /\#?\s\s(-o\s+disable_dns_lookups=.*)/ ) {
- if ( $use_amavis ne "yes" ) {
- $line = "# ".$1;
- } else {
- $line = " ".$1;
- }
- } elsif ( /\#?\s\s(-o\s+max_use=.*)/ ) {
- if ( $use_amavis ne "yes" ) {
- $line = "# ".$1;
- } else {
- $line = " ".$1;
- }
- } elsif( /\#?\s*(local\s+unix.*)/ ) {
- if( defined $normalize->{$1} ) { next; } else { $normalize->{$1} = 1; }
- if ($nullclient eq "yes") {
- $line = "#".$1;
- } else {
- $line = $1;
- }
- } elsif( /\#?\s*(localhost:10025\s+inet.*)/ ) {
- if( defined $normalize->{$1} ) { next; } else { $normalize->{$1} = 1; }
- if ( $use_amavis ne "yes" ) {
- $line = "#".$1;
- } else {
- $line = $1;
- }
- } elsif ( /\#?\s\s(-o\s+content_filter=.*)/ ) {
- if ( $use_amavis ne "yes" ) {
- $line = "# ".$1;
- } else {
- $line = " ".$1;
- }
- } elsif ( /\#?\s\s(-o\s+smtpd_delay_reject=.*)/) {
- if ( $use_amavis ne "yes" ) {
- $line = "# ".$1;
- } else {
- $line = " ".$1;
- }
- # next should match
- # # -o smtpd_client_restrictions=
- # and not
- # # -o smtpd_client_restrictions=permit_sasl_authenticated,reject
- } elsif ( /^\#?\s\s(-o\s+smtpd_client_restrictions=.*)/) {
- if ( $use_amavis ne "yes" ) {
- $line = "# ".$1;
- } else {
- $line = " ".$1;
- }
- } elsif ( /\#?\s\s(-o\s+smtpd_helo_restrictions=.*)/) {
- if ( $use_amavis ne "yes" ) {
- $line = "# ".$1;
- } else {
- $line = " ".$1;
- }
- } elsif ( /\#?\s\s(-o\s+smtpd_sender_restrictions=.*)/) {
- if ( $use_amavis ne "yes" ) {
- $line = "# ".$1;
- } else {
- $line = " ".$1;
- }
- } elsif ( /\#?\s\s(-o\s+smtpd_recipient_restrictions=.*)/) {
- if ( $use_amavis ne "yes" ) {
- $line = "# ".$1;
- } else {
- $line = " ".$1;
- }
- } elsif ( /\#?\s\s(-o\s+smtpd_data_restrictions=.*)/) {
- if ( $use_amavis ne "yes" ) {
- $line = "# ".$1;
- } else {
- $line = " ".$1;
- }
- } elsif ( /\#?\s\s(-o\s+smtpd_end_of_data_restrictions=.*)/) {
- if ( $use_amavis ne "yes" ) {
- $line = "# ".$1;
- } else {
- $line = " ".$1;
- }
- } elsif ( /\#?\s\s(-o\s+smtpd_restriction_classes=.*)/) {
- if ( $use_amavis ne "yes" ) {
- $line = "# ".$1;
- } else {
- $line = " ".$1;
- }
- } elsif ( /\#?\s\s(-o\s+mynetworks=.*)/) {
- if ( $use_amavis ne "yes" ) {
- $line = "# ".$1;
- } else {
- $line = " ".$1;
- }
- } elsif ( /\#?\s\s(-o\s+smtpd_error_sleep_time=.*)/) {
- if ( $use_amavis ne "yes" ) {
- $line = "# ".$1;
- } else {
- $line = " ".$1;
- }
- } elsif ( /\#?\s\s(-o\s+smtpd_soft_error_limit=.*)/) {
- if ( $use_amavis ne "yes" ) {
- $line = "# ".$1;
- } else {
- $line = " ".$1;
- }
- } elsif ( /\#?\s\s(-o\s+smtpd_hard_error_limit=.*)/) {
- if ( $use_amavis ne "yes" ) {
- $line = "# ".$1;
- } else {
- $line = " ".$1;
- }
- } elsif ( /\#?\s\s(-o\s+smtpd_client_connection_count_limit=.*)/) {
- if ( $use_amavis ne "yes" ) {
- $line = "# ".$1;
- } else {
- $line = " ".$1;
- }
- } elsif ( /\#?\s\s(-o\s+smtpd_client_connection_rate_limit=.*)/) {
- if ( $use_amavis ne "yes" ) {
- $line = "# ".$1;
- } else {
- $line = " ".$1;
- }
- } elsif ( /\#?\s\s(-o\s+receive_override_options=.*)/) {
- if ( $use_amavis ne "yes" ) {
- $line = "# ".$1;
- } else {
- $line = " ".$1;
- if( $line !~ /receive_override_options=no_unknown_recipient_checks,no_header_body_checks/ )
- {
- $line .= " -o receive_override_options=no_unknown_recipient_checks,no_header_body_checks,no_address_mappings";
- }
- }
- } elsif ( /\#?\s\s(-o\s+local_header_rewrite_clients=.*)/) {
- if ( $use_amavis ne "yes" ) {
- $line = "# ".$1;
- } else {
- $line = " ".$1;
- }
- } elsif ( /\#?\s\s(-o\s+local_recipient_maps=.*)/) {
- if ( $use_amavis ne "yes" ) {
- $line = "# ".$1;
- } else {
- $line = " ".$1;
- }
- } elsif ( /\#?\s\s(-o\s+relay_recipient_maps=.*)/) {
- if ( $use_amavis ne "yes" ) {
- $line = "# ".$1;
- } else {
- $line = " ".$1;
- }
- } elsif( /\#?\s*(tlsmgr\s+unix.*)/ ) {
- if( defined $normalize->{$1} ) { next; } else { $normalize->{$1} = 1; }
- if ( $tlsclient ne "yes" && $tlsserver ne "yes" && $sslserver ne "yes" ) {
- $line = "#".$1;
- } else {
- $line = $1;
- }
- } elsif( /\#?\s*(smtps\s+inet.*?smtpd)/ ) {
- if( defined $normalize->{$1} ) { next; } else { $normalize->{$1} = 1; }
- if ( $sslserver ne "yes" ) {
- $line = "#".$1." -o smtpd_tls_wrappermode=yes";
- } else {
- $line = $1." -o smtpd_tls_wrappermode=yes";
- }
- if ( $use_amavis eq "yes" ) {
- $line =~ /(\#?\s*smtps\s+inet\s+[yn-]?\s+[yn-]?\s+[yn-]?\s+[0-9?yn-]?\s+)[0-9-]+(.*)/;
- $line = $1."10".$2." -o content_filter=smtp:[127.0.0.1]:10024";
- } else {
- $line =~ /(\#?\s*smtps\s+inet\s+[yn-]?\s+[yn-]?\s+[yn-]?\s+[0-9?yn-]?\s+)[0-9-]+(.*)/;
- $line = $1."-".$2;
- }
- } elsif( /^(\#?\s*(?:pickup|qmgr)\s+)(?:fifo|unix)(\s+.*)/ ) {
- if( defined $normalize->{$1} ) { next; } else { $normalize->{$1} = 1; }
- if ( $laptop eq "yes" ) {
- $line = $1."unix".$2;
- } else {
- $line = $1."fifo".$2;
- }
- } else {
- $line = $_;
- }
-
- if( $line =~ /^\#/ ) {
- print $line."\n";
- next;
- }
-
- my $match = 0;
- foreach my $serv ( ( "smtp", "pickup", "cleanup", "rewrite",
- "bounce", "defer", "showq", "error",
- "lmtp", "smtps", "tlsmgr", "localhost:10025" ) ) {
- if( $line =~ /^$serv\s+/ ) {
- $line =~ /(^$serv\s+\w+\s+[yn-]?\s+[yn-]?\s+)[yn-]?(.*)/;
- print $1.( $chroot eq "yes" ? "y" : "n" ).$2."\n";
- $match = 1;
- } else {
- next;
- }
- }
- print $line."\n" if ! $match;
-}'
-
-}
-
-update_cf() {
- while test "x$1" != "x" ; do
- if [ ! -f $r/etc/postfix/${1}.SuSEconfig ]; then
- eval gen_${1/\./_} > $r/etc/postfix/${1}.SuSEconfig
- test -s $r/etc/postfix/${1}.SuSEconfig || {
- warn_user "Writing $r/etc/postfix/${1}.SuSEconfig failed, exiting..."
- exit 1
- }
- check_md5_and_move $r/etc/postfix/$1
- else
- warn_user "Found /etc/postfix/${1}.SuSEconfig, exiting..."
- exit 1
- fi
- shift
- done
-}
-
-restore_cf() {
- while test "x$1" != "x" ; do
- warn_user "/etc/postfix/${1}: zero file size or missing, restoring
-from @conf_backup_dir@/${1}"
- if [ ! -s @conf_backup_dir@/$1 ]; then
- warn_user "@conf_backup_dir@/${1}: zero file size or missing, exiting..."
- exit 1
- fi
- rm -f /var/adm/SuSEconfig/md5/etc/postfix/$1
- cp --remove-destination @conf_backup_dir@/$1 /etc/postfix/$1
-
- update_cf $1
- shift
- done
-}
-
-gen_CA() {
- openssl=/usr/bin/openssl
- sslpath=$POSTFIX_SSL_PATH
- sslconfig=$sslpath/openssl_postfix.conf
- date="$(date)"
-
- oldmask=$(umask)
- umask 077
- mkdir -p $sslpath/private
- mkdir -p $sslpath/certs
- mkdir -p $sslpath/newcerts
-
- test -f $sslpath/serial || \
- echo 01 > $sslpath/serial
- touch $sslpath/index.txt
- sed -e "s/@POSTFIX_SSL_COUNTRY@/$POSTFIX_SSL_COUNTRY/" \
- -e "s/@POSTFIX_SSL_STATE@/$POSTFIX_SSL_STATE/" \
- -e "s/@POSTFIX_SSL_LOCALITY@/$POSTFIX_SSL_LOCALITY/" \
- -e "s/@POSTFIX_SSL_ORGANIZATION@/$POSTFIX_SSL_ORGANIZATION/" \
- -e "s/@POSTFIX_SSL_ORGANIZATIONAL_UNIT@/$POSTFIX_SSL_ORGANIZATIONAL_UNIT/" \
- -e "s/@POSTFIX_SSL_COMMON_NAME@/$POSTFIX_SSL_COMMON_NAME/" \
- -e "s/@POSTFIX_SSL_EMAIL_ADDRESS@/$POSTFIX_SSL_EMAIL_ADDRESS/" \
- -e "s/@RANDOM@/${RANDOM}${RANDOM}/" \
- -e "s/@COMMENT@/generated by SuSEconfig.postfix at $date/" \
- /etc/postfix/openssl_postfix.conf.in > $sslconfig
-
- echo "creating CA request/certificate..."
- $openssl req -days 2000 -config $sslconfig -new -x509 -nodes \
- -keyout $sslpath/private/cakey.pem -out $sslpath/$POSTFIX_TLS_CAFILE 2>/dev/null || {
- echo "error creating CA request/certificate"
- rm -rf $sslpath
- umask $oldmask
- return
- }
-
- echo "creating certificate request..."
- $openssl req -config $sslconfig -new -nodes -keyout \
- $sslpath/$POSTFIX_TLS_KEYFILE -out $sslpath/certs/postfixreq.pem 2>/dev/null || {
- echo "error creating certificate request"
- rm -rf $sslpath
- umask $oldmask
- return
- }
-
- echo "signing server certificate..."
- $openssl ca -config $sslconfig -notext -batch \
- -out $sslpath/$POSTFIX_TLS_CERTFILE \
- -infiles $sslpath/certs/postfixreq.pem 2>/dev/null || {
- echo "error signing server certificate"
- rm -rf $sslpath
- umask $oldmask
- return
- }
-
- chmod 755 $sslpath
- chmod 755 $sslpath/certs
- chmod 644 $sslpath/cacert.pem
- umask $oldmask
-}
-
-###############################################################################
-#################################### MAIN #####################################
-###############################################################################
-
-r=$ROOT
-
-test -s $r/etc/sysconfig/postfix || {
- echo "No $r/etc/sysconfig/postfix found."
- exit 1
-}
-. $r/etc/sysconfig/postfix
-
-# this file contains generic mail setup information
-test -s $r/etc/sysconfig/mail || {
- echo "No $r/etc/sysconfig/mail found."
- exit 1
-}
-. $r/etc/sysconfig/mail
-
-# We may need TIMEZONE for chroot setup
-test -s $r/etc/sysconfig/clock && . $r/etc/sysconfig/clock
-
-# Try to get a valid hostname...
-if [ -z "$POSTFIX_MYHOSTNAME" ]; then
- test -s "$r/var/run/dhcp-hostname" && . "$r/var/run/dhcp-hostname"
- case $FQHOSTNAME in *.*) ;; *) unset FQHOSTNAME ;; esac
- test -z "$FQHOSTNAME" -a -s $r/etc/HOSTNAME && read -t 1 FQHOSTNAME < $r/etc/HOSTNAME
- # check whether hostname contains at least one dot...
- echo $FQHOSTNAME | grep "\." >/dev/null || FQHOSTNAME=""
- # still no valid hostname? :-( set hostname to linux.local
- test -z "$FQHOSTNAME" && FQHOSTNAME=linux.local
-else
- FQHOSTNAME=$POSTFIX_MYHOSTNAME
-fi
-
-# check whether we want to use amavis
-if [ -x /usr/sbin/amavisd ]; then
- test -s $r/etc/sysconfig/amavis && . $r/etc/sysconfig/amavis
- if [ "$USE_AMAVIS" = "yes" ]; then
- gen_amavisd_cf
- insserv amavis
- fi
-fi
-
-test -f $r/lib/YaST/SuSEconfig.functions || {
- echo "ERROR - can not find $r/lib/YaST/SuSEconfig.functions!!"
- echo "This should not happen. Exit..."
- exit 1
-}
-. $r/lib/YaST/SuSEconfig.functions
-
-
-# call mkchroot. The conditions what to do take place in this function.
-mkchroot
-
-# restore main.cf and master.cf, if they had been removed by accident
-test -z "$r" && {
- if [ ! -s /etc/postfix/main.cf ]; then
- restore_cf main.cf
- fi
-
- if [ ! -s /etc/postfix/master.cf ]; then
- restore_cf master.cf
- fi
-}
-
-if test "$MAIL_CREATE_CONFIG" = "yes"; then
- test -z "$r" && update_cf master.cf main.cf
-fi
-
-PFVERSION=$(/usr/sbin/postconf -h mail_version)
-test -z "$PFVERSION" && {
- echo "ERROR - unable to determine the version of postfix, you are running"
- echo "This should not happen. Exit..."
- exit 1
-}
-PFMAJOR=${PFVERSION:0:1}
-
-if test -z "$r" && test "$POSTFIX_SMTP_TLS_SERVER" == yes ; then
- test -d $POSTFIX_SSL_PATH || gen_CA
-fi
-
-if test -z "$r" && test "$POSTFIX_UPDATE_MAPS" == yes ; then
- test -e /etc/aliases && \
- if test /etc/aliases -nt /etc/aliases.db \
- -o ! -e /etc/aliases.db ; then
- echo "Rebuilding /etc/aliases.db."
- /usr/bin/newaliases
- fi
- update_db $POSTFIX_MAP_LIST
-
- for i in $(get_alias_maps); do
- if test $i -nt $i.db -o ! -e $i.db; then
- echo "Rebuilding $i.db"
- /usr/sbin/postalias $i
- fi
- done
-
- /usr/sbin/postfix reload > /dev/null 2>&1
-fi
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/postfix-SuSE/cond_slp.systemd new/postfix-SuSE/cond_slp.systemd
--- old/postfix-SuSE/cond_slp.systemd 1970-01-01 01:00:00.000000000 +0100
+++ new/postfix-SuSE/cond_slp.systemd 2011-08-12 18:23:46.000000000 +0200
@@ -0,0 +1,37 @@
+#!/bin/bash
+#
+# /etc/postfix/system/cond_slp
+#
+# Description:
+#
+
+POSTCONF=/usr/sbin/postconf
+OPENSLP_BIN=/usr/bin/slptool
+
+test -f /etc/sysconfig/postfix && . /etc/sysconfig/postfix
+
+[ "${POSTFIX_REGISTER_SLP,,[A-Z]}" != yes ] && exit
+[ -x $OPENSLP_BIN ] || exit
+
+PIFACES=$($POSTCONF -h inet_interfaces|sed -e 's/\(127.0.0.1\|::1\|[[:space:]]\)//g')
+[ -n "$PIFACES" ] || exit
+
+PSERVICES=$(grep -E '^smtp.*smtpd' /etc/postfix/master.cf| cut -d" " -f1)
+[ -n "$PSERVICES" ] || exit
+
+cond_slp()
+{
+ local cmd=$1
+ local srv
+ local FQHN=$($POSTCONF -h myhostname)
+ for srv in $PSERVICES; do
+ sport=$(sed -ne "/^$srv/Is/^$srv[[:space:]]\+\([0-9]\+\)\/tcp.*/\1/gp" /etc/services)
+ [ -n "$sport" ] || continue
+ $OPENSLP_BIN $cmd service:$srv://$FQHN:$sport > /dev/null 2>&1
+ done
+}
+
+cond_slp $1 &
+
+#
+# end /etc/postfix/system/cond_slp
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/postfix-SuSE/postfix.service new/postfix-SuSE/postfix.service
--- old/postfix-SuSE/postfix.service 1970-01-01 01:00:00.000000000 +0100
+++ new/postfix-SuSE/postfix.service 2011-08-12 17:35:38.000000000 +0200
@@ -0,0 +1,39 @@
+# This file is part of package postfix.
+#
+# Copyright (c) 2011 SuSE LINUX Products GmbH, Germany.
+# Author: Werner Fink
+# Please send feedback to http://www.suse.de/feedback
+#
+# Description:
+#
+# Used to start the postfix Mail Transport Agent service
+# which handles all mails stored at /var/spool/postfix/ and
+# all connections on port 25 aka smtp at localhost as well
+# as on all other network interfaces.
+#
+
+[Unit]
+Description=Postfix Mail Transport Agent
+Requires=var-run.mount nss-lookup.target network.target remote-fs.target syslog.target time-sync.target
+After=var-run.mount nss-lookup.target network.target remote-fs.target syslog.target time-sync.target
+Wants=amavis.service mysql.service cyrus.service ldap.service openslp.service ypbind.service
+After=amavis.service mysql.service cyrus.service ldap.service openslp.service ypbind.service
+Before=mail-transfer-agent.target
+Conflicts=sendmail.service exim.service
+
+[Service]
+Type=forking
+PIDFile=/var/spool/postfix/pid/master.pid
+ExecStartPre=-/bin/echo 'Starting mail service (Postfix)'
+EnvironmentFile=-/etc/sysconfig/postfix
+ExecStartPre=/etc/postfix/system/update_chroot
+ExecStart=/usr/sbin/postfix start
+ExecStartPost=/etc/postfix/system/wait_qmgr 60
+ExecStartPost=/etc/postfix/system/cond_slp register
+ExecReload=/usr/sbin/postfix reload
+ExecReload=/usr/sbin/postfix flush
+ExecStop=/usr/sbin/postfix stop
+ExecStopPost=/etc/postfix/system/cond_slp deregister
+
+[Install]
+WantedBy=multi-user.target
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/postfix-SuSE/update_chroot.systemd new/postfix-SuSE/update_chroot.systemd
--- old/postfix-SuSE/update_chroot.systemd 1970-01-01 01:00:00.000000000 +0100
+++ new/postfix-SuSE/update_chroot.systemd 2011-08-12 18:01:16.000000000 +0200
@@ -0,0 +1,83 @@
+#!/bin/bash
+#
+# /etc/postfix/system/update_chroot
+#
+# Description:
+#
+#
+
+defaults=/usr/bin/my_print_defaults
+test -f /etc/sysconfig/postfix && . /etc/sysconfig/postfix
+
+warn_user(){
+ tput bold
+ echo -e "\t*** WARNING ***"
+ echo -e $1
+ echo -e "\t*** WARNING ***"
+ tput sgr0
+}
+
+chk_mysql_sock()
+{
+ lcoal -i RET=0
+ local PF_CHROOT="/var/spool/postfix"
+ local MYSQLD="$($defaults mysqld)"
+
+ if [ -n "$MYSQLD" ]; then
+ MYSQL_SOCKET=$(echo "$MYSQLD" | sed -rn '/--socket[[:blank:]=]/{ s@.*[[:blank:]=]([^[:blank:]=]*)@\1@p; }')
+ MYSQL_SOCKET_DIR=${MYSQL_SOCKET%/*}
+ CHR_MYSQL_SOCKET=${PF_CHROOT}${MYSQL_SOCKET}
+ CHR_MYSQL_SOCKET_DIR=${CHR_MYSQL_SOCKET%/*}
+ if [ -S $MYSQL_SOCKET ]; then
+ if [ -d $CHR_MYSQL_SOCKET_DIR ]; then
+ if grep $CHR_MYSQL_SOCKET_DIR /proc/mounts &> /dev/null; then
+ RET=0
+ else
+ RET=8
+ fi
+ else
+ RET=4
+ fi
+ else
+ RET=2
+ fi
+ else
+ RET=1
+ fi
+ return $RET
+}
+
+if [ "${POSTFIX_UPDATE_CHROOT_JAIL,,[A-Z]}" != "no" ]; then
+ if [ "${POSTFIX_MYSQL_CONN,,[A-Z]}" == "socket" -a "${POSTFIX_WITH_MYSQL,,[A-Z]}" != "no" ]; then
+ chk_mysql_sock
+ case $? in
+ 1)
+warn_user "\t/etc/my.cnf does not exist!!\n\
+\tThis should not happen!\n\
+\tPlease check if postfix-mysql is installed and check for package mysql."
+ exit 5
+ ;;
+ 2)
+warn_user "\tMySQL not started\n\
+\tPlease check if MySQL is started on boot"
+ exit 7
+ ;;
+ 4)
+warn_user "\t$CHR_MYSQL_SOCKET_DIR does not exist!!\n\
+\tThis should not happen!\n\
+\tPlease run SuSEconfig."
+ exit 6
+ ;;
+ 8)
+ /bin/mount -o bind $MYSQL_SOCKET_DIR $CHR_MYSQL_SOCKET_DIR &> /dev/null
+ [ $? -ne 0 ] && {
+ echo -n " ... can not mount $MYSQL_SOCKET_DIR to $CHR_MYSQL_SOCKET_DIR"
+ exit 1
+ }
+ ;;
+ esac
+ fi
+fi
+exit 0
+#
+# end /etc/postfix/system/update_chroot
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/postfix-SuSE/wait_qmgr.systemd new/postfix-SuSE/wait_qmgr.systemd
--- old/postfix-SuSE/wait_qmgr.systemd 1970-01-01 01:00:00.000000000 +0100
+++ new/postfix-SuSE/wait_qmgr.systemd 2011-08-12 18:12:17.000000000 +0200
@@ -0,0 +1,20 @@
+#!/bin/bash
+#
+# /etc/postfix/system/wait_qmgr
+#
+# Description:
+#
+
+POSTFIX_BIN=/usr/sbin/postfix
+typeset -i sec=$1
+typeset -i ms=$((sec*100))
+
+( while ! pidof qmgr > /dev/null 2>&1 ; do
+ ((ms-- <= 0)) && break
+ usleep 10000
+ done
+ exec -a $POSTFIX_BIN $POSTFIX_BIN flush
+) > /dev/null 2>&1 &
+
+#
+# end /etc/postfix/system/wait_qmgr
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
--
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org