ppp security settings
I have attached a patch against the latest selinux-small for pppd settings (granting access to /dev/ppp by the program /usr/sbin/pppd).
Also I have added settings for /dev/vc/* (devfs equivalent of /dev/tty[0-9]+) and /dev/pts/*.
Also I have added dhclient to the domain dhcpc_exec_t and made appropriate changes for it's config files.
Let me know if I'm doing anything stupid here.
Signature · 4 lines
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/projects.html Projects I am working on http://www.coker.com.au/~russell/ My home page
policy/rbac +3 -0
@@ -21,6 +21,7 @@ # system_r is the role of system processes. # role system_r types { + pppd_t kernel_t kmod_t any_socket_t
@@ -85,6 +86,7 @@ # user_r is the role for unprivileged users. # role user_r types { + pppd_t user_t passwd_t utempter_t
@@ -112,6 +114,7 @@ # sysadm_r is the role for the system administrator. # role sysadm_r types { + pppd_t sysadm_t ifconfig_t fsadm_t
policy/domains/system/pppd.te +33 -0
@@ -0,0 +1,33 @@ +# +# Authors: Russell Coker +# + +################################# +# +# Rules for the pppd_t domain, et al. +# +# pppd_t is the domain for the pppd program. +# pppd_exec_t is the type of the pppd executable. +# pppd_key_t is the type of the ssh private key files +# +type pppd_t, domain, privuser, privrole, privlog, privowner; +type pppd_exec_t, file_type, exec_type, sysadmfile; +type pppd_key_t, file_type, sysadmfile; + +# Use the network. +can_network(pppd_t) + +# Use capabilities. +allow pppd_t self:capability { fowner fsetid sys_tty_config dac_override net_bind_service }; + +# Create /var/run/pppd.pid +type pppd_var_run_t, file_type, sysadmfile, pidfile; +file_type_auto_trans(pppd_t, var_run_t, pppd_var_run_t) + +# Access key files +allow pppd_t pppd_key_t:file rw_file_perms; + +# Run pppd in pppd_t by default +domain_auto_trans({ user_t sysadm_t }, pppd_exec_t, pppd_t) + +allow pppd_t net_device_t:chr_file rw_file_perms;
policy/devfs_contexts +3 -0
@@ -27,6 +27,8 @@ /random system_u:object_r:random_device_t /urandom system_u:object_r:random_device_t /tty system_u:object_r:devtty_t +/vc system_u:object_r:devtty_t +/pts system_u:object_r:devtty_t /scsi -c system_u:object_r:fixed_disk_device_t /scsi -b system_u:object_r:fixed_disk_device_t /ide -c system_u:object_r:fixed_disk_device_t
@@ -39,5 +41,6 @@ /floppy -b system_u:object_r:removable_device_t /rtc system_u:object_r:clock_device_t /ptmx system_u:object_r:ptmx_t +/ppp system_u:object_r:net_device_t # FLASK
setfiles/file_contexts +4 -0
@@ -177,6 +177,8 @@ /etc/named.conf system_u:object_r:named_conf_t /etc/mrtg(|/.*) system_u:object_r:etc_mrtg_t /etc/dhcpc.*(|/.*) system_u:object_r:etc_dhcpc_t +/etc/dhclient.conf system_u:object_r:etc_dhcpc_t +/etc/dhclient-script system_u:object_r:etc_dhcpc_t # # /lib
@@ -232,6 +234,7 @@ /sbin/ip system_u:object_r:netutils_exec_t /sbin/arping system_u:object_r:netutils_exec_t /sbin/dhcpcd system_u:object_r:dhcpc_exec_t +/sbin/dhclient.* system_u:object_r:dhcpc_exec_t /sbin/ipchains system_u:object_r:ipchains_exec_t /sbin/ipchains-restore system_u:object_r:ipchains_exec_t /sbin/ipchains-save system_u:object_r:ipchains_exec_t
@@ -357,6 +360,7 @@ /usr/sbin/named system_u:object_r:named_exec_t /usr/sbin/checkpc system_u:object_r:checkpc_exec_t /usr/sbin/ipchains system_u:object_r:ipchains_exec_t +/usr/sbin/pppd system_u:object_r:pppd_exec_t # # /usr/X11R6/bin
Quoted 10 lines · Russell Coker
I have attached a patch against the latest selinux-small for pppd settings (granting access to
/dev/pppby the program/usr/sbin/pppd).Also I have added settings for
/dev/vc/*(devfs equivalent of /dev/tty[0-9]+) and/dev/pts/*.Also I have added dhclient to the domain
dhcpc_exec_tand made appropriate changes for it's config files.Let me know if I'm doing anything stupid here.
A few questions and comments:
1) I would only add pppd_t to system_r. If started by an administrator, it should be done via run_init, so you don't need it in sysadm_r. Do you really want it started by ordinary users? If not, then drop it from user_r in rbac and drop the user_t transition from pppd.te.
2) I doubt that you really need all of the "priv*" attributes on the pppd_t domain - you probably just cut-and-pasted from an existing domain that did need those attributes. In particular, pppd_t should have no reason to be associated with the "privuser", "privrole", or "privowner" attributes.
3) Your diff doesn't show the type declaration for net_device_t anywhere - probably in types/files.te.
4) I'm not familiar with dhclient, so I'm not sure whether it belongs in the same domain as dhcpcd.
--
Stephen D. Smalley, NAI Labs
[email protected]
--
You have received this message because you are subscribed to the selinux list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 10 lines · Stephen Smalley
Quoted 9 lines · Russell Coker
I have attached a patch against the latest selinux-small for pppd settings (granting access to
/dev/pppby the program/usr/sbin/pppd).Also I have added settings for
/dev/vc/*(devfs equivalent of /dev/tty[0-9]+) and/dev/pts/*.Also I have added dhclient to the domain
dhcpc_exec_tand made appropriate changes for it's config files.
Quoted 6 lines
Quoted 1 line
Let me know if I'm doing anything stupid here.
A few questions and comments:
1) I would only add
pppd_ttosystem_r. If started by an administrator, it should be done viarun_init, so you don't need it insysadm_r.
Your other message regarding run_init convinced me about this.
Quoted 3 lines
Do you
really want it started by ordinary users? If not, then drop it fromuser_rin rbac and drop theuser_ttransition from pppd.te.
In some situations yes. If someone is running a laptop to connect to the net then they will generally want to start and stop pppd as non-root and non-sysadm_r.
I think I will put in the user_t transition in a comment.
Quoted 2 lines
2) I doubt that you really need all of the "priv*" attributes on the
pppd_tdomain - you probably just cut-and-pasted from an existing domain
Yes.
Quoted 3 lines
that did need those attributes. In particular,
pppd_tshould have no reason to be associated with the "privuser", "privrole", or "privowner" attributes.
OK.
Quoted 2 lines
3) Your diff doesn't show the type declaration for
net_device_tanywhere - probably in types/files.te.
In types/device.te:
type net_device_t, file_type;
Quoted 2 lines
4) I'm not familiar with dhclient, so I'm not sure whether it belongs in the same domain as dhcpcd.
dhclient is a dhcp client program. It does exactly the same thing as dhcpcd and (IMHO) deserves to be in the same domain.
Signature · 9 lines
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/projects.html Projects I am working on http://www.coker.com.au/~russell/ My home page -- You have received this message because you are subscribed to the selinux list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.