Skip to contentSkip to conversation

gentoo diff for arpwatch

PATCH petre rodan 3 participants 4 messages Nov 15, 2004 – Jan 5, 2005

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi,

attached you'll find a +15 -5 patch to the arpwatch policy

both /var/lib/arpwatch and /var/arpwatch are used by gentoo.
etc_t is used when arpwatch_t reads nsswitch.conf, usr_t is needed to read the ethercodes file.

the distro_gentoo block is needed because init creates ethX.dat files before the daemon is started.

bye,
peter

Signature · 4 lines
petre rodan
<[email protected]>
Developer,
Hardened Gentoo Linux
root/cvs/cvs.gentoo.org/gentoo-projects/selinux/arpwatch/arpwatch.fc renamed from root/public_html/policy/nsa/file_contexts/program/arpwatch.fc +1 -4
@@ -1,7 +1,4 @@
 # arpwatch - keep track of ethernet/ip address pairings
 /usr/sbin/arpwatch	--	system_u:object_r:arpwatch_exec_t
-ifdef(`distro_redhat', `
-/var/arpwatch(/.*)?	system_u:object_r:arpwatch_data_t
-', `
+/var/arpwatch(/.*)?		system_u:object_r:arpwatch_data_t
 /var/lib/arpwatch(/.*)?		system_u:object_r:arpwatch_data_t
-')
root/cvs/cvs.gentoo.org/gentoo-projects/selinux/arpwatch/arpwatch.te renamed from root/public_html/policy/nsa/domains/program/unused/arpwatch.te +14 -1
@@ -25,11 +25,24 @@
 allow arpwatch_t self:packet_socket create_socket_perms;
 allow arpwatch_t self:unix_stream_socket create_stream_socket_perms;
 
-allow arpwatch_t sbin_t:dir search;
+allow arpwatch_t { sbin_t var_lib_t }:dir search;
 allow arpwatch_t sbin_t:lnk_file read;
+allow arpwatch_t { etc_t usr_t }:file r_file_perms;
+
 can_ypbind(arpwatch_t)
 allow system_mail_t arpwatch_tmp_t:file rw_file_perms;
+allow system_mail_t arpwatch_t:packet_socket { read write };
 ifdef(`postfix.te', `
 allow postfix_local_t arpwatch_data_t:dir { search };
 ')
+ifdef(`qmail.te', `
+allow arpwatch_t bin_t:dir search;
+allow qmail_inject_t arpwatch_tmp_t:file { read write };
+allow qmail_inject_t arpwatch_t:packet_socket { read write };
+')
+
+ifdef(`distro_gentoo', `
+allow initrc_t arpwatch_data_t:dir { add_name write };
+allow initrc_t arpwatch_data_t:file create;
+')
 
#1 lore raw

Merged with some changes.

I moved the following rules and put an "ifdef(`arpwatch.te'" around them:
"allow system_mail_t" rules to mta.te
"allow qmail_inject_t" rules to qmail.te
"allow allow postfix_local_t" rule to postfix.te

I also moved the "allow initrc_t" rules to initrc.te and put "ifdef(distro_gentoo" and "ifdef(arpwatch.te'" around them.

Quoted 11 lines · petre rodan

Hi,

attached you'll find a +15 -5 patch to the arpwatch policy

both /var/lib/arpwatch and /var/arpwatch are used by gentoo.
etc_t is used when arpwatch_t reads nsswitch.conf, usr_t is needed to read the ethercodes file.

the distro_gentoo block is needed because init creates ethX.dat files before the daemon is started.

bye,
peter

Signature · 7 lines
James Carter <[email protected]>
National Security Agency

--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
#2 lore raw
Quoted 5 lines · James Carter

I moved the following rules and put an "ifdef(`arpwatch.te'" around them:
"allow system_mail_t" rules to mta.te
"allow qmail_inject_t" rules to qmail.te
"allow allow postfix_local_t" rule to postfix.te

This is not what we want. Below I have pasted some text from
http://www.coker.com.au/selinux/talks/ibmtu-2004/linux21.ppt describing the MTA policy (it's not great but it's the best description of MTA policy).

I have attached a patch that makes some changes to make it work with the design of the mta policy. This makes it work with Postfix, Qmail, Sendmail, and any other mta that might be used. The idea is that you don't have to write policy for every combination of program that sends mail and mta, this doesn't scale well as the number of supported mta's increases.

It might be appropriate to move the policy in the ifdef(arpwatch.te' from mta.te into arpwatch.te with an ifdef(mta.te'. We probably don't want to have an ifdef in mta.te for every daemon that does unexpected things.

Also note that system_mail_t is unable to do anything you might desire with a packet_socket file handle that it inherits. This would be a bug in arpwatch...

Sorry for the month delay in responding to this.

Quoted 17 lines

I also moved the "allow initrc_t" rules to initrc.te and put "ifdef(distro_gentoo" and "ifdef(arpwatch.te'" around them.

Quoted 13 lines · petre rodan

Hi,

attached you'll find a +15 -5 patch to the arpwatch policy

both /var/lib/arpwatch and /var/arpwatch are used by gentoo. etc_t is used when arpwatch_t reads nsswitch.conf, usr_t is needed to read the ethercodes file.

the distro_gentoo block is needed because init creates ethX.dat files before the daemon is started.

bye,
peter

A mail server interacts with most programs on the system. To alleviate the risk of local DOS the program that receives mail from a user runs in it’s own domain.

Separate domain for receiving local mail from each user role, such domains can not communicate with each other

Mail server also interacts with the rest of the system for local delivery, SMTP delivery, and SMTP reception

Mail related attributes:
user_mail_domain for user_mail_t, staff_mail_t, sysadm_mail_t, etc – all the domains used to read the user’s files to send to the local mail server

mta_user_agent for domains that are part of an MTA which need to read user files for local mail receipt – executed from user_mail_domain

mta_delivery_agent for MTA domains that deliver mail to the user’s home directory

Mail_server_sender for the domain in the MTA which makes outbound port 25 connections – for anti-virus etc

Mail_server_domain for MTA domains that listen on port 25

Signature · 4 lines
http://www.coker.com.au/selinux/   My NSA Security Enhanced Linux packages
http://www.coker.com.au/bonnie++/  Bonnie++ hard drive benchmark
http://www.coker.com.au/postal/    Postal SMTP/POP benchmark
http://www.coker.com.au/~russell/  My home page
program/unused/mta.te renamed from usr/src/se/policy/domains/program/unused/mta.te +6 -2
@@ -48,9 +48,13 @@
 allow { system_mail_t mta_user_agent } admin_tty_type:chr_file { read write };
 
 ifdef(`arpwatch.te', `
-allow system_mail_t arpwatch_tmp_t:file rw_file_perms;
-allow system_mail_t arpwatch_t:packet_socket { read write };
+# why is mail delivered to a directory of type arpwatch_data_t?
+allow mta_delivery_agent arpwatch_data_t:dir search;
+allow { system_mail_t mta_user_agent } arpwatch_tmp_t:file rw_file_perms;
+ifdef(`hide_broken_symptoms', `
+dontaudit { system_mail_t mta_user_agent } arpwatch_t:packet_socket { read write };
 ')
+')dnl end if arpwatch.te
 
 allow mta_delivery_agent home_root_t:dir { getattr search };
 
program/unused/postfix.te renamed from usr/src/se/policy/domains/program/unused/postfix.te +0 -3
@@ -207,9 +209,6 @@
 allow postfix_local_t postfix_public_t:dir search;
 allow postfix_local_t postfix_public_t:sock_file write;
 can_exec(postfix_local_t, shell_exec_t)
-ifdef(`arpwatch.te', `
-allow postfix_local_t arpwatch_data_t:dir { search };
-')
 
 define(`postfix_public_domain',`
 postfix_server_domain($1)
program/unused/qmail.te renamed from usr/src/se/policy/domains/program/unused/qmail.te +0 -4
@@ -148,10 +148,6 @@
 allow qmail_inject_t sbin_t:dir search;
 role sysadm_r types qmail_inject_t;
 in_user_role(qmail_inject_t)
-ifdef(`arpwatch.te', `
-allow qmail_inject_t arpwatch_tmp_t:file { read write };
-allow qmail_inject_t arpwatch_t:packet_socket { read write };
-')
 
 qmaild_sub_domain(userdomain, qmail_qread, `, mta_user_agent')
 in_user_role(qmail_qread_t)
#3 lore raw

Ok. Merged.

Quoted 17 lines · Russell Coker
Quoted 5 lines · James Carter

I moved the following rules and put an "ifdef(`arpwatch.te'" around them:
"allow system_mail_t" rules to mta.te
"allow qmail_inject_t" rules to qmail.te
"allow allow postfix_local_t" rule to postfix.te

This is not what we want. Below I have pasted some text from
http://www.coker.com.au/selinux/talks/ibmtu-2004/linux21.ppt describing the MTA policy (it's not great but it's the best description of MTA policy).

I have attached a patch that makes some changes to make it work with the design of the mta policy. This makes it work with Postfix, Qmail, Sendmail, and any other mta that might be used. The idea is that you don't have to write policy for every combination of program that sends mail and mta, this doesn't scale well as the number of supported mta's increases.

Signature · 7 lines
James Carter <[email protected]>
National Security Agency

--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.