From 8770262622ef32171c7df3d7e2d93ba1cdd0efbe Mon Sep 17 00:00:00 2001 From: Stuart Gathman Date: Wed, 26 Jun 2013 18:28:49 +0000 Subject: [PATCH] Initial selinux policy support --- milter-template.py | 3 +++ pymilter.spec | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/milter-template.py b/milter-template.py index 3d5a381..e79d58d 100644 --- a/milter-template.py +++ b/milter-template.py @@ -71,6 +71,9 @@ class myMilter(Milter.Base): self.fromparms = Milter.dictfromlist(str) # ESMTP parms self.user = self.getsymval('{auth_authen}') # authenticated user self.log("mail from:", mailfrom, *str) + # NOTE: self.fp is only an *internal* copy of message data. You + # must use addheader, chgheader, replacebody to change the message + # on the MTA. self.fp = StringIO.StringIO() self.canon_from = '@'.join(parse_addr(mailfrom)) self.fp.write('From %s %s\n' % (self.canon_from,time.ctime())) diff --git a/pymilter.spec b/pymilter.spec index c5b7618..0acc97f 100644 --- a/pymilter.spec +++ b/pymilter.spec @@ -7,8 +7,9 @@ Summary: Python interface to sendmail milter API Name: %{pythonbase}-pymilter Version: 0.9.8 -Release: 1%{dist} +Release: 2%{dist} Source: http://downloads.sourceforge.net/pymilter/pymilter-%{version}.tar.gz +Source1: pymilter.te License: GPLv2+ Group: Development/Libraries BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root @@ -19,6 +20,7 @@ Requires: %{pythonbase} >= 2.6.5, sendmail >= 8.13 Requires: %{pythonbase}-pydns # Needed for callbacks, not a core function but highly useful for milters BuildRequires: ed, %{pythonbase}-devel, sendmail-devel >= 8.13 +BuildRequires: policycoreutils %description This is a python extension module to enable python scripts to @@ -31,6 +33,8 @@ DSNs, and doing CBV. %build env CFLAGS="$RPM_OPT_FLAGS" %{__python} setup.py build +checkmodule -m -M -o pymilter.mod %{SOURCE1} +semodule_package -o pymilter.pp -m pymilter.mod %install rm -rf $RPM_BUILD_ROOT