Skip to contentSkip to conversation

pppd with ipppd

PATCH Carsten Grohmann 1 participant 1 message Sep 6, 2002 SELinux security module

lore
Share & tools
lore
#0 lore raw

Hi,

I follow your suggestion and add the few line for the ipppd to the pppd_t domain. The attached files contains the rules and the patch for the net_context and network.te files.
May be that some rule is SuSE specific. I missing labeling the password files in your rules. Don't you use it?

Carsten

#DESC ppp daemon
#
# Author: 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_secret_t is the type of the pap and chap password files
# pppd_log_t is the type of the ppp log files
#
daemon_domain(pppd, `, privmail')
type pppd_secret_t, file_type, sysadmfile;
type pppd_log_t, file_type, sysadmfile, logfile;

# Use the network.
can_network(pppd_t)

# Use capabilities.
allow pppd_t self:capability { net_admin setuid setgid fsetid };

allow pppd_t fs_t:filesystem getattr;

allow pppd_t var_lock_t:dir rw_dir_perms;
allow pppd_t var_lock_t:file create_file_perms;

# allow writing log files
file_type_auto_trans(pppd_t, var_log_t, pppd_log_t)

# Access secret files
allow pppd_t pppd_secret_t:file r_file_perms;

ifdef(`postfix.te',
`allow pppd_t etc_postfix_t:dir search; allow pppd_t etc_postfix_t:file r_file_perms; allow pppd_t postfix_master_exec_t:file read; allow postfix_postqueue_t pppd_t:fd use; allow postfix_postqueue_t pppd_t:process sigchld;')

# allow running ip-up and ip-down scripts and running chat.
can_exec(pppd_t, { shell_exec_t bin_t sbin_t etc_t })
allow pppd_t { bin_t sbin_t }:dir search;
allow pppd_t bin_t:lnk_file read;

# Access /dev/ppp and /dev/ippp*
allow pppd_t ppp_device_t:chr_file rw_file_perms;

allow pppd_t self:unix_dgram_socket create_socket_perms; allow pppd_t self:unix_stream_socket create_socket_perms;

allow pppd_t { device_t proc_t }:dir search; allow pppd_t proc_t:{ file lnk_file } r_file_perms;

allow pppd_t { resolv_conf_t etc_runtime_t }:file r_file_perms;

allow pppd_t self:socket create_socket_perms;

allow pppd_t devtty_t:chr_file { setattr rw_file_perms };

# for scripts
allow pppd_t self:fifo_file rw_file_perms;
allow pppd_t etc_t:lnk_file read;
# for ~/.ppprc - if it actually exists then you need some policy to read it
allow pppd_t { sysadm_home_dir_t user_home_dir_type }:dir search;

ifdef(pppd_for_user',
# Run pppd in pppd_t by default for user domain_auto_trans({ user_t sysadm_t }, pppd_exec_t, pppd_t) in_user_role(pppd_t)
role sysadm_r types pppd_t;
allow { user_t sysadm_t } pppd_t:process signal; ')

# Rules for ifconfig_t
######################

ifdef(ifconfig.te', domain_auto_trans(pppd_t, ifconfig_exec_t, ifconfig_t) allow ifconfig_t pppd_t:udp_socket { read write }; allow pppd_t ifconfig_exec_t:file { read };')

# Dontaudit
###########

dontaudit ifconfig_t pppd_secret_t:file { read } ;

# pppd
/usr/sbin/pppd			system_u:object_r:pppd_exec_t
/usr/sbin/ipppd			system_u:object_r:pppd_exec_t
/dev/ppp			system_u:object_r:ppp_device_t
/dev/ippp.*			system_u:object_r:ppp_device_t
/var/run/pppd.tdb		system_u:object_r:var_run_pppd_t
/etc/ppp/.*secrets		system_u:object_r:pppd_secret_t
/var/run/ipppd.*pid		system_u:object_r:var_run_pppd_t
net_contexts renamed from original/net_contexts +1 -0
@@ -53,6 +53,7 @@
 netifcon eth0 system_u:object_r:netif_eth0_t system_u:object_r:netmsg_eth0_t
 netifcon eth1 system_u:object_r:netif_eth1_t system_u:object_r:netmsg_eth1_t
 netifcon eth2 system_u:object_r:netif_eth2_t system_u:object_r:netmsg_eth2_t
+netifcon ippp0 system_u:object_r:netif_ippp0_t system_u:object_r:netmsg_ippp0_t
 netifcon ipsec0 system_u:object_r:netif_ipsec0_t system_u:object_r:netmsg_ipsec0_t
 netifcon ipsec1 system_u:object_r:netif_ipsec1_t system_u:object_r:netmsg_ipsec1_t
 netifcon ipsec2 system_u:object_r:netif_ipsec2_t system_u:object_r:netmsg_ipsec2_t
network.te renamed from original/types/network.te +4 -0
@@ -54,6 +54,7 @@
 type netif_eth1_t, netif_type;
 type netif_eth2_t, netif_type;
 type netif_lo_t, netif_type;
+type netif_ippp0_t, netif_type;
 
 type netif_ipsec0_t, netif_type;
 type netif_ipsec1_t, netif_type;
@@ -69,6 +70,7 @@
 type netmsg_eth1_t, netmsg_type;
 type netmsg_eth2_t, netmsg_type;
 type netmsg_lo_t, netmsg_type;
+type netmsg_ippp0_t, netmsg_type;
 
 type netmsg_ipsec0_t, netmsg_type;
 type netmsg_ipsec1_t, netmsg_type;
@@ -116,6 +118,8 @@
 allow netmsg_lo_t node_lo_t:node { tcp_recv udp_recv rawip_recv };
 allow netmsg_lo_t node_t:node { tcp_recv udp_recv rawip_recv };
 allow netmsg_lo_t netif_lo_t:netif { tcp_recv udp_recv rawip_recv };
+allow netmsg_ippp0_t node_t:node { tcp_recv udp_recv rawip_recv };
+allow netmsg_ippp0_t netif_ippp0_t:netif { tcp_recv udp_recv rawip_recv };
 allow netmsg_ipsec0_t node_t:node { tcp_recv udp_recv rawip_recv };
 allow netmsg_ipsec0_t netif_ipsec0_t:node { tcp_recv udp_recv rawip_recv };
 allow netmsg_ipsec1_t node_t:node { tcp_recv udp_recv rawip_recv };