pkgsrc-Changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
CVS commit: pkgsrc/mail/opensmtpd-filter-dnsbl
Module Name: pkgsrc
Committed By: vins
Date: Mon Sep 4 10:32:47 UTC 2023
Added Files:
pkgsrc/mail/opensmtpd-filter-dnsbl: DESCR Makefile PLIST distinfo
pkgsrc/mail/opensmtpd-filter-dnsbl/files: README.dnsbl
pkgsrc/mail/opensmtpd-filter-dnsbl/patches: patch-Makefile patch-main.c
Log Message:
mail/opensmtpd-filter-dnsbl: import opensmtpd-filter-dnsbl-0.3.
filter-dnsbl is an opensmtpd filter that checks the sender's IP address
against one or more dnsbl lists to flag or reject spam messages at
session time.
To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 pkgsrc/mail/opensmtpd-filter-dnsbl/DESCR \
pkgsrc/mail/opensmtpd-filter-dnsbl/Makefile \
pkgsrc/mail/opensmtpd-filter-dnsbl/PLIST \
pkgsrc/mail/opensmtpd-filter-dnsbl/distinfo
cvs rdiff -u -r0 -r1.1 pkgsrc/mail/opensmtpd-filter-dnsbl/files/README.dnsbl
cvs rdiff -u -r0 -r1.1 \
pkgsrc/mail/opensmtpd-filter-dnsbl/patches/patch-Makefile \
pkgsrc/mail/opensmtpd-filter-dnsbl/patches/patch-main.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Added files:
Index: pkgsrc/mail/opensmtpd-filter-dnsbl/DESCR
diff -u /dev/null pkgsrc/mail/opensmtpd-filter-dnsbl/DESCR:1.1
--- /dev/null Mon Sep 4 10:32:47 2023
+++ pkgsrc/mail/opensmtpd-filter-dnsbl/DESCR Mon Sep 4 10:32:47 2023
@@ -0,0 +1,3 @@
+filter-dnsbl is an opensmtpd filter that checks the sender's IP address
+against one or more dnsbl lists to flag or reject spam messages at
+session time.
Index: pkgsrc/mail/opensmtpd-filter-dnsbl/Makefile
diff -u /dev/null pkgsrc/mail/opensmtpd-filter-dnsbl/Makefile:1.1
--- /dev/null Mon Sep 4 10:32:47 2023
+++ pkgsrc/mail/opensmtpd-filter-dnsbl/Makefile Mon Sep 4 10:32:47 2023
@@ -0,0 +1,42 @@
+# $NetBSD: Makefile,v 1.1 2023/09/04 10:32:47 vins Exp $
+
+DISTNAME= filter-dnsbl-0.3
+PKGNAME= ${DISTNAME:S|^|opensmtpd-|}
+CATEGORIES= mail
+MASTER_SITES= https://imperialat.at/releases/
+
+MAINTAINER= vins%NetBSD.org@localhost
+HOMEPAGE= http://imperialat.at/dev/filter-dnsbl/
+COMMENT= OpenSMTPD filter integration for DNSBL lists
+LICENSE= isc
+
+DEPENDS+= opensmtpd-[0-9]*:../../mail/opensmtpd
+
+USE_BSD_MAKEFILE= yes
+
+SUBST_CLASSES+= prefix
+SUBST_STAGE.prefix= pre-configure
+SUBST_FILES.prefix= README.dnsbl
+SUBST_VARS.prefix= PKG_SYSCONFDIR PREFIX
+SUBST_MESSAGE.prefix= Replacing pkgsrc placeholders
+
+MAKE_ENV+= LOCALBASE=${PREFIX:Q}
+MAKE_ENV+= BINDIR=${PREFIX}/libexec/opensmtpd
+MAKE_ENV+= MANDIR=${PREFIX}/${PKGMANDIR}
+
+INSTALL_ENV= INSTALL=${INSTALL:Q}
+INSTALL_TARGET= bindir install
+INSTALLATION_DIRS+= libexec/opensmtpd ${PKGMANDIR}/man8
+INSTALLATION_DIRS+= share/doc/opensmtpd/filters
+
+post-extract:
+ ${RUN}${CP} ${FILESDIR}/README.* ${WRKSRC}
+
+post-install:
+ ${INSTALL_DATA} ${WRKSRC}/README.dnsbl \
+ ${DESTDIR}${PREFIX}/share/doc/opensmtpd/filters
+
+.include "../../devel/libopensmtpd/buildlink3.mk"
+.include "../../devel/libevent/buildlink3.mk"
+.include "../../net/libasr/buildlink3.mk"
+.include "../../mk/bsd.pkg.mk"
Index: pkgsrc/mail/opensmtpd-filter-dnsbl/PLIST
diff -u /dev/null pkgsrc/mail/opensmtpd-filter-dnsbl/PLIST:1.1
--- /dev/null Mon Sep 4 10:32:47 2023
+++ pkgsrc/mail/opensmtpd-filter-dnsbl/PLIST Mon Sep 4 10:32:47 2023
@@ -0,0 +1,5 @@
+@comment $NetBSD: PLIST,v 1.1 2023/09/04 10:32:47 vins Exp $
+bin/filter-dnsbl
+man/man8/filter-dnsbl.8
+share/doc/opensmtpd/filters/README.dnsbl
+@pkgdir libexec/opensmtpd
Index: pkgsrc/mail/opensmtpd-filter-dnsbl/distinfo
diff -u /dev/null pkgsrc/mail/opensmtpd-filter-dnsbl/distinfo:1.1
--- /dev/null Mon Sep 4 10:32:47 2023
+++ pkgsrc/mail/opensmtpd-filter-dnsbl/distinfo Mon Sep 4 10:32:47 2023
@@ -0,0 +1,7 @@
+$NetBSD: distinfo,v 1.1 2023/09/04 10:32:47 vins Exp $
+
+BLAKE2s (filter-dnsbl-0.3.tar.gz) = e8bc9b2b504ee74122fd3854548792b9050440b9a3a5d02722af6de670447268
+SHA512 (filter-dnsbl-0.3.tar.gz) = c7b805b05ea7629c87c90146be3a9f375b68542a7b6b781e37ffb842e33b67aca53633a7f4cd6f8befda71cc6e30e9330624f95ee3ce0c84b128c4b1483fee59
+Size (filter-dnsbl-0.3.tar.gz) = 3413 bytes
+SHA1 (patch-Makefile) = 1a262a5860642f965cf6d62c4efddb7515fd121e
+SHA1 (patch-main.c) = b5c7edc0022bfa69268e896df6cf57c48e6484d7
Index: pkgsrc/mail/opensmtpd-filter-dnsbl/files/README.dnsbl
diff -u /dev/null pkgsrc/mail/opensmtpd-filter-dnsbl/files/README.dnsbl:1.1
--- /dev/null Mon Sep 4 10:32:47 2023
+++ pkgsrc/mail/opensmtpd-filter-dnsbl/files/README.dnsbl Mon Sep 4 10:32:47 2023
@@ -0,0 +1,26 @@
++-----------------------------------------------------------------------
+| DNSBL-list filter setup
++-----------------------------------------------------------------------
+
+filter-dnsbl looks up the IP address of the sender at the blacklist
+(a domain name) and by default drops the connection if it is found.
+
+To use the DNSBL-list filter, you must declare it first in your OpenSMTPD
+configuration.
+
+Edit the @PKG_SYSCONFDIR@/smtpd/smtpd.conf file to declare the filter:
+
+ filter "dnsbl" \
+ proc-exec "@PREFIX@/libexec/opensmtpd/filter-dnsbl [options] <blacklist>"
+
+The following options may be passed to filter-dnsbl:
+
+-m allows the message to continue, but it will be
+ marked with an X-Spam and X-Spam-DNSBL header.
+
+-v more verbose logging.
+
+Then add the filter to each listener that should be filtered:
+
+ listen on socket filter "dnsbl"
+ listen on $ipv4 [...] filter "dnsbl"
Index: pkgsrc/mail/opensmtpd-filter-dnsbl/patches/patch-Makefile
diff -u /dev/null pkgsrc/mail/opensmtpd-filter-dnsbl/patches/patch-Makefile:1.1
--- /dev/null Mon Sep 4 10:32:47 2023
+++ pkgsrc/mail/opensmtpd-filter-dnsbl/patches/patch-Makefile Mon Sep 4 10:32:47 2023
@@ -0,0 +1,27 @@
+$NetBSD: patch-Makefile,v 1.1 2023/09/04 10:32:47 vins Exp $
+
+* DESTDIR support.
+* Link against libasr.
+
+--- Makefile.orig 2019-10-22 10:52:02.000000000 +0000
++++ Makefile
+@@ -2,8 +2,8 @@ LOCALBASE?= /usr/local/
+
+ PROG= filter-dnsbl
+ MAN= filter-dnsbl.8
+-BINDIR= ${LOCALBASE}/libexec/smtpd/
+-MANDIR= ${LOCALBASE}/man/man
++BINDIR?= ${LOCALBASE}/libexec/smtpd/
++MANDIR?= ${LOCALBASE}/man/man
+
+ SRCS+= main.c
+
+@@ -14,7 +14,7 @@ CFLAGS+=-Wmissing-declarations
+ CFLAGS+=-Wshadow -Wpointer-arith -Wcast-qual
+ CFLAGS+=-Wsign-compare
+ LDFLAGS+=-L${LOCALBASE}/lib
+-LDADD+= -levent -lopensmtpd
++LDADD+= -lasr -levent -lopensmtpd
+ DPADD= ${LIBEVENT}
+
+ bindir:
Index: pkgsrc/mail/opensmtpd-filter-dnsbl/patches/patch-main.c
diff -u /dev/null pkgsrc/mail/opensmtpd-filter-dnsbl/patches/patch-main.c:1.1
--- /dev/null Mon Sep 4 10:32:47 2023
+++ pkgsrc/mail/opensmtpd-filter-dnsbl/patches/patch-main.c Mon Sep 4 10:32:47 2023
@@ -0,0 +1,92 @@
+$NetBSD: patch-main.c,v 1.1 2023/09/04 10:32:47 vins Exp $
+
+* Provide an inline definition of pledge().
+* Provide compatibility functions for OpenBSD's libevent
+ (pulled from OpenSMTD/openbsd-compat).
+
+--- main.c.orig 2021-10-27 09:33:56.000000000 +0000
++++ main.c
+@@ -1,5 +1,6 @@
+ /*
+ * Copyright (c) 2019 Martijn van Duren <martijn%openbsd.org@localhost>
++ * Copyright (c) 2012 Eric Faurot <eric%openbsd.org@localhost>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+@@ -31,6 +32,76 @@
+
+ #include "opensmtpd.h"
+
++static inline int
++pledge(const char *promises, const char *execpromises)
++{
++ return 0;
++}
++
++struct event_asr {
++ struct event ev;
++ struct asr_query *async;
++ void (*cb)(struct asr_result *, void *);
++ void *arg;
++};
++
++struct event_asr * event_asr_run(struct asr_query *,
++ void (*)(struct asr_result *, void *), void *);
++void event_asr_abort(struct event_asr *);
++
++static void
++event_asr_dispatch(int fd __attribute__((__unused__)),
++ short ev __attribute__((__unused__)), void *arg)
++{
++ struct event_asr *eva = arg;
++ struct asr_result ar;
++ struct timeval tv;
++
++ event_del(&eva->ev);
++
++ if (asr_run(eva->async, &ar)) {
++ eva->cb(&ar, eva->arg);
++ free(eva);
++ } else {
++ event_set(&eva->ev, ar.ar_fd,
++ ar.ar_cond == ASR_WANT_READ ? EV_READ : EV_WRITE,
++ event_asr_dispatch, eva);
++ tv.tv_sec = ar.ar_timeout / 1000;
++ tv.tv_usec = (ar.ar_timeout % 1000) * 1000;
++ event_add(&eva->ev, &tv);
++ }
++}
++
++struct event_asr *
++event_asr_run(struct asr_query *async, void (*cb)(struct asr_result *, void *),
++ void *arg)
++{
++ struct event_asr *eva;
++ struct timeval tv;
++
++ eva = calloc(1, sizeof *eva);
++ if (eva == NULL)
++ return (NULL);
++ eva->async = async;
++ eva->cb = cb;
++ eva->arg = arg;
++ tv.tv_sec = 0;
++ tv.tv_usec = 0;
++ evtimer_set(&eva->ev, event_asr_dispatch, eva);
++ evtimer_add(&eva->ev, &tv);
++ return (eva);
++}
++
++void
++event_asr_abort(struct event_asr *eva)
++{
++ asr_abort(eva->async);
++ event_del(&eva->ev);
++ free(eva);
++}
++
++struct asr_query *gethostbyname_async(const char *, void *);
++
+ struct dnsbl_session;
+
+ struct dnsbl_query {
Home |
Main Index |
Thread Index |
Old Index