qmail.eclass: hide qmail-pop3 behind a use flag
authorRolf Eike Beer <eike@sf-mail.de>
Thu, 10 Oct 2019 11:49:53 +0000 (13:49 +0200)
committerJoonas Niilola <juippis@gentoo.org>
Tue, 12 Nov 2019 14:45:30 +0000 (16:45 +0200)
Other solutions offer much more features and better security, so do not install
this by default. Keep it for the moment for those who explicitely want it.

Signed-off-by: Rolf Eike Beer <eike@sf-mail.de>
Closes: https://github.com/gentoo/gentoo/pull/13551
Signed-off-by: Joonas Niilola <juippis@gentoo.org>
eclass/qmail.eclass
mail-mta/netqmail/metadata.xml
mail-mta/netqmail/netqmail-1.06-r10.ebuild
mail-mta/netqmail/netqmail-1.06-r11.ebuild [new file with mode: 0644]
mail-mta/netqmail/netqmail-1.06-r4.ebuild

index b6ef483aa82cbece8e878f38df8134cb6cc3b9d5..7e33611462be1dab0e44f6e77c4fb90135cb2a15 100644 (file)
@@ -64,7 +64,7 @@ is_prime() {
 
 dospp() {
        insinto "${QMAIL_HOME}"/plugins/
-       insopts -o root -g "$GROUP_ROOT" -m 0755
+       insopts -o root -g "${GROUP_ROOT}" -m 0755
        newins $1 ${2:-$(basename $1)}
 }
 
@@ -77,8 +77,8 @@ dosupervise() {
        local runfile=${2:-${service}} logfile=${3:-${service}-log}
        [[ -z "${service}" ]] && die "no service given"
 
-       insopts -o root -g "$GROUP_ROOT" -m 0755
-       diropts -o root -g "$GROUP_ROOT" -m 0755
+       insopts -o root -g "${GROUP_ROOT}" -m 0755
+       diropts -o root -g "${GROUP_ROOT}" -m 0755
 
        dodir ${SUPERVISE_DIR}/${service}{,/log}
        fperms +t ${SUPERVISE_DIR}/${service}{,/log}
@@ -169,11 +169,13 @@ qmail_full_install() {
        einfo "Installing all qmail software"
        insopts -o root -g qmail -m 755
        doins bouncesaying condredirect config-fast except preline qbiff \
-               qmail-{pop3d,qmqpd,qmtpd,qread,qstat,smtpd,tcpok,tcpto} \
+               qmail-{qmqpd,qmtpd,qread,qstat,smtpd,tcpok,tcpto} \
                qreceipt qsmhook tcp-env
+       use pop3 && doins qmail-pop3d
 
        insopts -o root -g qmail -m 711
-       doins qmail-{clean,getpw,local,popup,pw2u,remote,rspawn,send} splogger
+       doins qmail-{clean,getpw,local,pw2u,remote,rspawn,send} splogger
+       use pop3 && doins qmail-popup
 
        insopts -o root -g qmail -m 700
        doins qmail-{lspawn,newmrh,newu,start}
@@ -188,12 +190,12 @@ qmail_full_install() {
 qmail_config_install() {
        einfo "Installing stock configuration files"
        insinto "${QMAIL_HOME}"/control
-       insopts -o root -g "$GROUP_ROOT" -m 644
+       insopts -o root -g "${GROUP_ROOT}" -m 644
        doins "${GENQMAIL_S}"/control/{conf-*,defaultdelivery}
 
        einfo "Installing configuration sanity checker and launcher"
        insinto "${QMAIL_HOME}"/bin
-       insopts -o root -g "$GROUP_ROOT" -m 644
+       insopts -o root -g "${GROUP_ROOT}" -m 644
        doins "${GENQMAIL_S}"/control/qmail-config-system
 
        declare -F qmail_config_install_hook >/dev/null && \
@@ -244,9 +246,9 @@ qmail_maildir_install() {
        done
 
        einfo "Setting up default maildirs in the account skeleton"
-       diropts -o root -g "$GROUP_ROOT" -m 755
+       diropts -o root -g "${GROUP_ROOT}" -m 755
        insinto /etc/skel
-       insopts -o root -g "$GROUP_ROOT" -m 644
+       insopts -o root -g "${GROUP_ROOT}" -m 644
        newins "${GENQMAIL_S}"/control/defaultdelivery .qmail.sample
        "${MAILDIRMAKE}" "${D}"/etc/skel/.maildir
        keepdir /etc/skel/.maildir/{cur,new,tmp}
@@ -258,10 +260,16 @@ qmail_maildir_install() {
 qmail_tcprules_install() {
        dodir "${TCPRULES_DIR}"
        insinto "${TCPRULES_DIR}"
-       insopts -o root -g "$GROUP_ROOT" -m 0644
+       insopts -o root -g "${GROUP_ROOT}" -m 0644
        doins "${GENQMAIL_S}"/tcprules/Makefile.qmail
        doins "${GENQMAIL_S}"/tcprules/tcp.qmail-*
-       use ssl || rm -f "${D}${TCPRULES_DIR}"/tcp.qmail-pop3sd
+       use ssl && use pop3 || rm -f "${D}${TCPRULES_DIR}"/tcp.qmail-pop3sd
+}
+
+qmail_supervise_install_one() {
+       dosupervise ${i}
+       diropts -o qmaill -g "${GROUP_ROOT}" -m 755
+       keepdir /var/log/qmail/${i}
 }
 
 qmail_supervise_install() {
@@ -269,16 +277,13 @@ qmail_supervise_install() {
 
        cd "${GENQMAIL_S}"/supervise
 
-       for i in qmail-{send,smtpd,qmtpd,qmqpd,pop3d}; do
-               dosupervise ${i}
-               diropts -o qmaill -g "$GROUP_ROOT" -m 755
-               keepdir /var/log/qmail/${i}
+       for i in qmail-{send,smtpd,qmtpd,qmqpd}; do
+               qmail_supervise_install_one ${i}
        done
 
-       if use ssl; then
-               dosupervise qmail-pop3sd
-               diropts -o qmaill -g "$GROUP_ROOT" -m 755
-               keepdir /var/log/qmail/qmail-pop3sd
+       if use pop3; then
+               qmail_supervise_install_one qmail-pop3d
+               use ssl && qmail_supervise_install_one qmail-pop3sd
        fi
 
        declare -F qmail_supervise_install_hook >/dev/null && \
@@ -288,7 +293,7 @@ qmail_supervise_install() {
 qmail_spp_install() {
        einfo "Installing qmail-spp configuration files"
        insinto "${QMAIL_HOME}"/control/
-       insopts -o root -g "$GROUP_ROOT" -m 0644
+       insopts -o root -g "${GROUP_ROOT}" -m 0644
        doins "${GENQMAIL_S}"/spp/smtpplugins
 
        einfo "Installing qmail-spp plugins"
@@ -308,16 +313,16 @@ qmail_ssl_install() {
 
        einfo "Installing SSL Certificate creation script"
        insinto "${QMAIL_HOME}"/control
-       insopts -o root -g "$GROUP_ROOT" -m 0644
+       insopts -o root -g "${GROUP_ROOT}" -m 0644
        doins "${GENQMAIL_S}"/ssl/servercert.cnf
 
        insinto "${QMAIL_HOME}"/bin
-       insopts -o root -g "$GROUP_ROOT" -m 0755
+       insopts -o root -g "${GROUP_ROOT}" -m 0755
        doins "${GENQMAIL_S}"/ssl/mkservercert
 
        einfo "Installing RSA key generation cronjob"
        insinto /etc/${CRON_FOLDER}
-       insopts -o root -g "$GROUP_ROOT" -m 0755
+       insopts -o root -g "${GROUP_ROOT}" -m 0755
        doins "${GENQMAIL_S}"/ssl/qmail-genrsacert.sh
 
        keepdir "${QMAIL_HOME}"/control/tlshosts
@@ -375,7 +380,9 @@ qmail_rootmail_fixup() {
 
 qmail_tcprules_fixup() {
        mkdir -p "${TCPRULES_DIR}"
-       for f in {smtp,qmtp,qmqp,pop3}{,.cdb}; do
+       local POP_FILES=
+       use pop3 && POP_FILES="pop3 pop3.cdb"
+       for f in {smtp,qmtp,qmqp}{,.cdb} ${POP_FILES}; do
                old="/etc/tcp.${f}"
                new="${TCPRULES_DIR}/tcp.qmail-${f}"
                fail=0
@@ -417,13 +424,15 @@ qmail_supervise_config_notice() {
        elog "ln -s ${SUPERVISE_DIR}/qmail-send /service/qmail-send"
        elog "ln -s ${SUPERVISE_DIR}/qmail-smtpd /service/qmail-smtpd"
        elog
-       elog "To start the pop3 server as well, create the following link:"
-       elog "ln -s ${SUPERVISE_DIR}/qmail-pop3d /service/qmail-pop3d"
-       elog
-       if use ssl; then
-               elog "To start the pop3s server as well, create the following link:"
-               elog "ln -s ${SUPERVISE_DIR}/qmail-pop3sd /service/qmail-pop3sd"
+       if use pop3; then
+               elog "To start the pop3 server as well, create the following link:"
+               elog "ln -s ${SUPERVISE_DIR}/qmail-pop3d /service/qmail-pop3d"
                elog
+               if use ssl; then
+                       elog "To start the pop3s server as well, create the following link:"
+                       elog "ln -s ${SUPERVISE_DIR}/qmail-pop3sd /service/qmail-pop3sd"
+                       elog
+               fi
        fi
        elog "Additionally, the QMTP and QMQP protocols are supported, "
        elog "and can be started as:"
index c6d666316346ad396da3aa8e91a017ccbf1aea1a..208703780530804fdf8f0b80fb777b256d6f5f0f 100644 (file)
@@ -14,6 +14,7 @@
                <flag name="gencertdaily">Generate SSL certificates daily instead of
                        hourly</flag>
                <flag name="highvolume">Prepare netqmail for high volume servers</flag>
+               <flag name="pop3">Include POP3 server</flag>
        </use>
        <upstream>
                <remote-id type="sourceforge">qmail-spp</remote-id>
index 315e297526f08e5866f4d9b0ac03132ab95c4e34..35fb8779c8ddd115c085e5779f5ae8b9b12e8238 100644 (file)
@@ -42,7 +42,7 @@ SRC_URI="mirror://qmail/${P}.tar.gz
 LICENSE="public-domain"
 SLOT="0"
 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~mips ~ppc ~ppc64 ~x86"
-IUSE="authcram gencertdaily highvolume libressl qmail-spp ssl vanilla"
+IUSE="authcram gencertdaily highvolume libressl +pop3 qmail-spp ssl vanilla"
 REQUIRED_USE="vanilla? ( !ssl !qmail-spp !highvolume )"
 RESTRICT="test"
 
diff --git a/mail-mta/netqmail/netqmail-1.06-r11.ebuild b/mail-mta/netqmail/netqmail-1.06-r11.ebuild
new file mode 100644 (file)
index 0000000..cced7ca
--- /dev/null
@@ -0,0 +1,198 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+GENQMAIL_PV=20191010
+QMAIL_SPP_PV=0.42
+
+QMAIL_TLS_PV=20190114
+QMAIL_TLS_F=${PN}-1.05-tls-smtpauth-${QMAIL_TLS_PV}.patch
+QMAIL_TLS_CVE=vu555316.patch
+
+QMAIL_BIGTODO_PV=103
+QMAIL_BIGTODO_F=big-todo.${QMAIL_BIGTODO_PV}.patch
+
+QMAIL_LARGE_DNS='qmail-103.patch'
+
+QMAIL_SMTPUTF8='qmail-smtputf8.patch'
+
+inherit qmail
+
+DESCRIPTION="qmail -- a secure, reliable, efficient, simple message transfer agent"
+HOMEPAGE="
+       http://netqmail.org
+       https://cr.yp.to/qmail.html
+       http://qmail.org
+"
+SRC_URI="mirror://qmail/${P}.tar.gz
+       https://github.com/DerDakon/genqmail/releases/download/genqmail-${GENQMAIL_PV}/${GENQMAIL_F}
+       https://www.ckdhr.com/ckd/${QMAIL_LARGE_DNS}
+       !vanilla? (
+               highvolume? ( mirror://qmail/${QMAIL_BIGTODO_F} )
+               qmail-spp? ( mirror://sourceforge/qmail-spp/${QMAIL_SPP_F} )
+               ssl? (
+                       https://mirror.alexh.name/qmail/netqmail/${QMAIL_TLS_F}
+                       http://inoa.net/qmail-tls/${QMAIL_TLS_CVE}
+                       https://arnt.gulbrandsen.priv.no/qmail/qmail-smtputf8.patch
+               )
+       )
+"
+
+LICENSE="public-domain"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~mips ~ppc ~ppc64 ~x86"
+IUSE="authcram gencertdaily highvolume libressl pop3 qmail-spp ssl vanilla"
+REQUIRED_USE="vanilla? ( !ssl !qmail-spp !highvolume )"
+RESTRICT="test"
+
+DEPEND="
+       acct-group/nofiles
+       acct-group/qmail
+       acct-user/alias
+       acct-user/qmaild
+       acct-user/qmaill
+       acct-user/qmailp
+       acct-user/qmailq
+       acct-user/qmailr
+       acct-user/qmails
+       net-dns/libidn2
+       net-mail/queue-repair
+       sys-apps/gentoo-functions
+       sys-apps/groff
+       ssl? (
+               !libressl? ( >=dev-libs/openssl-1.1:0= )
+               libressl? ( dev-libs/libressl:= )
+       )
+"
+RDEPEND="${DEPEND}
+       sys-apps/ucspi-tcp
+       virtual/checkpassword
+       virtual/daemontools
+       authcram? ( >=net-mail/cmd5checkpw-0.30 )
+       ssl? (
+               pop3? ( sys-apps/ucspi-ssl )
+       )
+       !mail-mta/courier
+       !mail-mta/esmtp
+       !mail-mta/exim
+       !mail-mta/mini-qmail
+       !mail-mta/msmtp[mta]
+       !mail-mta/nullmailer
+       !mail-mta/opensmtpd
+       !mail-mta/postfix
+       !mail-mta/qmail-ldap
+       !mail-mta/sendmail
+       !mail-mta/ssmtp[mta]
+"
+
+pkg_setup() {
+       if [[ -n "${QMAIL_PATCH_DIR}" ]]; then
+               eerror
+               eerror "The QMAIL_PATCH_DIR variable for custom patches"
+               eerror "has been removed from ${PN}. If you need custom patches"
+               eerror "see 'user patches' in the portage manual."
+               eerror
+               die "QMAIL_PATCH_DIR is not supported anymore"
+       fi
+}
+
+src_unpack() {
+       genqmail_src_unpack
+       use qmail-spp && qmail_spp_src_unpack
+
+       unpack ${P}.tar.gz
+}
+
+PATCHES=(
+       "${FILESDIR}/${PV}-exit.patch"
+       "${FILESDIR}/${PV}-readwrite.patch"
+       "${DISTDIR}/${QMAIL_LARGE_DNS}"
+       "${FILESDIR}/${PV}-fbsd-utmpx.patch"
+       "${FILESDIR}/${P}-ipme-multiple.patch"
+)
+
+src_prepare() {
+       if ! use vanilla; then
+               if use ssl; then
+                       # This patch contains relative paths and needs to be cleaned up.
+                       sed 's~^--- \.\./\.\./~--- ~g' \
+                               < "${DISTDIR}"/${QMAIL_TLS_F} \
+                               > "${T}"/${QMAIL_TLS_F} || die
+                       PATCHES+=( "${T}/${QMAIL_TLS_F}"
+                               "${DISTDIR}/${QMAIL_TLS_CVE}"
+                               "${FILESDIR}/qmail-smtputf8.patch"
+                               "${FILESDIR}/qmail-smtputf8-crlf-fix.patch"
+                       )
+               fi
+               if use highvolume; then
+                       PATCHES+=( "${DISTDIR}/${QMAIL_BIGTODO_F}" )
+               fi
+
+               if use qmail-spp; then
+                       if use ssl; then
+                               SPP_PATCH="${QMAIL_SPP_S}/qmail-spp-smtpauth-tls-20060105.diff"
+                       else
+                               SPP_PATCH="${QMAIL_SPP_S}/netqmail-spp.diff"
+                       fi
+                       # make the patch work with "-p1"
+                       sed -e 's#^--- \([Mq]\)#--- a/\1#' -e 's#^+++ \([Mq]\)#+++ b/\1#' -i ${SPP_PATCH} || die
+
+                       PATCHES+=( "${SPP_PATCH}" )
+               fi
+       fi
+
+       default
+
+       qmail_src_postunpack
+
+       # Fix bug #33818 but for netqmail (Bug 137015)
+       if ! use authcram; then
+               einfo "Disabled CRAM_MD5 support"
+               sed -e 's,^#define CRAM_MD5$,/*&*/,' -i "${S}"/qmail-smtpd.c || die
+       else
+               einfo "Enabled CRAM_MD5 support"
+       fi
+
+       ht_fix_file Makefile*
+}
+
+src_compile() {
+       qmail_src_compile
+       use qmail-spp && qmail_spp_src_compile
+}
+
+src_install() {
+       qmail_src_install
+}
+
+pkg_postinst() {
+       qmail_queue_setup
+       qmail_rootmail_fixup
+       qmail_tcprules_build
+
+       qmail_config_notice
+       qmail_supervise_config_notice
+       elog
+       elog "If you are looking for documentation, check those links:"
+       elog "https://wiki.gentoo.org/wiki/Virtual_mail_hosting_with_qmail"
+       elog "  -- qmail/vpopmail Virtual Mail Hosting System Guide"
+       elog "http://www.lifewithqmail.com/"
+       elog "  -- Life with qmail"
+       elog
+}
+
+pkg_preinst() {
+       qmail_tcprules_fixup
+}
+
+pkg_config() {
+       # avoid some weird locale problems
+       export LC_ALL=C
+
+       qmail_config_fast
+       qmail_tcprules_config
+       qmail_tcprules_build
+
+       use ssl && qmail_ssl_generate
+}
index 8d6b6afbb0b8d9ec3cdfd097be5eb5c65938cf70..520694626f7998b4d68709c15e00613cda36f1fb 100644 (file)
@@ -37,7 +37,7 @@ SRC_URI="mirror://qmail/${P}.tar.gz
 LICENSE="public-domain"
 SLOT="0"
 KEYWORDS="alpha amd64 arm hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh sparc x86"
-IUSE="authcram gencertdaily highvolume libressl qmail-spp ssl vanilla"
+IUSE="authcram gencertdaily highvolume libressl +pop3 qmail-spp ssl vanilla"
 REQUIRED_USE='vanilla? ( !ssl !qmail-spp !highvolume )'
 RESTRICT="test"