Skip to contentSkip to conversation

gentoo diff for snmpd

PATCH petre rodan 4 participants 8 messages Nov 15, 2004 – Nov 22, 2004 SELinux security module

lore
Share & tools
lore
#0 lore raw

Hi,

gentoo as a special context for /proc/net:
genfscon proc /net system_u:object_r:proc_net_t

so a small diff is needed for the snmpd policy. attached.

bye,
peter

Signature · 4 lines
petre rodan
<[email protected]>
Developer,
Hardened Gentoo Linux
root/cvs/cvs.gentoo.org/gentoo-projects/selinux/snmpd/snmpd.te renamed from root/public_html/policy/nsa/domains/program/unused/snmpd.te +6 -0
@@ -70,6 +70,12 @@
 ')
 allow snmpd_t var_lib_nfs_t:dir search;
 
+ifdef(`distro_gentoo', `
+# needed in order to retrieve net traffic data
+allow snmpd_t proc_net_t:dir search;
+allow snmpd_t proc_net_t:file r_file_perms;
+')
+
 dontaudit snmpd_t domain:dir { getattr search };
 
 dontaudit snmpd_t selinux_config_t:dir search;
root/cvs/cvs.gentoo.org/gentoo-projects/selinux/snmpd/snmpd.fc renamed from root/public_html/policy/nsa/file_contexts/program/snmpd.fc +1 -0
@@ -1,6 +1,7 @@
 # snmpd
 /usr/sbin/snmp(trap)?d	--	system_u:object_r:snmpd_exec_t
 /var/lib/snmp(/.*)?		system_u:object_r:snmpd_var_lib_t
+/var/lib/net-snmp(/.*)?	system_u:object_r:snmpd_var_lib_t
 /etc/snmp/snmp(trap)?d\.conf -- system_u:object_r:snmpd_etc_t
 /usr/share/snmp/mibs/\.index -- system_u:object_r:snmpd_var_lib_t
 /var/run/snmpd\.pid	--	system_u:object_r:snmpd_var_run_t
#1 lore raw
Quoted 2 lines · petre rodan

gentoo as a special context for /proc/net:
genfscon proc /net system_u:object_r:proc_net_t

This seems generally useful.
Care to provide a patch which adds this genfscon line plus the necessary policy?

Thomas

Signature · 2 lines
http://www.cip.ifi.lmu.de/~bleher/selinux/ - my SELinux pages
GPG-Fingerprint: BC4F BB16 30D6 F253 E3EA  D09E C562 2BAE B2F4 ABE7
#2 lore raw

Hi Thomas,

Quoted 11 lines · Thomas Bleher
Quoted 2 lines · petre rodan

gentoo as a special context for /proc/net:
genfscon proc /net system_u:object_r:proc_net_t

This seems generally useful.
Care to provide a patch which adds this genfscon line plus the necessary policy?

Thomas

Chris is currently working on a base-policy patch that will be sent here. I'm not sure if that will also contain proc_net-related rules.

If he wants it, I can come up with a diff about this issue.

bye,
peter

Signature · 4 lines
petre rodan
<[email protected]>
Developer,
Hardened Gentoo Linux
#3 lore raw
In reply to petre rodan

Merged.

Oops, there is no proc_net_t defined.
Petre, could you send me the proc_net_t stuff as well.

Quoted 9 lines · petre rodan

Hi,

gentoo as a special context for /proc/net:
genfscon proc /net system_u:object_r:proc_net_t

so a small diff is needed for the snmpd policy. attached.

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.
#4 lore raw

Hi James,

Quoted 4 lines · James Carter

Merged.

Oops, there is no proc_net_t defined.
Petre, could you send me the proc_net_t stuff as well.

please see the attachment.

Quoted 8 lines · petre rodan
Quoted 7 lines

Hi,

gentoo as a special context for /proc/net:
genfscon proc /net system_u:object_r:proc_net_t

so a small diff is needed for the snmpd policy. attached.

bye,
peter

Signature · 4 lines
petre rodan
<[email protected]>
Developer,
Hardened Gentoo Linux

Index: policy/genfs_contexts
===================================================================
RCS file: /cvsroot/selinux/nsa/selinux-usr/policy/genfs_contexts,v retrieving revision 1.16

genfs_contexts +1 -0
diff -u -B -r1.16 genfs_contexts
@@ -36,6 +36,7 @@
 genfscon proc /kcore			system_u:object_r:proc_kcore_t
 genfscon proc /mdstat			system_u:object_r:proc_mdstat_t
 genfscon proc /mtrr			system_u:object_r:mtrr_device_t
+genfscon proc /net			system_u:object_r:proc_net_t
 genfscon proc /sysvipc			system_u:object_r:proc_t
 genfscon proc /sys			system_u:object_r:sysctl_t
 genfscon proc /sys/kernel		system_u:object_r:sysctl_kernel_t

Index: policy/domains/program/ifconfig.te
===================================================================
RCS file: /cvsroot/selinux/nsa/selinux-usr/policy/domains/program/ifconfig.te,v retrieving revision 1.9

domains/program/ifconfig.te +2 -2
diff -u -B -r1.9 ifconfig.te
@@ -38,8 +38,8 @@
 allow ifconfig_t { kernel_t init_t }:fd use;
 
 # Access /proc
-allow ifconfig_t proc_t:dir r_dir_perms;
-allow ifconfig_t proc_t:file r_file_perms;
+allow ifconfig_t { proc_t proc_net_t }:dir r_dir_perms;
+allow ifconfig_t { proc_t proc_net_t }:file r_file_perms;
 
 allow ifconfig_t privfd:fd use;
 allow ifconfig_t run_init_t:fd use;

Index: policy/domains/program/unused/iptables.te
===================================================================
RCS file: /cvsroot/selinux/nsa/selinux-usr/policy/domains/program/unused/iptables.te,v retrieving revision 1.13

domains/program/unused/iptables.te +2 -0
diff -u -B -r1.13 iptables.te
@@ -54,6 +54,8 @@
 ifdef(`gnome-pty-helper.te', `allow iptables_t sysadm_gph_t:fd use;')
 
 allow iptables_t proc_t:file { getattr read };
+allow iptables_t proc_net_t:dir { search };
+allow iptables_t proc_net_t:file { read getattr };
 
 # system-config-network appends to /var/log
 allow iptables_t var_log_t:file append;

Index: policy/domains/program/unused/rpcd.te
===================================================================
RCS file: /cvsroot/selinux/nsa/selinux-usr/policy/domains/program/unused/rpcd.te,v retrieving revision 1.26

domains/program/unused/rpcd.te +1 -0
diff -u -B -r1.26 rpcd.te
@@ -71,6 +71,7 @@
 
 # for /proc/fs/nfs/exports - should we have a new type?
 allow nfsd_t proc_t:file r_file_perms;
+allow nfsd_t proc_net_t:dir search;
 allow nfsd_t exports_t:file { getattr read };
 
 allow nfsd_t nfsd_fs_t:filesystem mount;

Index: policy/macros/global_macros.te
===================================================================
RCS file: /cvsroot/selinux/nsa/selinux-usr/policy/macros/global_macros.te,v retrieving revision 1.46

macros/global_macros.te +2 -0
diff -u -B -r1.46 global_macros.te
@@ -214,6 +214,8 @@
 # Read system information files in /proc.
 allow $1 proc_t:dir r_dir_perms;
 allow $1 proc_t:notdevfile_class_set r_file_perms;
+allow $1 proc_net_t:dir r_dir_perms;
+allow $1 proc_net_t:file r_file_perms;
 allow $1 proc_mdstat_t:file r_file_perms;
 
 # Stat /proc/kmsg and /proc/kcore.

Index: policy/macros/program/vmware_macros.te
===================================================================
RCS file: /cvsroot/selinux/nsa/selinux-usr/policy/macros/program/vmware_macros.te,v retrieving revision 1.3

macros/program/vmware_macros.te +2 -0
diff -u -B -r1.3 vmware_macros.te
@@ -55,6 +55,8 @@
 
 # Access /proc
 r_dir_file($1_vmware_t, proc_t)
+allow $1_vmware_t proc_net_t:dir search;
+allow $1_vmware_t proc_net_t:file { getattr read };
 
 # Access to some files in the user home directory
 r_dir_file($1_vmware_t, $1_home_t)

Index: policy/types/procfs.te
===================================================================
RCS file: /cvsroot/selinux/nsa/selinux-usr/policy/types/procfs.te,v retrieving revision 1.7

types/procfs.te +1 -0
diff -u -B -r1.7 procfs.te
@@ -17,6 +17,7 @@
 type proc_kmsg_t, proc_fs;
 type proc_kcore_t, proc_fs;
 type proc_mdstat_t, proc_fs;
+type proc_net_t, proc_fs;
 
 #
 # sysctl_t is the type of /proc/sys.
#5 lore raw

I put an "ifdef(`distro_gentoo'" around all of these rules and merged them.

Quoted 21 lines · petre rodan

Hi James,

Quoted 4 lines · James Carter

Merged.

Oops, there is no proc_net_t defined.
Petre, could you send me the proc_net_t stuff as well.

please see the attachment.

Quoted 8 lines · petre rodan
Quoted 7 lines

Hi,

gentoo as a special context for /proc/net:
genfscon proc /net system_u:object_r:proc_net_t

so a small diff is needed for the snmpd policy. attached.

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.
#6 lore raw
Quoted 5 lines · James Carter

I put an "ifdef(`distro_gentoo'" around all of these rules and merged them.

Are you sure the proc_net changes are specific to gentoo?

Quoted 27 lines · petre rodan
Quoted 26 lines

Hi James,

Quoted 6 lines · James Carter

Merged.

Oops, there is no proc_net_t defined.
Petre, could you send me the proc_net_t stuff as well.

please see the attachment.

Quoted 9 lines · petre rodan
Quoted 8 lines

Hi,

gentoo as a special context for /proc/net:
genfscon proc /net system_u:object_r:proc_net_t

Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines

so a small diff is needed for the snmpd policy. attached.

bye,
peter

--
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.

#7 lore raw
Quoted 8 lines · Daniel J Walsh
Quoted 5 lines · James Carter

I put an "ifdef(`distro_gentoo'" around all of these rules and merged them.

Are you sure the proc_net changes are specific to gentoo?

I don't see why it couldn't be used in the other distributions. I guess I put the ifdef's in because I knew only Gentoo was using it. I don't have a problem with the ifdef's being removed.

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.