From e1221e7aa4c66dbd279f4460f3314679f720287f Mon Sep 17 00:00:00 2001 From: Yi Zhao Date: Thu, 26 Oct 2017 14:43:31 -0700 Subject: postfix: fix send mail failure and eliminate warning * Update main.cf for postfix 3.x to eliminate startup warning * Set daemon_directory from ${libexecdir} to ${libexecdir}/postfix * Using absolute path for newaliases and postmap to generate the correct db file in pkg_postinst * Remove duplicate SRC_URI lines in postfix_3.2.2.bb (LOCAL REV: NOT UPSTREAM) -- will sent to oe-devel later Signed-off-by: Yi Zhao * Move use of newaliases and postmap on host to install phase because absolute path might not exist at rootfs build time. Signed-off-by: Joe Slater Signed-off-by: Armin Kuster Signed-off-by: Joe MacDonald --- .../recipes-daemons/postfix/files/main.cf | 105 +++++++++++++++++++++ .../recipes-daemons/postfix/files/main.cf_2.0 | 102 -------------------- .../recipes-daemons/postfix/postfix.inc | 28 +++--- .../recipes-daemons/postfix/postfix_3.2.2.bb | 17 +--- 4 files changed, 124 insertions(+), 128 deletions(-) create mode 100644 meta-networking/recipes-daemons/postfix/files/main.cf delete mode 100644 meta-networking/recipes-daemons/postfix/files/main.cf_2.0 (limited to 'meta-networking/recipes-daemons') diff --git a/meta-networking/recipes-daemons/postfix/files/main.cf b/meta-networking/recipes-daemons/postfix/files/main.cf new file mode 100644 index 0000000000..2371ace6e4 --- /dev/null +++ b/meta-networking/recipes-daemons/postfix/files/main.cf @@ -0,0 +1,105 @@ +compatibility_level = 2 +smtputf8_enable = no + +# 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 = @LIBEXECDIR@ +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/main.cf_2.0 b/meta-networking/recipes-daemons/postfix/files/main.cf_2.0 deleted file mode 100644 index dc7feb57b7..0000000000 --- a/meta-networking/recipes-daemons/postfix/files/main.cf_2.0 +++ /dev/null @@ -1,102 +0,0 @@ -# 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 = @LIBEXECDIR@ -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/postfix.inc b/meta-networking/recipes-daemons/postfix/postfix.inc index a588bd3476..8dad45f85d 100644 --- a/meta-networking/recipes-daemons/postfix/postfix.inc +++ b/meta-networking/recipes-daemons/postfix/postfix.inc @@ -18,7 +18,7 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=64375f37431336ea1b1b3005fe3fa354" SRC_URI = "ftp://ftp.porcupine.org/mirrors/postfix-release/official/postfix-${PV}.tar.gz \ file://makedefs.patch \ file://install.patch \ - file://main.cf_2.0 \ + file://main.cf \ file://postfix \ file://internal_recipient \ file://postfix.service \ @@ -135,7 +135,7 @@ SYSTEMD_SERVICE_${PN} = "postfix.service" do_install () { sh ./postfix-install 'install_root=${D}' \ 'config_directory=${sysconfdir}/postfix' \ - 'daemon_directory=${libexecdir}' \ + 'daemon_directory=${libexecdir}/postfix' \ 'command_directory=${sbindir}' \ 'queue_directory=${localstatedir}/spool/postfix' \ 'sendmail_path=${sbindir}/sendmail.postfix' \ @@ -149,8 +149,8 @@ do_install () { mv ${D}${sysconfdir}/postfix/main.cf ${D}${sysconfdir}/postfix/sample-main.cf install -m 755 ${S}/bin/smtp-sink ${D}/${sbindir}/ install -d ${D}${sysconfdir}/init.d - install -m 644 ${WORKDIR}/main.cf_2.0 ${D}${sysconfdir}/postfix/main.cf - sed -i 's#@LIBEXECDIR@#${libexecdir}#' ${D}${sysconfdir}/postfix/main.cf + install -m 644 ${WORKDIR}/main.cf ${D}${sysconfdir}/postfix/main.cf + sed -i 's#@LIBEXECDIR@#${libexecdir}/postfix#' ${D}${sysconfdir}/postfix/main.cf install -m 755 ${WORKDIR}/check_hostname.sh ${D}${sbindir}/ @@ -159,11 +159,11 @@ do_install () { install -d ${D}${systemd_unitdir}/system install -m 0644 ${WORKDIR}/postfix.service ${D}${systemd_unitdir}/system - sed -i -e 's#@LIBEXECDIR@#${libexecdir}#g' ${D}${systemd_unitdir}/system/postfix.service + sed -i -e 's#@LIBEXECDIR@#${libexecdir}/postfix#g' ${D}${systemd_unitdir}/system/postfix.service sed -i -e 's#@LOCALSTATEDIR@#${localstatedir}#g' ${D}${systemd_unitdir}/system/postfix.service sed -i -e 's#@SBINDIR@#${sbindir}#g' ${D}${systemd_unitdir}/system/postfix.service - install -m 0755 ${WORKDIR}/aliasesdb ${D}${libexecdir} + install -m 0755 ${WORKDIR}/aliasesdb ${D}${libexecdir}/postfix install -m 770 -d ${D}${localstatedir}/spool/postfix chown postfix:postfix ${D}${localstatedir}/spool/postfix @@ -217,6 +217,12 @@ do_install_append_class-native() { do_install_append_class-target() { # Remove references to buildmachine paths in target makedefs.out sed -i 's:-fdebug-prefix-map[^ ]*::g; s:--sysroot=${STAGING_DIR_TARGET}::g' ${D}/etc/postfix/makedefs.out + # Since we are building recipe postfix, newaliases and postmap come from our sysroot_native. + touch ${D}/etc/aliases + newaliases -C ${D}/etc/postfix/main.cf -oA${D}/etc/aliases + touch ${D}/etc/postfix/virtual_alias + postmap -c ${D}/etc/postfix ${D}/etc/postfix/virtual_alias + } NATIVE_INSTALL_WORKS = "1" @@ -240,13 +246,8 @@ pkg_postinst_${PN} () { touch /etc/postfix/virtual_alias postmap /etc/postfix/virtual_alias else - touch $D/etc/aliases - newaliases -C $D/etc/postfix/main.cf -oA$D/etc/aliases - touch $D/etc/postfix/virtual_alias - postmap -c $D/etc/postfix $D/etc/postfix/virtual_alias - if ${@'true' if 'linuxstdbase' in d.getVar('DISTROOVERRIDES', False) else 'false'}; then - # /usr/lib/sendmial is required by LSB core test + # /usr/lib/sendmail is required by LSB core test [ ! -L $D/usr/lib/sendmail ] && ln -sf ${sbindir}/sendmail $D/usr/lib/ fi fi @@ -255,4 +256,5 @@ pkg_postinst_${PN} () { # Exclude .debug directories from the main package FILES_${PN} = "${sysconfdir} ${localstatedir} ${bindir}/* ${sbindir}/* \ ${libexecdir}/* ${systemd_unitdir}/*" -FILES_${PN}-dbg += "${libexecdir}/.debug" +CONFFILES_${PN} = "/etc/aliases /etc/postfix/virtual_alias*" +FILES_${PN}-dbg += "${libexecdir}/postfix/.debug" diff --git a/meta-networking/recipes-daemons/postfix/postfix_3.2.2.bb b/meta-networking/recipes-daemons/postfix/postfix_3.2.2.bb index 439ede9b65..89af406ac3 100644 --- a/meta-networking/recipes-daemons/postfix/postfix_3.2.2.bb +++ b/meta-networking/recipes-daemons/postfix/postfix_3.2.2.bb @@ -1,18 +1,9 @@ require postfix.inc -SRC_URI = "ftp://ftp.porcupine.org/mirrors/postfix-release/official/postfix-${PV}.tar.gz \ - file://makedefs.patch \ - file://install.patch \ - file://main.cf_2.0 \ - file://postfix \ - file://internal_recipient \ - file://postfix.service \ - file://aliasesdb \ - file://check_hostname.sh \ - file://0001-Check-for-glibc-before-setting-CANT_USE_SEND_RECV_MS.patch \ - file://0001-makedefs-Use-native-compiler-to-build-makedefs.test.patch \ - file://postfix-install.patch \ - file://icu-config.patch \ +SRC_URI += "file://0001-Check-for-glibc-before-setting-CANT_USE_SEND_RECV_MS.patch \ + file://0001-makedefs-Use-native-compiler-to-build-makedefs.test.patch \ + file://postfix-install.patch \ + file://icu-config.patch \ " SRC_URI[md5sum] = "aea073a9b0bea5bdb590460a270a4aa0" SRC_URI[sha256sum] = "d06849418d119d09366997b2b481bb23f737629769b4e4a52da42fb3ad8b0576" -- cgit 1.2.3-korg