Skip to contentSkip to conversation

freeswan IP sec patch

PATCH Russell Coker 2 participants 2 messages Aug 28, 2002 – Sep 21, 2002 SELinux security module

lore
Share & tools
lore
#0 lore raw

The attached patch makes ipsec with freeswan work for me. I had to change it to only have a single var_run_t because both programs want to use each other's files under /var/run. It doesn't work unless it can search for kernel modules. The installation process for Debian requires accessing /root/.rnd, I'm not sure what other distributions do in this regard (maybe it should have "ifdef(`dpkg.te'," around it.

Signature · 3 lines
I do not get viruses because I do not use MS software.
If you use Outlook then please do not put my email address in your
address-book so that WHEN you get a virus it won't use my address in the
Quoted 1 line

From field.

domains/program/ipsec.te renamed from tmp/policy/domains/program/ipsec.te +20 -19
diff -ruw /tmp/policy/domains/program/ipsec.te ./domains/program/ipsec.te
@@ -25,9 +25,11 @@
 
 type ipsec_mgmt_t, domain, privlog, admin;
 type ipsec_mgmt_exec_t, file_type, sysadmfile, exec_type;
-type ipsec_mgmt_var_run_t, file_type, sysadmfile, pidfile;
 domain_auto_trans(ipsec_mgmt_t, ipsec_exec_t, ipsec_t)
-file_type_auto_trans(ipsec_mgmt_t, var_run_t, ipsec_mgmt_var_run_t)
+file_type_auto_trans(ipsec_mgmt_t, var_run_t, ipsec_var_run_t)
+
+allow ipsec_mgmt_t modules_object_t:dir search;
+allow ipsec_mgmt_t modules_object_t:file getattr;
 
 allow ipsec_t self:capability { net_admin net_bind_service };
 allow ipsec_t self:process signal;
@@ -40,13 +42,8 @@
 
 # Inherit and use descriptors from init.
 # allow access (for, e.g., klipsdebug) to console
-allow ipsec_mgmt_t console_device_t:chr_file rw_file_perms;
-allow ipsec_t console_device_t:chr_file rw_file_perms;
-allow ipsec_t init_t:fd use;
-allow ipsec_mgmt_t { init_t privfd }:fd use;
-# do we really need this?
-allow ipsec_t initrc_t:fd use;
-allow ipsec_mgmt_t initrc_t:fd use;
+allow { ipsec_t ipsec_mgmt_t } console_device_t:chr_file rw_file_perms;
+allow { ipsec_t ipsec_mgmt_t } { init_t initrc_t privfd }:fd use;
 
 # i don't know where this pesky pipe is...
 allow ipsec_t initrc_t:fifo_file { write };
@@ -69,6 +66,7 @@
 # also need to run things like whack and shell scripts
 can_exec(ipsec_mgmt_t, ipsec_exec_t)
 can_exec(ipsec_mgmt_t, ipsec_mgmt_exec_t)
+allow ipsec_mgmt_t ipsec_mgmt_exec_t:lnk_file read;
 can_exec(ipsec_mgmt_t, shell_exec_t)
 can_exec(ipsec_t, shell_exec_t)
 can_exec(ipsec_mgmt_t, ifconfig_exec_t)
@@ -111,7 +109,6 @@
 
 # denials when ps tries to search /proc. Do not audit these denials.
 dontaudit ipsec_mgmt_t domain:dir r_dir_perms;
-dontaudit ipsec_mgmt_t domain:notdevfile_class_set r_file_perms;
 
 # suppress audit messages about unnecessary socket access
 dontaudit ipsec_mgmt_t domain:key_socket { read write };
@@ -173,7 +170,7 @@
 # fork
 allow ipsec_mgmt_t self:process fork;
 # startup script runs /bin/gawk with a pipe
-allow ipsec_mgmt_t self:fifo_file write;
+allow ipsec_mgmt_t self:fifo_file rw_file_perms;
 # read /etc/mtab Why?
 allow ipsec_mgmt_t etc_runtime_t:file { read getattr };
 # read link for /bin/sh 
@@ -190,6 +187,14 @@
 can_network(ipsec_t)
 allow ipsec_t ipsec_t:unix_dgram_socket { create connect write };
 
+# for sleep
+allow ipsec_mgmt_t fs_t:filesystem getattr;
+# for id
+allow ipsec_mgmt_t security_t:security { sid_to_context };
+
+# for the start script
+can_exec(ipsec_mgmt_t, etc_t)
+
 # allow access to /etc/localtime
 allow ipsec_mgmt_t etc_t:file { read getattr };
 allow ipsec_t etc_t:file { read getattr };
@@ -209,12 +214,8 @@
 allow ipsec_t self:process fork;
 allow ipsec_t self:fifo_file { read getattr };
 
+# ideally it would not need this.  It wants to write to /root/.rnd
+file_type_auto_trans(ipsec_mgmt_t, sysadm_home_dir_t, sysadm_home_t, file)
 
-rw_dir_file(ipsec_mgmt_t, sysadm_home_t)
-
-dontaudit ipsec_mgmt_t devpts_t:dir { getattr read };
-dontaudit ipsec_mgmt_t tty_device_t:chr_file getattr;
-dontaudit ipsec_mgmt_t device_t:dir { getattr read };
-
-allow ipsec_mgmt_t { sysadm_tty_device_t sysadm_devpts_t }:chr_file { read write ioctl };
-allow ipsec_t { sysadm_tty_device_t sysadm_devpts_t }:chr_file { read write };
+allow ipsec_mgmt_t { sysadm_tty_device_t sysadm_devpts_t }:chr_file { getattr read write ioctl };
+allow ipsec_t { sysadm_tty_device_t sysadm_devpts_t }:chr_file { getattr read write };
file_contexts/program/ipsec.fc renamed from tmp/policy/file_contexts/program/ipsec.fc +1 -1
diff -ruw /tmp/policy/file_contexts/program/ipsec.fc ./file_contexts/program/ipsec.fc
@@ -15,4 +15,4 @@
 /usr/local/lib/ipsec/spi	system_u:object_r:ipsec_exec_t
 /usr/sbin/ipsec			system_u:object_r:ipsec_mgmt_exec_t
 /usr/local/sbin/ipsec		system_u:object_r:ipsec_mgmt_exec_t
-/var/run/ipsec.info            system_u:object_r:ipsec_mgmt_var_run_t
+/var/run/ipsec.info		system_u:object_r:ipsec_var_run_t
#1 lore raw
Quoted 6 lines · Russell Coker

The attached patch makes ipsec with freeswan work for me. I had to change it to only have a single var_run_t because both programs want to use each other's files under /var/run. It doesn't work unless it can search for kernel modules. The installation process for Debian requires accessing /root/.rnd, I'm not sure what other distributions do in this regard (maybe it should have "ifdef(`dpkg.te'," around it.

Thanks, merged.

--
Stephen D. Smalley, NAI Labs
[email protected]

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