Merge branch 'feature/policyd' of linux/gentoo-overlay into master
This commit is contained in:
commit
3d84dc5b86
10 changed files with 231 additions and 0 deletions
7
mail-filter/policyd/ChangeLog
Normal file
7
mail-filter/policyd/ChangeLog
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
*policyd-1.82-r3 (20 Nov 2019)
|
||||||
|
|
||||||
|
20 Nov 2019; <manuel@gentoo.org> +files/policyd-cleanup.cron,
|
||||||
|
+files/policyd-makefile.patch, +files/policyd-post182.patch,
|
||||||
|
+files/policyd.confd, +files/policyd.rc, +files/policyd.service,
|
||||||
|
+metadata.xml, +policyd-1.82-r3.ebuild:
|
||||||
|
mail-filter/policyd: Add ebuild with systemd unit file.
|
10
mail-filter/policyd/Manifest
Normal file
10
mail-filter/policyd/Manifest
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
AUX policyd-cleanup.cron 59 BLAKE2B 18aa332fa2c5e00b8a2278a930cdf5c8ec7dbe20f4f60d7c82ed14698d0f5f2caa032b6db59da9714aaafd33cbdfc8ec58a218ef76226ba4662e8dd05542c38c SHA512 220fb388adf3d7f7021992b8866f23a5f308d429885028d2b52a49140b965748d3934e7a8ebd7a6d3443878948a461271638199a44d496a90fdfebcc811e7bac
|
||||||
|
AUX policyd-makefile.patch 1439 BLAKE2B af1b28b000772f3627886c10bf3026d16dfff5fbdbf1de957c674bec4c7a79006b6c0e03d117644c80085962fc0151f29ff74cb5cfdea868ec2c1fe605803c6e SHA512 b1b27490dc3bff75f353d51091c97864562b077980e042ab2c973dcf84a1071d0c3942aa06a9a4667e286c24377fcf3db6e43606639c3ebdefce7b489c64944b
|
||||||
|
AUX policyd-post182.patch 1567 BLAKE2B 7019004993501396bada4754b40dbbf09e507220d458448aac991edc4116636d6303c3e885ea5711e46bdc4f35d1c25023172725b71c1d1629ed4ccf4478695c SHA512 155e919d8411cbeb0265b11324b234bb687d9d4125b38cdc174ad4128234d745b7ec38487b518f8a2a923868f3dfd2071f53f768aea407de814c6f53354d2718
|
||||||
|
AUX policyd.confd 61 BLAKE2B d39d4e5894dbc1164d29bf7e3fccc19c4247fd6a0f09c09f07e6f57ed531fc8aa5c22ea05ce63767e011754d1fc4aeed03b1d0cb1ef07705bf734c4e1f3b5f53 SHA512 6fbac91a71bd556e864b70534a57fcc60bf4a838ff780ee878b257313e12205ae95402c591cc62604dad8d1ee349ecea74c1646429c39587dc0ba13a697ca68f
|
||||||
|
AUX policyd.rc 440 BLAKE2B 58eb5a7975033dc287e1831bd3fe178a324a90df731d078d0242e5185d0ec2c7e2863d3ab679d43172d1e80ac7e7d044f440d33e2d65fc4920d5e652f7e24007 SHA512 353ea57078cdc9b6bac143778e5ea3fa3d5bc6f865614a90499d2687d6afe21fcd5f87d4f8ce0f2a803909de7ae95d56be880c2a4d99a1b674fdb8168e558bc2
|
||||||
|
AUX policyd.service 174 BLAKE2B ded5a09a603d84847182c589f4a3284c7c0557a42b555dd4a48b6bd1da215fe822883ab50fb061808dda26bcaea421e7aabf27486a8d5b00ab5435463f58ff0d SHA512 bcd3a05c80943cb2f8af4a9ad886a26090c787cddf535c6022086a38e0f3944311b5417a102d7074659a8970ba7dddc70b03d99d78811fea96698127915b9ed7
|
||||||
|
DIST policyd-1.82.tar.gz 68372 BLAKE2B 39603b025235d3a68401e8cf9b357d224515f5308f1b86bf84d1231157ac2d5c2ca4dc00cc9deefdd03cdb4ffc214a8ebe5582e299f05b79a471e93238e36cff SHA512 08de114736620d5f1c11f7183135ecf4589c2d6258dee486b5f4f5a9156e4feabd7eaf19fa09428e79d5d5c72ac4757c83af86f43a7547030b1a59cb368e82a8
|
||||||
|
EBUILD policyd-1.82-r3.ebuild 2084 BLAKE2B f9c5a379ce1b79d08ed41e4a2ea1a1847c89188f28616e109da01e479291a81be86a817a9949522b1145e962d151dc8fd8f27dd4af08a61ff1a3eea97169355c SHA512 8bf3b1937fab32df5c0dd4c1970ac99e3cc6ed2d6e37b4d02e38fd1e07eeaa49cd9d196629f7731810bbecf07d6a6b10738279991c23bb514f062a1ac51d5a26
|
||||||
|
MISC ChangeLog 327 BLAKE2B 9654947636f40cf8290203ea29f26029cdfbd713994d4b7ea849d3198016a7e7cc58c9e1d09bbfceab81e1870e789917d68f394c2858b646901a0658efa41fd2 SHA512 212a79d8e634354270f2f650f46d6192873c58ef1434674cd31b1f0aaa01d78ad8d9d22e56db877a43135a949d6fb76ff627bfdae0b81e1ded9eb954fa85280c
|
||||||
|
MISC metadata.xml 249 BLAKE2B cea7fd2e21aaa481df4b19103927fcdd71b9e296720387e01aed419f8f27ef74ed751add3132fd2f811f55265315453ca1b6de218a4b4b78c06b6ec3bcb6d312 SHA512 d9f2d22053f3ff8e8dd64e0a1695fa371612f1f57d62bf1a914ce28443cc910dfb5b4f53b61742668da15ae3f8b9dfd3004c7fe980a71922d0fcf7bc8952ca9b
|
2
mail-filter/policyd/files/policyd-cleanup.cron
Normal file
2
mail-filter/policyd/files/policyd-cleanup.cron
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
#!/bin/bash
|
||||||
|
/usr/sbin/policyd_cleanup -c /etc/policyd.conf
|
39
mail-filter/policyd/files/policyd-makefile.patch
Normal file
39
mail-filter/policyd/files/policyd-makefile.patch
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
diff --git a/Makefile b/Makefile
|
||||||
|
index ded74ce..6f2afd1 100644
|
||||||
|
--- a/Makefile
|
||||||
|
+++ b/Makefile
|
||||||
|
@@ -16,8 +16,8 @@ lib += -L/usr/local/mysql
|
||||||
|
|
||||||
|
|
||||||
|
CC := gcc
|
||||||
|
-CPPFLAGS := -O $(inc)
|
||||||
|
-CFLAGS := -g -W -Wall -DMAXFDS=4096
|
||||||
|
+CPPFLAGS := $(inc) ${CPPFLAGS}
|
||||||
|
+CFLAGS := -g -W -Wall -DMAXFDS=`ulimit -n` ${CFLAGS}
|
||||||
|
OS_NAME := $(shell uname | tr [A-Z] [a-z])
|
||||||
|
LDLIBS = $(lib) -lmysqlclient -lz
|
||||||
|
|
||||||
|
@@ -50,20 +50,20 @@ policyd: syslog.o policyd.o generic.o mysql.o greylist.o throttle.o sockets.o ci
|
||||||
|
whitelist.o throttle_host.o throttle_sasl.o throttle_from.o throttle_rcpt.o helo.o
|
||||||
|
@echo ""
|
||||||
|
@echo "[*] Linking policyd*"
|
||||||
|
- @$(CC) $(CFLAGS) $(CPPFLAGS) \
|
||||||
|
+ @$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) \
|
||||||
|
syslog.o policyd.o generic.o mysql.o greylist.o throttle.o sockets.o cidr.o spamtrap.o blacklist.o blacklist_helo.o \
|
||||||
|
whitelist.o throttle_host.o throttle_sasl.o throttle_from.o throttle_rcpt.o helo.o \
|
||||||
|
$(LDLIBS) -o policyd
|
||||||
|
|
||||||
|
cleanup: syslog.o cidr.o cleanup.o generic.o sockets.o mysql.o
|
||||||
|
@echo "[*] Linking cleanup*"
|
||||||
|
- @$(CC) $(CFLAGS) $(CPPFLAGS) \
|
||||||
|
+ @$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) \
|
||||||
|
syslog.o cidr.o cleanup.o generic.o sockets.o mysql.o \
|
||||||
|
$(LDLIBS) -o cleanup
|
||||||
|
|
||||||
|
stats: cidr.o syslog.o stats.o generic.o sockets.o mysql.o
|
||||||
|
@echo "[*] Linking stats*"
|
||||||
|
- @$(CC) $(CFLAGS) $(CPPFLAGS) \
|
||||||
|
+ @$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) \
|
||||||
|
cidr.o syslog.o stats.o generic.o sockets.o mysql.o \
|
||||||
|
$(LDLIBS) -o stats
|
||||||
|
@echo ""
|
52
mail-filter/policyd/files/policyd-post182.patch
Normal file
52
mail-filter/policyd/files/policyd-post182.patch
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
First patch from debian. The other two mostly cosmetic patches from bug #288438.
|
||||||
|
--- a/syslog.c
|
||||||
|
+++ b/syslog.c
|
||||||
|
@@ -214,14 +214,15 @@ char
|
||||||
|
if (strlen (str) == 0)
|
||||||
|
return (str);
|
||||||
|
|
||||||
|
+ p = str + strlen(str);
|
||||||
|
+
|
||||||
|
for (i = 0; isspace (str[i]); i++)
|
||||||
|
;
|
||||||
|
|
||||||
|
- strcpy (str, str + i);
|
||||||
|
+ str += i;
|
||||||
|
|
||||||
|
- p = str + strlen (str);
|
||||||
|
- while ((p--) != str && isspace (*p))
|
||||||
|
- *p = 0;
|
||||||
|
+ while ((p--) != str && isspace (*p))
|
||||||
|
+ *p = 0;
|
||||||
|
|
||||||
|
return (str);
|
||||||
|
}
|
||||||
|
diff -ur policyd-1.82-orig/throttle.c policyd-1.82/throttle.c
|
||||||
|
--- a/throttle.c 2007-08-20 08:42:05.000000000 +0200
|
||||||
|
+++ b/throttle.c 2009-10-10 03:49:25.000000000 +0200
|
||||||
|
@@ -145,11 +145,11 @@
|
||||||
|
|
||||||
|
if(tcount[fd] >= tquota[fd] && tcount[fd] >= trcpt[fd]) {
|
||||||
|
tresult = tcount[fd];
|
||||||
|
- if (DEBUG >= 4) logmessage("tquota[fd] won\n"); }
|
||||||
|
+ if (DEBUG >= 4) logmessage("tcount[fd] won\n"); }
|
||||||
|
|
||||||
|
if(trcpt[fd] >= tcount[fd] && trcpt[fd] >= tquota[fd]) {
|
||||||
|
tresult = trcpt[fd];
|
||||||
|
- if (DEBUG >= 4) logmessage("tquota[fd] won\n"); }
|
||||||
|
+ if (DEBUG >= 4) logmessage("trcpt[fd] won\n"); }
|
||||||
|
|
||||||
|
if(DEBUG >= 4)
|
||||||
|
logmessage("DEBUG: fd: %d: tresult: %d\n", fd, tresult);
|
||||||
|
diff -ur policyd-1.82-orig/throttle_sasl.c policyd-1.82/throttle_sasl.c
|
||||||
|
--- a/throttle_sasl.c 2007-08-20 08:42:05.000000000 +0200
|
||||||
|
+++ b/throttle_sasl.c 2009-10-10 03:50:27.000000000 +0200
|
||||||
|
@@ -188,7 +188,7 @@
|
||||||
|
"UPDATE throttle SET"
|
||||||
|
" _abuse_cur=1"
|
||||||
|
" WHERE _from='%s'",
|
||||||
|
- triplet_array[fd][1]);
|
||||||
|
+ triplet_array[fd][4]);
|
||||||
|
if(db_doquery(fd) == -1) return(db_failure(fd, "throttle"));
|
||||||
|
|
||||||
|
return (-5);
|
2
mail-filter/policyd/files/policyd.confd
Normal file
2
mail-filter/policyd/files/policyd.confd
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
# Config file for policyd
|
||||||
|
POLICYD_CONFIG="/etc/policyd.conf"
|
21
mail-filter/policyd/files/policyd.rc
Normal file
21
mail-filter/policyd/files/policyd.rc
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
#!/sbin/openrc-run
|
||||||
|
# Copyright 1999-2019 Gentoo Authors
|
||||||
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
|
||||||
|
depend() {
|
||||||
|
before mta
|
||||||
|
provide postfix_greylist
|
||||||
|
}
|
||||||
|
|
||||||
|
start() {
|
||||||
|
ebegin "Starting policyd"
|
||||||
|
start-stop-daemon --name policyd --start --quiet --exec /usr/sbin/policyd \
|
||||||
|
-- -c ${POLICYD_CONFIG}
|
||||||
|
eend $?
|
||||||
|
}
|
||||||
|
|
||||||
|
stop() {
|
||||||
|
ebegin "Stopping policyd"
|
||||||
|
start-stop-daemon --stop --quiet --pidfile /var/run/policyd.pid
|
||||||
|
eend $?
|
||||||
|
}
|
10
mail-filter/policyd/files/policyd.service
Normal file
10
mail-filter/policyd/files/policyd.service
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Policyd
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
User=policyd
|
||||||
|
EnvironmentFile=/etc/conf.d/policyd
|
||||||
|
ExecStart=/usr/sbin/policyd -c ${POLICYD_CONFIG}
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
8
mail-filter/policyd/metadata.xml
Normal file
8
mail-filter/policyd/metadata.xml
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
|
||||||
|
<pkgmetadata>
|
||||||
|
<!-- maintainer-needed -->
|
||||||
|
<upstream>
|
||||||
|
<remote-id type="sourceforge">policyd</remote-id>
|
||||||
|
</upstream>
|
||||||
|
</pkgmetadata>
|
80
mail-filter/policyd/policyd-1.82-r3.ebuild
Normal file
80
mail-filter/policyd/policyd-1.82-r3.ebuild
Normal file
|
@ -0,0 +1,80 @@
|
||||||
|
# Copyright 1999-2019 Gentoo Authors
|
||||||
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
|
||||||
|
EAPI="7"
|
||||||
|
|
||||||
|
inherit toolchain-funcs systemd
|
||||||
|
|
||||||
|
DESCRIPTION="Policy daemon for postfix and other MTAs"
|
||||||
|
HOMEPAGE="http://policyd.sf.net/"
|
||||||
|
|
||||||
|
# This is not available through SF mirrors
|
||||||
|
SRC_URI="http://policyd.sourceforge.net/${P}.tar.gz"
|
||||||
|
LICENSE="GPL-2"
|
||||||
|
SLOT="0"
|
||||||
|
KEYWORDS="~amd64 ~hppa ~x86"
|
||||||
|
IUSE="libressl"
|
||||||
|
DEPEND="dev-db/mysql-connector-c:0=
|
||||||
|
!libressl? ( dev-libs/openssl:0= )
|
||||||
|
libressl? ( dev-libs/libressl:= )"
|
||||||
|
RDEPEND="${DEPEND}"
|
||||||
|
|
||||||
|
PATCHES=(
|
||||||
|
"${FILESDIR}/${PN}-post182.patch"
|
||||||
|
"${FILESDIR}/${PN}-makefile.patch"
|
||||||
|
)
|
||||||
|
|
||||||
|
src_prepare() {
|
||||||
|
default
|
||||||
|
sed -i -e 's/@${CC}/${CC}/' -e 's/@$(CC)/$(CC)/' Makefile
|
||||||
|
|
||||||
|
ebegin "Applying config patches"
|
||||||
|
sed -i -e s:UID=0:UID=65534:g \
|
||||||
|
-e s:GID=0:GID=65534:g \
|
||||||
|
-e s:DAEMON=0:DAEMON=1:g \
|
||||||
|
-e s:DEBUG=3:DEBUG=0:g \
|
||||||
|
-e s:DATABASE_KEEPALIVE=0:DATABASE_KEEPALIVE=1:g \
|
||||||
|
policyd.conf || die "sed failed"
|
||||||
|
eend
|
||||||
|
}
|
||||||
|
|
||||||
|
src_compile() {
|
||||||
|
emake CC=$(tc-getCC) build
|
||||||
|
}
|
||||||
|
|
||||||
|
src_install() {
|
||||||
|
insopts -o root -g nobody -m 0750
|
||||||
|
mv cleanup policyd_cleanup
|
||||||
|
mv stats policyd_stats
|
||||||
|
|
||||||
|
dosbin policyd policyd_cleanup policyd_stats
|
||||||
|
|
||||||
|
insopts -o root -g nobody -m 0640
|
||||||
|
insinto /etc
|
||||||
|
doins policyd.conf
|
||||||
|
|
||||||
|
insopts -o root -g nobody -m 0700
|
||||||
|
exeinto /etc/cron.hourly
|
||||||
|
newexe "${FILESDIR}/${PN}-cleanup.cron" ${PN}-cleanup.cron
|
||||||
|
|
||||||
|
dodoc ChangeLog DATABASE.mysql README doc/support.txt
|
||||||
|
|
||||||
|
newinitd "${FILESDIR}/${PN}.rc" ${PN}
|
||||||
|
newconfd "${FILESDIR}/${PN}.confd" ${PN}
|
||||||
|
systemd_dounit "${FILESDIR}/${PN}.service"
|
||||||
|
}
|
||||||
|
|
||||||
|
pkg_postinst() {
|
||||||
|
elog "You will need to create the database using the script DATABASE.mysql"
|
||||||
|
elog "in /usr/share/doc/${PF}/"
|
||||||
|
elog "Read the mysql section of the README.txt for details."
|
||||||
|
elog
|
||||||
|
elog "To use policyd with postfix, update your /etc/postfix/main.cf file by adding"
|
||||||
|
elog " check_policy_service inet:127.0.0.1:10031"
|
||||||
|
elog "to your smtpd_recipient_restrictions line, or similar."
|
||||||
|
elog
|
||||||
|
elog "Also remember to start the daemon at boot:"
|
||||||
|
elog " rc-update add policyd default"
|
||||||
|
elog
|
||||||
|
elog "Read the documentation for more info."
|
||||||
|
}
|
Loading…
Reference in a new issue