Skip to contentSkip to conversation

net_contexts

DISCUSSION Russell Coker 1 participant 1 message Apr 25, 2002 SELinux security module

lore
Share & tools
lore
#0 lore raw

I've attached my latest net_contexts file which ifdef's around all the port bindings. I've moved the definitions for the port_type objects to the *.te files, so now if you remove a .te file then the policy compiled with that change will also not have any special settings for the TCP/UDP ports associated with that program.

In the case of port 8080 I used an ugly pair of ifdef's for squid and apache.

For the other files in my current sample policy see
http://www.coker.com.au/selinux/policy.tgz

Signature · 4 lines
If you send email to me or to a mailing list that I use which has >4 lines
of legalistic junk at the end then you are specifically authorizing me to do
whatever I wish with the message and all other messages from your domain, by
posting the message you agree that your long legalistic sig is void.

# FLASK

#
# Security contexts for network entities
# If no context is specified, then a default initial SID is used. #

#
# Port numbers (default = initial SID 'port')
#

# protocol number context
# protocol low-high context
#
ifdef(`ftpd.te', `tcp 21 system_u:object_r:ftp_port_t')
ifdef(`inetd.te', `tcp 23 system_u:object_r:telnet_port_t')
ifdef(`sendmail.te', `tcp 25 system_u:object_r:smtp_port_t')
ifdef(`apache.te', `tcp 80  system_u:object_r:http_port_t')
ifdef(`rlogind.te', `tcp 513 system_u:object_r:rlogin_port_t')
ifdef(`rshd', `tcp 514 system_u:object_r:rsh_port_t')
ifdef(`lpd.te', `tcp 515 system_u:object_r:printer_port_t')
ifdef(`cups.te', `tcp 631 system_u:object_r:ipp_port_t')
ifdef(`apache.te', `tcp 8080  system_u:object_r:http_cache_port_t',
`ifdef(`squid.te', `tcp 8080  system_u:object_r:http_cache_port_t')')
ifdef(`named.te', `udp 53 system_u:object_r:named_port_t')
ifdef(`radius.te', `udp 1645 system_u:object_r:radius_port_t
udp 1646 system_u:object_r:radacct_port_t
udp 1812 system_u:object_r:radius_port_t
udp 1813 system_u:object_r:radacct_port_t')
ifdef(`', `tcp 2628 system_u:object_r:dict_port_t')

# Network interfaces (default = initial SID 'netif' and 'netmsg') #

# interface netif_context default_msg_context
#
lo system_u:object_r:netif_lo_t system_u:object_r:netmsg_lo_t
eth0 system_u:object_r:netif_eth0_t system_u:object_r:netmsg_eth0_t
eth1 system_u:object_r:netif_eth1_t system_u:object_r:netmsg_eth1_t

# Nodes (default = initial SID 'node')
#

# address mask context
#
# The first matching entry is used.
#
127.0.0.1 255.255.255.255 system_u:object_r:node_lo_t

# NFS servers (default = initial SID 'nfs')
#

# address mask fs_context file_context
# 
# The first matching entry is used.
#
10.33.1.2 255.255.255.255 system_u:object_r:nfs_t system_u:object_r:nfs_t

# FLASK