From 479b7f33fb984da5a20f69614a7f19fce35328af Mon Sep 17 00:00:00 2001 From: Matthias Andree Date: Tue, 3 Apr 2018 16:52:56 +0000 Subject: [PATCH] Add new port mail/ratelimit-policyd. This rearranges a few things in the Makefile, such as reordering of USES= and USE... options, and uses PORTDOCS for README.md. I have also revised pkg-message.in and pkg-descr for grammar and consistency (trailing colons) and added a "postfix reload" line. PR: 226795 Submitted by: Miroslav Lachman --- mail/Makefile | 1 + mail/ratelimit-policyd/Makefile | 63 +++++++++++++++++++++ mail/ratelimit-policyd/distinfo | 3 + mail/ratelimit-policyd/files/pkg-message.in | 37 ++++++++++++ mail/ratelimit-policyd/pkg-descr | 4 ++ 5 files changed, 108 insertions(+) create mode 100644 mail/ratelimit-policyd/Makefile create mode 100644 mail/ratelimit-policyd/distinfo create mode 100644 mail/ratelimit-policyd/files/pkg-message.in create mode 100644 mail/ratelimit-policyd/pkg-descr diff --git a/mail/Makefile b/mail/Makefile index 048961053d07..f8072c46d958 100644 --- a/mail/Makefile +++ b/mail/Makefile @@ -584,6 +584,7 @@ SUBDIR += queue-repair SUBDIR += rainloop SUBDIR += rainloop-community + SUBDIR += ratelimit-policyd SUBDIR += raysfilter SUBDIR += razor-agents SUBDIR += rbl-milter diff --git a/mail/ratelimit-policyd/Makefile b/mail/ratelimit-policyd/Makefile new file mode 100644 index 000000000000..5c04d9670b0a --- /dev/null +++ b/mail/ratelimit-policyd/Makefile @@ -0,0 +1,63 @@ +# Created by: Miroslav Lachman +# $FreeBSD$ + +PORTNAME= ratelimit-policyd +PORTVERSION= 1.0.1 +CATEGORIES= mail +MASTER_SITES= GH + +MAINTAINER= 000.fbsd@quip.cz +COMMENT= Sender rate limit policy daemon for Postfix + +LICENSE= NONE + +USES+= perl5 shebangfix + +USE_GITHUB= yes +GH_ACCOUNT= MirLach +GH_PROJECT= ratelimit-policyd +#GH_TAGNAME= 65154a2 + +RUN_DEPENDS+= p5-DBD-mysql>=0:databases/p5-DBD-mysql + +SHEBANG_FILES= ratelimit-policyd.pl + +NO_BUILD= yes + +SUB_FILES= pkg-message + +PERIODIC_DAILY= etc/periodic/daily + +PLIST_FILES= bin/ratelimit-policyd.pl \ + etc/rc.d/ratelimit-policyd \ + etc/ratelimit-policyd.cfg.sample \ + ${PERIODIC_DAILY}/535.ratelimit-policyd + +PORTDATA= mysql-schema.sql +PORTDOCS= README.md + +post-patch: + ${REINPLACE_CMD} -e "s|/usr/local|${PREFIX}|g" ${WRKSRC}/rc.d/ratelimit-policyd + ${REINPLACE_CMD} -e "s|/usr/local|${PREFIX}|g" ${WRKSRC}/ratelimit-policyd.pl + ${REINPLACE_CMD} -e "s|/usr/local|${PREFIX}|g" \ + ${WRKSRC}/periodic/daily/535.ratelimit-policyd + +do-install: + ${INSTALL_SCRIPT} ${WRKSRC}/ratelimit-policyd.pl ${STAGEDIR}${PREFIX}/bin + ${INSTALL_SCRIPT} ${WRKSRC}/rc.d/ratelimit-policyd ${STAGEDIR}${PREFIX}/etc/rc.d + ${INSTALL_DATA} ${WRKSRC}/ratelimit-policyd.cfg \ + ${STAGEDIR}${PREFIX}/etc/ratelimit-policyd.cfg.sample + + @${MKDIR} ${STAGEDIR}${DATADIR} + ${INSTALL_DATA} ${WRKSRC}/mysql-schema.sql ${STAGEDIR}${DATADIR} + + @${MKDIR} ${STAGEDIR}${DOCSDIR} +.for i in ${PORTDOCS} + ${INSTALL_MAN} ${WRKSRC}/${i} ${STAGEDIR}${DOCSDIR}/ +.endfor + + @${MKDIR} ${STAGEDIR}${PREFIX}/${PERIODIC_DAILY} + ${INSTALL_SCRIPT} ${WRKSRC}/periodic/daily/535.ratelimit-policyd \ + ${STAGEDIR}${PREFIX}/${PERIODIC_DAILY} + +.include diff --git a/mail/ratelimit-policyd/distinfo b/mail/ratelimit-policyd/distinfo new file mode 100644 index 000000000000..67d70b481895 --- /dev/null +++ b/mail/ratelimit-policyd/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1522007262 +SHA256 (MirLach-ratelimit-policyd-1.0.1_GH0.tar.gz) = 14a3785dff86b0cf58e57220f79551ba159ee184bbb21f462c019675675d775b +SIZE (MirLach-ratelimit-policyd-1.0.1_GH0.tar.gz) = 11218 diff --git a/mail/ratelimit-policyd/files/pkg-message.in b/mail/ratelimit-policyd/files/pkg-message.in new file mode 100644 index 000000000000..94a8a71e8377 --- /dev/null +++ b/mail/ratelimit-policyd/files/pkg-message.in @@ -0,0 +1,37 @@ +This package must be integrated with Postfix to be effective: + + * Add a new MySQL user account for ratelimit-policyd with the + following permissions: + + GRANT USAGE ON *.* TO 'policyd'@'localhost' IDENTIFIED BY ''; + GRANT SELECT, INSERT, UPDATE, DELETE ON `policyd`.* TO 'policyd'@'localhost'; + + * Create a database 'policyd' and a table 'ratelimit': + + mysql -u root -p < %%LOCALBASE%%/share/ratelimit-policyd/mysql-schema.sql + + * Edit the configuration in %%LOCALBASE%%/etc/ratelimit-policyd.cfg + + * Enable the ratelimit-policyd service in rc.conf: + + sysrc ratelimit_policyd_enable="YES" + + * Start the service: + + service ratelimit-policyd start + + * Add or modify the postfix data restriction class + 'smtpd_sender_restrictions' in main.cf: + + smtpd_sender_restrictions = + check_sender_access mysql:%%LOCALBASE%%/etc/postfix/clients.cf, + check_policy_service inet:127.0.0.1:10032 + + check_policy_service must be after check_sender_access (if you are using it) + + * Reload Postfix: + + postfix reload + + * See the documentation in %%LOCALBASE%%/share/ratelimit-policyd/README.md + or visit https://github.com/MirLach/ratelimit-policyd diff --git a/mail/ratelimit-policyd/pkg-descr b/mail/ratelimit-policyd/pkg-descr new file mode 100644 index 000000000000..c94af04fe116 --- /dev/null +++ b/mail/ratelimit-policyd/pkg-descr @@ -0,0 +1,4 @@ +A sender rate limit policy daemon for Postfix written in Perl. +Customised to work with a modern Perl version on FreeBSD. + +WWW: https://github.com/MirLach/ratelimit-policyd