Skip to contentSkip to conversation

milter-state-dir.patch

refpolicy Paul Howarth 2 participants 5 messages Mar 17, 2009 – Apr 21, 2009

lore
Share & tools
lore
#0 lore raw

This is a patch to support a single system-wide spamassassin configuration using spamass-milter. Current policy only supports a spamassassin configuration that uses separate per-user config files, which are stored either in ~/.spamassassin for real users or in some system-specific directory probably labelled spamassassin_spool_t for virtual users.

The current Fedora spamass-milter package runs as user sa-milt, having a home directory of /var/run/spamass-milter. This has proved to be an unfortunate choice because all files (including the system-wide spamassassin preferences and bayes databases) get cleared out of that directory on reboot (http://bugzilla.redhat.com/489995). I therefore intend to change the home directory of this user to /var/lib/spamass-milter.

This patch provides for appropriate labelling and rules for this directory to allow spamass-milter and spamassassin to work in this configuration.

Paul.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: milter-state-dir.patch
Type: text/x-patch
Size: 2963 bytes
Desc: not available
Url : http://oss.tresys.com/pipermail/refpolicy/attachments/20090317/093c621f/attachment.bin

#1 lore raw
Quoted 15 lines · Paul Howarth

This is a patch to support a single system-wide spamassassin configuration using spamass-milter. Current policy only supports a spamassassin configuration that uses separate per-user config files, which are stored either in ~/.spamassassin for real users or in some system-specific directory probably labelled spamassassin_spool_t for virtual users.

The current Fedora spamass-milter package runs as user sa-milt, having a home directory of /var/run/spamass-milter. This has proved to be an unfortunate choice because all files (including the system-wide spamassassin preferences and bayes databases) get cleared out of that directory on reboot (http://bugzilla.redhat.com/489995). I therefore intend to change the home directory of this user to /var/lib/spamass-milter.

Quoted 3 lines

This patch provides for appropriate labelling and rules for this directory to allow spamass-milter and spamassassin to work in this configuration.

Attached is an updated version of the patch that:

* renames the spamass_milter_manage_state interface to milter_spamass_manage_state so as to fit the naming convention better

* adds milter_spamass_manage_state(spamc_t), needed for razor, pyzor etc. called from spamassassin when installed and used with the milter

Paul.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: milter-state-dir.patch
Type: text/x-patch
Size: 3150 bytes
Desc: not available
Url : http://oss.tresys.com/pipermail/refpolicy/attachments/20090402/8ea7bb42/attachment.bin

#2 lore raw
Quoted 26 lines · Paul Howarth
Quoted 3 lines · Paul Howarth

This is a patch to support a single system-wide spamassassin configuration using spamass-milter. Current policy only supports a spamassassin configuration that uses separate per-user config

files,

Quoted 1 line

which are stored either in ~/.spamassassin for real users or in

some

Quoted 1 line

system-specific directory probably labelled spamassassin_spool_t

for

Quoted 3 lines

virtual users.

The current Fedora spamass-milter package runs as user sa-milt,

having a

Quoted 3 lines

home directory of /var/run/spamass-milter. This has proved to be an unfortunate choice because all files (including the system-wide spamassassin preferences and bayes databases) get cleared out of

that

Quoted 1 line

directory on reboot (http://bugzilla.redhat.com/489995). I

therefore

Quoted 6 lines

intend to change the home directory of this user to /var/lib/spamass-milter.

This patch provides for appropriate labelling and rules for this directory to allow spamass-milter and spamassassin to work in this configuration.

Quoted 7 lines

Attached is an updated version of the patch that:

* renames the spamass_milter_manage_state interface to milter_spamass_manage_state so as to fit the naming convention better

* adds milter_spamass_manage_state(spamc_t), needed for razor, pyzor etc. called from spamassassin when installed and used with the milter

Sorry for the slow response. Two things.

* The interface should be milter_manage_spamass_state().

* Is this needed because of the way that Fedora configures it? (is this a Fedora-specific change) If so, it should likely be in a distro_redhat.

Quoted 114 lines

differences
between files
attachment
(milter-state-dir.patch)

Index: policy/modules/services/spamassassin.te
===================================================================

modules/services/spamassassin.te (working copy) renamed from modules/services/spamassassin.te (revision 2937) +9 -0
@@ -280,6 +280,11 @@
 ')
 
 optional_policy(`
+       # Needed for pyzor/razor called from spamd
+       milter_spamass_manage_state(spamc_t)
+')
+
+optional_policy(`
        nis_use_ypbind(spamc_t)
 ')
 
@@ -454,5 +459,9 @@
 ')
 
 optional_policy(`
+       milter_spamass_manage_state(spamd_t)
+')
+
+optional_policy(`
        udev_read_db(spamd_t)
 ')

Index: policy/modules/services/milter.te
===================================================================

modules/services/milter.te (working copy) renamed from modules/services/milter.te (revision 2937) +1 -0
@@ -14,6 +14,12 @@
 milter_template(regex)
 milter_template(spamass)
 
+# Type for the spamass-milter home directory, under which

spamassassin will
+# store system-wide preferences, bayes databases etc. if not configured to

modules/services/milter.te (working copy) renamed from modules/services/milter.te (revision 2937) +8 -0
+# use per-user configuration
+type spamass_milter_state_t;
+files_type(spamass_milter_state_t);
+
 ########################################
 #
 # milter-regex local policy
@@ -41,6 +47,10 @@
 #   http://savannah.nongnu.org/projects/spamass-milt/
 #
 
+# The milter runs from /var/lib/spamass-milter
+files_search_var_lib(spamass_milter_t);
+allow spamass_milter_t spamass_milter_state_t:dir search_dir_perms;
+
 kernel_read_system_state(spamass_milter_t)
 
 # When used with -b or -B options, the milter invokes sendmail to

send mail
Index: policy/modules/services/milter.fc
===================================================================

modules/services/milter.fc (working copy) renamed from modules/services/milter.fc (revision 2937) +1 -0
@@ -2,5 +2,6 @@
 /var/spool/milter-regex(/.*)?                          gen_context(system_u:object_r:regex_milter_data_t,s0)
 
 /usr/sbin/spamass-milter                       --      gen_context(system_u:object_r:spamass_milter_exec_t,s0)
+/var/lib/spamass-milter(/.*)?                          gen_context(system_u:object_r:spamass_milter_state_t,s0)
 /var/run/spamass-milter(/.*)?                          gen_context(system_u:object_r:spamass_milter_data_t,s0)
 /var/run/spamass-milter

\.pid -- gen_context(system_u:object_r:spamass_milter_data_t,s0)
Index: policy/modules/services/milter.if
===================================================================

modules/services/milter.if (working copy) renamed from modules/services/milter.if (revision 2937) +18 -0
@@ -77,3 +77,24 @@
        getattr_dirs_pattern($1, milter_data_type, milter_data_type)
        getattr_sock_files_pattern($1, milter_data_type,
 milter_data_type)
 ')
+
+########################################
+## <summary>
+##     Manage spamassassin milter state
+## </summary>
+## <param name="domain">
+##     <summary>
+##     Domain allowed access.
+##     </summary>
+## </param>
+#
+interface(`milter_spamass_manage_state',`
+       gen_require(`
+               type spamass_milter_state_t;
+       ')
+
+       files_search_var_lib($1)
+       manage_files_pattern($1, spamass_milter_state_t,

spamass_milter_state_t)
+ manage_dirs_pattern($1, spamass_milter_state_t,
spamass_milter_state_t)
+ manage_lnk_files_pattern($1, spamass_milter_state_t,
spamass_milter_state_t)
+')

Signature · 3 lines
Chris PeBenito
Tresys Technology, LLC
(410) 290-1411 x150
#3 lore raw
Quoted 34 lines · On Tue, 21 Apr 2009 16:12:27 -0400 "Christopher J. PeBenito"…
Quoted 33 lines · Paul Howarth
Quoted 3 lines · Paul Howarth

This is a patch to support a single system-wide spamassassin configuration using spamass-milter. Current policy only supports a spamassassin configuration that uses separate per-user config

files,

Quoted 1 line

which are stored either in ~/.spamassassin for real users or in

some

Quoted 1 line

system-specific directory probably labelled spamassassin_spool_t

for

Quoted 3 lines

virtual users.

The current Fedora spamass-milter package runs as user sa-milt,

having a

Quoted 4 lines

home directory of /var/run/spamass-milter. This has proved to be an unfortunate choice because all files (including the system-wide spamassassin preferences and bayes databases) get cleared out of

that

Quoted 1 line

directory on reboot (http://bugzilla.redhat.com/489995). I

therefore

Quoted 6 lines

intend to change the home directory of this user to /var/lib/spamass-milter.

This patch provides for appropriate labelling and rules for this directory to allow spamass-milter and spamassassin to work in this configuration.

Attached is an updated version of the patch that:

* renames the spamass_milter_manage_state interface to milter_spamass_manage_state so as to fit the naming convention better

Quoted 7 lines
Quoted 3 lines

* adds milter_spamass_manage_state(spamc_t), needed for razor, pyzor etc. called from spamassassin when installed and used with the milter

Sorry for the slow response. Two things.

* The interface should be milter_manage_spamass_state().

OK: do you want me to resubmit the patch or can you do the rename whilst merging.

Quoted 3 lines

* Is this needed because of the way that Fedora configures it? (is this a Fedora-specific change) If so, it should likely be in a distro_redhat.

No, it's not Fedora-specific. There's a bunch of different ways that the milter and spamassassin can be configured, and I'd missed this one originally.

Paul.

#4 lore raw
Quoted 48 lines · Paul Howarth
Quoted 34 lines · On Tue, 21 Apr 2009 16:12:27 -0400 "Christopher J. PeBenito"…
Quoted 33 lines · Paul Howarth
Quoted 3 lines · Paul Howarth

This is a patch to support a single system-wide spamassassin configuration using spamass-milter. Current policy only supports a spamassassin configuration that uses separate per-user config

files,

Quoted 1 line

which are stored either in ~/.spamassassin for real users or in

some

Quoted 1 line

system-specific directory probably labelled spamassassin_spool_t

for

Quoted 3 lines

virtual users.

The current Fedora spamass-milter package runs as user sa-milt,

having a

Quoted 4 lines

home directory of /var/run/spamass-milter. This has proved to be an unfortunate choice because all files (including the system-wide spamassassin preferences and bayes databases) get cleared out of

that

Quoted 1 line

directory on reboot (http://bugzilla.redhat.com/489995). I

therefore

Quoted 6 lines

intend to change the home directory of this user to /var/lib/spamass-milter.

This patch provides for appropriate labelling and rules for this directory to allow spamass-milter and spamassassin to work in this configuration.

Attached is an updated version of the patch that:

* renames the spamass_milter_manage_state interface to milter_spamass_manage_state so as to fit the naming convention better

Quoted 7 lines
Quoted 3 lines

* adds milter_spamass_manage_state(spamc_t), needed for razor, pyzor etc. called from spamassassin when installed and used with the milter

Sorry for the slow response. Two things.

* The interface should be milter_manage_spamass_state().

OK: do you want me to resubmit the patch or can you do the rename whilst merging.

Quoted 7 lines
Quoted 3 lines

* Is this needed because of the way that Fedora configures it? (is this a Fedora-specific change) If so, it should likely be in a distro_redhat.

No, it's not Fedora-specific. There's a bunch of different ways that the milter and spamassassin can be configured, and I'd missed this one originally.

Merged.

Signature · 3 lines
Chris PeBenito
Tresys Technology, LLC
(410) 290-1411 x150