Package init

This commit is contained in:
overweight 2019-09-30 11:14:05 -04:00
commit 28210317ed
15 changed files with 1016 additions and 0 deletions

View File

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

View File

@ -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*$/;

BIN
pflogsumm-1.1.5.tar.gz Normal file

Binary file not shown.

View File

@ -0,0 +1,22 @@
diff --git a/conf/post-install b/conf/post-install
index 904cefa..5f1039b 100644
--- a/conf/post-install
+++ b/conf/post-install
@@ -532,6 +532,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

63
postfix-3.1.0-files.patch Normal file
View File

@ -0,0 +1,63 @@
diff --git a/conf/postfix-files b/conf/postfix-files
index a433f4f..3ecdb5b 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
@@ -140,18 +139,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
@@ -164,8 +158,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
@@ -179,9 +173,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
@@ -228,7 +222,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

145
postfix-3.2.0-config.patch Normal file
View File

@ -0,0 +1,145 @@
diff --git a/conf/main.cf b/conf/main.cf
index 7af8bde..fbe5c62 100644
--- a/conf/main.cf
+++ b/conf/main.cf
@@ -132,6 +132,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
@@ -176,7 +180,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
@@ -398,7 +402,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
@@ -409,7 +413,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)
@@ -479,7 +483,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.
@@ -499,8 +523,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
@@ -673,4 +696,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 b67ed59..a9633ba 100644
--- a/conf/master.cf
+++ b/conf/master.cf
@@ -96,14 +96,14 @@ scache unix - - n - 1 scache
# Also specify in main.cf: cyrus_destination_recipient_limit=1
#
#cyrus unix - n n - - pipe
-# user=cyrus argv=/cyrus/bin/deliver -e -r ${sender} -m ${extension} ${user}
+# 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}
#
# ====================================================================
#

View File

@ -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 3f570c4..611d9cd 100644
--- a/src/util/sys_defs.h
+++ b/src/util/sys_defs.h
@@ -768,8 +768,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

BIN
postfix-3.3.1.tar.gz Normal file

Binary file not shown.

4
postfix-chroot-update Normal file
View File

@ -0,0 +1,4 @@
#!/bin/bash
[ -x /etc/postfix/chroot-update ] && exec /etc/postfix/chroot-update
exit 0

164
postfix-etc-init.d-postfix Normal file
View File

@ -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 <sjmudd@pobox.com>
# 25/02/99: Mostly s/sendmail/postfix/g by John A. Martin <jam@jamux.com>
# 23/11/00: Changes & suggestions by Ajay Ramaswamy <ajayr@bigfoot.com>
# 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 $?

3
postfix-pam.conf Normal file
View File

@ -0,0 +1,3 @@
#%PAM-1.0
auth include password-auth
account include password-auth

2
postfix-sasl.conf Normal file
View File

@ -0,0 +1,2 @@
pwcheck_method: saslauthd
mech_list: plain login

20
postfix.aliasesdb Normal file
View File

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

21
postfix.service Normal file
View File

