pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc Added mail/srs-milter 20141121nb9
details: https://anonhg.NetBSD.org/pkgsrc/rev/2b76830bb068
branches: trunk
changeset: 379948:2b76830bb068
user: manu <manu%pkgsrc.org@localhost>
date: Wed May 25 15:45:31 2022 +0000
description:
Added mail/srs-milter 20141121nb9
This milter implemets SRS (Sender Rewriting Scheme) that can be used to
fix envelope MAIL FROM for forwarded mails protected by SPF. It can be
configured in two modes for:
* Incoming mail -- rewrite RCPT TO addresses in SRS format back
* Outgoing mail -- rewrite MAIL FROM address to SRS format
diffstat:
doc/CHANGES-2022 | 3 +-
mail/Makefile | 3 +-
mail/srs-milter/DESCR | 6 +
mail/srs-milter/Makefile | 42 +++
mail/srs-milter/PLIST | 2 +
mail/srs-milter/distinfo | 6 +
mail/srs-milter/files/srs-milter-in.sh | 48 +++
mail/srs-milter/files/srs-milter-out.sh | 48 +++
mail/srs-milter/patches/patch-srs-filter.c | 353 +++++++++++++++++++++++++++++
9 files changed, 509 insertions(+), 2 deletions(-)
diffs (truncated from 564 to 300 lines):
diff -r 6c5852144316 -r 2b76830bb068 doc/CHANGES-2022
--- a/doc/CHANGES-2022 Wed May 25 15:38:54 2022 +0000
+++ b/doc/CHANGES-2022 Wed May 25 15:45:31 2022 +0000
@@ -1,4 +1,4 @@
-$NetBSD: CHANGES-2022,v 1.2741 2022/05/25 15:38:54 kleink Exp $
+$NetBSD: CHANGES-2022,v 1.2742 2022/05/25 15:45:31 manu Exp $
Changes to the packages collection and infrastructure in 2022:
@@ -4208,3 +4208,4 @@
Added www/py-wtforms-dateutil version 0.1 [kleink 2022-05-25]
Added www/py-wtforms-django version 0.1 [kleink 2022-05-25]
Added www/py-wtforms-sqlalchemy version 0.3 [kleink 2022-05-25]
+ Added mail/srs-milter 20141121nb9 [manu 2022-05-25]
diff -r 6c5852144316 -r 2b76830bb068 mail/Makefile
--- a/mail/Makefile Wed May 25 15:38:54 2022 +0000
+++ b/mail/Makefile Wed May 25 15:45:31 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.578 2022/02/05 13:51:20 schmonz Exp $
+# $NetBSD: Makefile,v 1.579 2022/05/25 15:45:31 manu Exp $
#
COMMENT= Electronic mail utilities
@@ -380,6 +380,7 @@
SUBDIR+= squirrelmail-decode
SUBDIR+= squirrelmail-locales
SUBDIR+= sqwebmail
+SUBDIR+= srs-milter
SUBDIR+= ssmtp
SUBDIR+= swaks
SUBDIR+= sylpheed
diff -r 6c5852144316 -r 2b76830bb068 mail/srs-milter/DESCR
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mail/srs-milter/DESCR Wed May 25 15:45:31 2022 +0000
@@ -0,0 +1,6 @@
+This milter implemets SRS (Sender Rewriting Scheme) that can be used to
+fix envelope MAIL FROM for forwarded mails protected by SPF. It can be
+configured in two modes for:
+
+* Incoming mail -- rewrite RCPT TO addresses in SRS format back
+* Outgoing mail -- rewrite MAIL FROM address to SRS format
diff -r 6c5852144316 -r 2b76830bb068 mail/srs-milter/Makefile
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mail/srs-milter/Makefile Wed May 25 15:45:31 2022 +0000
@@ -0,0 +1,42 @@
+# $NetBSD: Makefile,v 1.1 2022/05/25 15:45:31 manu Exp $
+
+GITHUB_PROJECT= srs-milter
+GITHUB_TAG= 3c44b13a10471df0361c08786c8826ea1d0ecc7b
+DISTNAME= 3c44b13a10471df0361c08786c8826ea1d0ecc7b
+PKGNAME= ${GITHUB_PROJECT}-20141121
+PKGREVISION= 9
+CATEGORIES= mail
+MASTER_SITES= ${MASTER_SITE_GITHUB:=emsearcy/}
+DIST_SUBDIR= ${GITHUB_PROJECT}
+EXTRACT_SUFX= .zip
+
+MAINTAINER= pkgsrc-users%NetBSD.org@localhost
+HOMEPAGE= https://github.com/emsearcy/srs-milter
+COMMENT= Sender Rewriting Scheme milter
+LICENSE= generic-nonlicense
+
+WRKSRC= ${WRKDIR}/srs-milter-3c44b13a10471df0361c08786c8826ea1d0ecc7b/src
+
+INSTALLATION_DIRS= sbin
+
+RCD_SCRIPTS= srs-milter-in srs-milter-out
+
+BUILD_DEFS+= MILTER_USER VARBASE
+FILES_SUBST+= MILTER_USER=${MILTER_USER:Q}
+
+do-build:
+ cd ${WRKSRC} && \
+ ${CC} ${CPPFLAGS} -c srs-filter.c && \
+ ${CC} -o srs-milter ${LDFLAGS} -lspf2 -lsrs2 -lpthread \
+ srs-filter.o ${BUILDLINK_PREFIX.libmilter}/lib/libmilter.a
+
+do-install:
+ cd ${WRKSRC} && \
+ ${INSTALL_PROGRAM} srs-milter ${DESTDIR}${PREFIX}/sbin
+
+.include "../../mail/libspf2/buildlink3.mk"
+.include "../../mail/libsrs2/buildlink3.mk"
+.include "../../mail/libmilter/buildlink3.mk"
+.include "../../mk/pthread.buildlink3.mk"
+
+.include "../../mk/bsd.pkg.mk"
diff -r 6c5852144316 -r 2b76830bb068 mail/srs-milter/PLIST
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mail/srs-milter/PLIST Wed May 25 15:45:31 2022 +0000
@@ -0,0 +1,2 @@
+@comment $NetBSD: PLIST,v 1.1 2022/05/25 15:45:31 manu Exp $
+sbin/srs-milter
diff -r 6c5852144316 -r 2b76830bb068 mail/srs-milter/distinfo
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mail/srs-milter/distinfo Wed May 25 15:45:31 2022 +0000
@@ -0,0 +1,6 @@
+$NetBSD: distinfo,v 1.1 2022/05/25 15:45:31 manu Exp $
+
+BLAKE2s (srs-milter/3c44b13a10471df0361c08786c8826ea1d0ecc7b-3c44b13a10471df0361c08786c8826ea1d0ecc7b.zip) = e62ffea86976769bda9e0af3d64a52dd57901bf2130b7b8d39a7741d2731bfa0
+SHA512 (srs-milter/3c44b13a10471df0361c08786c8826ea1d0ecc7b-3c44b13a10471df0361c08786c8826ea1d0ecc7b.zip) =
91db41b5fd955a1856ce1b30ec2ceaac2483820b3c1cc29e9817460633f3013401b416bb98e76fd5bf41492836b8dea42ea46689c4544d021a1d65f234c80112
+Size (srs-milter/3c44b13a10471df0361c08786c8826ea1d0ecc7b-3c44b13a10471df0361c08786c8826ea1d0ecc7b.zip) = 15843 bytes
+SHA1 (patch-srs-filter.c) = c3533bff78ecb36380d73a357b6ea6341d02550c
diff -r 6c5852144316 -r 2b76830bb068 mail/srs-milter/files/srs-milter-in.sh
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mail/srs-milter/files/srs-milter-in.sh Wed May 25 15:45:31 2022 +0000
@@ -0,0 +1,48 @@
+#!@CD_SCRIPTS_SHELL@
+#
+# $NetBSD: srs-milter-in.sh,v 1.1 2022/05/25 15:45:32 manu Exp $
+#
+# PROVIDE: srs_milter_in
+# REQUIRE: DAEMON
+# BEFORE: mail
+
+if [ -f /etc/rc.subr ]; then
+ . /etc/rc.subr
+fi
+
+name="srs_milter_in"
+rcvar=$name
+command="@PREFIX@/sbin/srs-milter"
+pidfile="@VARBASE@/run/srs-milter/${name}.pid"
+keyfile="/etc/mail/srs.key"
+command_args="-P ${pidfile} -s local:@VARBASE@/run/srs-milter/${name}.sock"
+command_args="${command_args} --srs-secret-file=${keyfile}"
+command_args="${command_args} --user @MILTER_USER@ --reverse"
+required_files="${keyfile}"
+start_precmd="srs_milter_precmd"
+
+srs_milter_precmd()
+{
+ if [ ! -f ${keyfile} ]; then
+ ( umask 077; dd if=/dev/random bs=256 count=1 of=${keyfile} )
+ chown srs ${keyfile}
+ fi
+
+ if [ ! -d @VARBASE@/run/srs-milter ]; then
+ mkdir -p @VARBASE@/run/srs-milter
+ chown srs @VARBASE@/run/srs-milter
+ chmod 0750 @VARBASE@/run/srs-milter
+ fi
+
+ if [ -e @VARBASE@/run/srs-milter/${name}.sock ]; then
+ rm -f @VARBASE@/run/srs-milter/${name}.sock
+ fi
+}
+
+if [ -f /etc/rc.subr ]; then
+ load_rc_config $name
+ run_rc_command "$1"
+else
+ @ECHO@ -n " ${name}"
+ ${command} ${srs_milter_flags} ${command_args}
+fi
diff -r 6c5852144316 -r 2b76830bb068 mail/srs-milter/files/srs-milter-out.sh
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mail/srs-milter/files/srs-milter-out.sh Wed May 25 15:45:31 2022 +0000
@@ -0,0 +1,48 @@
+#!@CD_SCRIPTS_SHELL@
+#
+# $NetBSD: srs-milter-out.sh,v 1.1 2022/05/25 15:45:32 manu Exp $
+#
+# PROVIDE: srs_milter_out
+# REQUIRE: DAEMON
+# BEFORE: mail
+
+if [ -f /etc/rc.subr ]; then
+ . /etc/rc.subr
+fi
+
+name="srs_milter_out"
+rcvar=$name
+command="@PREFIX@/sbin/srs-milter"
+pidfile="@VARBASE@/run/srs-milter/${name}.pid"
+keyfile="/etc/mail/srs.key"
+command_args="-P ${pidfile} -s local:@VARBASE@/run/srs-milter/${name}.sock"
+command_args="${command_args} --srs-secret-file=${keyfile}"
+command_args="${command_args} --user @MILTER_USER@ --forward"
+required_files="${keyfile}"
+start_precmd="srs_milter_precmd"
+
+srs_milter_precmd()
+{
+ if [ ! -f ${keyfile} ]; then
+ ( umask 077; dd if=/dev/random bs=256 count=1 of=${keyfile} )
+ chown srs ${keyfile}
+ fi
+
+ if [ ! -d @VARBASE@/run/srs-milter ]; then
+ mkdir -p @VARBASE@/run/srs-milter
+ chown srs @VARBASE@/run/srs-milter
+ chmod 0750 @VARBASE@/run/srs-milter
+ fi
+
+ if [ -e @VARBASE@/run/srs-milter/${name}.sock ]; then
+ rm -f @VARBASE@/run/srs-milter/${name}.sock
+ fi
+}
+
+if [ -f /etc/rc.subr ]; then
+ load_rc_config $name
+ run_rc_command "$1"
+else
+ @ECHO@ -n " ${name}"
+ ${command} ${srs_milter_flags} ${command_args}
+fi
diff -r 6c5852144316 -r 2b76830bb068 mail/srs-milter/patches/patch-srs-filter.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mail/srs-milter/patches/patch-srs-filter.c Wed May 25 15:45:31 2022 +0000
@@ -0,0 +1,353 @@
+$NetBSD: patch-srs-filter.c,v 1.1 2022/05/25 15:45:32 manu Exp $
+
+- Update pidfile after forking
+- Process addresses with or without enclosing brackets
+- Add -u/--user option to use unprivilegied user
+- Add -A/--alias-cmd and -R/--aliad_regex to resolve aliases
+- Add -n/--reverse-null to ensable SRS reverse for null sender <>
+
+--- srs-filter.c.orig 2022-05-11 14:10:11.430909881 +0200
++++ srs-filter.c 2022-05-17 08:53:10.516904377 +0200
+@@ -3,11 +3,13 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <getopt.h>
+ #include <unistd.h>
++#include <regex.h>
+ #include <string.h>
+ #include <strings.h>
+ #include <pthread.h>
++#include <pwd.h>
+ #include <syslog.h>
+ #include <sys/stat.h>
+ #include <sys/types.h>
+ #include <sys/socket.h>
+@@ -37,10 +39,16 @@
+ /* these should be read from command line or config file */
+ static int CONFIG_verbose = 0;
+ static int CONFIG_forward = 0;
+ static int CONFIG_reverse = 0;
++static int CONFIG_reverse_null = 0;
+ static char *CONFIG_socket = NULL;
++static char *CONFIG_user = NULL;
++static char *CONFIG_pidfile = NULL;
+ static char **CONFIG_domains = NULL;
++static char *CONFIG_alias_cmd = NULL;
++static char *CONFIG_alias_regex_str = "^\\(.*\\)\\.\\.\\. deliverable";
++static regex_t CONFIG_alias_regex;
+ static int CONFIG_spf_check = 0;
+ static char *CONFIG_spf_heloname = NULL;
+ static union {
+ struct sockaddr_in in;
+@@ -70,9 +78,43 @@
+ srs_t *srs;
+ SPF_server_t *spf;
+ };
+
++static char *srs_milter_resolve_alias(char *recip) {
++ char *recip_alias = NULL;
++ char *alias_cmd = NULL;
++ FILE *f = NULL;
+
++ if (asprintf(&alias_cmd, CONFIG_alias_cmd, recip) < 0)
++ goto out;
++
++ if ((f = popen(alias_cmd, "r")) == NULL) {
++ syslog(LOG_ERR, "failed to run alias-cmd %s: %s", alias_cmd, strerror(errno));
++ goto out;
++ }
++
++ do {
++ char line[4096];
++ regmatch_t pm[2];
++
++ if (fgets(line, sizeof(line), f) == NULL)
++ break;
++
++ if (regexec(&CONFIG_alias_regex, line, 2, pm, 0) == 0) {
++ recip_alias = strndup(line + pm[1].rm_so, pm[1].rm_eo - pm[1].rm_so);
++ break;
++ }
++ } while (!feof(f));
++
++out:
++ if (f)
++ pclose(f);
++
++ if (alias_cmd)
++ free(alias_cmd);
++
++ return recip_alias;
++}
+
+ char *srs_milter_load_file_secrets(char ***CONFIG_srs_secrets, char *secrets_file) {
+ int i, l;
+ FILE *f;
+@@ -114,9 +156,9 @@
+ int is_local_addr(const char *addr) {
+ int i, r;
+ const char *dom;
Home |
Main Index |
Thread Index |
Old Index