[UPDATE] mail/spampd 2.30 -> 2.51 + fix boot issue

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[UPDATE] mail/spampd 2.30 -> 2.51 + fix boot issue

trondd-2
I'd love to get update in for 6.4 as it fixes a long standing issue with spampd
failing to start correctly via rc at boot time.

Tim.


-------- Original Message --------
Date: Fri, 24 Aug 2018 11:27:00 +0200
From: Henrik Friedrichsen <[hidden email]>
To: trondd <[hidden email]>
Subject: Re: [UPDATE] mail/spampd 2.30 -> 2.51 + fix boot issue

Hey Tim,

thanks for your mail. Indeed, I missed the last updates because I kept
checking the project website and not the GitHub repository.

The diff looks good to me. Would you like to post this to ports@ and I
give my 'ok'

Cheers,
Henrik

On Thu, Aug 23, 2018 at 08:24:40PM -0400, trondd wrote:

> Hi Henrik.
>
> I've put together an update to spampd as it's quite out of date.  Releases
> moved to GitHub so that's probably why they have been missed.  Thanks to Sumit
> Khanna for lighting the fire to fix the start up issue[0] and Max Paperno who
> maintains SpamPD for his responsive fix[1].  I have patched the fix into the
> latest release as I hope to get this in for 6.4 and don't want to wait for an
> official release.
>
> Can we get tis submitted to ports@ and try to get it infor 64?
>
> Thanks.
> Tim.
>
>
> 2.30 through 2.51 changelog:
>
> 2.51 (01-May-18)
>
> - Fix listening to IP address, broken in 2.50 "Unix ports" feature.  (#18)
> - Add --setsid option to start server with setsid if running in background (#18)
>
> 2.50 (30-Apr-18)
>
> - Replace IO::Socket::INET with IO::Socket::IP for IPv6 support (#9).
> - Unix ports (ability to listen on UNIX sockets) (#13).
> - Add X-Envelope-* headers before Received (#14).
> - Add /usr/local/bin and /usr/local/sbin to PATH (#17).
>
> Please refer to commit notes at
> (https://github.com/mpaperno/spampd/compare/2.42...2.50) for details and credits.
>
> 2.42 (08-Dec-13) (experimental)
>
> - Untaint some params for compatibility with Perl 5.18.
>
> 2.41 (11-Aug-10) (experimental)
>
> - Added setting of user name at SA init time.
>
> 2.40 (10-Jan-09) (experimental)
>
> - New config option to load a specific configuration file after the default
>   local.cf file, thereby overriding any settings therein.  The new option is
>   --saconfig=filename. Thanks to Sven Mueller for code and Bernd Zeimetz for
>   bringing it up. (http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=344373)
>  
> - Integrated code by Alexander Wirt to introduce a parameter which
>   sets a proper home directory (--homedir=path) and also cleans up the
>   environment before backgrounding.
>   (http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=421100)
>   * NOTE: * default homedir is /var/spool/spamassassin/spampd which needs to be
>   writable by the user spampd is running as.  Previously, some files like the
>   auto-whitelist were written to the .spamassassin folder inside the users home
>   directory who started spampd, typically root.
>  
> - Integrated fix from Vladislav Kurz for LMTP multi-line response after DATA
>   is sent. (http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=395355)
>  
> - Yet another fix for older Net::Server versions (<= 0.87) dying when logging
>   a % character to Sys::Syslog. This also fixes the bug in 2.30 that logs "%s"
>   instead of the actual messages on some system.
>  
> - Fixed bug with temp files sticking around until spampd child exists,
>   introduced when SA 3.0 was released
>   (https://issues.apache.org/SpamAssassin/show_bug.cgi?id=5444).
> Thanks to Simon Matter for bringing this to my attention.
>
>
>
> [0] https://penguindreams.org/blog/openbsd-spampd-and-the-startup-bug/
> [1] https://github.com/mpaperno/spampd/issues/19


Index: Makefile
===================================================================
RCS file: /cvs/ports/mail/spampd/Makefile,v
retrieving revision 1.7
diff -u -p -r1.7 Makefile
--- Makefile 11 Jan 2018 19:27:04 -0000 1.7
+++ Makefile 23 Aug 2018 23:54:39 -0000
@@ -2,8 +2,9 @@
 
 COMMENT= SMTP/LMTP proxy for Spamassassin
 
-DISTNAME= spampd-2.30
-REVISION= 4
+GH_ACCOUNT= mpaperno
+GH_PROJECT= spampd
+GH_TAGNAME= 2.51
 
 CATEGORIES= mail
 
@@ -13,8 +14,6 @@ MAINTAINER= Henrik Friedrichsen <henrik
 # GPLv2+
 PERMIT_PACKAGE_CDROM=   Yes
 
-MASTER_SITES= http://www.worlddesign.com/Content/rd/mta/spampd/
-
 RUN_DEPENDS= devel/p5-Net-Server \
  mail/p5-Mail-SpamAssassin
 
@@ -24,8 +23,8 @@ NO_TEST= Yes
 
 do-install:
  cd ${WRKSRC} && \
- pod2man --section=8 --center="Spam Proxy Daemon" spampd > spampd.8
+ pod2man --section=8 --center="Spam Proxy Daemon" spampd.pl > spampd.8
  ${INSTALL_MAN} ${WRKBUILD}/spampd.8 ${PREFIX}/man/man8/spampd.8
- ${INSTALL_SCRIPT} ${WRKSRC}/spampd ${PREFIX}/sbin/spampd
+ ${INSTALL_SCRIPT} ${WRKSRC}/spampd.pl ${PREFIX}/sbin/spampd
 
 .include <bsd.port.mk>
Index: distinfo
===================================================================
RCS file: /cvs/ports/mail/spampd/distinfo,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 distinfo
--- distinfo 8 Feb 2014 18:58:22 -0000 1.1.1.1
+++ distinfo 23 Aug 2018 23:54:39 -0000
@@ -1,2 +1,2 @@
-SHA256 (spampd-2.30.tar.gz) = aIVUT00bM56+OtWAaENDlygKZSb2guePfQJGrvagmXk=
-SIZE (spampd-2.30.tar.gz) = 25001
+SHA256 (spampd-2.51.tar.gz) = k8w+8Z7P8iSsAPbHoOAo8Fnsg5cDMp9FZ4RrdQlkrAc=
+SIZE (spampd-2.51.tar.gz) = 215462
Index: patches/patch-spampd
===================================================================
RCS file: patches/patch-spampd
diff -N patches/patch-spampd
--- patches/patch-spampd 27 Nov 2014 12:37:29 -0000 1.3
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,105 +0,0 @@
-$OpenBSD: patch-spampd,v 1.3 2014/11/27 12:37:29 ajacoutot Exp $
-
-https://github.com/mpaperno/spampd/commit/1fe20e4c0f06760eb341b519c32954bfc9ef7a15
-https://github.com/mpaperno/spampd/commit/9088ae52b6fc6dcf4bc1b2d19109166b4f76c66a
-https://github.com/mpaperno/spampd/commit/7706c364d19f630ba7fbc8681f6e75282d60a73f
-https://github.com/mpaperno/spampd/commit/e472b7b8f39f69ec20c81eaaf42c7fbfb9c703dd
-
---- spampd.orig Wed Nov 26 09:56:25 2014
-+++ spampd Wed Nov 26 09:56:09 2014
-@@ -752,8 +752,8 @@ my $childtimeout = 6*60; # child process per-command t
- my $satimeout = 285; # SpamAssassin timeout in seconds (15s less than Postfix
-                      # default for smtp_data_done_timeout)
- my $pidfile = '/var/run/spampd.pid'; # write pid to file
--my $user = 'mail'; # user to run as
--my $group = 'mail'; # group to run as
-+my $user = '_spampd'; # user to run as
-+my $group = '_spampd'; # group to run as
- my $tagall = 0; # mark-up all msgs with SA, not just spam
- my $maxsize = 64; # max. msg size to scan with SA, in KB.
- my $rh = 0; # log which rules were hit
-@@ -824,6 +824,20 @@ if ( $logsock !~ /^(unix|inet)$/ ) {
- usage(0);
- }
-
-+# Untaint some options provided by admin command line.
-+$logsock = $1 if $logsock =~ /^(.*)$/;
-+
-+$pidfile = $1 if $pidfile =~ /^(.*)$/;
-+
-+$relayhost = $1 if $relayhost =~ /^(.*)$/;
-+
-+$relayport = $1 if $relayport =~ /^(.*)$/;
-+
-+$host = $1 if $host =~ /^(.*)$/;
-+
-+$port = $1 if $port =~ /^(.*)$/;
-+#
-+
- if ( $options{tagall} ) { $tagall = 1; }
- if ( $options{'log-rules-hit'} ) { $rh = 1; }
- if ( $options{debug} ) { $debug = 1; $nsloglevel = 4; }
-@@ -849,6 +863,7 @@ if ( $tmp[1] ) { $port = $tmp[1]; }
- my $assassin = Mail::SpamAssassin->new({
- 'dont_copy_prefs' => 1,
- 'debug' => $debug,
-+ 'user_dir' => (getpwnam($user))[7],
- 'local_tests_only' => $options{'local-only'} || 0 });
-
- $options{'auto-whitelist'} and eval {
-@@ -942,9 +957,9 @@ Options:
-   --pid=filename           Store the daemon's process ID in this file.
-                                Default is /var/run/spampd.pid
-   --user=username          Specifies the user that the daemon runs as.
--                               Default is mail.
-+                               Default is _spampd.
-   --group=groupname        Specifies the group that the daemon runs as.
--                               Default is mail.
-+                               Default is _spampd.
-   --nodetach               Don't detach from the console and fork into
-                                background. Useful for some daemon control
-                                tools or when running as a win32 service
-@@ -1075,10 +1090,10 @@ L<http://www.WorldDesign.com/index.cfm/rd/mta/spampd.h
-
- =head1 Requires
-
--=over 5
--
- Perl modules:
-
-+=over 5
-+
- =item B<Mail::SpamAssassin>
-
- =item B<Net::Server::PreForkSimple>
-@@ -1249,7 +1264,7 @@ alternate to using the above --relayhost=ip:port notat
- =item B<--group=groupname> or  B<--g=groupname>
-
- Specifies the user and group that the proxy will run as. Default is
--I<mail>/I<mail>.
-+I<_spampd>/I<_spampd>.
-
- =item B<--children=n> or B<--c=n>
-
-@@ -1299,7 +1314,7 @@ Default is 285 seconds.
-
- Specifies a filename where I<spampd> will write its process ID so
- that it is easy to kill it later. The directory that will contain this
--file must be writable by the I<spampd> user. The default is
-+file must be writable by the I<_spampd> user. The default is
- F</var/run/spampd.pid>.
-
- =item B<--logsock=unix or inet> C<(new in v2.20)>
-@@ -1390,10 +1405,10 @@ Prints usage information.
-
- =head2 Deprecated Options
-
--=over 5
--
- The following options are no longer used but still accepted for backwards
- compatibility with prevoius I<spampd> versions:
-+
-+=over 5
-
- =item  B<--dead-letters>
-
Index: patches/patch-spampd_pl
===================================================================
RCS file: patches/patch-spampd_pl
diff -N patches/patch-spampd_pl
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-spampd_pl 23 Aug 2018 23:54:39 -0000
@@ -0,0 +1,60 @@
+$OpenBSD$
+
+Index: spampd.pl
+--- spampd.pl.orig
++++ spampd.pl
+@@ -798,7 +798,13 @@ sub mylog($$$) {
+     $self->log($level, $msg);
+ }
+
++# Override Net::Server's HUP handling - just gracefully restart all the children.
++sub sig_hup {
++      my $self = shift;
++      $self->hup_children;
++}
+
++
+ ##################   SETUP   ######################
+
+
+@@ -816,8 +822,8 @@ my $childtimeout = 6*60; # child process per-command t
+ my $satimeout = 285; # SpamAssassin timeout in seconds (15s less than Postfix
+                      # default for smtp_data_done_timeout)
+ my $pidfile = '/var/run/spampd.pid'; # write pid to file
+-my $user = 'mail'; # user to run as
+-my $group = 'mail'; # group to run as
++my $user = '_spampd'; # user to run as
++my $group = '_spampd'; # group to run as
+ my $tagall = 0; # mark-up all msgs with SA, not just spam
+ my $maxsize = 64; # max. msg size to scan with SA, in KB.
+ my $rh = 0; # log which rules were hit
+@@ -1078,9 +1084,9 @@ Options:
+   --pid=filename           Store the daemon's process ID in this file.
+                                Default is /var/run/spampd.pid
+   --user=username          Specifies the user that the daemon runs as.
+-                               Default is mail.
++                               Default is _spampd.
+   --group=groupname        Specifies the group that the daemon runs as.
+-                               Default is mail.
++                               Default is _spampd.
+   --nodetach               Don't detach from the console and fork into
+                                background. Useful for some daemon control
+                                tools or when running as a win32 service
+@@ -1414,7 +1420,7 @@ Spevifies what UNIX socket spampd will relay to. If th
+ =item B<--group=groupname> or  B<--g=groupname>
+
+ Specifies the user and group that the proxy will run as. Default is
+-I<mail>/I<mail>.
++I<_spampd>/I<_spampd>.
+
+ =item B<--children=n> or B<--c=n>
+
+@@ -1553,7 +1559,7 @@ Things like the auto-whitelist and other plugin (razor
+ written to here.
+ Defaul is /var/spool/spamassassin/spampd.  A good place for this is in the same
+ place your bayes_path SA config setting points to (if any).  Make sure this
+-directory is accessible to the user that spampd is running as (default: mail).
++directory is accessible to the user that spampd is running as (default: _spampd).
+ New in v2.40. Thanks to Alexander Wirt for this fix.
+
+ =item B<--saconfig=filename>

Reply | Threaded
Open this post in threaded view
|

Re: [UPDATE] mail/spampd 2.30 -> 2.51 + fix boot issue

Josh Grosse-3
On Fri, Aug 24, 2018 at 02:16:31PM -0400, trondd wrote:
> I'd love to get update in for 6.4 as it fixes a long standing issue with spampd
> failing to start correctly via rc at boot time.
>
> Tim.

Seems to be working here. Tested on my personal MTA,  an amd64 6.3-release system.
(I am not running any MTAs on -current at the moment)

Reply | Threaded
Open this post in threaded view
|

Re: [UPDATE] mail/spampd 2.30 -> 2.51 + fix boot issue

Henrik Friedrichsen
In reply to this post by trondd-2
On Fri, Aug 24, 2018 at 02:16:31PM -0400, trondd wrote:
> I'd love to get update in for 6.4 as it fixes a long standing issue with spampd
> failing to start correctly via rc at boot time.

I second that notion. Thanks again, looks good to me.