Skip to contentSkip to conversation

semanage interface has no effect

DISCUSSION Stepan G. Fedorov 5 participants 10 messages Aug 25, 2014 SELinux security module

lore
Share & tools
lore
#0 lore raw

Hello!

Goal of this experiment is to see allow rules for netif class objects is working.

I use debian wheezy whith MLS selinux policy, in enforced mode.

eth0 is hte only netwotk interface, except lo.

sesearch --allow -cnetif shows lots of allow rules for netif_t target type / netif target class.

I do:
1) I add new type nginx_http_if_t with my own policy module;
2) semanage interface -a -t nginx_http_if_t -r s1:c0.c1023 eth0.

I expect: to see all the processes in system unable to read/write packets from eth0 interface.

I actually got: nothing changes - all networking is working as it was before changing of interface context.

What am I doing/understanding wrong?

Thank you!

Signature · 2 lines
Stepan G. Fedorov <[email protected]>
Tel: +7-965-750-91-91
#1 lore raw
Quoted 16 lines · Stepan G. Fedorov

Hello!

Goal of this experiment is to see allow rules for netif class objects is working.

I use debian wheezy whith MLS selinux policy, in enforced mode.

eth0 is hte only netwotk interface, except lo.

sesearch --allow -cnetif shows lots of allow rules for netif_t target type / netif target class.

I do:
1) I add new type nginx_http_if_t with my own policy module;
2) semanage interface -a -t nginx_http_if_t -r s1:c0.c1023 eth0.

Quoted 8 lines

I expect: to see all the processes in system unable to read/write packets from eth0 interface.

I actually got: nothing changes - all networking is working as it was before changing of interface context.

What am I doing/understanding wrong?

I suspect that these controls may be legacy (net_compat?)

I may be wrong

Quoted 12 lines

Thank you!

Signature · 8 lines
Stepan G. Fedorov <[email protected]>
Tel: +7-965-750-91-91

_______________________________________________
Selinux mailing list
[email protected]
To unsubscribe, send email to [email protected].
To get help, send an email containing "help" to [email protected].
Signature · 2 lines
http://subkeys.pgp.net:11371/pks/lookup?search=0x02DFF788&op=index
Dominick Grift
#2 lore raw
In reply to Stepan G. Fedorov
Quoted 16 lines · Stepan G. Fedorov

Hello!

Goal of this experiment is to see allow rules for netif class objects is working.

I use debian wheezy whith MLS selinux policy, in enforced mode.

eth0 is hte only netwotk interface, except lo.

sesearch --allow -cnetif shows lots of allow rules for netif_t target type / netif target class.

I do:
1) I add new type nginx_http_if_t with my own policy module;
2) semanage interface -a -t nginx_http_if_t -r s1:c0.c1023 eth0.

Quoted 8 lines

I expect: to see all the processes in system unable to read/write packets from eth0 interface.

I actually got: nothing changes - all networking is working as it was before changing of interface context.

What am I doing/understanding wrong?

Legacy network checks are gone; use peer labeling or secmark instead,
http://paulmoore.livejournal.com/tag/documentation

#3 lore raw

25.08.2014 17:10, Stephen Smalley пишет:

Quoted 1 line

Legacy network checks are gone; use peer labeling or secmark instead, http://paulmoore.livejournal.com/tag/documentation

Thank you for quick reply!

In case of "just installed" system, where no iptables SECMARK rules present, and no labeled packets arrive on network interface - what will be selinux contexts of all incoming packets?

Signature · 2 lines
Stepan G. Fedorov <[email protected]>
Tel: +7-965-750-91-91
maintainer
#4 lore raw
Quoted 11 lines · Stepan G. Fedorov

25.08.2014 17:10, Stephen Smalley пишет:

Quoted 2 lines

Legacy network checks are gone; use peer labeling or secmark instead,
http://paulmoore.livejournal.com/tag/documentation

Thank you for quick reply!

In case of "just installed" system, where no iptables SECMARK rules present, and no labeled packets arrive on network interface - what will be selinux contexts of all incoming packets?

In this case the incoming packets would be labeled "unlabeled_t", just like any other unlabeled data on the system.

Signature · 2 lines
paul moore
www.paul-moore.com
#5 lore raw
Quoted 7 lines · Paul Moore
Quoted 6 lines · Stepan G. Fedorov

25.08.2014 17:10, Stephen Smalley пишет:

Quoted 2 lines

Legacy network checks are gone; use peer labeling or secmark instead,
http://paulmoore.livejournal.com/tag/documentation

Quoted 8 lines
Quoted 5 lines

Thank you for quick reply!

In case of "just installed" system, where no iptables SECMARK rules present, and no labeled packets arrive on network interface - what will be selinux contexts of all incoming packets?

In this case the incoming packets would be labeled "unlabeled_t", just like any other unlabeled data on the system.

...but the new network permission checks will not be applied until/unless you configure secmark or labeled networking. Or set the always_check_network policy capability to 1 for secmark, if your kernel supports that.

#6 lore raw
Quoted 5 lines

...but the new network permission checks will not be applied until/unless you configure secmark or labeled networking. Or set the always_check_network policy capability to 1 for secmark, if your kernel supports that.

Seems I have no such capability. My /sys/fs/selinux/policy_capabilities/ contains only two files:
network_peer_controls
open_perms

Signature · 2 lines
Stepan G. Fedorov <[email protected]>
Tel: +7-965-750-91-91
#7 lore raw
Quoted 10 lines · Stepan G. Fedorov
Quoted 5 lines

...but the new network permission checks will not be applied until/unless you configure secmark or labeled networking. Or set the always_check_network policy capability to 1 for secmark, if your kernel supports that.

Seems I have no such capability. My /sys/fs/selinux/policy_capabilities/ contains only two files:
network_peer_controls
open_perms

That directory only lists the capabilities that are enabled in the loaded policy. You need at least a 3.13 kernel and the capability declared in the policy (in the base module, base.pp). Distributions will likely never ship with that capability enabled, as it requires packet (SECMARK) and peer rules throughout the policy.

Signature · 3 lines
Chris PeBenito
Tresys Technology, LLC
www.tresys.com | oss.tresys.com
#8 lore raw
In reply to Paul Moore
Quoted 1 line

In this case the incoming packets would be labeled "unlabeled_t", just like any other unlabeled data on the system.

Can you, please tell where exactly I can see this in the linux source code for better understanding?

Signature · 2 lines
Stepan G. Fedorov <[email protected]>
Tel: +7-965-750-91-91
#9 lore raw
Quoted 6 lines · Stepan G. Fedorov
Quoted 2 lines

In this case the incoming packets would be labeled "unlabeled_t", just like any other unlabeled data on the system.

Can you, please tell where exactly I can see this in the linux source code for better understanding?

secmark or peer label?

secmark label: Unless set by net/netfilter/xt_*SECMARK.c, secmark should just be zero (cleared upon skb allocation) and thus will be remapped by security/selinux/ss/sidtab.c:sidtab_search_core() to the UNLABELED initial SID.

peer label: security/selinux/hooks.c:selinux_skb_peerlbl_sid() asks the xfrm (ipsec) and netlabel (cipso) subsystems for any labeling information for the packet and then calls security/selinux/ss/services.c:security_net_peersid_resolve() to make the final determination. In the absence of any labeling information, we'll also end up with SECSID_NULL i.e. 0 and then the sidtab will again remap it to the UNLABELED initial SID.