# HG changeset patch # User Michael Schloh von Bennewitz # Date 1239054785 -7200 # Node ID bc79b3740eb8e52e5c0e864bdfbf225fdb529830 # Parent d06cf9bcdea5df8b218156e8c1e73caef2faa5a0 Import package vendor original specs for necessary manipulations. diff -r d06cf9bcdea5 -r bc79b3740eb8 postfix/fsl.postfix --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/postfix/fsl.postfix Mon Apr 06 23:53:05 2009 +0200 @@ -0,0 +1,16 @@ +## +## fsl.postfix -- OSSP fsl configuration +## + +ident (postfix/.+)/.+ q{ + prefix( + prefix="%b %d %H:%M:%S %N <%L> $1[%P]: " + ) + -> { + debug: file( + path="@l_prefix@/var/postfix/log/postfix.log", + perm=0644, monitor=3600 + ) + } +}; + diff -r d06cf9bcdea5 -r bc79b3740eb8 postfix/postfix.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/postfix/postfix.patch Mon Apr 06 23:53:05 2009 +0200 @@ -0,0 +1,115 @@ +Index: makedefs +--- makedefs.orig 2008-01-15 21:20:24 +0100 ++++ makedefs 2008-01-24 12:31:48 +0100 +@@ -132,6 +132,10 @@ + ;; + FreeBSD.7*) SYSTYPE=FREEBSD7 + ;; ++ FreeBSD.7*) SYSTYPE=FREEBSD7 ++ ;; ++ FreeBSD.8*) SYSTYPE=FREEBSD8 ++ ;; + OpenBSD.2*) SYSTYPE=OPENBSD2 + ;; + OpenBSD.3*) SYSTYPE=OPENBSD3 +Index: src/util/file_limit.c +--- src/util/file_limit.c.orig 2003-10-22 20:48:36 +0200 ++++ src/util/file_limit.c 2008-01-24 12:31:48 +0100 +@@ -80,12 +80,21 @@ + void set_file_limit(off_t limit) + { + #ifdef USE_ULIMIT ++#ifdef USE_SOFTLIMITONLY ++#error "USE_ULIMIT and USE_SOFTLIMITONLY are mutual exclusive" ++#endif + if (ulimit(UL_SETFSIZE, limit / ULIMIT_BLOCK_SIZE) < 0) + msg_fatal("ulimit: %m"); + #else + struct rlimit rlim; + ++#ifdef USE_SOFTLIMITONLY ++ if (getrlimit(RLIMIT_FSIZE, &rlim) < 0) ++ rlim.rlim_max = RLIM_INFINITY; ++ rlim.rlim_cur = limit; ++#else + rlim.rlim_cur = rlim.rlim_max = limit; ++#endif + if (setrlimit(RLIMIT_FSIZE, &rlim) < 0) + msg_fatal("setrlimit: %m"); + #ifdef SIGXFSZ +Index: src/util/msg_syslog.c +--- src/util/msg_syslog.c.orig 2006-06-15 20:07:16 +0200 ++++ src/util/msg_syslog.c 2008-01-24 12:31:48 +0100 +@@ -50,6 +50,11 @@ + #include + #include + #include ++#ifdef USE_SOFTLIMITONLY ++#include ++#include ++#include ++#endif + + /* Application-specific. */ + +@@ -144,6 +149,9 @@ + + static void msg_syslog_print(int level, const char *text) + { ++#ifdef USE_SOFTLIMITONLY ++ struct rlimit save, rlim; ++#endif + static int log_level[] = { + LOG_INFO, LOG_WARNING, LOG_ERR, LOG_CRIT, LOG_CRIT, + }; +@@ -154,6 +162,15 @@ + if (level < 0 || level >= (int) (sizeof(log_level) / sizeof(log_level[0]))) + msg_panic("msg_syslog_print: invalid severity level: %d", level); + ++#ifdef USE_SOFTLIMITONLY ++ if (getrlimit(RLIMIT_FSIZE, &save) < 0) { ++ save.rlim_cur = RLIM_INFINITY; ++ save.rlim_max = RLIM_INFINITY; ++ } ++ rlim.rlim_cur = save.rlim_max; ++ rlim.rlim_max = save.rlim_max; ++ (void)setrlimit(RLIMIT_FSIZE, &rlim); ++#endif + if (level == MSG_INFO) { + syslog(syslog_facility | log_level[level], "%.*s", + (int) MSG_SYSLOG_RECLEN, text); +@@ -161,6 +178,9 @@ + syslog(syslog_facility | log_level[level], "%s: %.*s", + severity_name[level], (int) MSG_SYSLOG_RECLEN, text); + } ++#ifdef USE_SOFTLIMITONLY ++ (void)setrlimit(RLIMIT_FSIZE, &save); ++#endif + } + + /* msg_syslog_init - initialize */ +Index: src/util/sys_defs.h +--- src/util/sys_defs.h.orig 2008-01-15 01:51:44 +0100 ++++ src/util/sys_defs.h 2008-01-24 12:32:41 +0100 +@@ -24,7 +24,7 @@ + * 4.4BSD and close derivatives. + */ + #if defined(FREEBSD2) || defined(FREEBSD3) || defined(FREEBSD4) \ +- || defined(FREEBSD5) || defined(FREEBSD6) || defined(FREEBSD7) \ ++ || defined(FREEBSD5) || defined(FREEBSD6) || defined(FREEBSD7) || defined(FREEBSD8) \ + || defined(BSDI2) || defined(BSDI3) || defined(BSDI4) \ + || defined(OPENBSD2) || defined(OPENBSD3) || defined(OPENBSD4) \ + || defined(NETBSD1) || defined(NETBSD2) || defined(NETBSD3) \ +Index: src/smtp/smtp_reuse.c +--- src/smtp/smtp_reuse.c.orig 2008-12-04 01:06:42 +0100 ++++ src/smtp/smtp_reuse.c 2009-01-04 11:11:45 +0100 +@@ -216,7 +216,9 @@ + /* + * Avoid poor performance when TCP MSS > VSTREAM_BUFSIZE. + */ ++#if 0 + vstream_tweak_sock(stream); ++#endif + + /* + * Update the list of used cached addresses. diff -r d06cf9bcdea5 -r bc79b3740eb8 postfix/postfix.patch.pfls --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/postfix/postfix.patch.pfls Mon Apr 06 23:53:05 2009 +0200 @@ -0,0 +1,71 @@ +This patch makes Pflogsumm working with the particular format +of the OSSP fsl based Postfix logfile and additionally allows +one to specify a more flexible data format. + +Index: pflogsumm.1 +--- pflogsumm.1.orig 2007-04-06 16:11:28 +0200 ++++ pflogsumm.1 2007-04-06 17:35:12 +0200 +@@ -172,6 +172,8 @@ + .Vb 2 + \& -d today generate report for just today + \& -d yesterday generate report for just "yesterday" ++\& -d YYYY-MM-DD generate report for just "YYYY-MM-DD" ++\& (Really takes string Date::Parse will handle) + .Ve + .PP + .Vb 1 +Index: pflogsumm.pl +--- pflogsumm.pl.orig 2008-06-29 15:46:01 +0200 ++++ pflogsumm.pl 2008-06-29 19:39:07 +0200 +@@ -10,7 +10,7 @@ + + =head1 SYNOPSIS + +- pflogsumm.pl -[eq] [-d ] [-h ] [-u ] ++ pflogsumm.pl -[eq] [-d ] [-h ] [-u ] + [--verp_mung[=]] [--verbose_msg_detail] [--iso_date_time] + [-m|--uucp_mung] [-i|--ignore_case] [--smtpd_stats] [--mailq] + [--problems_first] [--rej_add_from] [--no_bounce_detail] +@@ -37,6 +37,9 @@ + + -d today generate report for just today + -d yesterday generate report for just "yesterday" ++ -d YYYY-MM-DD generate report for just "YYYY-MM-DD" ++ (Actually this will take any date string ++ parsable by the perl Date::Parse module) + + -e extended (extreme? excessive?) detail + +@@ -359,6 +362,7 @@ + use strict; + use locale; + use Getopt::Long; ++use Date::Parse; + eval { require Date::Calc }; + my $hasDateCalc = $@ ? 0 : 1; + +@@ -542,8 +546,8 @@ + my $logRmdr; + next unless((($msgMonStr, $msgDay, $msgHr, $msgMin, $msgSec, $logRmdr) = + /^(...) +(\d+) (..):(..):(..) \S+ (.+)$/o) == 6); +- unless((($cmd, $qid) = $logRmdr =~ m#^(?:postfix|$syslogName)/([^\[:]*).*?: ([^:\s]+)#o) == 2 || +- (($cmd, $qid) = $logRmdr =~ m#^((?:postfix)(?:-script)?)(?:\[\d+\])?: ([^:\s]+)#o) == 2) ++ unless((($cmd, $qid) = $logRmdr =~ m#^<[a-z]+>\s+(?:postfix|$syslogName)/([^\[:]*).*?: ([^:\s]+)#o) == 2 || ++ (($cmd, $qid) = $logRmdr =~ m#^<[a-z]+>\s+((?:postfix)(?:-script)?)(?:\[\d+\])?: ([^:\s]+)#o) == 2) + { + #print UNPROCD "$_"; + next; +@@ -1406,11 +1410,11 @@ + # Back up to yesterday + $time -= ((localtime($time))[2] + 2) * 3600; + } elsif($dateOpt ne "today") { +- die "$usageMsg\n"; ++ $time = str2time($dateOpt); + } + my ($t_mday, $t_mon) = (localtime($time))[3,4]; + +- return sprintf("%s %2d", $monthNames[$t_mon], $t_mday); ++ return sprintf("%s %02d", $monthNames[$t_mon], $t_mday); + } + + # if there's a real domain: uses that. Otherwise uses the IP addr. diff -r d06cf9bcdea5 -r bc79b3740eb8 postfix/postfix.spec --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/postfix/postfix.spec Mon Apr 06 23:53:05 2009 +0200 @@ -0,0 +1,379 @@ +## +## postfix.spec -- OpenPKG RPM Package Specification +## Copyright (c) 2000-2008 OpenPKG Foundation e.V. +## +## Permission to use, copy, modify, and distribute this software for +## any purpose with or without fee is hereby granted, provided that +## the above copyright notice and this permission notice appear in all +## copies. +## +## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED +## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR +## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +## SUCH DAMAGE. +## + +# package versions +%define V_postfix 2.5.6 +%define V_pflogsumm 1.1.2 +%define V_whoson 2.4.0 + +# package information +Name: postfix +Summary: Mail Transfer Agent (MTA) +URL: http://www.postfix.org/ +Vendor: Wietse Venema +Packager: OpenPKG Foundation e.V. +Distribution: OpenPKG Community +Class: BASE +Group: Mail +License: IPL +Version: %{V_postfix} +Release: 20090104 + +# package options +%option with_fsl yes +%option with_ssl no +%option with_sasl no +%option with_mysql no +%option with_pgsql no +%option with_ldap no +%option with_whoson no +%option with_fdsetsize no + +# list of sources +Source0: ftp://ftp.porcupine.org/mirrors/postfix-release/official/postfix-%{V_postfix}.tar.gz +Source1: http://jimsun.linxnet.com/downloads/pflogsumm-%{V_pflogsumm}.tar.gz +Source2: postfix.txt +Source3: fsl.postfix +Source4: rc.postfix +Patch0: postfix.patch +Patch1: postfix.patch.pfls +Patch2: ftp://ftp.openpkg.org/sources/CPY/postfix/postfix-%{V_whoson}-whoson.patch + +# build information +Prefix: %{l_prefix} +BuildRoot: %{l_buildroot} +BuildPreReq: OpenPKG, openpkg >= 20060823, perl, gcc +PreReq: OpenPKG, openpkg >= 20060823, perl, procmail, perl-time +BuildPreReq: make, pcre, db +PreReq: make, pcre, db +%if "%{with_fsl}" == "yes" +BuildPreReq: fsl +PreReq: fsl +%endif +%if "%{with_ssl}" == "yes" +BuildPreReq: openssl +PreReq: openssl +%endif +%if "%{with_sasl}" == "yes" +BuildPreReq: sasl +PreReq: sasl +%endif +%if "%{with_mysql}" == "yes" +BuildPreReq: mysql +PreReq: mysql +%endif +%if "%{with_pgsql}" == "yes" +BuildPreReq: postgresql, openssl +PreReq: postgresql, openssl +%endif +%if "%{with_ldap}" == "yes" +BuildPreReq: openldap, openssl +PreReq: openldap, openssl +%endif +%if "%{with_whoson}" == "yes" +BuildPreReq: whoson +PreReq: whoson +%endif +AutoReq: no +AutoReqProv: no +Provides: MTA +Conflicts: exim, sendmail, ssmtp + +%description + Postfix is a new-generation Mail Transfer Agent (MTA) able to fully + replace the Sendmail MTA. It is fully standards compliant and + supports SMTP, ESMTP, LMTP over IPv4/IPv6 with optional TLS/SASL. + + Local specifics in this OpenPKG version: + o Postfix delivers locally via Procmail + o Postfix logs directly to the filesystem via OSSP fsl + o Berkeley-DB dictionary support + o PCRE matching support + o Optional STARTTLS encryption support (see package options) + o Optional SASL2 authentication support (see package options) + o Optional MySQL dictionary support (see package options) + o Optional PostgreSQL dictionary support (see package options) + o Optional OpenLDAP dictionary support (see package options) + o Optional WHOSON dictionary support (see package options) + +%track + prog postfix = { + version = %{V_postfix} + url = ftp://ftp.porcupine.org/mirrors/postfix-release/official/ + regex = postfix-(\d+\.\d+\.\d+)\.tar\.gz + } + prog postfix:pflogsumm = { + version = %{V_pflogsumm} + url = http://jimsun.linxnet.com/postfix_contrib.html + regex = pflogsumm-(__VER__)\.tar\.gz + } + prog postfix:whoson = { + version = %{V_whoson} + url = ftp://ftp.openpkg.org/sources/CPY/postfix/ + regex = postfix-(__VER__)-whoson.patch + } + +%prep + # unpack distribution files + %setup -q + %setup -q -T -D -a 1 + + # apply OpenPKG patches + %patch -p0 + ( cd pflogsumm-%{V_pflogsumm} && %{l_patch} -p0 -b <%{PATCH1} ) || exit $? + + # apply vendor WHOSON patch +%if "%{with_whoson}" == "yes" + %patch -p0 -P 2 +%endif + +%build + # configure Postfix (hard-core part I) + %{l_shtool} subst \ + -e 's/var_config_dir, /var_command_dir, /' \ + src/postfix/postfix.c + %{l_shtool} subst \ + -e 's;config_directory/postfix-script;command_directory/postfix-script;' \ + -e 's;config_directory/post-install;command_directory/postfix-install;' \ + conf/postfix-script + %{l_shtool} subst \ + -e 's;/usr/include;%{l_prefix}/include;g' \ + makedefs + + # configure Postfix (regular part) + unset LD_LIBRARY_PATH || true + CCARGS="" + CCARGS="$CCARGS %{l_cflags -O}" + CCARGS="$CCARGS %{l_cppflags}" + CCARGS="$CCARGS -DDEF_COMMAND_DIR=\\\"%{l_prefix}/sbin\\\"" + CCARGS="$CCARGS -DDEF_SENDMAIL_PATH=\\\"%{l_prefix}/sbin/sendmail\\\"" + CCARGS="$CCARGS -DDEF_CONFIG_DIR=\\\"%{l_prefix}/etc/postfix\\\"" + CCARGS="$CCARGS -DDEF_DAEMON_DIR=\\\"%{l_prefix}/libexec/postfix\\\"" + CCARGS="$CCARGS -DDEF_QUEUE_DIR=\\\"%{l_prefix}/var/postfix\\\"" + CCARGS="$CCARGS -DDEF_DATA_DIR=\\\"%{l_prefix}/var/postfix/data\\\"" + AUXLIBS="" + AUXLIBS="$AUXLIBS %{l_ldflags}" + CCARGS="$CCARGS -DHAS_DB" + AUXLIBS="$AUXLIBS -ldb" + CCARGS="$CCARGS -DHAS_PCRE" + AUXLIBS="$AUXLIBS -lpcre" +%if "%{with_mysql}" == "yes" + CCARGS="$CCARGS -DHAS_MYSQL %{l_cppflags mysql .}" + AUXLIBS="$AUXLIBS %{l_ldflags mysql .} -lmysqlclient -lz -lm" +%endif +%if "%{with_pgsql}" == "yes" + CCARGS="$CCARGS -DHAS_PGSQL %{l_cppflags postgresql .}" + AUXLIBS="$AUXLIBS -lpq -lssl -lcrypto -lcrypt" +%endif +%if "%{with_sasl}" == "yes" + CCARGS="$CCARGS -DUSE_SASL_AUTH -DUSE_CYRUS_SASL %{l_cppflags sasl .}" + AUXLIBS="$AUXLIBS -lsasl2 -lcrypt" + if [ -f /usr/lib/libdl.so -o -f /usr/lib/libdl.a ]; then + AUXLIBS="$AUXLIBS -ldl" + fi + if [ -f /usr/lib64/libdl.so -o -f /usr/lib64/libdl.a ]; then + AUXLIBS="$AUXLIBS -ldl" + fi +%endif +%if "%{with_ssl}" == "yes" + CCARGS="$CCARGS -DUSE_TLS" + AUXLIBS="$AUXLIBS -lssl -lcrypto" +%endif +%if "%{with_ldap}" == "yes" + CCARGS="$CCARGS -DHAS_LDAP" + AUXLIBS="$AUXLIBS -lldap -llber -lssl -lcrypto" +%endif +%if "%{with_fsl}" == "yes" + AUXLIBS="$AUXLIBS %{l_fsl_ldflags} %{l_fsl_libs}" + CCARGS="$CCARGS -DUSE_SOFTLIMITONLY" +%endif +%if "%{with_fdsetsize}" != "no" +%if "%{with_fdsetsize}" == "yes" + CCARGS="$CCARGS -DFD_SETSIZE=1024" +%else + CCARGS="$CCARGS -DFD_SETSIZE=%{with_fdsetsize}" +%endif +%endif + case "%{l_platform -t}" in + *-sunos* ) AUXLIBS="$AUXLIBS -lrt" ;; + esac + %{l_make} %{l_mflags} -f Makefile.init makefiles \ + CC="%{l_cc}" CCARGS="$CCARGS" AUXLIBS="$AUXLIBS" + + # configure Postfix (hard-core part II) + %{l_shtool} subst \ + -e 's;#define HAS_DBM;#define HAS_DBM_DISABLED;' \ + -e 's;#define HAS_DB;#define HAS_DB_DISABLED;' \ + src/util/sys_defs.h + + # build Postfix + %{l_make} %{l_mflags} + +%install + rm -rf $RPM_BUILD_ROOT + + # perform standard installation procedure + %{l_shtool} subst -e "s;chown;true;" postfix-install + sh postfix-install -non-interactive \ + install_root=$RPM_BUILD_ROOT \ + config_directory=%{l_prefix}/etc/postfix \ + daemon_directory=%{l_prefix}/libexec/postfix \ + command_directory=%{l_prefix}/sbin \ + queue_directory=%{l_prefix}/var/postfix \ + data_directory=%{l_prefix}/var/postfix/data \ + sendmail_path=%{l_prefix}/sbin/sendmail \ + newaliases_path=%{l_prefix}/sbin/newaliases \ + mailq_path=%{l_prefix}/sbin/mailq \ + manpage_directory=%{l_prefix}/man \ + mail_user=%{l_musr} \ + setgid_group=%{l_rgrp} + + # post-adjust binaries + rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/mailq + ln $RPM_BUILD_ROOT%{l_prefix}/sbin/sendmail \ + $RPM_BUILD_ROOT%{l_prefix}/sbin/mailq + rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/newaliases + ln $RPM_BUILD_ROOT%{l_prefix}/sbin/sendmail \ + $RPM_BUILD_ROOT%{l_prefix}/sbin/newaliases + strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true + strip $RPM_BUILD_ROOT%{l_prefix}/libexec/postfix/* >/dev/null 2>&1 || true + + # post-adjust configuration + for cfg in \ + *LICENSE makedefs.out bounce.cf.default access aliases \ + canonical header_checks relocated transport virtual \ + main.cf master.cf main.cf.default; do + rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/postfix/$cfg + done + mv $RPM_BUILD_ROOT%{l_prefix}/etc/postfix/postfix-script \ + $RPM_BUILD_ROOT%{l_prefix}/sbin/postfix-script + rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/postfix/postfix-script* + mv $RPM_BUILD_ROOT%{l_prefix}/etc/postfix/post-install \ + $RPM_BUILD_ROOT%{l_prefix}/sbin/postfix-install + + # install default configuration + for name in `grep "^/d" -e "/<\/file>/,\$d" >$name + %{l_shtool} install -c -m 644 %{l_value -s -a} \ + $name $RPM_BUILD_ROOT%{l_prefix}/etc/postfix/ + done + + # pre-create variable stuff + ( cd $RPM_BUILD_ROOT%{l_prefix}/var/postfix + %{l_shtool} mkdir -f -p -m 700 data + %{l_shtool} mkdir -f -p -m 755 log + ) || exit $? + + # install addons + %{l_shtool} install -c -m 755 \ + -e 's;/usr/sbin/sendmail;%{l_prefix}/sbin/sendmail;g' \ + auxiliary/rmail/rmail $RPM_BUILD_ROOT%{l_prefix}/sbin/rmail + %{l_shtool} install -c -m 755 \ + -e 's;/usr/bin/perl;%{l_prefix}/bin/perl;g' \ + -e 's;postconf -h;%{l_prefix}/sbin/postconf -h;' \ + auxiliary/qshape/qshape.pl $RPM_BUILD_ROOT%{l_prefix}/sbin/qshape + %{l_shtool} install -c -m 644 \ + man/man1/qshape.1 $RPM_BUILD_ROOT%{l_prefix}/man/man8/qshape.8 + ( cd pflogsumm-%{V_pflogsumm} + %{l_shtool} install -c -m 755 \ + -e 's;/usr/bin/perl;%{l_prefix}/bin/perl;g' \ + pflogsumm.pl $RPM_BUILD_ROOT%{l_prefix}/sbin/pflogsumm + %{l_shtool} install -c -m 644 \ + pflogsumm.1 $RPM_BUILD_ROOT%{l_prefix}/man/man1/ + ) || exit $? + + # install run-command script + %{l_shtool} mkdir -f -p -m 755 \ + $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d + %{l_shtool} install -c -m 755 %{l_value -s -a} \ + %{SOURCE rc.postfix} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ + + # adjust installation to avoid file name conflicts + ( cd $RPM_BUILD_ROOT%{l_prefix}/man/man8 + mv master.8 postfix_master.8 + ) || exit $? + + # install OSSP fsl configuration + %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl + %{l_shtool} install -c -m 644 %{l_value -s -a} \ + %{SOURCE fsl.postfix} \ + $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/ + + # generate file list + %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ + %{l_files_std} \ + '%config %{l_prefix}/etc/fsl/fsl.postfix' \ + '%attr(-,%{l_susr},%{l_mgrp}) %{l_prefix}/etc/postfix' \ + '%config %attr(-,%{l_susr},%{l_mgrp}) %{l_prefix}/etc/postfix/*' \ + '%attr(-,%{l_susr},%{l_mgrp}) %{l_prefix}/libexec/postfix/*' \ + '%attr(2755,%{l_musr},%{l_rgrp}) %{l_prefix}/sbin/{postdrop,postqueue}' \ + '%dir %attr(-,%{l_susr},%{l_mgrp}) %{l_prefix}/libexec/postfix' \ + '%dir %attr(-,%{l_susr},%{l_mgrp}) %{l_prefix}/var/postfix' \ + '%dir %attr(-,%{l_musr},%{l_rgrp}) %{l_prefix}/var/postfix/{maildrop,public}' + +%files -f files + +%clean + rm -rf $RPM_BUILD_ROOT + +%pre + # before upgrade, save status and stop service + [ $1 -eq 2 ] || exit 0 + eval `%{l_rc} postfix status 2>/dev/null | tee %{l_tmpfile}` + %{l_rc} postfix stop 2>/dev/null + exit 0 + +%post + if [ $1 -eq 1 ]; then + # after install, generate configuration + ( cd $RPM_INSTALL_PREFIX/etc/postfix && %{l_make} all; true ) >/dev/null 2>&1 + fi + if [ $1 -eq 2 ]; then + # after upgrade, regenerate configuration + ( cd $RPM_INSTALL_PREFIX/etc/postfix && %{l_make} clean all; true ) >/dev/null 2>&1 + # after upgrade, restore status + eval `cat %{l_tmpfile}`; rm -f %{l_tmpfile} >/dev/null 2>&1 || true + [ ".$postfix_active" = .yes ] && %{l_rc} postfix start + fi + exit 0 + +%preun + # before erase, stop service and remove log files + [ $1 -eq 0 ] || exit 0 + %{l_rc} postfix stop 2>/dev/null + rm -f $RPM_INSTALL_PREFIX/var/postfix/log/postfix.log* >/dev/null 2>&1 || true + rm -f $RPM_INSTALL_PREFIX/var/postfix/log/postfix.sum* >/dev/null 2>&1 || true + # remove generated configuration files + ( cd $RPM_INSTALL_PREFIX/etc/postfix && %{l_make} clean >/dev/null 2>&1; true ) || true + # remove generated run-time files and directories + rm -rf $RPM_INSTALL_PREFIX/etc/postfix/data/* + rm -rf $RPM_INSTALL_PREFIX/var/postfix/pid/* + rm -rf $RPM_INSTALL_PREFIX/var/postfix/private/* + rm -rf $RPM_INSTALL_PREFIX/var/postfix/public/* + find $RPM_INSTALL_PREFIX/var/postfix/active/ -type d -print |\ + xargs rmdir >/dev/null 2>&1 || true + find $RPM_INSTALL_PREFIX/var/postfix/incoming/ -type d -print |\ + xargs rmdir >/dev/null 2>&1 || true + exit 0 + diff -r d06cf9bcdea5 -r bc79b3740eb8 postfix/postfix.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/postfix/postfix.txt Mon Apr 06 23:53:05 2009 +0200 @@ -0,0 +1,340 @@ + +## +## @l_prefix@/etc/postfix/Makefile -- maintainance procedures +## + +# path configuration +PREFIX = @l_prefix@ +SBINDIR = $(PREFIX)/sbin +ETCDIR = $(PREFIX)/etc + +# program configuration +RC = $(ETCDIR)/rc +POSTALIAS = $(SBINDIR)/postalias +POSTMAP = $(SBINDIR)/postmap +POSTFIX = $(SBINDIR)/postfix + +# table filename configuration +T_ACCESS = access +T_CANONICAL = canonical +T_GENERIC = generic +T_VIRTUAL = virtual +T_RELOCATED = relocated +T_TRANSPORT = transport +T_ALIASES = aliases + +# dependency tracking +TIMESTAMP = .up-to-date +DEPENDENCIES = Makefile master.cf main.cf $(TABLES) + +# managed tables: +# - use extension ".db" for hash tables ("hash") +# - use no extension for regex tables ("pcre") +TABLES = \ + $(T_ACCESS).db \ + $(T_CANONICAL).db \ + $(T_GENERIC).db \ + $(T_VIRTUAL).db \ + $(T_RELOCATED).db \ + $(T_TRANSPORT).db \ + $(T_ALIASES).db + +# default target +all: $(TABLES) $(TIMESTAMP) + +# implicit checking and reloading +$(TIMESTAMP): $(DEPENDENCIES) + $(POSTFIX) check + $(POSTFIX) reload >/dev/null 2>&1 || true + touch $(TIMESTAMP) && chmod 600 $(TIMESTAMP) + +# explicit checking +check: + $(POSTFIX) check + +# hash table update targets +$(T_ACCESS).db: $(T_ACCESS) $(MAKEFILE) + $(POSTMAP) hash:$(T_ACCESS) +$(T_CANONICAL).db: $(T_CANONICAL) $(MAKEFILE) + $(POSTMAP) hash:$(T_CANONICAL) +$(T_GENERIC).db: $(T_GENERIC) $(MAKEFILE) + $(POSTMAP) hash:$(T_GENERIC) +$(T_VIRTUAL).db: $(T_VIRTUAL) $(MAKEFILE) + $(POSTMAP) hash:$(T_VIRTUAL) +$(T_RELOCATED).db: $(T_RELOCATED) $(MAKEFILE) + $(POSTMAP) hash:$(T_RELOCATED) +$(T_TRANSPORT).db: $(T_TRANSPORT) $(MAKEFILE) + $(POSTMAP) hash:$(T_TRANSPORT) +$(T_ALIASES).db: $(T_ALIASES) $(MAKEFILE) + $(POSTALIAS) hash:$(T_ALIASES) + +# cleanup target +clean: + -rm -f $(TABLES) + -rm -f $(TIMESTAMP) + +# process management +start: + $(RC) postfix start +reload: + $(RC) postfix reload +stop: + $(RC) postfix stop + + + +## +## @l_prefix@/etc/postfix/master.cf -- Postfix master process table +## +# ========================================================================== +# service type private unpriv chroot wakeup maxproc command + args +# (yes) (yes) (yes) (never) (100) +# ========================================================================== +smtp inet n - n - - smtpd +#628 inet n - n - - qmqpd +pickup fifo n - n 60 1 pickup +cleanup unix n - n - 0 cleanup +qmgr fifo n - n 300 1 qmgr +tlsmgr unix - - n 1000? 1 tlsmgr +rewrite unix - - n - - trivial-rewrite +bounce unix - - n - 0 bounce +defer unix - - n - 0 bounce +trace unix - - n - 0 bounce +verify unix - - n - 1 verify +flush unix n - n 1000? 0 flush +proxymap unix - - n - - proxymap +proxywrite unix - - n - - proxymap +smtp unix - - n - - smtp +relay unix - - n - - smtp -o fallback_relay= +showq unix n - n - - showq +error unix - - n - - error +retry unix - - n - - error +local unix - n n - - local +virtual unix - n n - - virtual +lmtp unix - - n - - lmtp +anvil unix - - n - 1 anvil +scache unix - - n - 1 scache +#maildrop unix - n n - - pipe flags=DRhu user=@l_nusr@ argv=@l_prefix@/bin/maildrop -d ${recipient} +#cyrus unix - n n - - pipe user=@l_nusr@ argv=@l_prefix@/bin/cyrdeliver -e -r ${sender} -m ${extension} ${user} +#uucp unix - n n - - pipe flags=Fqhu user=@l_nusr@ argv=@l_prefix@/bin/uux -r -n -z -a$sender - $nexthop!rmail ($recipient) +#ifmail unix - n n - - pipe flags=F user=@l_nusr@ argv=@l_prefix@/bin/ifmail -r $nexthop ($recipient) +#bsmtp unix - n n - - pipe flags=Fq. user=@l_nusr@ argv=@l_prefix@/bin/bsmtp -f $sender $nexthop $recipient + + +## +## @l_prefix@/etc/postfix/main.cf -- Postfix main configuration +## +## Run "@l_prefix@/sbin/postconf -n" to see all parameters overriding +## defaults, run "@l_prefix@/sbin/postconf -d" to see all possible +## parameters and their defaults and read the following manual +## pages for description of each parameter: bounce(8), cleanup(8), +## defer(8), error(8), flush(8), lmtp(8), local(8), master(8), +## pickup(8), pipe(8), qmgr(8), showq(8), smtp(8), smtpd(8), spawn(8), +## trivial-rewrite(8). +## + +# users +mail_owner = @l_musr@ +setgid_group = @l_rgrp@ +default_privs = @l_nusr@ + +# local host +myhostname = mail.example.com +mydomain = example.com +myorigin = $myhostname + +# smtp daemon +#smtpd_banner = $myhostname ESMTP $mail_name +inet_interfaces = 127.0.0.1 + +# smtp client +smtp_bind_address = 127.0.0.1 + +# relaying +mynetworks = 127.0.0.0/8 +#mydestination = $myhostname, localhost.$mydomain +#relay_domains = $mydestination, +# hash:@l_prefix@/etc/postfix/access +#smtpd_recipient_restrictions = permit_mynetworks, +# check_client_access hash:@l_prefix@/etc/postfix/access, +# reject_unauth_destination + +# maps +#canonical_maps = hash:@l_prefix@/etc/postfix/canonical +#smtp_generic_maps = hash:@l_prefix@/etc/postfix/generic +#virtual_alias_maps = hash:@l_prefix@/etc/postfix/virtual +#relocated_maps = hash:@l_prefix@/etc/postfix/relocated +#transport_maps = hash:@l_prefix@/etc/postfix/transport +alias_maps = hash:@l_prefix@/etc/postfix/aliases +alias_database = hash:@l_prefix@/etc/postfix/aliases + +# local delivery +#local_recipient_maps = proxy:unix:passwd.byname $alias_maps +recipient_delimiter = + +mailbox_command = @l_prefix@/bin/procmail -a "$EXTENSION" + + + +## +## @l_prefix@/etc/postfix/access -- access control for relaying +## +## Searched for both the client (hostname, parent domains, IP address, +## networks obtained by stripping least significant octets from IP +## address) and destination address (resolved destination address, +## parent domain, or localpart@) in order to allow relaying. Rejects +## the request if the result is REJECT or "[45]XX text". Permits the +## request if the result is OK or RELAY or all-numerical. +## + +# Syntax (see access(5)): +# | user@domain action +# | domain action +# | user@ action +# | net.work.addr.ess action +# | net.work.addr action +# | net.work action +# | net action +# where "action" is one of: +# "[45]NN text", "REJECT", "OK", "restriction..." +# +# Examples: +# | mail.example.com OK +# | example.com REJECT +# | 192.168.0.1 OK +# | 192.168 REJECT +# | postmaster@ OK + + + +## +## @l_prefix@/etc/postfix/virtual -- virtual address translation +## +## Searched for virtual addresses user@domain, user and @domain +## (in this order). It redirect mail for all recipients, local or +## remote. The mapping affects only envelope recipients. +## + +# Syntax (see virtual(5)): +# | user@domain address, address, ... +# | user address, address, ... +# | @domain address, address, ... +# +# Examples: +# | @example.com john@example.com +# | postmaster@example.com postmaster +# | john@example1.com john1 +# | john@example2.com john2 + + + +## +## @l_prefix@/etc/postfix/aliases -- local mailbox aliases +## +## Searched for virtual addresses user@domain, user and @domain +## (in this order). It redirect mail for all recipients, local or +## remote. The mapping affects only envelope recipients. +## + +# Syntax (see aliases(5)): +# | name: value, value, ... +# where value is one of: +# "address", "/file/name", "|command", ":include:/file/name" +# +# Examples: +# | john.doe: john, doe +# | robot: |/path/to/robot +# | archive: /path/to/archive +# | users: :include:/path/to/users.list +# | owner-users: john.doe + +# standard mail targets +nobody: /dev/null +MAILER-DAEMON: postmaster + +# mailbox names for common services, roles and functions +# (see RFC2142 for more details and expanded list of names) +postmaster: root +hostmaster: root +security: root +abuse: root + +# save unprivileged user storage of careless admins +root: /dev/null + + + +## +## @l_prefix@/etc/postfix/canonical -- address canonification on mail receiving +## +## Searched for canonical addresses for user@domain, user and @domain +## (in this order). +## + +# Syntax (see canonical(5)): +# | user@domain address +# | user address +# | @domain address +# +# Examples: +# | postmaster@mail.example.com postmaster@example.com +# | john John.Doe +# | @example.com @example.com + + + +## +## @l_prefix@/etc/postfix/relocated -- relocate obsolete addresses +## +## Searched for relocated addresses user@domain, user and @domain +## (in this order). It bounces mail for all recipients. +## + +# Syntax (see relocated(5)): +# | user@domain address +# | user address +# | @domain address +# +# Examples: +# | john@invalid john@example.com +# | john john@example.com +# | @invalid john@example.com + + + +## +## @l_prefix@/etc/postfix/generic -- address canonification on mail sending +## +## Searched for canonical addresses for user@domain, user and @domain +## (in this order). +## + +# Syntax (see generic(5)): +# | user@domain address +# | user address +# | @domain address +# +# Examples: +# | postmaster@mail.example.com postmaster@example.com +# | john John.Doe +# | @example.com @example.com + + + +## +## @l_prefix@/etc/postfix/transport -- transport selection +## +## Searched for domain and .domain (in this order). It selects the +## specified transport facility for delivery. +## + +# Syntax (see transport(5)): +# | domain transport:nexthop +# | .domain transport:nexthop +# +# Examples: +# | me.example.com local: +# | you.example.com smtp:mail.example.com:2525 +# | example.com smtp:mail.example.com +# | .example.com smtp:mail.example.com + + diff -r d06cf9bcdea5 -r bc79b3740eb8 postfix/rc.postfix --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/postfix/rc.postfix Mon Apr 06 23:53:05 2009 +0200 @@ -0,0 +1,74 @@ +#!@l_prefix@/bin/openpkg rc +## +## rc.postfix -- Run-Commands +## + +%config + MTA_name="postfix" + MTA_aliases_file="@l_prefix@/etc/postfix/aliases" + MTA_aliases_update="cd @l_prefix@/etc/postfix && @l_prefix@/sbin/postalias aliases" + postfix_enable="$openpkg_rc_def" + postfix_log_prolog="true" + postfix_log_epilog="true" + postfix_log_numfiles="10" + postfix_log_minsize="1M" + postfix_log_complevel="9" + postfix_sum_flags="" + +%status -u @l_susr@ -o + postfix_usable="no" + postfix_active="no" + @l_prefix@/sbin/postfix check >/dev/null 2>&1 && postfix_usable="yes" + @l_prefix@/libexec/postfix/master -t >/dev/null 2>&1 || postfix_active="yes" + echo "postfix_enable=\"$postfix_enable\"" + echo "postfix_usable=\"$postfix_usable\"" + echo "postfix_active=\"$postfix_active\"" + +%start -u @l_susr@ + rcService postfix enable yes || exit 0 + rcService postfix active yes && exit 0 + @l_prefix@/sbin/postfix start + +%stop -u @l_susr@ + rcService postfix enable yes || exit 0 + rcService postfix active no && exit 0 + @l_prefix@/sbin/postfix stop + sleep 2 + +%restart -u @l_susr@ + rcService postfix enable yes || exit 0 + rcService postfix active no && exit 0 + rc postfix stop start + +%reload -u @l_susr@ + rcService postfix enable yes || exit 0 + rcService postfix active no && exit 0 + @l_prefix@/sbin/postfix reload + +%daily -u @l_susr@ + rcService postfix enable yes || exit 0 + + # rotate summary logfile + shtool rotate -f \ + -n ${postfix_log_numfiles} -s 0 \ + -z ${postfix_log_complevel} -m 644 -o @l_musr@ -g @l_mgrp@ \ + @l_prefix@/var/postfix/log/postfix.sum + + # generate summary logfile + logfiles="@l_prefix@/var/postfix/log/postfix.log" + if [ -f "@l_prefix@/var/postfix/log/postfix.log.0" ]; then + logfiles="$logfiles @l_prefix@/var/postfix/log/postfix.log.0" + fi + @l_prefix@/sbin/pflogsumm -d yesterday -h 10 -u 10 -i \ + --iso_date_time --problems_first --smtpd_stats --verbose_msg_detail \ + ${postfix_sum_flags} \ + ${logfiles} >@l_prefix@/var/postfix/log/postfix.sum 2>/dev/null + + # rotate logfile + shtool rotate -f \ + -n ${postfix_log_numfiles} -s ${postfix_log_minsize} -d \ + -z ${postfix_log_complevel} -m 644 -o @l_musr@ -g @l_mgrp@ \ + -P "$postfix_log_prolog" \ + -E "$postfix_log_epilog" \ + @l_prefix@/var/postfix/log/postfix.log +