diff --git a/pflogsumm-1.1.5-datecalc.patch b/pflogsumm-1.1.5-datecalc.patch new file mode 100644 index 0000000000000000000000000000000000000000..77ca806d7eacc7d6457039d2ae12989f639c30e2 --- /dev/null +++ b/pflogsumm-1.1.5-datecalc.patch @@ -0,0 +1,15 @@ +diff --git pflogsumm-1.1.5/pflogsumm.pl pflogsumm-1.1.5/pflogsumm.pl +index 31de5bd..36384dd 100755 +--- pflogsumm-1.1.5/pflogsumm.pl ++++ pflogsumm-1.1.5/pflogsumm.pl +@@ -398,8 +398,8 @@ Copyright (C) 1998-2010 by James S. Seymour, Release 1.1.5 + use strict; + use locale; + use Getopt::Long; +-eval { require Date::Calc }; +-my $hasDateCalc = $@ ? 0 : 1; ++require Date::Calc; ++my $hasDateCalc = 1; + + my $mailqCmd = "mailq"; + my $release = "1.1.5"; diff --git a/pflogsumm-1.1.5-ipv6-warnings-fix.patch b/pflogsumm-1.1.5-ipv6-warnings-fix.patch new file mode 100644 index 0000000000000000000000000000000000000000..51e759e971ec23e30ec71ac4d430827293657e28 --- /dev/null +++ b/pflogsumm-1.1.5-ipv6-warnings-fix.patch @@ -0,0 +1,13 @@ +diff --git pflogsumm-1.1.5/pflogsumm.pl pflogsumm-1.1.5/pflogsumm.pl +index 36384dd..eb527d0 100755 +--- pflogsumm-1.1.5/pflogsumm.pl ++++ pflogsumm-1.1.5/pflogsumm.pl +@@ -1536,7 +1536,7 @@ sub gimme_domain { + # split domain/ipaddr into separates + # newer versions of Postfix have them "dom.ain[i.p.add.ress]" + # older versions of Postfix have them "dom.ain/i.p.add.ress" +- unless((($domain, $ipAddr) = /^([^\[]+)\[((?:\d{1,3}\.){3}\d{1,3})\]/) == 2 || ++ unless((($domain, $ipAddr) = /^([^\[]+)\[((?:\d{1,3}\.){3}\d{1,3}|[0-9a-f:]+)\]/) == 2 || + (($domain, $ipAddr) = /^([^\/]+)\/([0-9a-f.:]+)/i) == 2) { + # more exhaustive method + ($domain, $ipAddr) = /^([^\[\(\/]+)[\[\(\/]([^\]\)]+)[\]\)]?:?\s*$/; diff --git a/pflogsumm-1.1.5-syslog-name-underscore-fix.patch b/pflogsumm-1.1.5-syslog-name-underscore-fix.patch new file mode 100644 index 0000000000000000000000000000000000000000..9279bcca21435f42c4a05c6b97e1042a7ec9bfce --- /dev/null +++ b/pflogsumm-1.1.5-syslog-name-underscore-fix.patch @@ -0,0 +1,18 @@ +diff --git a/pflogsumm-1.1.5/pflogsumm.pl b/pflogsumm-1.1.5/pflogsumm.pl +index eb527d0..7e26206 100755 +--- a/pflogsumm-1.1.5/pflogsumm.pl ++++ b/pflogsumm-1.1.5/pflogsumm.pl +@@ -503,7 +503,12 @@ $usageMsg = + # Accept either "_"s or "-"s in --switches + foreach (@ARGV) { + last if($_ eq "--"); +- tr/_/-/ if(/^--\w/); ++ if (/^--\w/) ++ { ++ my @argspl = split("=", $_, 2); ++ $argspl[0] =~ tr/_/-/; ++ $_ = join("=", @argspl); ++ } + } + + # Some pre-inits for convenience diff --git a/pflogsumm-1.1.5.tar.gz b/pflogsumm-1.1.5.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..f047b445778a148e200cdc7a49d81b26a75d4e06 Binary files /dev/null and b/pflogsumm-1.1.5.tar.gz differ diff --git a/postfix-3.3.3-alternatives.patch b/postfix-3.3.3-alternatives.patch new file mode 100644 index 0000000000000000000000000000000000000000..2c3ba18ecee11e50b51e627744546a9e8b8dfe25 --- /dev/null +++ b/postfix-3.3.3-alternatives.patch @@ -0,0 +1,22 @@ +diff --git a/conf/post-install b/conf/post-install +index 25ef7e6..4fd6434 100644 +--- a/conf/post-install ++++ b/conf/post-install +@@ -537,6 +537,17 @@ test -n "$create" && { + case $path in + no|no/*) continue;; + esac ++ # Munge paths for alternatives. ++ case $path in ++ /usr/bin/mailq) path=$path.postfix ;; ++ /usr/bin/newaliases) path=$path.postfix ;; ++ /usr/bin/rmail) path=$path.postfix ;; ++ /usr/sbin/sendmail) path=$path.postfix ;; ++ /usr/share/man/man1/mailq.1.gz) path=/usr/share/man/man1/mailq.postfix.1.gz ;; ++ /usr/share/man/man1/newaliases.1.gz) path=/usr/share/man/man1/newaliases.postfix.1.gz ;; ++ /usr/share/man/man5/aliases.5.gz) path=/usr/share/man/man5/aliases.postfix.5.gz ;; ++ /usr/share/man/man8/smtpd.8.gz) path=/usr/share/man/man8/smtpd.postfix.8.gz ;; ++ esac + # Pick up the flags. + case $flags in *u*) upgrade_flag=1;; *) upgrade_flag=;; esac + case $flags in *c*) create_flag=1;; *) create_flag=;; esac diff --git a/postfix-3.4.0-files.patch b/postfix-3.4.0-files.patch new file mode 100644 index 0000000000000000000000000000000000000000..ad7355386176dc23ee6c544cec6116fb0471220c --- /dev/null +++ b/postfix-3.4.0-files.patch @@ -0,0 +1,63 @@ +diff --git a/conf/postfix-files b/conf/postfix-files +index 4ed9d1f..19711d2 100644 +--- a/conf/postfix-files ++++ b/conf/postfix-files +@@ -83,7 +83,6 @@ $shlib_directory/${LIB_PREFIX}sqlite${LIB_SUFFIX}:f:root:-:755 + $meta_directory/dynamicmaps.cf.d:d:root:-:755 + $meta_directory/dynamicmaps.cf:f:root:-:644 + $meta_directory/main.cf.proto:f:root:-:644 +-$meta_directory/makedefs.out:f:root:-:644 + $meta_directory/master.cf.proto:f:root:-:644 + $meta_directory/postfix-files.d:d:root:-:755 + $meta_directory/postfix-files:f:root:-:644 +@@ -141,18 +140,13 @@ $command_directory/postqueue:f:root:$setgid_group:2755:u + $sendmail_path:f:root:-:755 + $newaliases_path:l:$sendmail_path + $mailq_path:l:$sendmail_path +-$config_directory/LICENSE:f:root:-:644:1 +-$config_directory/TLS_LICENSE:f:root:-:644:1 + $config_directory/access:f:root:-:644:p1 +-$config_directory/aliases:f:root:-:644:p1 +-$config_directory/bounce.cf.default:f:root:-:644:1 + $config_directory/canonical:f:root:-:644:p1 + $config_directory/cidr_table:f:root:-:644:o + $config_directory/generic:f:root:-:644:p1 + $config_directory/generics:f:root:-:644:o + $config_directory/header_checks:f:root:-:644:p1 + $config_directory/install.cf:f:root:-:644:o +-$config_directory/main.cf.default:f:root:-:644:1 + $config_directory/main.cf:f:root:-:644:p + $config_directory/master.cf:f:root:-:644:p + $config_directory/pcre_table:f:root:-:644:o +@@ -165,8 +159,8 @@ $config_directory/postfix-script:f:root:-:755:o + $config_directory/postfix-script-sgid:f:root:-:755:o + $config_directory/postfix-script-nosgid:f:root:-:755:o + $config_directory/post-install:f:root:-:755:o +-$manpage_directory/man1/mailq.1:f:root:-:644 +-$manpage_directory/man1/newaliases.1:f:root:-:644 ++$manpage_directory/man1/mailq.postfix.1:f:root:-:644 ++$manpage_directory/man1/newaliases.postfix.1:f:root:-:644 + $manpage_directory/man1/postalias.1:f:root:-:644 + $manpage_directory/man1/postcat.1:f:root:-:644 + $manpage_directory/man1/postconf.1:f:root:-:644 +@@ -180,9 +174,9 @@ $manpage_directory/man1/postmap.1:f:root:-:644 + $manpage_directory/man1/postmulti.1:f:root:-:644 + $manpage_directory/man1/postqueue.1:f:root:-:644 + $manpage_directory/man1/postsuper.1:f:root:-:644 +-$manpage_directory/man1/sendmail.1:f:root:-:644 ++$manpage_directory/man1/sendmail.postfix.1:f:root:-:644 + $manpage_directory/man5/access.5:f:root:-:644 +-$manpage_directory/man5/aliases.5:f:root:-:644 ++$manpage_directory/man5/aliases.postfix.5:f:root:-:644 + $manpage_directory/man5/body_checks.5:f:root:-:644 + $manpage_directory/man5/bounce.5:f:root:-:644 + $manpage_directory/man5/canonical.5:f:root:-:644 +@@ -230,7 +224,7 @@ $manpage_directory/man8/qmqpd.8:f:root:-:644 + $manpage_directory/man8/scache.8:f:root:-:644 + $manpage_directory/man8/showq.8:f:root:-:644 + $manpage_directory/man8/smtp.8:f:root:-:644 +-$manpage_directory/man8/smtpd.8:f:root:-:644 ++$manpage_directory/man8/smtpd.postfix.8:f:root:-:644 + $manpage_directory/man8/spawn.8:f:root:-:644 + $manpage_directory/man8/tlsproxy.8:f:root:-:644 + $manpage_directory/man8/tlsmgr.8:f:root:-:644 diff --git a/postfix-3.4.4-chroot-example-fix.patch b/postfix-3.4.4-chroot-example-fix.patch new file mode 100644 index 0000000000000000000000000000000000000000..5870b4c5b5185d73aca9db322e29f8edaab35910 --- /dev/null +++ b/postfix-3.4.4-chroot-example-fix.patch @@ -0,0 +1,35 @@ +--- a/examples/chroot-setup/LINUX2 2006-01-01 15:53:58.000000000 -0800 ++++ b/examples/chroot-setup/LINUX2 2016-11-27 00:45:52.145301784 -0800 +@@ -45,14 +45,14 @@ + # 20060101 /lib64 support by Keith Owens. + # + +-CP="cp -p" ++CP="cp -p -Z" + + cond_copy() { + # find files as per pattern in $1 + # if any, copy to directory $2 + dir=`dirname "$1"` + pat=`basename "$1"` +- lr=`find "$dir" -maxdepth 1 -name "$pat"` ++ lr=`find "$dir/" -maxdepth 1 -name "$pat"` + if test ! -d "$2" ; then exit 1 ; fi + if test "x$lr" != "x" ; then $CP $1 "$2" ; fi + } +@@ -63,8 +63,8 @@ + POSTFIX_DIR=${POSTFIX_DIR-/var/spool/postfix} + cd ${POSTFIX_DIR} + +-mkdir -p etc lib usr/lib/zoneinfo +-test -d /lib64 && mkdir -p lib64 ++mkdir -p -Z etc lib usr/lib/zoneinfo ++test -d /lib64 && mkdir -p -Z lib64 + + # find localtime (SuSE 5.3 does not have /etc/localtime) + lt=/etc/localtime +@@ -88,4 +88,3 @@ + cond_copy '/lib64/libdb.so*' lib64 + fi + +-postfix reload diff --git a/postfix-3.7.0-config.patch b/postfix-3.7.0-config.patch new file mode 100644 index 0000000000000000000000000000000000000000..d8be512fdb2661e524dfca17c07633cf384e4cb0 --- /dev/null +++ b/postfix-3.7.0-config.patch @@ -0,0 +1,145 @@ +diff --git a/conf/main.cf b/conf/main.cf +index 47de434..112c1f1 100644 +--- a/conf/main.cf ++++ b/conf/main.cf +@@ -136,6 +136,10 @@ mail_owner = postfix + #inet_interfaces = all + #inet_interfaces = $myhostname + #inet_interfaces = $myhostname, localhost ++inet_interfaces = localhost ++ ++# Enable IPv4, and IPv6 if supported ++inet_protocols = all + + # The proxy_interfaces parameter specifies the network interface + # addresses that this mail system receives mail on by way of a +@@ -180,7 +184,7 @@ mail_owner = postfix + # + # See also below, section "REJECTING MAIL FOR UNKNOWN LOCAL USERS". + # +-#mydestination = $myhostname, localhost.$mydomain, localhost ++mydestination = $myhostname, localhost.$mydomain, localhost + #mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain + #mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain, + # mail.$mydomain, www.$mydomain, ftp.$mydomain +@@ -407,7 +411,7 @@ unknown_local_recipient_reject_code = 550 + # "postfix reload" to eliminate the delay. + # + #alias_maps = dbm:/etc/aliases +-#alias_maps = hash:/etc/aliases ++alias_maps = hash:/etc/aliases + #alias_maps = hash:/etc/aliases, nis:mail.aliases + #alias_maps = netinfo:/aliases + +@@ -418,7 +422,7 @@ unknown_local_recipient_reject_code = 550 + # + #alias_database = dbm:/etc/aliases + #alias_database = dbm:/etc/mail/aliases +-#alias_database = hash:/etc/aliases ++alias_database = hash:/etc/aliases + #alias_database = hash:/etc/aliases, hash:/opt/majordomo/aliases + + # ADDRESS EXTENSIONS (e.g., user+foo) +@@ -488,7 +492,27 @@ unknown_local_recipient_reject_code = 550 + # + # Cyrus IMAP over LMTP. Specify ``lmtpunix cmd="lmtpd" + # listen="/var/imap/socket/lmtp" prefork=0'' in cyrus.conf. +-#mailbox_transport = lmtp:unix:/var/imap/socket/lmtp ++#mailbox_transport = lmtp:unix:/var/lib/imap/socket/lmtp ++ ++# If using the cyrus-imapd IMAP server deliver local mail to the IMAP ++# server using LMTP (Local Mail Transport Protocol), this is prefered ++# over the older cyrus deliver program by setting the ++# mailbox_transport as below: ++# ++# mailbox_transport = lmtp:unix:/var/lib/imap/socket/lmtp ++# ++# The efficiency of LMTP delivery for cyrus-imapd can be enhanced via ++# these settings. ++# ++# local_destination_recipient_limit = 300 ++# local_destination_concurrency_limit = 5 ++# ++# Of course you should adjust these settings as appropriate for the ++# capacity of the hardware you are using. The recipient limit setting ++# can be used to take advantage of the single instance message store ++# capability of Cyrus. The concurrency limit can be used to control ++# how many simultaneous LMTP sessions will be permitted to the Cyrus ++# message store. + # + # Cyrus IMAP via command line. Uncomment the "cyrus...pipe" and + # subsequent line in master.cf. +@@ -508,8 +532,7 @@ unknown_local_recipient_reject_code = 550 + # the main.cf file, otherwise the SMTP server will reject mail for + # non-UNIX accounts with "User unknown in local recipient table". + # +-#fallback_transport = lmtp:unix:/file/name +-#fallback_transport = cyrus ++#fallback_transport = lmtp:unix:/var/lib/imap/socket/lmtp + #fallback_transport = + + # The luser_relay parameter specifies an optional destination address +@@ -682,4 +705,41 @@ sample_directory = + # readme_directory: The location of the Postfix README files. + # + readme_directory = +-inet_protocols = ipv4 ++ ++# TLS CONFIGURATION ++# ++# Basic Postfix TLS configuration by default with self-signed certificate ++# for inbound SMTP and also opportunistic TLS for outbound SMTP. ++ ++# The full pathname of a file with the Postfix SMTP server RSA certificate ++# in PEM format. Intermediate certificates should be included in general, ++# the server certificate first, then the issuing CA(s) (bottom-up order). ++# ++smtpd_tls_cert_file = /etc/pki/tls/certs/postfix.pem ++ ++# The full pathname of a file with the Postfix SMTP server RSA private key ++# in PEM format. The private key must be accessible without a pass-phrase, ++# i.e. it must not be encrypted. ++# ++smtpd_tls_key_file = /etc/pki/tls/private/postfix.key ++ ++# Announce STARTTLS support to remote SMTP clients, but do not require that ++# clients use TLS encryption (opportunistic TLS inbound). ++# ++smtpd_tls_security_level = may ++ ++# Directory with PEM format Certification Authority certificates that the ++# Postfix SMTP client uses to verify a remote SMTP server certificate. ++# ++smtp_tls_CApath = /etc/pki/tls/certs ++ ++# The full pathname of a file containing CA certificates of root CAs ++# trusted to sign either remote SMTP server certificates or intermediate CA ++# certificates. ++# ++smtp_tls_CAfile = /etc/pki/tls/certs/ca-bundle.crt ++ ++# Use TLS if this is supported by the remote SMTP server, otherwise use ++# plaintext (opportunistic TLS outbound). ++# ++smtp_tls_security_level = may +diff --git a/conf/master.cf b/conf/master.cf +index 83fc6fd..bb0eae9 100644 +--- a/conf/master.cf ++++ b/conf/master.cf +@@ -110,14 +110,14 @@ postlog unix-dgram n - n - 1 postlogd + # Also specify in main.cf: cyrus_destination_recipient_limit=1 + # + #cyrus unix - n n - - pipe +-# flags=DRX user=cyrus argv=/cyrus/bin/deliver -e -r ${sender} -m ${extension} ${user} ++# flags=DRX user=cyrus argv=/usr/lib/cyrus-imapd/deliver -e -r ${sender} -m ${extension} ${user} + # + # ==================================================================== + # + # Old example of delivery via Cyrus. + # + #old-cyrus unix - n n - - pipe +-# flags=R user=cyrus argv=/cyrus/bin/deliver -e -m ${extension} ${user} ++# flags=R user=cyrus argv=/usr/lib/cyrus-imapd/deliver -e -m ${extension} ${user} + # + # ==================================================================== + # diff --git a/postfix-3.7.0-large-fs.patch b/postfix-3.7.0-large-fs.patch new file mode 100644 index 0000000000000000000000000000000000000000..3c09e5e6bc396b18d26f722af339ce57f3b7f35a --- /dev/null +++ b/postfix-3.7.0-large-fs.patch @@ -0,0 +1,37 @@ +diff --git a/src/util/fsspace.c b/src/util/fsspace.c +index 50a4aa7..beef3db 100644 +--- a/src/util/fsspace.c ++++ b/src/util/fsspace.c +@@ -91,8 +91,15 @@ void fsspace(const char *path, struct fsspace * sp) + + if (statvfs(path, &fsbuf) < 0) + msg_fatal("statvfs %s: %m", path); +- sp->block_size = fsbuf.f_frsize; +- sp->block_free = fsbuf.f_bavail; ++ if (fsbuf.f_frsize > 0) ++ sp->block_size = fsbuf.f_frsize; ++ else ++ sp->block_size = fsbuf.f_bsize; ++ /* 4G of FS blocks is surely enough space to put a mail in */ ++ sp->block_free = 0; ++ sp->block_free = ~sp->block_free; ++ if (fsbuf.f_bavail < sp->block_free) ++ sp->block_free = fsbuf.f_bavail; + #endif + if (msg_verbose) + msg_info("%s: %s: block size %lu, blocks free %lu", +diff --git a/src/util/sys_defs.h b/src/util/sys_defs.h +index c9ebc33..f2be0e2 100644 +--- a/src/util/sys_defs.h ++++ b/src/util/sys_defs.h +@@ -771,8 +771,8 @@ extern int initgroups(const char *, int); + #define GETTIMEOFDAY(t) gettimeofday(t,(struct timezone *) 0) + #define ROOT_PATH "/bin:/usr/bin:/sbin:/usr/sbin" + #define FIONREAD_IN_TERMIOS_H +-#define USE_STATFS +-#define STATFS_IN_SYS_VFS_H ++#define USE_STATVFS ++#define STATVFS_IN_SYS_STATVFS_H + #define PREPEND_PLUS_TO_OPTSTRING + #define HAS_POSIX_REGEXP + #define HAS_DLOPEN diff --git a/postfix-3.7.0-whitespace-name-fix.patch b/postfix-3.7.0-whitespace-name-fix.patch new file mode 100644 index 0000000000000000000000000000000000000000..e6a1db438e13cc23328acba7482be0f4a99dcc69 --- /dev/null +++ b/postfix-3.7.0-whitespace-name-fix.patch @@ -0,0 +1,13 @@ +diff --git a/src/cleanup/cleanup_message.c b/src/cleanup/cleanup_message.c +index f2b86d0..018e39e 100644 +--- a/src/cleanup/cleanup_message.c ++++ b/src/cleanup/cleanup_message.c +@@ -772,6 +772,8 @@ static void cleanup_header_done_callback(void *context) + /* Normalize whitespace. */ + token = tok822_scan_limit(state->fullname, &dummy_token, + var_token_limit); ++ if (!token) ++ token = tok822_alloc(TOK822_QSTRING, state->fullname); + } else { + token = tok822_alloc(TOK822_QSTRING, state->fullname); + } diff --git a/postfix-3.7.4.tar.gz b/postfix-3.7.4.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..19d42cbe2b10189a6a073048b7cb7130a8b4ac56 Binary files /dev/null and b/postfix-3.7.4.tar.gz differ diff --git a/postfix-chroot-update b/postfix-chroot-update new file mode 100644 index 0000000000000000000000000000000000000000..9fa0b08fffd5cb48e64f6a7623ecbedf2ccb0352 --- /dev/null +++ b/postfix-chroot-update @@ -0,0 +1,4 @@ +#!/bin/bash + +[ -x /etc/postfix/chroot-update ] && exec /etc/postfix/chroot-update +exit 0 diff --git a/postfix-etc-init.d-postfix b/postfix-etc-init.d-postfix new file mode 100644 index 0000000000000000000000000000000000000000..c609b0ad00082904f25d11ad9f23507c42763aeb --- /dev/null +++ b/postfix-etc-init.d-postfix @@ -0,0 +1,164 @@ +#!/bin/bash +# +# postfix Postfix Mail Transfer Agent +# +# chkconfig: - 80 30 +# description: Postfix is a Mail Transport Agent, which is the program \ +# that moves mail from one machine to another. +# processname: master +# pidfile: /var/spool/postfix/pid/master.pid +# config: /etc/postfix/main.cf +# config: /etc/postfix/master.cf +# +# Based on startup script from Simon J Mudd +# 25/02/99: Mostly s/sendmail/postfix/g by John A. Martin +# 23/11/00: Changes & suggestions by Ajay Ramaswamy +# 20/01/01: Changes to fall in line with RedHat 7.0 style +# 23/02/01: Fix a few untidy problems with help from Daniel Roesen. + +### BEGIN INIT INFO +# Provides: postfix $mail-transfer-agent +# Required-Start: $local_fs $network $remote_fs +# Required-Stop: $local_fs $network $remote_fs +# Short-Description: start and stop postfix +# Description: Postfix is a Mail Transport Agent, which is the program that +# moves mail from one machine to another. +### END INIT INFO + +# Source function library. +. /etc/rc.d/init.d/functions + +# Source networking configuration. +. /etc/sysconfig/network + +RETVAL=0 +prog="postfix" +lockfile=/var/lock/subsys/$prog +pidfile=/var/spool/postfix/pid/master.pid + +ALIASESDB_STAMP=/var/lib/misc/postfix.aliasesdb-stamp + +# Script to update chroot environment +CHROOT_UPDATE=/etc/postfix/chroot-update + +status -p $pidfile -l $(basename $lockfile) master >/dev/null 2>&1 +running=$? + +conf_check() { + [ -x /usr/sbin/postfix ] || exit 5 + [ -d /etc/postfix ] || exit 6 + [ -d /var/spool/postfix ] || exit 5 +} + +make_aliasesdb() { + if [ "$(/usr/sbin/postconf -h alias_database)" == "hash:/etc/aliases" ] + then + # /etc/aliases.db may be used by other MTA, make sure nothing + # has touched it since our last newaliases call + [ /etc/aliases -nt /etc/aliases.db ] || + [ "$ALIASESDB_STAMP" -nt /etc/aliases.db ] || + [ "$ALIASESDB_STAMP" -ot /etc/aliases.db ] || return + /usr/bin/newaliases + touch -r /etc/aliases.db "$ALIASESDB_STAMP" + else + /usr/bin/newaliases + fi +} + +start() { + [ "$EUID" != "0" ] && exit 4 + # Check that networking is up. + [ ${NETWORKING} = "no" ] && exit 1 + conf_check + # Start daemons. + echo -n $"Starting postfix: " + make_aliasesdb >/dev/null 2>&1 + [ -x $CHROOT_UPDATE ] && $CHROOT_UPDATE + /usr/sbin/postfix start 2>/dev/null 1>&2 && success || failure $"$prog start" + RETVAL=$? + [ $RETVAL -eq 0 ] && touch $lockfile + echo + return $RETVAL +} + +stop() { + [ "$EUID" != "0" ] && exit 4 + conf_check + # Stop daemons. + echo -n $"Shutting down postfix: " + /usr/sbin/postfix stop 2>/dev/null 1>&2 && success || failure $"$prog stop" + RETVAL=$? + [ $RETVAL -eq 0 ] && rm -f $lockfile $pidfile + echo + return $RETVAL +} + +reload() { + conf_check + echo -n $"Reloading postfix: " + [ -x $CHROOT_UPDATE ] && $CHROOT_UPDATE + /usr/sbin/postfix reload 2>/dev/null 1>&2 && success || failure $"$prog reload" + RETVAL=$? + echo + return $RETVAL +} + +abort() { + conf_check + /usr/sbin/postfix abort 2>/dev/null 1>&2 && success || failure $"$prog abort" + return $? +} + +flush() { + conf_check + /usr/sbin/postfix flush 2>/dev/null 1>&2 && success || failure $"$prog flush" + return $? +} + +check() { + conf_check + /usr/sbin/postfix check 2>/dev/null 1>&2 && success || failure $"$prog check" + return $? +} + +# See how we were called. +case "$1" in + start) + [ $running -eq 0 ] && exit 0 + start + ;; + stop) + [ $running -eq 0 ] || exit 0 + stop + ;; + restart|force-reload) + stop + start + ;; + reload) + [ $running -eq 0 ] || exit 7 + reload + ;; + abort) + abort + ;; + flush) + flush + ;; + check) + check + ;; + status) + status -p $pidfile -l $(basename $lockfile) master + ;; + condrestart) + [ $running -eq 0 ] || exit 0 + stop + start + ;; + *) + echo $"Usage: $0 {start|stop|restart|reload|abort|flush|check|status|condrestart}" + exit 2 +esac + +exit $? diff --git a/postfix-pam.conf b/postfix-pam.conf new file mode 100644 index 0000000000000000000000000000000000000000..73e5348115f745bd5932974ac6e48c48c2607d21 --- /dev/null +++ b/postfix-pam.conf @@ -0,0 +1,3 @@ +#%PAM-1.0 +auth include password-auth +account include password-auth diff --git a/postfix-sasl.conf b/postfix-sasl.conf new file mode 100644 index 0000000000000000000000000000000000000000..18d730882b66f8011430d4890882b5a017a504f5 --- /dev/null +++ b/postfix-sasl.conf @@ -0,0 +1,2 @@ +pwcheck_method: saslauthd +mech_list: plain login diff --git a/postfix.aliasesdb b/postfix.aliasesdb new file mode 100644 index 0000000000000000000000000000000000000000..8c0156edc6845d2a3967aed358803910f7dc819d --- /dev/null +++ b/postfix.aliasesdb @@ -0,0 +1,20 @@ +#!/bin/bash + +ALIASESDB_STAMP=/var/lib/misc/postfix.aliasesdb-stamp + +make_aliasesdb() { + if [ "$(/usr/sbin/postconf -h alias_database)" == "hash:/etc/aliases" ] + then + # /etc/aliases.db may be used by other MTA, make sure nothing + # has touched it since our last newaliases call + [ /etc/aliases -nt /etc/aliases.db ] || + [ "$ALIASESDB_STAMP" -nt /etc/aliases.db ] || + [ "$ALIASESDB_STAMP" -ot /etc/aliases.db ] || return 0 + /usr/bin/newaliases + touch -r /etc/aliases.db "$ALIASESDB_STAMP" + else + /usr/bin/newaliases + fi +} + +make_aliasesdb diff --git a/postfix.service b/postfix.service new file mode 100644 index 0000000000000000000000000000000000000000..7a798fb02e3e82283313af156221d9af45a32618 --- /dev/null +++ b/postfix.service @@ -0,0 +1,22 @@ +[Unit] +Description=Postfix Mail Transport Agent +After=syslog.target network.target +Conflicts=sendmail.service exim.service + +[Service] +Type=forking +PIDFile=/var/spool/postfix/pid/master.pid +EnvironmentFile=-/etc/sysconfig/network +PrivateTmp=true +CapabilityBoundingSet=~ CAP_NET_ADMIN CAP_SYS_ADMIN CAP_SYS_BOOT CAP_SYS_MODULE +ProtectSystem=true +PrivateDevices=true +ExecStartPre=-/usr/sbin/restorecon -R /var/spool/postfix/pid/master.pid +ExecStartPre=-/usr/libexec/postfix/aliasesdb +ExecStartPre=-/usr/libexec/postfix/chroot-update +ExecStart=/usr/sbin/postfix start +ExecReload=/usr/sbin/postfix reload +ExecStop=/usr/sbin/postfix stop + +[Install] +WantedBy=multi-user.target diff --git a/postfix.spec b/postfix.spec new file mode 100644 index 0000000000000000000000000000000000000000..b5986fa3fcda82791229eae7bb164ce0eb83885e --- /dev/null +++ b/postfix.spec @@ -0,0 +1,674 @@ +%define anolis_release 1 + +%undefine _strict_symbol_defs_build + +%bcond_without mysql +%bcond_without pgsql +%bcond_without sqlite +%bcond_without cdb +%bcond_without ldap +%bcond_without lmdb +%bcond_without pcre +%bcond_without sasl +%bcond_without tls +%bcond_without ipv6 +%bcond_without pflogsumm + +%define postfix_uid 89 +%define postfix_user postfix +%define postfix_gid 89 +%define postfix_group postfix +%define maildrop_group postdrop +%define maildrop_gid 90 +%define pflogsumm_ver 1.1.5 + +%define postfix_config_dir %{_sysconfdir}/postfix +%define postfix_daemon_dir %{_libexecdir}/postfix +%define postfix_shlib_dir %{_libdir}/postfix +%define postfix_command_dir %{_sbindir} +%define postfix_queue_dir %{_var}/spool/postfix +%define postfix_data_dir %{_var}/lib/postfix +%define postfix_doc_dir %{?_pkgdocdir}%{!?_pkgdocdir:%{_docdir}/%{name}-%{version}} +%define postfix_sample_dir %{postfix_doc_dir}/samples +%define postfix_readme_dir %{postfix_doc_dir}/README_FILES + +%global sysv2systemdnvr 2.8.12-2 +%global sslcert %{_sysconfdir}/pki/tls/certs/postfix.pem +%global sslkey %{_sysconfdir}/pki/tls/private/postfix.key +%global _privatelibs libpostfix-.+\.so.* +%global __provides_exclude ^(%{_privatelibs})$ +%global __requires_exclude ^(%{_privatelibs})$ + +Name: postfix +Summary: Postfix Mail Transport Agent +Version: 3.7.4 +Release: %{anolis_release}%{?dist} +Epoch: 2 +URL: http://www.postfix.org +License: (IBM and GPLv2+) or (EPL-2.0 and GPLv2+) +Requires(post): systemd systemd-sysv hostname +Requires(post): %{_sbindir}/alternatives +Requires(post): %{_bindir}/openssl +Requires(pre): %{_sbindir}/groupadd +Requires(pre): %{_sbindir}/useradd +Requires(preun): %{_sbindir}/alternatives +Requires(preun): systemd +Requires(postun): systemd +Requires: diffutils +Requires: findutils +Requires: policycoreutils +Provides: MTA smtpd smtpdaemon server(smtp) + +Source0: ftp://ftp.porcupine.org/mirrors/postfix-release/official/%{name}-%{version}.tar.gz +Source1: postfix-etc-init.d-postfix +Source2: postfix.service +Source3: postfix.aliasesdb +Source4: postfix-chroot-update +Source53: http://jimsun.linxnet.com/downloads/pflogsumm-%{pflogsumm_ver}.tar.gz +Source100: postfix-sasl.conf +Source101: postfix-pam.conf + +Patch1: postfix-3.7.0-config.patch +Patch2: postfix-3.4.0-files.patch +Patch3: postfix-3.3.3-alternatives.patch +Patch4: postfix-3.7.0-large-fs.patch +Patch9: pflogsumm-1.1.5-datecalc.patch +Patch10: pflogsumm-1.1.5-ipv6-warnings-fix.patch +Patch11: postfix-3.4.4-chroot-example-fix.patch +Patch12: postfix-3.7.0-whitespace-name-fix.patch +Patch13: pflogsumm-1.1.5-syslog-name-underscore-fix.patch + +BuildRequires: make gcc m4 findutils pkgconfig systemd-rpm-macros +BuildRequires: libdb-devel perl-generators zlib-devel libicu-devel +%{?with_ldap:BuildRequires: openldap-devel} +%{?with_lmdb:BuildRequires: lmdb-devel} +%{?with_sasl:BuildRequires: cyrus-sasl-devel} +%{?with_pcre:BuildRequires: pcre2-devel} +%{?with_mysql:BuildRequires: mariadb-connector-c-devel} +%{?with_pgsql:BuildRequires: libpq-devel} +%{?with_sqlite:BuildRequires: sqlite-devel} +%{?with_cdb:BuildRequires: tinycdb-devel} +%{?with_tls:BuildRequires: openssl-devel} + +%description +Postfix is a Mail Transport Agent (MTA). + +%package perl-scripts +Summary: Postfix utilities written in perl +Requires: %{name} = %{EVR} +Obsoletes: postfix < 2:2.5.5 +%if %{with pflogsumm} +Provides: postfix-pflogsumm = %{EVR} +Obsoletes: postfix-pflogsumm < 2:2.5.5 +%endif +%description perl-scripts +This package contains perl scripts pflogsumm and qshape. + +Pflogsumm is a log analyzer/summarizer for the Postfix MTA. It is +designed to provide an over-view of Postfix activity. Pflogsumm +generates summaries and, in some cases, detailed reports of mail +server traffic volumes, rejected and bounced email, and server +warnings, errors and panics. + +qshape prints Postfix queue domain and age distribution. + +%if %{with mysql} +%package mysql +Summary: Postfix MySQL map support +Requires: %{name} = %{EVR} + +%description mysql +This provides support for MySQL maps in Postfix. If you plan to use MySQL +maps with Postfix, you need this. +%endif + +%if %{with pgsql} +%package pgsql +Summary: Postfix PostgreSQL map support +Requires: %{name} = %{EVR} + +%description pgsql +This provides support for PostgreSQL maps in Postfix. If you plan to use +PostgreSQL maps with Postfix, you need this. +%endif + +%if %{with sqlite} +%package sqlite +Summary: Postfix SQLite map support +Requires: %{name} = %{EVR} + +%description sqlite +This provides support for SQLite maps in Postfix. If you plan to use SQLite +maps with Postfix, you need this. +%endif + +%if %{with cdb} +%package cdb +Summary: Postfix CDB map support +Requires: %{name} = %{EVR} + +%description cdb +This provides support for CDB maps in Postfix. If you plan to use CDB +maps with Postfix, you need this. +%endif + +%if %{with ldap} +%package ldap +Summary: Postfix LDAP map support +Requires: %{name} = %{EVR} + +%description ldap +This provides support for LDAP maps in Postfix. If you plan to use LDAP +maps with Postfix, you need this. +%endif + +%if %{with lmdb} +%package lmdb +Summary: Postfix LDMB map support +Requires: %{name} = %{EVR} + +%description lmdb +This provides support for LMDB maps in Postfix. If you plan to use LMDB +maps with Postfix, you need this. +%endif + +%if %{with pcre} +%package pcre +Summary: Postfix PCRE map support +Requires: %{name} = %{EVR} + +%description pcre +This provides support for PCRE maps in Postfix. If you plan to use PCRE +maps with Postfix, you need this. +%endif + +%prep +%setup -q +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 + +sed -i \ +'s|^\(\s*#define\s\+DEF_SHLIB_DIR\s\+\)"/usr/lib/postfix"|\1"%{_libdir}/postfix"|' \ +src/global/mail_params.h + +%if %{with pflogsumm} +gzip -dc %{SOURCE53} | tar xf - +pushd pflogsumm-%{pflogsumm_ver} +%patch9 -p1 +%patch10 -p1 +popd +%endif +%patch11 -p1 +%patch12 -p1 +%patch13 -p1 + +sed -i makedefs -e '\@Linux\.@s|345|3456|' +sed -i src/util/sys_defs.h -e 's@defined(LINUX5)@defined(LINUX5) || defined(LINUX6)@' + +for f in README_FILES/TLS_{LEGACY_,}README TLS_ACKNOWLEDGEMENTS; do + iconv -f iso8859-1 -t utf8 -o ${f}{_,} && + touch -r ${f}{,_} && mv -f ${f}{_,} +done + +%build +%set_build_flags +unset AUXLIBS AUXLIBS_LDAP AUXLIBS_LMDB AUXLIBS_PCRE AUXLIBS_MYSQL AUXLIBS_PGSQL AUXLIBS_SQLITE AUXLIBS_CDB +CCARGS="-fPIC -fcommon" +AUXLIBS="" + +%if %{with ldap} + CCARGS="${CCARGS} -DHAS_LDAP -DLDAP_DEPRECATED=1 %{?with_sasl:-DUSE_LDAP_SASL}" + AUXLIBS_LDAP="-lldap -llber" +%endif +%if %{with lmdb} + CCARGS="${CCARGS} -DHAS_LMDB" + AUXLIBS_LMDB="-llmdb" +%endif +%if %{with pcre} + CCARGS="${CCARGS} -DHAS_PCRE=2 `pcre2-config --cflags`" + AUXLIBS_PCRE=`pcre2-config --libs8` +%endif +%if %{with mysql} + CCARGS="${CCARGS} -DHAS_MYSQL -I%{_includedir}/mysql" + AUXLIBS_MYSQL="-L%{_libdir}/mariadb -lmysqlclient -lm" +%endif +%if %{with pgsql} + CCARGS="${CCARGS} -DHAS_PGSQL -I%{_includedir}/pgsql" + AUXLIBS_PGSQL="-lpq" +%endif +%if %{with sqlite} + CCARGS="${CCARGS} -DHAS_SQLITE `pkg-config --cflags sqlite3`" + AUXLIBS_SQLITE="`pkg-config --libs sqlite3`" +%endif +%if %{with cdb} + CCARGS="${CCARGS} -DHAS_CDB `pkg-config --cflags libcdb`" + AUXLIBS_CDB="`pkg-config --libs libcdb`" +%endif +%if %{with sasl} + CCARGS="${CCARGS} -DUSE_SASL_AUTH -DUSE_CYRUS_SASL -I%{_includedir}/sasl" + AUXLIBS="${AUXLIBS} -L%{_libdir}/sasl2 -lsasl2" + %global sasl_config_dir %{_sysconfdir}/sasl2 +%endif +%if %{with tls} + if pkg-config openssl ; then + CCARGS="${CCARGS} -DUSE_TLS `pkg-config --cflags openssl`" + AUXLIBS="${AUXLIBS} `pkg-config --libs openssl`" + else + CCARGS="${CCARGS} -DUSE_TLS -I%{_includedir}/openssl" + AUXLIBS="${AUXLIBS} -lssl -lcrypto" + fi +%endif +%if ! %{with ipv6} + CCARGS="${CCARGS} -DNO_IPV6" +%endif + +CCARGS="${CCARGS} -DDEF_CONFIG_DIR=\\\"%{postfix_config_dir}\\\"" +CCARGS="${CCARGS} $(getconf LFS_CFLAGS)" +CCARGS="${CCARGS} -DNO_NIS" +LDFLAGS="$LDFLAGS %{?_hardened_build:-Wl,-z,relro,-z,now}" + +make -f Makefile.init makefiles shared=yes dynamicmaps=yes \ + %{?_hardened_build:pie=yes} CCARGS="${CCARGS}" AUXLIBS="${AUXLIBS}" \ + AUXLIBS_LDAP="${AUXLIBS_LDAP}" AUXLIBS_LMDB="${AUXLIBS_LMDB}" \ + AUXLIBS_PCRE="${AUXLIBS_PCRE}" AUXLIBS_MYSQL="${AUXLIBS_MYSQL}" \ + AUXLIBS_PGSQL="${AUXLIBS_PGSQL}" AUXLIBS_SQLITE="${AUXLIBS_SQLITE}" \ + AUXLIBS_CDB="${AUXLIBS_CDB}" \ + DEBUG="" SHLIB_RPATH="-Wl,-rpath,%{postfix_shlib_dir} $LDFLAGS" \ + OPT="$CFLAGS -fno-strict-aliasing -Wno-comment" \ + POSTFIX_INSTALL_OPTS=-keep-build-mtime + +%make_build + +%install +for i in man1/mailq.1 man1/newaliases.1 man1/sendmail.1 man5/aliases.5 man8/smtpd.8; do + dest=$(echo $i | sed 's|\.[1-9]$|.postfix\0|') + mv man/$i man/$dest + sed -i "s|^\.so $i|\.so $dest|" man/man?/*.[1-9] +done + +make non-interactive-package \ + install_root=$RPM_BUILD_ROOT \ + config_directory=%{postfix_config_dir} \ + meta_directory=%{postfix_config_dir} \ + shlib_directory=%{postfix_shlib_dir} \ + daemon_directory=%{postfix_daemon_dir} \ + command_directory=%{postfix_command_dir} \ + queue_directory=%{postfix_queue_dir} \ + data_directory=%{postfix_data_dir} \ + sendmail_path=%{postfix_command_dir}/sendmail.postfix \ + newaliases_path=%{_bindir}/newaliases.postfix \ + mailq_path=%{_bindir}/mailq.postfix \ + mail_owner=%{postfix_user} \ + setgid_group=%{maildrop_group} \ + manpage_directory=%{_mandir} \ + sample_directory=%{postfix_sample_dir} \ + readme_directory=%{postfix_readme_dir} || exit 1 + +mkdir -p %{buildroot}%{_unitdir} +install -m 644 %{SOURCE2} %{buildroot}%{_unitdir} +install -m 755 %{SOURCE3} %{buildroot}%{postfix_daemon_dir}/aliasesdb +install -m 755 %{SOURCE4} %{buildroot}%{postfix_daemon_dir}/chroot-update + +install -c auxiliary/rmail/rmail $RPM_BUILD_ROOT%{_bindir}/rmail.postfix + +for i in active bounce corrupt defer deferred flush incoming private saved maildrop public pid saved trace; do + mkdir -p $RPM_BUILD_ROOT%{postfix_queue_dir}/$i +done + +for i in smtp-sink smtp-source posttls-finger ; do + install -c -m 755 bin/$i $RPM_BUILD_ROOT%{postfix_command_dir}/ + install -c -m 755 man/man1/$i.1 $RPM_BUILD_ROOT%{_mandir}/man1/ +done + +sed -i -r "s#(/man[158]/.*.[158]):f#\1.gz:f#" $RPM_BUILD_ROOT%{postfix_config_dir}/postfix-files + +cat $RPM_BUILD_ROOT%{postfix_config_dir}/postfix-files +%if %{with sasl} +mkdir -p $RPM_BUILD_ROOT%{sasl_config_dir} +install -m 644 %{SOURCE100} $RPM_BUILD_ROOT%{sasl_config_dir}/smtpd.conf +%endif + +mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/pam.d +install -m 644 %{SOURCE101} $RPM_BUILD_ROOT%{_sysconfdir}/pam.d/smtp.postfix + +mkdir -p $RPM_BUILD_ROOT%{postfix_doc_dir} +cp -p COMPATIBILITY LICENSE TLS_ACKNOWLEDGEMENTS TLS_LICENSE $RPM_BUILD_ROOT%{postfix_doc_dir} + +mkdir -p $RPM_BUILD_ROOT%{postfix_doc_dir}/examples{,/chroot-setup} +cp -pr examples/{qmail-local,smtpd-policy} $RPM_BUILD_ROOT%{postfix_doc_dir}/examples +cp -p examples/chroot-setup/LINUX2 $RPM_BUILD_ROOT%{postfix_doc_dir}/examples/chroot-setup + +cp conf/{main,bounce}.cf.default $RPM_BUILD_ROOT%{postfix_doc_dir} +sed -i 's#%{postfix_config_dir}\(/bounce\.cf\.default\)#%{postfix_doc_dir}\1#' $RPM_BUILD_ROOT%{_mandir}/man5/bounce.5 +rm -f $RPM_BUILD_ROOT%{postfix_config_dir}/{TLS_,}LICENSE + +find $RPM_BUILD_ROOT%{postfix_doc_dir} -type f | xargs chmod 644 +find $RPM_BUILD_ROOT%{postfix_doc_dir} -type d | xargs chmod 755 + +%if %{with pflogsumm} +install -c -m 644 pflogsumm-%{pflogsumm_ver}/pflogsumm-faq.txt $RPM_BUILD_ROOT%{postfix_doc_dir}/pflogsumm-faq.txt +install -c -m 644 pflogsumm-%{pflogsumm_ver}/pflogsumm.1 $RPM_BUILD_ROOT%{_mandir}/man1/pflogsumm.1 +install -c pflogsumm-%{pflogsumm_ver}/pflogsumm.pl $RPM_BUILD_ROOT%{postfix_command_dir}/pflogsumm +%endif + +mantools/srctoman - auxiliary/qshape/qshape.pl > qshape.1 +install -c qshape.1 $RPM_BUILD_ROOT%{_mandir}/man1/qshape.1 +install -c auxiliary/qshape/qshape.pl $RPM_BUILD_ROOT%{postfix_command_dir}/qshape + +rm -f $RPM_BUILD_ROOT%{postfix_config_dir}/aliases + +mkdir -p $RPM_BUILD_ROOT%{_prefix}/lib +pushd $RPM_BUILD_ROOT%{_prefix}/lib +ln -sf ../sbin/sendmail.postfix . +popd + +mkdir -p $RPM_BUILD_ROOT%{_var}/lib/misc +touch $RPM_BUILD_ROOT%{_var}/lib/misc/postfix.aliasesdb-stamp + +for i in %{postfix_command_dir}/sendmail %{_bindir}/{mailq,newaliases,rmail} \ + %{_sysconfdir}/pam.d/smtp %{_prefix}/lib/sendmail \ + %{_mandir}/{man1/{mailq.1,newaliases.1},man5/aliases.5,man8/{sendmail.8,smtpd.8}} +do + touch $RPM_BUILD_ROOT$i +done + +function split_file +{ + grep "$1" "$3" >> "$3.d/$2" || : + sed -i "\|$1| d" "$3" || : +} + +pushd $RPM_BUILD_ROOT%{postfix_config_dir} +for map in %{?with_mysql:mysql} %{?with_pgsql:pgsql} %{?with_sqlite:sqlite} \ +%{?with_cdb:cdb} %{?with_ldap:ldap} %{?with_lmdb:lmdb} %{?with_pcre:pcre}; do + rm -f dynamicmaps.cf.d/"$map" "postfix-files.d/$map" + split_file "^\s*$map\b" "$map" dynamicmaps.cf + sed -i "s|postfix-$map\\.so|%{postfix_shlib_dir}/\\0|" "dynamicmaps.cf.d/$map" + split_file "^\$shlib_directory/postfix-$map\\.so:" "$map" postfix-files + split_file "^\$manpage_directory/man5/${map}_table\\.5" "$map" postfix-files + map_upper=`echo $map | tr '[:lower:]' '[:upper:]'` + split_file "^\$readme_directory/${map_upper}_README:" "$map" postfix-files +done +popd + +%post -e +%systemd_post %{name}.service + +%{_sbindir}/postfix set-permissions upgrade-configuration \ + daemon_directory=%{postfix_daemon_dir} \ + command_directory=%{postfix_command_dir} \ + mail_owner=%{postfix_user} \ + setgid_group=%{maildrop_group} \ + manpage_directory=%{_mandir} \ + sample_directory=%{postfix_sample_dir} \ + readme_directory=%{postfix_readme_dir} &> /dev/null + +ALTERNATIVES_DOCS="" +[ "%%{_excludedocs}" = 1 ] || ALTERNATIVES_DOCS='--slave %{_mandir}/man1/mailq.1.zst mta-mailqman %{_mandir}/man1/mailq.postfix.1.zst + --slave %{_mandir}/man1/newaliases.1.zst mta-newaliasesman %{_mandir}/man1/newaliases.postfix.1.zst + --slave %{_mandir}/man8/sendmail.8zstz mta-sendmailman %{_mandir}/man1/sendmail.postfix.1.zst + --slave %{_mandir}/man5/aliases.5.zst mta-aliasesman %{_mandir}/man5/aliases.postfix.5.zst + --slave %{_mandir}/man8/smtpd.8.zst mta-smtpdman %{_mandir}/man8/smtpd.postfix.8.zst' + +%{_sbindir}/alternatives --install %{postfix_command_dir}/sendmail mta %{postfix_command_dir}/sendmail.postfix 60 \ + --slave %{_bindir}/mailq mta-mailq %{_bindir}/mailq.postfix \ + --slave %{_bindir}/newaliases mta-newaliases %{_bindir}/newaliases.postfix \ + --slave %{_sysconfdir}/pam.d/smtp mta-pam %{_sysconfdir}/pam.d/smtp.postfix \ + --slave %{_bindir}/rmail mta-rmail %{_bindir}/rmail.postfix \ + --slave %{_prefix}/lib/sendmail mta-sendmail %{_prefix}/lib/sendmail.postfix \ + $ALTERNATIVES_DOCS \ + --initscript postfix + +%if %{with sasl} +if [ -f %{_libdir}/sasl2/smtpd.conf ]; then + mv -f %{_libdir}/sasl2/smtpd.conf %{sasl_config_dir}/smtpd.conf + /sbin/restorecon %{sasl_config_dir}/smtpd.conf 2> /dev/null +fi +%endif + +if [ ! -f %{sslkey} ]; then + umask 077 + %{_bindir}/openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:4096 -out %{sslkey} 2>/dev/null || echo "openssl genpkey failed" +fi + +if [ ! -f %{sslcert} ]; then + FQDN=`hostname` + if [ "x${FQDN}" = "x" ]; then + FQDN=localhost.localdomain + fi + + req_cmd="%{_bindir}/openssl req -new -key %{sslkey} -x509 -sha256 -days 365 -set_serial $RANDOM -out %{sslcert} \ + -subj /C=--/ST=SomeState/L=SomeCity/O=SomeOrganization/OU=SomeOrganizationalUnit/CN=${FQDN}/emailAddress=root@${FQDN}" + $req_cmd -noenc -copy_extensions none 2>/dev/null || $req_cmd 2>/dev/null || echo "openssl req failed" + chmod 644 %{sslcert} +fi + +exit 0 + +%pre +%{_sbindir}/groupadd -g %{maildrop_gid} -r %{maildrop_group} 2>/dev/null +%{_sbindir}/groupadd -g %{postfix_gid} -r %{postfix_group} 2>/dev/null +%{_sbindir}/groupadd -g 12 -r mail 2>/dev/null +%{_sbindir}/useradd -d %{postfix_queue_dir} -s /sbin/nologin -g %{postfix_group} -G mail -M -r -u %{postfix_uid} %{postfix_user} 2>/dev/null + +if [ -e %{_mandir}/man8/smtpd.8.zst ]; then + [ -h %{_mandir}/man8/smtpd.8.zst ] || rm -f %{_mandir}/man8/smtpd.8.zst +fi + +exit 0 + +%preun +%systemd_preun %{name}.service + +if [ "$1" = 0 ]; then + %{_sbindir}/alternatives --remove mta %{postfix_command_dir}/sendmail.postfix +fi +exit 0 + +%postun +%systemd_postun_with_restart %{name}.service + +%triggerun -- postfix < %{sysv2systemdnvr} +%{_bindir}/systemd-sysv-convert --save postfix >/dev/null 2>&1 ||: +%{_bindir}/systemd-sysv-convert --apply postfix >/dev/null 2>&1 ||: +/sbin/chkconfig --del postfix >/dev/null 2>&1 || : +/bin/systemctl try-restart postfix.service >/dev/null 2>&1 || : + + +%files +%defattr(-, root, root, -) +%if %{with sasl} +%config(noreplace) %{sasl_config_dir}/smtpd.conf +%endif +%config(noreplace) %{_sysconfdir}/pam.d/smtp.postfix +%{_unitdir}/postfix.service +%{postfix_doc_dir} +%if %{with pflogsumm} +%exclude %{postfix_doc_dir}/pflogsumm-faq.txt +%endif +%exclude %{_mandir}/man5/mysql_table.5* +%exclude %{postfix_doc_dir}/README_FILES/MYSQL_README +%exclude %{_mandir}/man5/pgsql_table.5* +%exclude %{postfix_doc_dir}/README_FILES/PGSQL_README +%exclude %{_mandir}/man5/sqlite_table.5* +%exclude %{postfix_doc_dir}/README_FILES/SQLITE_README +%exclude %{postfix_doc_dir}/README_FILES/CDB_README +%exclude %{_mandir}/man5/ldap_table.5* +%exclude %{postfix_doc_dir}/README_FILES/LDAP_README +%exclude %{_mandir}/man5/lmdb_table.5* +%exclude %{postfix_doc_dir}/README_FILES/LMDB_README +%exclude %{_mandir}/man5/pcre_table.5* +%exclude %{postfix_doc_dir}/README_FILES/PCRE_README + +%dir %attr(0755, root, root) %{postfix_config_dir} +%dir %attr(0755, root, root) %{postfix_daemon_dir} +%dir %attr(0755, root, root) %{postfix_queue_dir} +%dir %attr(0755, root, root) %{postfix_shlib_dir} +%dir %attr(0700, %{postfix_user}, root) %{postfix_queue_dir}/active +%dir %attr(0700, %{postfix_user}, root) %{postfix_queue_dir}/bounce +%dir %attr(0700, %{postfix_user}, root) %{postfix_queue_dir}/corrupt +%dir %attr(0700, %{postfix_user}, root) %{postfix_queue_dir}/defer +%dir %attr(0700, %{postfix_user}, root) %{postfix_queue_dir}/deferred +%dir %attr(0700, %{postfix_user}, root) %{postfix_queue_dir}/flush +%dir %attr(0700, %{postfix_user}, root) %{postfix_queue_dir}/hold +%dir %attr(0700, %{postfix_user}, root) %{postfix_queue_dir}/incoming +%dir %attr(0700, %{postfix_user}, root) %{postfix_queue_dir}/saved +%dir %attr(0700, %{postfix_user}, root) %{postfix_queue_dir}/trace +%dir %attr(0730, %{postfix_user}, %{maildrop_group}) %{postfix_queue_dir}/maildrop +%dir %attr(0755, root, root) %{postfix_queue_dir}/pid +%dir %attr(0700, %{postfix_user}, root) %{postfix_queue_dir}/private +%dir %attr(0710, %{postfix_user}, %{maildrop_group}) %{postfix_queue_dir}/public +%dir %attr(0700, %{postfix_user}, root) %{postfix_data_dir} +%dir %attr(0755, root, root) %{postfix_config_dir}/dynamicmaps.cf.d +%dir %attr(0755, root, root) %{postfix_config_dir}/postfix-files.d + +%attr(0644, root, root) %{_mandir}/man1/post*.1* +%attr(0644, root, root) %{_mandir}/man1/smtp*.1* +%attr(0644, root, root) %{_mandir}/man1/*.postfix.1* +%attr(0644, root, root) %{_mandir}/man5/access.5* +%attr(0644, root, root) %{_mandir}/man5/[b-v]*.5* +%attr(0644, root, root) %{_mandir}/man5/*.postfix.5* +%attr(0644, root, root) %{_mandir}/man8/[a-qt-v]*.8* +%attr(0644, root, root) %{_mandir}/man8/s[ch-lnp]*.8* +%attr(0644, root, root) %{_mandir}/man8/smtp.8* +%attr(0644, root, root) %{_mandir}/man8/smtpd.postfix.8* + +%attr(0755, root, root) %{postfix_command_dir}/smtp-sink +%attr(0755, root, root) %{postfix_command_dir}/smtp-source +%attr(0755, root, root) %{postfix_command_dir}/posttls-finger +%attr(0755, root, root) %{postfix_command_dir}/postalias +%attr(0755, root, root) %{postfix_command_dir}/postcat +%attr(0755, root, root) %{postfix_command_dir}/postconf +%attr(2755, root, %{maildrop_group}) %{postfix_command_dir}/postdrop +%attr(0755, root, root) %{postfix_command_dir}/postfix +%attr(0755, root, root) %{postfix_command_dir}/postkick +%attr(0755, root, root) %{postfix_command_dir}/postlock +%attr(0755, root, root) %{postfix_command_dir}/postlog +%attr(0755, root, root) %{postfix_command_dir}/postmap +%attr(0755, root, root) %{postfix_command_dir}/postmulti +%attr(2755, root, %{maildrop_group}) %{postfix_command_dir}/postqueue +%attr(0755, root, root) %{postfix_command_dir}/postsuper +%attr(0644, root, root) %config(noreplace) %{postfix_config_dir}/access +%attr(0644, root, root) %config(noreplace) %{postfix_config_dir}/canonical +%attr(0644, root, root) %config(noreplace) %{postfix_config_dir}/generic +%attr(0644, root, root) %config(noreplace) %{postfix_config_dir}/header_checks +%attr(0644, root, root) %config(noreplace) %{postfix_config_dir}/main.cf +%attr(0644, root, root) %config(noreplace) %{postfix_config_dir}/main.cf.proto +%attr(0644, root, root) %config(noreplace) %{postfix_config_dir}/master.cf +%attr(0644, root, root) %config(noreplace) %{postfix_config_dir}/master.cf.proto +%attr(0644, root, root) %config(noreplace) %{postfix_config_dir}/relocated +%attr(0644, root, root) %config(noreplace) %{postfix_config_dir}/transport +%attr(0644, root, root) %config(noreplace) %{postfix_config_dir}/virtual +%attr(0644, root, root) %{postfix_config_dir}/dynamicmaps.cf +%attr(0755, root, root) %{postfix_daemon_dir}/[^mp]* +%attr(0755, root, root) %{postfix_daemon_dir}/master +%attr(0755, root, root) %{postfix_daemon_dir}/pickup +%attr(0755, root, root) %{postfix_daemon_dir}/pipe +%attr(0755, root, root) %{postfix_daemon_dir}/post-install +%attr(0644, root, root) %{postfix_config_dir}/postfix-files +%attr(0755, root, root) %{postfix_daemon_dir}/postfix-script +%attr(0755, root, root) %{postfix_daemon_dir}/postfix-tls-script +%attr(0755, root, root) %{postfix_daemon_dir}/postfix-wrapper +%attr(0755, root, root) %{postfix_daemon_dir}/postmulti-script +%attr(0755, root, root) %{postfix_daemon_dir}/postscreen +%attr(0755, root, root) %{postfix_daemon_dir}/postlogd +%attr(0755, root, root) %{postfix_daemon_dir}/proxymap +%attr(0755, root, root) %{postfix_shlib_dir}/libpostfix-*.so +%{_bindir}/mailq.postfix +%{_bindir}/newaliases.postfix +%attr(0755, root, root) %{_bindir}/rmail.postfix +%attr(0755, root, root) %{_sbindir}/sendmail.postfix +%{_prefix}/lib/sendmail.postfix + +%ghost %{_sysconfdir}/pam.d/smtp + +%ghost %{_mandir}/man1/mailq.1.* +%ghost %{_mandir}/man1/newaliases.1.* +%ghost %{_mandir}/man5/aliases.5.* +%ghost %{_mandir}/man8/sendmail.8.* +%ghost %{_mandir}/man8/smtpd.8.* + +%ghost %attr(0755, root, root) %{_bindir}/mailq +%ghost %attr(0755, root, root) %{_bindir}/newaliases +%ghost %attr(0755, root, root) %{_bindir}/rmail +%ghost %attr(0755, root, root) %{_sbindir}/sendmail +%ghost %attr(0755, root, root) %{_prefix}/lib/sendmail + +%ghost %attr(0644, root, root) %{_var}/lib/misc/postfix.aliasesdb-stamp + +%files perl-scripts +%attr(0755, root, root) %{postfix_command_dir}/qshape +%attr(0644, root, root) %{_mandir}/man1/qshape* +%if %{with pflogsumm} +%doc %{postfix_doc_dir}/pflogsumm-faq.txt +%attr(0644, root, root) %{_mandir}/man1/pflogsumm.1.zst +%attr(0755, root, root) %{postfix_command_dir}/pflogsumm +%endif + +%if %{with mysql} +%files mysql +%attr(0644, root, root) %{postfix_config_dir}/dynamicmaps.cf.d/mysql +%attr(0644, root, root) %{postfix_config_dir}/postfix-files.d/mysql +%attr(0755, root, root) %{postfix_shlib_dir}/postfix-mysql.so +%attr(0644, root, root) %{_mandir}/man5/mysql_table.5* +%attr(0644, root, root) %{postfix_doc_dir}/README_FILES/MYSQL_README +%endif + +%if %{with pgsql} +%files pgsql +%attr(0644, root, root) %{postfix_config_dir}/dynamicmaps.cf.d/pgsql +%attr(0644, root, root) %{postfix_config_dir}/postfix-files.d/pgsql +%attr(0755, root, root) %{postfix_shlib_dir}/postfix-pgsql.so +%attr(0644, root, root) %{_mandir}/man5/pgsql_table.5* +%attr(0644, root, root) %{postfix_doc_dir}/README_FILES/PGSQL_README +%endif + +%if %{with sqlite} +%files sqlite +%attr(0644, root, root) %{postfix_config_dir}/dynamicmaps.cf.d/sqlite +%attr(0644, root, root) %{postfix_config_dir}/postfix-files.d/sqlite +%attr(0755, root, root) %{postfix_shlib_dir}/postfix-sqlite.so +%attr(0644, root, root) %{_mandir}/man5/sqlite_table.5* +%attr(0644, root, root) %{postfix_doc_dir}/README_FILES/SQLITE_README +%endif + +%if %{with cdb} +%files cdb +%attr(0644, root, root) %{postfix_config_dir}/dynamicmaps.cf.d/cdb +%attr(0644, root, root) %{postfix_config_dir}/postfix-files.d/cdb +%attr(0755, root, root) %{postfix_shlib_dir}/postfix-cdb.so +%attr(0644, root, root) %{postfix_doc_dir}/README_FILES/CDB_README +%endif + +%if %{with ldap} +%files ldap +%attr(0644, root, root) %{postfix_config_dir}/dynamicmaps.cf.d/ldap +%attr(0644, root, root) %{postfix_config_dir}/postfix-files.d/ldap +%attr(0755, root, root) %{postfix_shlib_dir}/postfix-ldap.so +%attr(0644, root, root) %{_mandir}/man5/ldap_table.5* +%attr(0644, root, root) %{postfix_doc_dir}/README_FILES/LDAP_README +%endif + +%if %{with lmdb} +%files lmdb +%attr(0644, root, root) %{postfix_config_dir}/dynamicmaps.cf.d/lmdb +%attr(0644, root, root) %{postfix_config_dir}/postfix-files.d/lmdb +%attr(0755, root, root) %{postfix_shlib_dir}/postfix-lmdb.so +%attr(0644, root, root) %{_mandir}/man5/lmdb_table.5* +%attr(0644, root, root) %{postfix_doc_dir}/README_FILES/LMDB_README +%endif + +%if %{with pcre} +%files pcre +%attr(0644, root, root) %{postfix_config_dir}/dynamicmaps.cf.d/pcre +%attr(0644, root, root) %{postfix_config_dir}/postfix-files.d/pcre +%attr(0755, root, root) %{postfix_shlib_dir}/postfix-pcre.so +%attr(0644, root, root) %{_mandir}/man5/pcre_table.5* +%attr(0644, root, root) %{postfix_doc_dir}/README_FILES/PCRE_README +%endif + +%changelog +* Fri Apr 07 2023 Chunmei Xu - 2:3.7.4-1 +- init from upstream