diff options
author | Vieri Di Paola <rentorbuy@yahoo.com> | 2019-06-18 14:54:00 +0200 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2019-07-14 15:08:45 +0200 |
commit | 38341c665404d9bd6e58d71929d0e0569713077b (patch) | |
tree | 7b9b400d03dbbc22245cb2a1140d4870aef8a464 | |
parent | dev-lang/python: Bump to 3.6.9 (diff) | |
download | gentoo-38341c665404d9bd6e58d71929d0e0569713077b.tar.gz gentoo-38341c665404d9bd6e58d71929d0e0569713077b.tar.bz2 gentoo-38341c665404d9bd6e58d71929d0e0569713077b.zip |
mail-filter/mimedefang: readd
Thanks to Eddie Chapman et al.
Signed-off-by: Vieri Di Paola <rentorbuy@yahoo.com>
Package-Manager: Portage-2.3.51, Repoman-2.3.11
Closes: https://github.com/gentoo/gentoo/pull/11833
Signed-off-by: Michał Górny <mgorny@gentoo.org>
-rw-r--r-- | mail-filter/mimedefang/Manifest | 1 | ||||
-rw-r--r-- | mail-filter/mimedefang/files/mimedefang-2.72-ldflags.patch | 38 | ||||
-rw-r--r-- | mail-filter/mimedefang/files/mimedefang-tests.patch | 11 | ||||
-rw-r--r-- | mail-filter/mimedefang/files/mimedefang.conf | 157 | ||||
-rw-r--r-- | mail-filter/mimedefang/files/mimedefang.init | 60 | ||||
-rw-r--r-- | mail-filter/mimedefang/metadata.xml | 19 | ||||
-rw-r--r-- | mail-filter/mimedefang/mimedefang-2.84.ebuild | 75 |
7 files changed, 361 insertions, 0 deletions
diff --git a/mail-filter/mimedefang/Manifest b/mail-filter/mimedefang/Manifest new file mode 100644 index 000000000000..2e890f20fb13 --- /dev/null +++ b/mail-filter/mimedefang/Manifest @@ -0,0 +1 @@ +DIST mimedefang-2.84.tar.gz 371596 BLAKE2B b9b871d6a438792afbcebfcd99a77a1f9bb2c0dc7826abea74db913c6dc154403753a3016dc0647e9873256fe354649dea096c0e50d54f8db16ff8d2b91f54f4 SHA512 ffe039654d2e3f649219efc559380e39b21ce910becc36e262356d59d50129f8683ee2e59dd9680aff46478ccebd6b3d9c4567f85ade9a8464077350f4e52f48 diff --git a/mail-filter/mimedefang/files/mimedefang-2.72-ldflags.patch b/mail-filter/mimedefang/files/mimedefang-2.72-ldflags.patch new file mode 100644 index 000000000000..998b3183e661 --- /dev/null +++ b/mail-filter/mimedefang/files/mimedefang-2.72-ldflags.patch @@ -0,0 +1,38 @@ +--- mimedefang-2.72/Makefile.in.orig ++++ mimedefang-2.72/Makefile.in +@@ -52,7 +52,7 @@ + all: mimedefang mimedefang-multiplexor md-mx-ctrl pod2man + + mimedefang-multiplexor: mimedefang-multiplexor.o event.o event_tcp.o drop_privs_nothread.o notifier.o syslog-fac.o utils.o $(EMBPERLOBJS) +- $(CC) $(CFLAGS) -o mimedefang-multiplexor mimedefang-multiplexor.o event.o event_tcp.o drop_privs_nothread.o syslog-fac.o notifier.o utils.o $(EMBPERLOBJS) $(LIBS_WITHOUT_PTHREAD) $(EMBPERLLDFLAGS) $(EMBPERLLIBS) ++ $(CC) $(CFLAGS) $(LDFLAGS) -o mimedefang-multiplexor mimedefang-multiplexor.o event.o event_tcp.o drop_privs_nothread.o syslog-fac.o notifier.o utils.o $(EMBPERLOBJS) $(LIBS_WITHOUT_PTHREAD) $(EMBPERLLDFLAGS) $(EMBPERLLIBS) + + embperl.o: embperl.c + $(CC) $(CFLAGS) $(EMBPERLCFLAGS) $(PTHREAD_FLAG) $(DEFS) $(MINCLUDE) -c -o embperl.o $(srcdir)/embperl.c +@@ -67,7 +67,7 @@ + $(CC) $(CFLAGS) $(EMBPERLCFLAGS) $(PTHREAD_FLAG) $(DEFS) $(MINCLUDE) -c -o test-embed-perl.o $(srcdir)/test-embed-perl.c + + te: test-embed-perl.o +- $(CC) $(CFLAGS) -o te test-embed-perl.o $(LIBS_WITHOUT_PTHREAD) $(EMBPERLLDFLAGS) $(EMBPERLLIBS) ++ $(CC) $(CFLAGS) $(LDFLAGS) -o te test-embed-perl.o $(LIBS_WITHOUT_PTHREAD) $(EMBPERLLDFLAGS) $(EMBPERLLIBS) + rm_r.o: rm_r.c + $(CC) $(CFLAGS) $(PTHREAD_FLAG) $(DEFS) $(MINCLUDE) -c -o rm_r.o $(srcdir)/rm_r.c + +@@ -75,7 +75,7 @@ + $(CC) $(CFLAGS) $(PTHREAD_FLAG) $(DEFS) $(MINCLUDE) -c -o syslog-fac.o $(srcdir)/syslog-fac.c + + md-mx-ctrl: md-mx-ctrl.o +- $(CC) $(CFLAGS) -o md-mx-ctrl md-mx-ctrl.o $(LIBS_WITHOUT_PTHREAD) ++ $(CC) $(CFLAGS) $(LDFLAGS) -o md-mx-ctrl md-mx-ctrl.o $(LIBS_WITHOUT_PTHREAD) + + md-mx-ctrl.o: md-mx-ctrl.c + $(CC) $(CFLAGS) $(DEFS) $(MINCLUDE) -c -o md-mx-ctrl.o $(srcdir)/md-mx-ctrl.c +@@ -99,7 +99,7 @@ + $(CC) $(CFLAGS) $(DEFS) $(MINCLUDE) -c -o mimedefang-multiplexor.o $(srcdir)/mimedefang-multiplexor.c + + mimedefang: mimedefang.o drop_privs_threaded.o utils.o rm_r.o syslog-fac.o dynbuf.o milter_cap.o gen_id.o +- $(CC) $(CFLAGS) $(PTHREAD_FLAG) -o mimedefang mimedefang.o drop_privs_threaded.o utils.o rm_r.o syslog-fac.o dynbuf.o milter_cap.o gen_id.o $(LDFLAGS) -lmilter $(LIBS) ++ $(CC) $(CFLAGS) $(LDFLAGS) $(PTHREAD_FLAG) -o mimedefang mimedefang.o drop_privs_threaded.o utils.o rm_r.o syslog-fac.o dynbuf.o milter_cap.o gen_id.o $(LDFLAGS) -lmilter $(LIBS) + + mimedefang.o: mimedefang.c mimedefang.h + $(CC) $(CFLAGS) $(PTHREAD_FLAG) $(DEFS) $(MINCLUDE) -c -o mimedefang.o $(srcdir)/mimedefang.c diff --git a/mail-filter/mimedefang/files/mimedefang-tests.patch b/mail-filter/mimedefang/files/mimedefang-tests.patch new file mode 100644 index 000000000000..82f8b9b56160 --- /dev/null +++ b/mail-filter/mimedefang/files/mimedefang-tests.patch @@ -0,0 +1,11 @@ +--- a/t/lib/MIMEDefang/Unit.pm.ori 2010-05-13 23:12:23.000000000 +0200 ++++ b/t/lib/MIMEDefang/Unit.pm 2019-07-10 15:08:35.190824853 +0200 +@@ -12,7 +12,7 @@ + no warnings 'redefine'; + local *CORE::GLOBAL::exit = sub { }; + local @ARGV = (); +- do 'mimedefang.pl.in'; ++ do './mimedefang.pl.in'; + use warnings 'redefine'; + } + 1; diff --git a/mail-filter/mimedefang/files/mimedefang.conf b/mail-filter/mimedefang/files/mimedefang.conf new file mode 100644 index 000000000000..5deb1401d5ef --- /dev/null +++ b/mail-filter/mimedefang/files/mimedefang.conf @@ -0,0 +1,157 @@ +#################################### +# Mandatory options for MIMEDefang # +#################################### + +# spool directory +SPOOLDIR='/var/spool/MIMEDefang' + +# The socket used by mimedefang to communicate with the sendmail binary. +# You can leave this commented out. +# SOCKET="${SPOOLDIR}/mimedefang.sock" + +# The socket used by the multiplexor. +# You can leave this commented out. +# MX_SOCKET="${SPOOLDIR}/mimedefang-multiplexor.sock" + +######################################## +# Additional options for MIMEDefang # +# For a list of all of them: # +# man mimedefang (MD_OPTS) # +# man mimedefang-multiplexor (MX_OPTS) # +######################################## + +############# +# MD_MX_OPTS: common options to both processes. +############# + +# Run the multiplexor and filters as this user, not root (RECOMMENDED). +MD_MX_OPTS+=' -U defang' + +# Syslog facility +# MD_MX_OPTS+=' -S mail' + +########## +# MD_OPTS: mimdefang options. +########## + +# Number of workers reserved for connections from loopback. Use -1 +# for default behaviour, 0 to allow loopback connections to queue, +# or >0 to reserve workers for loopback connections +MD_OPTS+=' -R -1' + +# If you want to keep spool directories around if the filter fails, +# add the -k option. +# MD_OPTS+=' -k' + +# Turns on the multiplexor relay checking function +# MD_OPTS+=' -r' + +# Turns on the multiplexor HELO checking function +# MD_OPTS+=' -H' + +# Turns on the multiplexor sender checking function +# MD_OPTS+=' -s' + +# Turns on the multiplexor recipient checking function +# MD_OPTS+=' -t' + +# Extra sendmail macros to pass. +# MD_OPTS+=' -a auth_author' + +# Do not reveal info via X-Scanned-By header (recommended). +MD_OPTS+=' -X' + +########## +# MX_OPTS: mimdefang-multiplexor options. +########## + +# multiplexor logs events to syslog +MX_OPTS+=' -l' + +# Use an embedded Perl interpreter +# MX_OPTS+=' -E' + +# Set to full path of socket for Sendmail's SOCKETMAP map, if you +# want to use it with MIMEDefang +# MX_OPTS+=("-N ${SPOOLDIR}/map.sock") + +# The multiplexor does not start all workers at the same time. Instead, +# it starts one worker every X seconds when the system is idle. +# If the system is busy, the multiplexor starts workers as incoming mail +# requires attention. +# MX_OPTS+=' -w 3' + +# The next setting is an absolute limit on worker activation. The multiplexor +# will NEVER activate a worker within X seconds of another. +# The default of zero means that the multiplexor will activate workers as +# quickly as necessary to keep up with incoming mail. +# MX_OPTS+=' -W 0' + +# The multiplexor can log stats to a file (eg. /var/log/mimedefang/stats). +# The log directory must exist and be writable by the user you're running +# MIMEDefang as. +# MX_OPTS+=' -t /var/log/mimedefang/stats' + +# The stats file can be flushed after each entry. +# MX_OPTS+=' -u' + +# The multiplexor can log stats to syslog. +# MX_OPTS+=' -T' + +# Maximum # of requests a process handles. +# MX_OPTS+=' -r 200' + +# Minimum number of processes to keep. The default of 0 is probably +# too low; we suggest 2 instead. +MX_OPTS+=' -m 2' + +# Maximum number of processes to run (mail received while this many +# processes are running is rejected with a temporary failure, so be +# wary of how many emails you receive at a time). This applies only +# if you DO use the multiplexor. The default value of 2 is probably +# too low; we suggest 10 instead. +MX_OPTS+=' -x 10' + +# Uncomment to log worker status; it will be logged every X seconds. +# MX_OPTS+=' -L 30' + +# Uncomment next line to have busy workers send status updates to the +# multiplexor. NOTE: Consumes one extra file descriptor per worker, plus +# a bit of CPU time. +# MX_OPTS+=' -Z' + +# Limit worker processes' resident-set size to this many kilobytes. Default +# is unlimited. +# MX_OPTS+=' -R 10000' + +# Limit total size of worker processes' memory space to this many kilobytes. +# Default is unlimited. +# MX_OPTS+=' -M 30000' + +# If you want to use the "notification" facility, set the appropriate port. +# See the mimedefang-notify man page for details. +# MX_OPTS+=' -O inet:4567' + +# Number of seconds a process should be idle before checking for +# minimum number and killed. +# MX_OPTS+=' -i 300' + +# Number of seconds a process is allowed to scan an email before it is +# considered dead. The default is 30 seconds; we suggest 600. +MX_OPTS+=' -b 600' + +# Multiplexor queue size -- default is 0 (no queueing) +# MX_OPTS+=' -q 10' + +# Multiplexor queue timeout -- default is 30 seconds +# MX_OPTS+=' -Q 30' + +# SUBFILTER -F option specifies which filter rules file to use +# MX_OPTS+=' -F /etc/mail/mimedefang-filter' + +########################### +# Upstream recommendation # +########################### +# Locale should be set to "C" for generating valid date headers +LC_ALL=C +export LC_ALL diff --git a/mail-filter/mimedefang/files/mimedefang.init b/mail-filter/mimedefang/files/mimedefang.init new file mode 100644 index 000000000000..931f47bf5919 --- /dev/null +++ b/mail-filter/mimedefang/files/mimedefang.init @@ -0,0 +1,60 @@ +#!/sbin/openrc-run +# Copyright 1999-2019 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +SPOOLDIR="${SPOOLDIR:-/var/spool/MIMEDefang}" +PID="${SPOOLDIR}/mimedefang.pid" +MXPID="${SPOOLDIR}/mimedefang-multiplexor.pid" +LOCK="${SPOOLDIR}/mimedefang.lock" +MXLOCK="${SPOOLDIR}/mimedefang-multiplexor.lock" + +# Make sure required vars are set +SOCKET="${SOCKET:-${SPOOLDIR}/mimedefang.sock}" +MX_SOCKET="${MX_SOCKET:-${SPOOLDIR}/mimedefang-multiplexor.sock}" + +description="MIMEDefang mail filter" +extra_commands="checkconfig" +description_checkconfig="Check config for ${RC_SVCNAME}" + +depend() { + use antivirus +} + +checkconfig() { + checkpath -d "${SPOOLDIR}" + einfo "multiplexor socket: ${MX_SOCKET}" + einfo "sendmail socket: ${SOCKET}" +} + +start() { + checkconfig || return 1 + + # First start mimedefang multiplexor + rm -f "${MX_SOCKET}" > /dev/null 2>&1 + ebegin "Starting mimedefang-multiplexor" + start-stop-daemon --start --quiet \ + --exec /usr/bin/mimedefang-multiplexor -- -p "${MXPID}" -o "${MXLOCK}" -z "${SPOOLDIR}" \ + ${MD_MX_OPTS} ${MX_OPTS} \ + -s "${MX_SOCKET}" + eend $? "Failed to start mimedefang-multiplexor" + + # And now start mimedefang + rm -f "${SOCKET}" > /dev/null 2>&1 + ebegin "Starting mimedefang" + start-stop-daemon --start --quiet \ + --exec /usr/bin/mimedefang -- -P "${PID}" -o "${LOCK}" -z "${SPOOLDIR}" \ + ${MD_MX_OPTS} ${MD_OPTS} \ + -m "${MX_SOCKET}" \ + -p "${SOCKET}" + eend $? "Failed to start mimedefang" +} + +stop() { + ebegin "Stopping mimedefang" + start-stop-daemon --stop --quiet --pidfile "${PID}" + eend $? "Failed to stop mimedefang" + + ebegin "Stopping mimedefang-multiplexor" + start-stop-daemon --stop --quiet --pidfile "${MXPID}" + eend $? "Failed to stop mimedefang-multiplexor" +} diff --git a/mail-filter/mimedefang/metadata.xml b/mail-filter/mimedefang/metadata.xml new file mode 100644 index 000000000000..be8b6de0ae7a --- /dev/null +++ b/mail-filter/mimedefang/metadata.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="person"> + <email>rentorbuy@yahoo.com</email> + <name>Vieri Di Paola</name> + </maintainer> + <maintainer type="project"> + <email>proxy-maint@gentoo.org</email> + <name>Proxy Maintainers</name> + </maintainer> + <longdescription lang="en"> + A program for Milter supported mail servers that implements antispam, + antivirus and other customizable filtering on email messages. + </longdescription> + <use> + <flag name="poll">Use poll instead of select</flag> + </use> +</pkgmetadata> diff --git a/mail-filter/mimedefang/mimedefang-2.84.ebuild b/mail-filter/mimedefang/mimedefang-2.84.ebuild new file mode 100644 index 000000000000..f927bb3e5b4e --- /dev/null +++ b/mail-filter/mimedefang/mimedefang-2.84.ebuild @@ -0,0 +1,75 @@ +# Copyright 1999-2019 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +inherit user + +DESCRIPTION="Antispam, antivirus and other customizable filters for MTAs with Milter support" +HOMEPAGE="http://www.mimedefang.org/" +SRC_URI="http://www.mimedefang.org/static/${P}.tar.gz" + +LICENSE="GPL-2+" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="clamav +poll test" +RESTRICT="!test? ( test )" + +RDEPEND=">=dev-perl/MIME-tools-5.412 + dev-perl/IO-stringy + virtual/perl-MIME-Base64 + dev-perl/Digest-SHA1 + dev-perl/MailTools + dev-perl/Unix-Syslog + clamav? ( app-antivirus/clamav ) + || ( mail-filter/libmilter mail-mta/sendmail )" +DEPEND="${RDEPEND} + test? ( + dev-perl/Test-Class + dev-perl/Test-Most + )" + +pkg_setup() { + enewgroup defang + enewuser defang -1 -1 -1 defang +} + +src_prepare() { + eapply "${FILESDIR}/${PN}-2.72-ldflags.patch" + eapply "${FILESDIR}/${PN}-tests.patch" + eapply_user +} + +src_configure() { + econf \ + --with-user=defang \ + $(use_enable poll) \ + $(use_enable clamav) \ + $(use_enable clamav clamd) +} + +src_install() { + emake DESTDIR="${D}" INSTALL_STRIP_FLAG="" install + + fowners defang:defang /etc/mail/mimedefang-filter + fperms 644 /etc/mail/mimedefang-filter + insinto /etc/mail/ + newins "${S}"/SpamAssassin/spamassassin.cf sa-mimedefang.cf + + keepdir /var/spool/{MD-Quarantine,MIMEDefang} + fowners defang:defang /var/spool/{MD-Quarantine,MIMEDefang} + fperms 700 /var/spool/{MD-Quarantine,MIMEDefang} + + keepdir /var/log/mimedefang + + newinitd "${FILESDIR}"/${PN}.init ${PN} + newconfd "${FILESDIR}"/${PN}.conf ${PN} + + dodoc -r examples contrib +} + +pkg_postinst() { + elog "You can install Mail::SpamAssassin (mail-filter/spamassassin) and" + elog "HTML::Parser (dev-perl/HTML-Parser) even after installing if you require" + elog "them as they are loaded at run-time." +} |