rpms/spamass-milter/devel spamass-milter-0.3.1-group.patch, NONE, 1.1 spamass-milter-0.3.1-macros.patch, NONE, 1.1 spamass-milter.README.Postfix, NONE, 1.1 spamass-milter.spec, 1.14, 1.15 spamass-milter.sysv, 1.2, 1.3

Paul Howarth pghmcfc at fedoraproject.org
Mon Feb 2 15:06:00 UTC 2009


Author: pghmcfc

Update of /cvs/pkgs/rpms/spamass-milter/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv3846/devel

Modified Files:
	spamass-milter.spec spamass-milter.sysv 
Added Files:
	spamass-milter-0.3.1-group.patch 
	spamass-milter-0.3.1-macros.patch 
	spamass-milter.README.Postfix 
Log Message:
- Require /usr/sbin/sendmail (for -b/-B/-x options) rather than sendmail pkg
- Make summary and description less Sendmail-specific
- Add patch to support group-writable socket for MTA communication, needed
  to be able to use a Unix-domain socket with Postfix (#452248)
- Add subpackage with group-writable directory for Postfix support
- Tweak initscript to change default options when Postfix socket directory is
  present
- Document additional ENVRCPT macros to provide


spamass-milter-0.3.1-group.patch:

--- NEW FILE spamass-milter-0.3.1-group.patch ---
--- spamass-milter-0.3.1/spamass-milter.cpp.group	2006-03-23 22:41:36.000000000 +0100
+++ spamass-milter-0.3.1/spamass-milter.cpp	2008-06-19 18:04:05.000000000 +0200
@@ -89,6 +89,8 @@
 #endif
 #include <errno.h>
 
+#include <grp.h>
+
 // C++ includes
 #include <cstdio>
 #include <cstddef>
@@ -181,8 +183,9 @@
 main(int argc, char* argv[])
 {
    int c, err = 0;
-   const char *args = "fd:mMp:P:r:u:D:i:b:B:e:x";
+   const char *args = "fd:mMp:P:r:u:D:i:b:B:e:xg:";
    char *sock = NULL;
+   char *group = NULL;
    bool dofork = false;
    char *pidfilename = NULL;
    FILE *pidfile = NULL;
@@ -225,6 +228,9 @@
 			case 'p':
 				sock = strdup(optarg);
 				break;
+			case 'g':
+				group = strdup(optarg);
+				break;
 			case 'P':
 				pidfilename = strdup(optarg);
 				break;
@@ -284,6 +290,7 @@
       cout << "                      [-P pidfile] [-r nn] [-u defaultuser] [-x]" << endl;
       cout << "                      [-- spamc args ]" << endl;
       cout << "   -p socket: path to create socket" << endl;
+      cout << "   -g group: socket group (perms to 750 as well)" << endl;
       cout << "   -b bucket: redirect spam to this mail address.  The orignal" << endl;
       cout << "          recipient(s) will not receive anything." << endl;
       cout << "   -B bucket: add this mail address as a BCC recipient of spam." << endl;
@@ -350,6 +357,28 @@
 	} else {
       debug(D_MISC, "smfi_register succeeded");
    }
+
+   if(group) {
+      struct group *gr;
+
+      (void) smfi_opensocket(0);
+      gr = getgrnam(group);
+      if(gr) {
+        int rc;
+	rc = chown(sock, (uid_t)-1, gr->gr_gid);
+	if(! rc) {
+           (void) chmod(sock, 0660);
+	} else {
+      	   perror("group option, chmod");
+	   exit(EX_NOPERM);
+	}
+      } else { 
+      	perror("group option, getgrnam");
+	exit(EX_NOUSER);
+      }
+   }
+   
+
 	debug(D_ALWAYS, "spamass-milter %s starting", PACKAGE_VERSION);
 	err = smfi_main();
 	debug(D_ALWAYS, "spamass-milter %s exiting", PACKAGE_VERSION);
--- spamass-milter-0.3.1/spamass-milter.1.in.group	2008-07-03 14:11:46.000000000 +0100
+++ spamass-milter-0.3.1/spamass-milter.1.in	2008-07-03 14:18:17.000000000 +0100
@@ -13,6 +13,7 @@
 .Op Fl D Ar host
 .Op Fl e Ar defaultdomain
 .Op Fl f
+.Op Fl g Ar group
 .Op Fl i Ar networks
 .Op Fl m
 .Op Fl M
@@ -107,6 +108,12 @@
 Causes
 .Nm
 to fork into the background.
+.It Fl g Ar group
+Makes the socket for communication with the MTA group-writable (mode 0750)
+and sets the socket's group to
+.Ar group .
+This option is intended for use with MTA's like Postfix that do not run as
+root, and is incompatible with Sendmail usage.
 .It Fl i Ar networks
 Ignores messages if the originating IP is in the network(s) listed.
 The message will be passed through without calling SpamAssassin at all.

spamass-milter-0.3.1-macros.patch:

--- NEW FILE spamass-milter-0.3.1-macros.patch ---
--- spamass-milter-0.3.1/README.orig	2009-01-30 16:20:00.000000000 +0000
+++ spamass-milter-0.3.1/README	2009-01-30 16:21:18.000000000 +0000
@@ -56,6 +56,7 @@
 
 INPUT_MAIL_FILTER(`spamassassin', `S=unix:%{_localstatedir}/run/spamass-milter/spamass-milter.sock, F=, T=C:15m;S:4m;R:4m;E:10m')dnl
 define(`confMILTER_MACROS_CONNECT',`t, b, j, _, {daemon_name}, {if_name}, {if_addr}')dnl
+define(`confMILTER_MACROS_ENVRCPT',confMILTER_MACROS_ENVRCPT`, r, v, Z')dnl
 define(`confMILTER_MACROS_HELO',`s, {tls_version}, {cipher}, {cipher_bits}, {cert_subject}, {cert_issuer}')dnl
 
 should do the trick. Of course you need to modify the path of the


--- NEW FILE spamass-milter.README.Postfix ---
Installing the spamass-milter-postfix package changes the default behaviour
of the spamass-milter initscript to be more Postfix-friendly, i.e.:

   The Unix-domain socket used for MTA communication is changed to
   %{_localstatedir}/run/spamass-milter/postfix/sock, and that socket is
   writable by the postfix group.

To configure Postfix to use the milter, add to /etc/postfix/main.cf:

  smtpd_milters = unix:%{_localstatedir}/run/spamass-milter/postfix/sock

For further information, see:
http://www.postfix.org/MILTER_README.html


Index: spamass-milter.spec
===================================================================
RCS file: /cvs/pkgs/rpms/spamass-milter/devel/spamass-milter.spec,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- spamass-milter.spec	20 May 2008 22:24:04 -0000	1.14
+++ spamass-milter.spec	2 Feb 2009 15:05:30 -0000	1.15
@@ -1,7 +1,7 @@
-Summary:	Sendmail milter for spamassassin
+Summary:	Milter (mail filter) for spamassassin
 Name:		spamass-milter
 Version:	0.3.1
-Release:	8%{?dist}
+Release:	9%{?dist}
 License:	GPLv2+
 Group:		System Environment/Daemons
 URL:		http://savannah.nongnu.org/projects/spamass-milt/
@@ -9,10 +9,13 @@
 Source1:	spamass-milter-wrapper
 Source2:	spamass-milter.sysv
 Source3:	spamass-milter.sysconfig
+Source4:	spamass-milter.README.Postfix
 Patch0:		spamass-milter-0.3.1-pathnames.patch
+Patch1:		spamass-milter-0.3.1-macros.patch
+Patch2:		spamass-milter-0.3.1-group.patch
 BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildRequires:	spamassassin, sendmail-devel
-Requires:	spamassassin, sendmail
+Requires:	spamassassin, /usr/sbin/sendmail
 
 Requires(pre): shadow-utils
 Requires(post): /sbin/chkconfig
@@ -22,19 +25,33 @@
 Requires(postun): /sbin/service
 
 %description
-A Sendmail milter (Mail Filter) application that pipes incoming mail
-(including things received by rmail/UUCP) through SpamAssassin, a highly
-customizable spam filter.
+A milter (Mail Filter) application that pipes incoming mail (including things
+received by rmail/UUCP) through SpamAssassin, a highly customizable spam
+filter. A milter-compatible MTA such as Sendmail or Postfix is required.
+
+%package postfix
+Summary:	Postfix support for spamass-milter
+Group:		System Environment/Daemons
+Requires:	%{name} = %{version}-%{release}
+Requires(pre):	postfix
+Requires(post):	shadow-utils
+
+%description postfix
+This package adds support for running spamass-milter using a Unix-domain
+socket to communicate with the Postfix MTA.
 
 %prep
 %setup -q
 %patch0 -p1 -b .pathnames
-%{__cp} -p %{SOURCE1} %{SOURCE2} %{SOURCE3} .
+%patch1 -p1 -b .macros
+%patch2 -p1 -b .group
+%{__cp} -p %{SOURCE1} %{SOURCE2} %{SOURCE3} %{SOURCE4} .
 %{__sed} -i -e 's|%%{_localstatedir}|%{_localstatedir}|g;
 		s|%%{_initrddir}|%{_initrddir}|g;
 		s|%%{_sysconfdir}|%{_sysconfdir}|g;
 		s|%%{_sbindir}|%{_sbindir}|g;' \
-	spamass-milter.{sysv,sysconfig} README
+	spamass-milter.{README.Postfix,sysv,sysconfig} README
+%{__mv} spamass-milter.README.Postfix README.Postfix
 
 %build
 export SENDMAIL=/usr/sbin/sendmail
@@ -47,7 +64,8 @@
 
 %{__install} -m 755 -D spamass-milter.sysv %{buildroot}%{_initrddir}/spamass-milter
 %{__install} -m 644 -D spamass-milter.sysconfig %{buildroot}%{_sysconfdir}/sysconfig/spamass-milter
-%{__install} -m 700 -d %{buildroot}%{_localstatedir}/run/spamass-milter
+%{__install} -m 711 -d %{buildroot}%{_localstatedir}/run/spamass-milter
+%{__install} -m 750 -d %{buildroot}%{_localstatedir}/run/spamass-milter/postfix
 %{__install} -m 755 spamass-milter-wrapper %{buildroot}%{_sbindir}/spamass-milter-wrapper
 
 %pre
@@ -69,6 +87,12 @@
 %postun
 /sbin/service spamass-milter condrestart &>/dev/null || :
 
+%post postfix
+# This is needed because the milter needs to "give away" the MTA communication
+# socket to the postfix group, and it needs to be a member of the group to do
+# that.
+/usr/sbin/usermod -a -G postfix sa-milt || :
+
 %clean
 %{__rm} -rf %{buildroot}
 
@@ -82,7 +106,22 @@
 %{_sbindir}/spamass-milter-wrapper
 %dir %attr(-,sa-milt,sa-milt) %{_localstatedir}/run/spamass-milter/
 
+%files postfix
+%defattr(-,root,root,-)
+%doc README.Postfix
+%dir %attr(-,sa-milt,postfix) %{_localstatedir}/run/spamass-milter/postfix/
+
 %changelog
+* Thu Jul  3 2008 Paul Howarth <paul at city-fan.org> 0.3.1-9
+- Require /usr/sbin/sendmail (for -b/-B/-x options) rather than sendmail pkg
+- Make summary and description less Sendmail-specific
+- Add patch to support group-writable socket for MTA communication, needed
+  to be able to use a Unix-domain socket with Postfix (#452248)
+- Add subpackage with group-writable directory for Postfix support
+- Tweak initscript to change default options when Postfix socket directory is
+  present
+- Document additional ENVRCPT macros to provide
+
 * Tue May 20 2008 Paul Howarth <paul at city-fan.org> 0.3.1-8
 - Fix initscript failure to start with SELinux in enforcing mode (#447247)
   (needs selinux-policy >= 3.3.1-55 on F9)


Index: spamass-milter.sysv
===================================================================
RCS file: /cvs/pkgs/rpms/spamass-milter/devel/spamass-milter.sysv,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- spamass-milter.sysv	20 May 2008 22:24:04 -0000	1.2
+++ spamass-milter.sysv	2 Feb 2009 15:05:30 -0000	1.3
@@ -25,9 +25,17 @@
 # Default variables
 PATH=/sbin:/bin:/usr/sbin:/usr/bin
 SOCKET="%{_localstatedir}/run/spamass-milter/spamass-milter.sock"
+SOCKET_OPTIONS=""
 EXTRA_FLAGS=""
 SYSCONFIG="%{_sysconfdir}/sysconfig/spamass-milter"
 
+# If Postfix support package is installed, use a postfix-group-writable
+# socket for communication with the MTA
+if [ -d %{_localstatedir}/run/spamass-milter/postfix ]; then
+	SOCKET="%{_localstatedir}/run/spamass-milter/postfix/sock"
+	SOCKET_OPTIONS="-g postfix"
+fi
+
 # Read configuration
 source %{_initrddir}/functions
 source %{_sysconfdir}/sysconfig/network
@@ -45,7 +53,7 @@
 	touch ${pidfile}
 	chown sa-milt:sa-milt ${pidfile}
 	[ -x /sbin/restorecon ] && /sbin/restorecon ${pidfile}
-	daemon --user sa-milt %{_sbindir}/${prog}-wrapper -p ${SOCKET} -P ${pidfile} ${EXTRA_FLAGS}
+	daemon --user sa-milt %{_sbindir}/${prog}-wrapper ${SOCKET_OPTIONS} -p ${SOCKET} -P ${pidfile} ${EXTRA_FLAGS}
 	RETVAL=$?
 	echo
 	if [ ${RETVAL} -eq 0 ]; then




More information about the fedora-extras-commits mailing list