@ -0,0 +1,21 @@
[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/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

507
postfix.spec Normal file
View File

@ -0,0 +1,507 @@
%undefine _strict_symbol_defs_build
%{!?_hardened_build:%global _hardened_build 1}
%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 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})$
%global sasl_config_dir %{_sysconfdir}/sasl2
Name: postfix
Summary: Postfix Mail Transport Agent
Version: 3.3.1
Release: 6
Epoch: 2
URL: http://www.postfix.org
License: (IBM and GPLv2+) or (EPL-2.0 and GPLv2+)
Requires(post): systemd-sysv %{_sbindir}/alternatives %{_bindir}/openssl
Requires(pre): %{_sbindir}/groupadd %{_sbindir}/useradd
Requires(preun): %{_sbindir}/alternatives
%{?systemd_requires}
Requires: diffutils
Provides: MTA smtpd smtpdaemon server(smtp)
Provides: %{name}-mysql %{name}-sqlite %{name}-ldap %{name}-pcre
Obsoletes: %{name}-mysql %{name}-sqlite %{name}-ldap %{name}-pcre
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: https://jimsun.linxnet.com/downloads/pflogsumm-1.1.5.tar.gz
Source100: postfix-sasl.conf
Source101: postfix-pam.conf
Patch1: postfix-3.2.0-config.patch
Patch2: postfix-3.1.0-files.patch
Patch3: postfix-3.1.0-alternatives.patch
Patch4: postfix-3.2.0-large-fs.patch
Patch9: pflogsumm-1.1.5-datecalc.patch
Patch10: pflogsumm-1.1.5-ipv6-warnings-fix.patch
BuildRequires: libdb-devel perl-generators pkgconfig zlib-devel systemd libicu-devel libnsl2-devel gcc m4 openldap-devel
BuildRequires: cyrus-sasl-devel pcre-devel mariadb-connector-c-devel postgresql-devel sqlite-devel tinycdb-devel openssl-devel
%description
Postfix is a Mail Transport Agent (MTA).
%package sysvinit
Summary: SysV initscript for postfix
BuildArch: noarch
Requires: %{name} = %{epoch}:%{version}-%{release}
Requires(preun): chkconfig
Requires(post): chkconfig
%description sysvinit
This package contains the SysV initscript.
%package perl-scripts
Summary: Postfix utilities written in perl
Requires: %{name} = %{epoch}:%{version}-%{release}
Obsoletes: postfix < 2:2.5.5-2
Provides: postfix-pflogsumm = %{epoch}:%{version}-%{release}
Obsoletes: postfix-pflogsumm < 2:2.5.5-2
%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.
%package pgsql
Summary: Postfix PostgreSQL map support
Requires: %{name} = %{epoch}:%{version}-%{release}
%description pgsql
This provides support for PostgreSQL maps in Postfix. If you plan to use
PostgreSQL maps with Postfix, you need this.
%package cdb
Summary: Postfix CDB map support
Requires: %{name} = %{epoch}:%{version}-%{release}
%description cdb
This provides support for CDB maps in Postfix. If you plan to use CDB
maps with Postfix, you need this.
%package_help
%prep
%setup -q
%patch1 -p1 -b .config
%patch2 -p1 -b .files
%patch3 -p1 -b .alternatives
%patch4 -p1 -b .large-fs
sed -i \
's|^\(\s*#define\s\+DEF_SHLIB_DIR\s\+\)"/usr/lib/postfix"|\1"%{_libdir}/postfix"|' \
src/global/mail_params.h
gzip -dc %{SOURCE53} | tar xf -
pushd pflogsumm-1.1.5
%patch9 -p1 -b .datecalc
%patch10 -p1 -b .ipv6-warnings-fix
popd
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
unset AUXLIBS AUXLIBS_LDAP AUXLIBS_PCRE AUXLIBS_MYSQL AUXLIBS_PGSQL AUXLIBS_SQLITE AUXLIBS_CDB
CCARGS="-fPIC"
AUXLIBS="-lnsl"
CCARGS="${CCARGS} -DHAS_LDAP -DLDAP_DEPRECATED=1 %{?with_sasl:-DUSE_LDAP_SASL}"
AUXLIBS_LDAP="-lldap -llber"
CCARGS="${CCARGS} -DHAS_PCRE -I%{_includedir}/pcre"
AUXLIBS_PCRE="-lpcre"
CCARGS="${CCARGS} -DHAS_MYSQL -I%{_includedir}/mysql"
AUXLIBS_MYSQL="-L%{_libdir}/mariadb -lmysqlclient -lm"
CCARGS="${CCARGS} -DHAS_PGSQL -I%{_includedir}/pgsql"
AUXLIBS_PGSQL="-lpq"
CCARGS="${CCARGS} -DHAS_SQLITE `pkg-config --cflags sqlite3`"
AUXLIBS_SQLITE="`pkg-config --libs sqlite3`"
CCARGS="${CCARGS} -DHAS_CDB `pkg-config --cflags libcdb`"
AUXLIBS_CDB="`pkg-config --libs libcdb`"
CCARGS="${CCARGS} -DUSE_SASL_AUTH -DUSE_CYRUS_SASL -I%{_includedir}/sasl"
AUXLIBS="${AUXLIBS} -L%{_libdir}/sasl2 -lsasl2"
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/usr/include/openssl"
AUXLIBS="${AUXLIBS} -lssl -lcrypto"
fi
CCARGS="${CCARGS} -DDEF_CONFIG_DIR=\\\"%{postfix_config_dir}\\\""
CCARGS="${CCARGS} $(getconf LFS_CFLAGS)"
LDFLAGS="%{?__global_ldflags} -Wl,-z,relro,-z,now"
make -f Makefile.init makefiles shared=yes dynamicmaps=yes \
pie=yes CCARGS="${CCARGS}" AUXLIBS="${AUXLIBS}" \
AUXLIBS_LDAP="${AUXLIBS_LDAP}" 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="$RPM_OPT_FLAGS -fno-strict-aliasing -Wno-comment" \
POSTFIX_INSTALL_OPTS=-keep-build-mtime
%make_build
%install
mkdir -p $RPM_BUILD_ROOT
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 \
setgid_group=postdrop \
manpage_directory=%{_mandir} \
sample_directory=%{postfix_sample_dir} \
readme_directory=%{postfix_readme_dir} || exit 1
mkdir -p $RPM_BUILD_ROOT%{_initrddir}
install -c %{SOURCE1} $RPM_BUILD_ROOT%{_initrddir}/postfix
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 ; 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
mkdir -p $RPM_BUILD_ROOT%{sasl_config_dir}
install -m 644 %{SOURCE100} $RPM_BUILD_ROOT%{sasl_config_dir}/smtpd.conf
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
install -c -m 644 pflogsumm-1.1.5/pflogsumm-faq.txt $RPM_BUILD_ROOT%{postfix_doc_dir}/pflogsumm-faq.txt
install -c -m 644 pflogsumm-1.1.5/pflogsumm.1 $RPM_BUILD_ROOT%{_mandir}/man1/pflogsumm.1
install -c pflogsumm-1.1.5/pflogsumm.pl $RPM_BUILD_ROOT%{postfix_command_dir}/pflogsumm
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/usr/lib
pushd $RPM_BUILD_ROOT/usr/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 /usr/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 mysql pgsql sqlite cdb ldap 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 \
setgid_group=postdrop \
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.gz mta-mailqman %{_mandir}/man1/mailq.postfix.1.gz
--slave %{_mandir}/man1/newaliases.1.gz mta-newaliasesman %{_mandir}/man1/newaliases.postfix.1.gz
--slave %{_mandir}/man8/sendmail.8.gz mta-sendmailman %{_mandir}/man1/sendmail.postfix.1.gz
--slave %{_mandir}/man5/aliases.5.gz mta-aliasesman %{_mandir}/man5/aliases.postfix.5.gz
--slave %{_mandir}/man8/smtpd.8.gz mta-smtpdman %{_mandir}/man8/smtpd.postfix.8.gz'
%{_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 /usr/lib/sendmail mta-sendmail /usr/lib/sendmail.postfix \
$ALTERNATIVES_DOCS \
--initscript postfix
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
if [ ! -f %{sslkey} ]; then
umask 077
%{_bindir}/openssl genrsa 4096 > %{sslkey} 2> /dev/null
fi
if [ ! -f %{sslcert} ]; then
FQDN=`hostname`
if [ "x${FQDN}" = "x" ]; then
FQDN=localhost.localdomain
fi
%{_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}"
chmod 644 %{sslcert}
fi
exit 0
%pre
%{_sbindir}/groupadd -g 90 -r postdrop 2>/dev/null
%{_sbindir}/groupadd -g 89 -r postfix 2>/dev/null
%{_sbindir}/groupadd -g 12 -r mail 2>/dev/null
%{_sbindir}/useradd -d %{postfix_queue_dir} -s /sbin/nologin -g postfix -G mail -M -r -u 89 postfix 2>/dev/null
if [ -e %{_mandir}/man8/smtpd.8.gz ]; then
[ -h %{_mandir}/man8/smtpd.8.gz ] || rm -f %{_mandir}/man8/smtpd.8.gz
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
%post sysvinit
/sbin/chkconfig --add postfix >/dev/null 2>&1 ||:
%preun sysvinit
if [ "$1" = 0 ]; then
%{_initrddir}/postfix stop >/dev/null 2>&1 ||:
/sbin/chkconfig --del postfix >/dev/null 2>&1 ||:
fi
%postun sysvinit
[ "$1" -ge 1 ] && %{_initrddir}/postfix condrestart >/dev/null 2>&1 ||:
%triggerpostun -n postfix-sysvinit -- postfix < 2.8.12-2
/sbin/chkconfig --add postfix >/dev/null 2>&1 || :
%triggerun -- postfix < 2.8.12-2
%{_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)
%config(noreplace) %{sasl_config_dir}/smtpd.conf
%config(noreplace) %{_sysconfdir}/pam.d/smtp.postfix
%{_unitdir}/postfix.service
%{postfix_doc_dir}
%dir %attr(0700,postfix,root) %{postfix_queue_dir}/active
%dir %attr(0700,postfix,root) %{postfix_queue_dir}/bounce
%dir %attr(0700,postfix,root) %{postfix_queue_dir}/corrupt
%dir %attr(0700,postfix,root) %{postfix_queue_dir}/defer
%dir %attr(0700,postfix,root) %{postfix_queue_dir}/deferred
%dir %attr(0700,postfix,root) %{postfix_queue_dir}/flush
%dir %attr(0700,postfix,root) %{postfix_queue_dir}/hold
%dir %attr(0700,postfix,root) %{postfix_queue_dir}/incoming
%dir %attr(0700,postfix,root) %{postfix_queue_dir}/saved
%dir %attr(0700,postfix,root) %{postfix_queue_dir}/trace
%dir %attr(0730,postfix,postdrop) %{postfix_queue_dir}/maildrop
%dir %{postfix_queue_dir}/pid
%dir %attr(0700,postfix,root) %{postfix_queue_dir}/private
%dir %attr(0710,postfix,postdrop) %{postfix_queue_dir}/public
%dir %attr(0700,postfix,root) %{postfix_data_dir}
%{postfix_command_dir}/smtp-sink
%{postfix_command_dir}/smtp-source
%{postfix_command_dir}/postalias
%{postfix_command_dir}/postcat
%{postfix_command_dir}/postconf
%{postfix_command_dir}/postfix
%{postfix_command_dir}/postkick
%{postfix_command_dir}/postlock
%{postfix_command_dir}/postlog
%{postfix_command_dir}/postmap
%{postfix_command_dir}/postmulti
%{postfix_command_dir}/postsuper
%attr(2755,root,postdrop) %{postfix_command_dir}/postqueue
%attr(2755,root,postdrop) %{postfix_command_dir}/postdrop
%config(noreplace) %{postfix_config_dir}/access
%config(noreplace) %{postfix_config_dir}/canonical
%config(noreplace) %{postfix_config_dir}/generic
%config(noreplace) %{postfix_config_dir}/header_checks
%config(noreplace) %{postfix_config_dir}/main.cf
%config(noreplace) %{postfix_config_dir}/main.cf.proto
%config(noreplace) %{postfix_config_dir}/master.cf
%config(noreplace) %{postfix_config_dir}/master.cf.proto
%config(noreplace) %{postfix_config_dir}/relocated
%config(noreplace) %{postfix_config_dir}/transport
%config(noreplace) %{postfix_config_dir}/virtual
%{postfix_config_dir}/dynamicmaps.cf
%{postfix_config_dir}/postfix-files
%{postfix_config_dir}/dynamicmaps.cf.d/sqlite
%{postfix_config_dir}/postfix-files.d/sqlite
%{postfix_shlib_dir}/postfix-sqlite.so
%{postfix_config_dir}/dynamicmaps.cf.d/ldap
%{postfix_config_dir}/postfix-files.d/ldap
%{postfix_shlib_dir}/postfix-ldap.so
%{postfix_config_dir}/dynamicmaps.cf.d/pcre
%{postfix_config_dir}/postfix-files.d/pcre
%{postfix_shlib_dir}/postfix-pcre.so
%{postfix_config_dir}/dynamicmaps.cf.d/mysql
%{postfix_config_dir}/postfix-files.d/mysql
%{postfix_shlib_dir}/postfix-mysql.so
%{postfix_shlib_dir}/libpostfix-*.so
%{postfix_daemon_dir}/*
%{_bindir}/mailq.postfix
%{_bindir}/newaliases.postfix
%{_bindir}/rmail.postfix
%{_sbindir}/sendmail.postfix
/usr/lib/sendmail.postfix
%ghost %{_sysconfdir}/pam.d/smtp
%ghost %{_bindir}/mailq
%ghost %{_bindir}/newaliases
%ghost %{_bindir}/rmail
%ghost %{_sbindir}/sendmail
%ghost /usr/lib/sendmail
%ghost %{_var}/lib/misc/postfix.aliasesdb-stamp
%exclude %{postfix_doc_dir}/pflogsumm-faq.txt
%exclude %{postfix_doc_dir}/README_FILES/*
%exclude %{_mandir}/man5/*_table.5*
%files sysvinit
%defattr(-,root,root)
%{_initrddir}/postfix
%files perl-scripts
%defattr(-,root,root)
%{postfix_command_dir}/qshape
%{postfix_command_dir}/pflogsumm
%files pgsql
%defattr(-,root,root)
%{postfix_config_dir}/dynamicmaps.cf.d/pgsql
%{postfix_config_dir}/postfix-files.d/pgsql
%{postfix_shlib_dir}/postfix-pgsql.so
%files cdb
%defattr(-,root,root)
%{postfix_config_dir}/dynamicmaps.cf.d/cdb
%{postfix_config_dir}/postfix-files.d/cdb
%{postfix_shlib_dir}/postfix-cdb.so
%files help
%defattr(-,root,root)
%{_mandir}/man1/qshape*
%{_mandir}/man1/pflogsumm.1.gz
%{_mandir}/man1/post*.1*
%{_mandir}/man1/smtp*.1*
%{_mandir}/man1/*.postfix.1*
%{_mandir}/man5/access.5*
%{_mandir}/man5/[b-v]*.5*
%{_mandir}/man5/*.postfix.5*
%{_mandir}/man8/[a-qt-v]*.8*
%{_mandir}/man8/s[ch-lnp]*.8*
%{_mandir}/man8/smtp.8*
%{_mandir}/man8/smtpd.postfix.8*
%ghost %{_mandir}/man1/mailq.1.gz
%ghost %{_mandir}/man1/newaliases.1.gz
%ghost %{_mandir}/man5/aliases.5.gz
%ghost %{_mandir}/man8/sendmail.8.gz
%ghost %{_mandir}/man8/smtpd.8.gz
%doc %{postfix_doc_dir}/pflogsumm-faq.txt
%{postfix_doc_dir}/README_FILES/*
%changelog
* Wed Sep 18 2019 openEuler Buildteam <buildteam@openeuler.org> - 2:3.3.1-6
- Package init