Skip to contentSkip to conversation

sysnetwork: Debian stores network interface configuration in /run/network (ifstate), That directory is created by the /etc/init.d/networking script.

PATCH New Dominick Grift 2 participants 2 messages Sep 26, 2013 – Sep 27, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sysnetwork: Debian stores network interface configuration in /run/network (ifstate), That directory is created by the /etc/init.d/networking script.

policy/modules/system/sysnetwork.fc +5 -0
index 346a7cc..40edc18 100644
@@ -72,3 +72,8 @@
 ifdef(`distro_gentoo',`
 /var/lib/dhcpc(/.*)?		gen_context(system_u:object_r:dhcpc_state_t,s0)
 ')
+
+ifdef(`distro_debian',`
+/var/run/network(/.*)?	gen_context(system_u:object_r:net_conf_t,s0)
+')
+
policy/modules/system/sysnetwork.if +12 -1
index 6944526..fb0b50e 100644
@@ -287,7 +287,7 @@
 	')
 
 	files_search_etc($1)
-	allow $1 net_conf_t:file setattr;
+	allow $1 net_conf_t:file setattr_file_perms;
 ')
 
 #######################################
@@ -330,6 +330,12 @@
 	allow $1 net_conf_t:file read_file_perms;
 
 	ifdef(`distro_redhat',`
+		allow $1 net_conf_t:dir list_dir_perms;
+		read_files_pattern($1, net_conf_t, net_conf_t)
+	')
+
+	ifdef(`distro_debian',`
+		files_search_pids($1)
 		allow $1 net_conf_t:dir list_dir_perms;
 		read_files_pattern($1, net_conf_t, net_conf_t)
 	')
@@ -435,6 +441,11 @@
 	ifdef(`distro_redhat',`
 		manage_files_pattern($1, net_conf_t, net_conf_t)
 	')
+
+	ifdef(`distro_debian',`
+		files_search_pids($1)
+		manage_files_pattern($1, net_conf_t, net_conf_t)
+	')
 ')
 
 #######################################
policy/modules/system/sysnetwork.te +4 -0
index 11247e2..9476a7e 100644
@@ -39,6 +39,10 @@
 type net_conf_t alias resolv_conf_t;
 files_type(net_conf_t)
 
+ifdef(`distro_debian',`
+	init_daemon_run_dir(net_conf_t, "network")
+')
+
 ########################################
 #
 # DHCP client local policy
#1 lore raw

PATCH 1/1 sysnetwork: Debian stores network interface configuration in /run/network (ifstate), That directory is created by the /etc/init.d/networking script.

Quoted 58 lines · Dominick Grift
policy/modules/system/sysnetwork.fc +5 -0
index 346a7cc..40edc18 100644
@@ -72,3 +72,8 @@
 ifdef(`distro_gentoo',`
 /var/lib/dhcpc(/.*)?		gen_context(system_u:object_r:dhcpc_state_t,s0)
 ')
+
+ifdef(`distro_debian',`
+/var/run/network(/.*)?	gen_context(system_u:object_r:net_conf_t,s0)
+')
+
policy/modules/system/sysnetwork.if +12 -1
index 6944526..fb0b50e 100644
@@ -287,7 +287,7 @@
 	')
 
 	files_search_etc($1)
-	allow $1 net_conf_t:file setattr;
+	allow $1 net_conf_t:file setattr_file_perms;
 ')
 
 #######################################
@@ -330,6 +330,12 @@
 	allow $1 net_conf_t:file read_file_perms;
 
 	ifdef(`distro_redhat',`
+		allow $1 net_conf_t:dir list_dir_perms;
+		read_files_pattern($1, net_conf_t, net_conf_t)
+	')
+
+	ifdef(`distro_debian',`
+		files_search_pids($1)
 		allow $1 net_conf_t:dir list_dir_perms;
 		read_files_pattern($1, net_conf_t, net_conf_t)
 	')
@@ -435,6 +441,11 @@
 	ifdef(`distro_redhat',`
 		manage_files_pattern($1, net_conf_t, net_conf_t)
 	')
+
+	ifdef(`distro_debian',`
+		files_search_pids($1)
+		manage_files_pattern($1, net_conf_t, net_conf_t)
+	')
 ')
 
 #######################################
policy/modules/system/sysnetwork.te +0 -0
index 11247e2..9476a7e 100644

policy/modules/system/sysnetwork.te line 48

Quoted 10 lines
policy/modules/system/sysnetwork.te +4 -0
@@ -39,6 +39,10 @@
 type net_conf_t alias resolv_conf_t;
 files_type(net_conf_t)
 
+ifdef(`distro_debian',`
+	init_daemon_run_dir(net_conf_t, "network")
+')
+
 ########################################
 #
 # DHCP client local policy

Merged.

--
Chris PeBenito
Tresys Technology, LLC
www.tresys.com | oss.tresys.com