diff options
author | Jackie Huang <jackie.huang@windriver.com> | 2014-07-13 22:27:15 -0400 |
---|---|---|
committer | Joe MacDonald <joe_macdonald@mentor.com> | 2014-07-20 23:30:19 -0400 |
commit | 96acc14b6c4928f52aa2f44af9532f3e2065b067 (patch) | |
tree | 5ee31cad6aefaf80a15e89179a79e54f37c1359c /meta-networking/recipes-daemons/postfix/files | |
parent | 239debcd8a0359aad64406476b801948f9b8ff14 (diff) | |
download | meta-openembedded-contrib-96acc14b6c4928f52aa2f44af9532f3e2065b067.tar.gz |
postfix: add new recipe
Postfix is Wietse Venema's mail server that started life at IBM
research as an alternative to the widely-used Sendmail program.
Postfix attempts to be fast, easy to administer, and secure.
The outside has a definite Sendmail-ish flavor, but the inside
is completely different.
Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
Signed-off-by: Joe MacDonald <joe_macdonald@mentor.com>
Diffstat (limited to 'meta-networking/recipes-daemons/postfix/files')
7 files changed, 410 insertions, 0 deletions
diff --git a/meta-networking/recipes-daemons/postfix/files/install.patch b/meta-networking/recipes-daemons/postfix/files/install.patch new file mode 100644 index 0000000000..a3fe089c22 --- /dev/null +++ b/meta-networking/recipes-daemons/postfix/files/install.patch @@ -0,0 +1,66 @@ +Change fixed postconf to a variable for cross-compiling + +Upstreamstatus: Inappropriate [embedded specific] + +Signed-off-by: Yao Zhao <yao.zhao@windriver.com> +--- +diff --git a/postfix-install b/postfix-install +index 49225ac..2e4c292 100644 +--- a/postfix-install ++++ b/postfix-install +@@ -201,8 +201,8 @@ test -z "$non_interactive" -a ! -t 0 && { + exit 1 + } + +-test -x bin/postconf || { +- echo $0: Error: no bin/postconf file. Did you forget to run \"make\"? 1>&2 ++test -x "$POSTCONF" || { ++ echo $0: Error: no $POSTCONF file. Did you forget to run \"make\"? 1>&2 + exit 1 + } + +@@ -363,7 +363,7 @@ HTML files. Specify \"no\" if you do not want to install these files." + + : ${install_root=/} + : ${tempdir=`pwd`} +-: ${config_directory=`bin/postconf -c conf -h -d config_directory`} ++: ${config_directory=`$POSTCONF -c conf -h -d config_directory`} + + # Find out the location of installed configuration files. + +@@ -433,7 +433,7 @@ test -f $CONFIG_DIRECTORY/main.cf && { + case "$junk" in + "") eval unset $name;; + esac +- eval : \${$name=\`bin/postconf -c $CONFIG_DIRECTORY -h $name\`} || ++ eval : \${$name=\`$POSTCONF -c $CONFIG_DIRECTORY -h $name\`} || + exit 1 + done + } +@@ -446,7 +446,7 @@ do + case "$junk" in + "") eval unset $name;; + esac +- eval : \${$name=\`bin/postconf -c conf -d -h $name\`} || exit 1 ++ eval : \${$name=\`$POSTCONF -c conf -d -h $name\`} || exit 1 + done + + # Override settings manually. +@@ -565,6 +565,8 @@ HTML_DIRECTORY=$install_root$html_directory + MANPAGE_DIRECTORY=$install_root$manpage_directory + README_DIRECTORY=$install_root$readme_directory + ++test "x$POSTCONF" != "x" || POSTCONF="bin/postconf" ++ + # Avoid repeated tests for existence of these; default permissions suffice. + + test -d $DAEMON_DIRECTORY || mkdir -p $DAEMON_DIRECTORY || exit 1 +@@ -724,7 +726,7 @@ do + # Postfix releases, and software should not suddenly be installed in + # the wrong place when Postfix is being upgraded. + +-bin/postconf -c $CONFIG_DIRECTORY -e \ ++"$POSTCONF" -c $CONFIG_DIRECTORY -e \ + "daemon_directory = $daemon_directory" \ + "data_directory = $data_directory" \ + "command_directory = $command_directory" \ diff --git a/meta-networking/recipes-daemons/postfix/files/internal_recipient b/meta-networking/recipes-daemons/postfix/files/internal_recipient new file mode 100644 index 0000000000..6a8f2681b8 --- /dev/null +++ b/meta-networking/recipes-daemons/postfix/files/internal_recipient @@ -0,0 +1 @@ +root@ permit_mynetworks,reject diff --git a/meta-networking/recipes-daemons/postfix/files/main.cf_2.0 b/meta-networking/recipes-daemons/postfix/files/main.cf_2.0 new file mode 100644 index 0000000000..a128faa0a1 --- /dev/null +++ b/meta-networking/recipes-daemons/postfix/files/main.cf_2.0 @@ -0,0 +1,102 @@ +# Configure your domain and accounts +#mydomain=sample.com +#FQDN from gethostname +#myhostname = +mydomain=localdomain +mydestination = $myhostname, localhost.localdomain localhost +mynetworks = 127.0.0.1/8 +inet_interfaces = 127.0.0.1 + +virtual_mailbox_domains = sample.com, other.net +virtual_mailbox_maps = hash:/etc/postfix/virtual +virtual_alias_maps = hash:/etc/postfix/virtual_alias + +alias_maps = hash:/etc/aliases + +# You'll start with the following lines for maildir storage +virtual_mailbox_base = /var/spool/vmail +virtual_uid_maps = static:`grep vmail /etc/passwd | cut -d ":" -f 3` +virtual_gid_maps = static:`grep vmail /etc/passwd | cut -d ":" -f 4` + + +# You'll start with the following lines for IMAP storage +#virtual_transport = lmtp:unix:/var/lib/cyrus/socket/lmtp + + +# General stuff here again +config_directory = /etc/postfix +sample_directory = /etc/postfix +queue_directory = /var/spool/postfix +mail_spool_directory = /var/spool/mail +readme_directory = no +command_directory = /usr/sbin +daemon_directory = /usr/libexec/postfix +mail_owner = postfix +setgid_group = postdrop +unknown_local_recipient_reject_code = 450 +mynetworks_style = host +debug_peer_level = 2 +sendmail_path = /usr/sbin/sendmail +newaliases_path = /usr/bin/newaliases +mailq_path = /usr/bin/mailq + +smtpd_data_restrictions = + permit_mynetworks, + reject_unauth_pipelining, + permit + +smtpd_client_restrictions = + permit_mynetworks, + # reject_unknown_client, # This can cause a lot of false rejects. + reject_invalid_hostname, + reject_rbl_client list.dsbl.org, + reject_rbl_client sbl.spamhaus.org, + reject_rbl_client cbl.abuseat.org, + reject_rbl_client dul.dnsbl.sorbs.net, + permit + +smtpd_helo_required = yes +smtpd_helo_restrictions = + permit_mynetworks, + reject_unauth_pipelining, + # reject_non_fqdn_hostname, # This can cause a lot of false rejects. + # reject_unknown_hostname, # This can cause a lot of false rejects. + reject_invalid_hostname, + permit + +smtpd_sender_restrictions = + permit_mynetworks, + reject_non_fqdn_sender, + # check_sender_access hash:/etc/postfix/access_domains, + reject_unknown_sender_domain, + permit + +smtpd_recipient_restrictions = + permit_mynetworks, + permit_sasl_authenticated, + reject_unauth_destination, + + # check_recipient_access pcre:/etc/postfix/recipient_checks.pcre, + # check_helo_access pcre:/etc/postfix/helo_checks.pcre, + + # check_client_access hash:/etc/postfix/maps/access_client, + # check_client_access hash:/etc/postfix/maps/exceptions_client, + # check_helo_access hash:/etc/postfix/maps/access_helo, + # check_helo_access hash:/etc/postfix/maps/verify_helo, + # check_sender_access hash:/etc/postfix/maps/access_sender, + # check_sender_access hash:/etc/postfix/maps/verify_sender, + # check_recipient_access hash:/etc/postfix/maps/access_recipient, + + # reject_multi_recipient_bounce, + reject_non_fqdn_recipient, + reject_unknown_recipient_domain, + # reject_unlisted_recipient, + #check_policy_service unix:private/policy, + + # check_sender_access hash:/etc/postfix/maps/no_verify_sender, + # check_sender_access hash:/etc/postfix/access_domains, + # reject_unverified_sender, + # reject_unverified_recipient + check_recipient_access hash:/etc/postfix/internal_recipient + +disable_vrfy_command = yes diff --git a/meta-networking/recipes-daemons/postfix/files/makedefs.patch b/meta-networking/recipes-daemons/postfix/files/makedefs.patch new file mode 100644 index 0000000000..32c31b0243 --- /dev/null +++ b/meta-networking/recipes-daemons/postfix/files/makedefs.patch @@ -0,0 +1,116 @@ +1)remove RANLIB, SYSLIBS, AR and get them from env. + +2)reference sysroot when searching header files +3)include sysroot path instead of absolute include path +for Linux2 and Linux3 systems. +4)for non-native build, search STAGING_BASELIBDIR/LIBDIR + native build, search host library path for nsl and resolv library + which comes from libc + +Upstreamstatus: Inappropriate [embedded specific] + +Signed-off-by: Yao Zhao <yao.zhao@windriver.com> +--- + makedefs | 27 +++++++++++---------------- + 1 files changed, 11 insertions(+), 16 deletions(-) + +diff --git a/makedefs b/makedefs +index dd5f256..e6fb795 100644 +--- a/makedefs ++++ b/makedefs +@@ -87,9 +87,6 @@ + + # Defaults for most sane systems + +-RANLIB=ranlib +-SYSLIBS= +-AR=ar + ARFL=rv + + # Ugly function to make our error message more visible among the +@@ -293,12 +290,12 @@ case "$SYSTEM.$RELEASE" in + case "$CCARGS" in + *-DNO_DB*) ;; + *-DHAS_DB*) ;; +- *) if [ -f /usr/include/db.h ] ++ *) if [ -f "$BUILD_SYSROOT"/usr/include/db.h ] + then + : we are all set +- elif [ -f /usr/include/db/db.h ] ++ elif [ -f "$BUILD_SYSROOT"/usr/include/db/db.h ] + then +- CCARGS="$CCARGS -I/usr/include/db" ++ CCARGS="$CCARGS -I"$BUILD_SYSROOT"/usr/include/db" + else + # No, we're not going to try db1 db2 db3 etc. + # On a properly installed system, Postfix builds +@@ -307,12 +304,12 @@ case "$SYSTEM.$RELEASE" in + echo "Install the appropriate db*-devel package first." 1>&2 + exit 1 + fi +- SYSLIBS="-ldb" ++ SYSLIBS="$SYSLIBS -ldb" + ;; + esac + for name in nsl resolv $GDBM_LIBS + do +- for lib in /usr/lib64 /lib64 /usr/lib /lib ++ for lib in $BUILD_SYSROOT_NSL_PATH + do + test -e $lib/lib$name.a -o -e $lib/lib$name.so && { + SYSLIBS="$SYSLIBS -l$name" +@@ -332,7 +329,7 @@ case "$SYSTEM.$RELEASE" in + if [ `expr "X$CCARGS" : "X.*-DNO_EPOLL"` -gt 0 ] + then + : +- elif [ ! -e /usr/include/sys/epoll.h ] ++ elif [ ! -e "$BUILD_SYSROOT"/usr/include/sys/epoll.h ] + then + echo CCARGS="$CCARGS -DNO_EPOLL" + else +@@ -356,8 +353,6 @@ int main(int argc, char **argv) + } + EOF + ${CC-gcc} -o makedefs.test makedefs.test.c || exit 1 +- ./makedefs.test 2>/dev/null || +- CCARGS="$CCARGS -DNO_EPOLL" + rm -f makedefs.test makedefs.test.[co] + fi;; + esac +@@ -366,12 +361,12 @@ EOF + case "$CCARGS" in + *-DNO_DB*) ;; + *-DHAS_DB*) ;; +- *) if [ -f /usr/include/db.h ] ++ *) if [ -f "$BUILD_SYSROOT"/usr/include/db.h ] + then + : we are all set +- elif [ -f /usr/include/db/db.h ] ++ elif [ -f "$BUILD_SYSROOT"/usr/include/db/db.h ] + then +- CCARGS="$CCARGS -I/usr/include/db" ++ CCARGS="$CCARGS -I"$BUILD_SYSROOT"/usr/include/db" + else + # On a properly installed system, Postfix builds + # by including <db.h> and by linking with -ldb +@@ -379,7 +374,7 @@ EOF + echo "Install the appropriate db*-devel package first." 1>&2 + exit 1 + fi +- SYSLIBS="-ldb" ++ SYSLIBS="$SYSLIBS -ldb" + ;; + esac + for name in nsl resolv +@@ -415,7 +410,7 @@ EOF + esac + for name in nsl resolv + do +- for lib in /usr/lib64 /lib64 /usr/lib /lib ++ for lib in $BUILD_SYSROOT_NSL_PATH + do + test -e $lib/lib$name.a -o -e $lib/lib$name.so && { + SYSLIBS="$SYSLIBS -l$name" +-- +1.7.1 + diff --git a/meta-networking/recipes-daemons/postfix/files/postfix b/meta-networking/recipes-daemons/postfix/files/postfix new file mode 100755 index 0000000000..7bcc81625a --- /dev/null +++ b/meta-networking/recipes-daemons/postfix/files/postfix @@ -0,0 +1,85 @@ +#!/bin/sh + +success() { + echo " Successful" + exit 0 +} + +fail() { + echo " Failed" + exit 1 + +} + +check_return () { + local ret="$1" + + if [ "$ret" = "0" ]; then + success + else + fail + fi +} + +PIDFile=/var/spool/postfix/pid/master.pid +case "$1" in + + start) + echo -n "Starting Postfix..." + if [ ! -e /etc/aliases.db ]; then + # The alias database is necessary for postfix to work correctly. + echo "Creating aliases database ..." + newaliases + fi + if ! postfix status >/dev/null 2>&1; then + postfix start + check_return $? + else + success + fi + ;; + + stop) + echo -n "Stopping Postfix..." + if postfix status >/dev/null 2>&1; then + postfix stop + check_return $? + else + success + fi + ;; + + reload) + echo -n "Reloading Postfix..." + if postfix status >/dev/null 2>&1; then + postfix reload + check_return $? + else + postfix start + check_return $? + fi + ;; + + restart) + $0 stop + sleep 1 + $0 start + ;; + + status) + if postfix status >/dev/null 2>&1; then + pid=`sed -e 's/\s//g' $PIDFile` + echo "The Postfix mail system is running (PID: $pid)" + exit 0 + else + echo "The Postfix mail system is not running" + exit 1 + fi + ;; + + *) + echo "Usage: $0 {start|stop|status|reload|restart}" + exit 1 + ;; +esac + diff --git a/meta-networking/recipes-daemons/postfix/files/postfix-add-db6-support.patch b/meta-networking/recipes-daemons/postfix/files/postfix-add-db6-support.patch new file mode 100644 index 0000000000..e3e28c8430 --- /dev/null +++ b/meta-networking/recipes-daemons/postfix/files/postfix-add-db6-support.patch @@ -0,0 +1,26 @@ +Subject: [PATCH] add db6 support db6 + +Upstream-Status: Backport + +Signed-off-by: Jackie Huang <jackie.huang@windriver.com> +--- + src/util/dict_db.c | 3 ++- + 1 files changed, 2 insertions(+), 1 deletions(-) + +diff --git a/src/util/dict_db.c b/src/util/dict_db.c +index 93ee480..f1ae66b 100644 +--- a/src/util/dict_db.c ++++ b/src/util/dict_db.c +@@ -693,7 +693,8 @@ static DICT *dict_db_open(const char *class, const char *path, int open_flags, + msg_fatal("set DB cache size %d: %m", dict_db_cache_size); + if (type == DB_HASH && db->set_h_nelem(db, DICT_DB_NELM) != 0) + msg_fatal("set DB hash element count %d: %m", DICT_DB_NELM); +-#if DB_VERSION_MAJOR == 5 || (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR > 0) ++#if DB_VERSION_MAJOR == 6 || DB_VERSION_MAJOR == 5 || \ ++ (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR > 0) + if ((errno = db->open(db, 0, db_path, 0, type, db_flags, 0644)) != 0) + FREE_RETURN(dict_surrogate(class, path, open_flags, dict_flags, + "open database %s: %m", db_path)); +-- +1.7.1 + diff --git a/meta-networking/recipes-daemons/postfix/files/postfix.service b/meta-networking/recipes-daemons/postfix/files/postfix.service new file mode 100644 index 0000000000..6ea9214780 --- /dev/null +++ b/meta-networking/recipes-daemons/postfix/files/postfix.service @@ -0,0 +1,14 @@ +[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 +ExecStart=/usr/sbin/postfix start +ExecReload=/usr/sbin/postfix reload +ExecStop=/usr/sbin/postfix stop + +[Install] +WantedBy=multi-user.target |