RHEL5 Kernel with labeled networking
DO NOT USE THESE KERNELS ON A PRODUCTION SYSTEM!
If you go to http://people.redhat.com/eparis/RHEL5_labeled_networking/
you should find a set of kernels based off of the Red Hat RHEL5 source tree. These should include patches for
network labeling support from Venkat
netlabel auditing
ipsec/secmark secid reconciliation
netlabel secid reconciliation
I need a very fast response from everyone involved if these kernels
A) boot
B) run without labeled networking (very very important)
C) run with labeled networking
If you run across a problem feel free to let me or the list know. You may also feel free to open a bug in bugzilla.redhat.com for the product choose Red Hat Enterprise Linux Public Beta and RHEL5. If you open a bug for this labeled networking you can go ahead and assign it to [email protected] so I'm sure to see it and bug the correct people.
At this time there is a known ipsec problem with these kernels. I haven't looked at it closely but I believe the problem is that processes which intend to send over an ipsec tunnels but have certain avc denials will actually cause traffic to flow unencrypted. SO PLEASE DO NOT USE THESE ON ANY PRODUCTION SYSTEM!! There is work going on upstream (on linux-netdev not either of these lists) to fix this issue in the 2.6-net tree and when it is finished it will get brought back into RHEL5. (I don't think you will hit this bug with relatively modern policy but it is there and can be a serious security flaw)
Before network labeling is completed we still need some work implementing how we plan to audit configuration changes in ipsec labeling decisions. I believe we agreed today that this auditing must be done in kernelspace since we do not have fine grained enough controls on netlink messages to allow for all of the auditing in userspace.
DO NOT USE THESE KERNELS ON A PRODUCTION SYSTEM
-Eric
--
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.
Eric,
I've booted your kernel on the following systems:
ia64 box running rhel5 beta 1 targeted policy
x86 box running fc6t2 mls policy
I don't have any labeled networking specifically configured.
Networking only works in permissive mode. If I put either system in enforcing mode, I can't ping, bring up X, or do anything.
Are there some policy changes that are needed? Seems like by default
everything should work like it did before?
-- ljk
--
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.
Quoted 7 lines · Linda Knippers
Eric,
I've booted your kernel on the following systems:
ia64 box running rhel5 beta 1 targeted policy
x86 box running fc6t2 mls policy
Quoted 7 lines
I don't have any labeled networking specifically configured.
Networking only works in permissive mode. If I put either system in enforcing mode, I can't ping, bring up X, or do anything.
Are there some policy changes that are needed? Seems like by default
everything should work like it did before?
Only if you set /selinux/compat_net to 1.
Otherwise, you need modified policy to define and allow flow_in/flow_out permissions as required, and I suspect you need more in order to deal with the fact that we now get labeled traffic on loopback by default (thus affecting packet send/recv as well). Venkat, do you have a policy patch?
Signature · 8 lines
Stephen Smalley National Security Agency -- 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.
Quoted 18 lines · Stephen Smalley
Quoted 7 lines · Linda Knippers
Eric,
I've booted your kernel on the following systems:
ia64 box running rhel5 beta 1 targeted policy
x86 box running fc6t2 mls policyQuoted 7 lines
I don't have any labeled networking specifically configured.
Networking only works in permissive mode. If I put either system in enforcing mode, I can't ping, bring up X, or do anything.
Are there some policy changes that are needed? Seems like by default
everything should work like it did before?
Quoted 7 lines
Only if you set /selinux/compat_net to 1.
Otherwise, you need modified policy to define and allow flow_in/flow_out permissions as required, and I suspect you need more in order to deal with the fact that we now get labeled traffic on loopback by default (thus affecting packet send/recv as well). Venkat, do you have a policy patch?
Ok, with /selinux/compat_net set to 1, I can go into enforcing mode on my rhel5 beta 1 targeted system. Its got selinux-policy-2.3.3-22.
The first time I tried the same thing on my fc6/mls system it killed all my network sessions. The second time I tried it my established sessions stayed up but the mouse quit working. This system has selinux-policy-mls-2.3.16-6.
-- ljk
--
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.
Quoted 30 lines · Linda Knippers
Quoted 19 lines · Stephen Smalley
Quoted 7 lines · Linda Knippers
Eric,
I've booted your kernel on the following systems:
ia64 box running rhel5 beta 1 targeted policy
x86 box running fc6t2 mls policyQuoted 7 lines
I don't have any labeled networking specifically configured.
Networking only works in permissive mode. If I put either system in enforcing mode, I can't ping, bring up X, or do anything.
Are there some policy changes that are needed? Seems like by default
everything should work like it did before?Quoted 7 lines
Only if you set /selinux/compat_net to 1.
Otherwise, you need modified policy to define and allow flow_in/flow_out permissions as required, and I suspect you need more in order to deal with the fact that we now get labeled traffic on loopback by default (thus affecting packet send/recv as well). Venkat, do you have a policy patch?
Quoted 7 lines
Ok, with /selinux/compat_net set to 1, I can go into enforcing mode on my rhel5 beta 1 targeted system. Its got selinux-policy-2.3.3-22.
The first time I tried the same thing on my fc6/mls system it killed all my network sessions. The second time I tried it my established sessions stayed up but the mouse quit working. This system has selinux-policy-mls-2.3.16-6.
The mouse problem has nothing to do with this kernel. It stops working in mls enforcing mode with older kernels as well. I haven't been running X on my mls system so I never noticed before.
-- ljk
--
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.
Quoted 9 lines · Linda Knippers
Eric,
I've booted your kernel on the following systems:
ia64 box running rhel5 beta 1 targeted policy
x86 box running fc6t2 mls policyI don't have any labeled networking specifically configured.
Quoted 7 lines
Networking only works in permissive mode. If I put either system in enforcing mode, I can't ping, bring up X, or do anything.
Are there some policy changes that are needed? Seems like by default
everything should work like it did before?-- ljk
I think there is going to need to be a policy change that I'm actually talking with Dan about as I type this e-mail. I think we need
allow $1 unlabeled_t:packet { flow_in flow_out };
to be added to policy to allow things to work as they did. I'll post again as soon as we have a policy that appears to let normal networking work in enforcing.
-Eric
--
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.
Quoted 8 lines · Eric Paris
I think there is going to need to be a policy change that I'm actually talking with Dan about as I type this e-mail. I think we need
allow $1 unlabeled_t:packet {
flow_inflow_out};to be added to policy to allow things to work as they did. I'll post again as soon as we have a policy that appears to let normal networking work in enforcing.
We need this policy in rawhide before the kernel patches are merged upstream, so we can note the required policy version associated with the patches. We've do not want to kill Andrew Morton's box again with this kind of thing.
- James
Signature · 7 lines
James Morris <[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.
Quoted 13 lines · James Morris
Quoted 8 lines · Eric Paris
I think there is going to need to be a policy change that I'm actually talking with Dan about as I type this e-mail. I think we need
allow $1 unlabeled_t:packet {
flow_inflow_out};to be added to policy to allow things to work as they did. I'll post again as soon as we have a policy that appears to let normal networking work in enforcing.
Quoted 4 lines
We need this policy in rawhide before the kernel patches are merged upstream, so we can note the required policy version associated with the patches. We've do not want to kill Andrew Morton's box again with this kind of thing.
Dumb question....should compat_net be "1" by default?
-- ljk
--
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.
Quoted 1 line · Linda Knippers
Dumb question....should
compat_netbe "1" by default?
Ideally, no, the new secmark controls were posted in May and everyone should be using them. I only added the compat_net option to help with transition, and it could disappear at any time.
Signature · 7 lines
James Morris <[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.
Quoted 9 lines · James Morris
Quoted 1 line · Linda Knippers
Dumb question....should
compat_netbe "1" by default?Ideally, no, the new secmark controls were posted in May and everyone should be using them. I only added the
compat_netoption to help with transition, and it could disappear at any time.
Just seems like we're pretty early in the transition if updating the kernel requires a new policy to not suffer a major regression, but then I don't really understand all the secid reconciliation stuff.
-- ljk
--
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.
Quoted 6 lines · James Morris
Quoted 3 lines · Eric Paris
I think there is going to need to be a policy change that I'm actually talking with Dan about as I type this e-mail. I think we need
Quoted 10 lines
Quoted 6 lines
allow $1 unlabeled_t:packet {
flow_inflow_out};to be added to policy to allow things to work as they did. I'll post again as soon as we have a policy that appears to let normal networking work in enforcing.
We need this policy in rawhide before the kernel patches are merged upstream, so we can note the required policy version associated with the patches. We've do not want to kill Andrew Morton's box again with this kind of thing.
Using these kernels I'm getting some interesting denials. I labeled the spd's with system_u:object_r:ipsec_spd_t:s0 so that it would be discernible from any socket contexts that may appear.
First I had to add a polmatch rule for unconfined_t to ipsec_spd_t, so far it makes sense.
Next I need polmatch on unconfined_t to unconfined_t, I assume this is because the SA is going to be labeled unconfined_t, seems reasonable. Racoon also needed setcontext for unconfined_t unconfined_t (not sure what the source and target mean here)
the denial I totally don't understand is:
audit(1159877238.937:35): avc: denied { polmatch } for scontext=system_u:object_r:unlabeled_t:s0 tcontext=root:system_r:unconfined_t:s0-s0:c0.c255 tclass=association
there is no unlabeled anything, except for a non-ipsec connection which isn't being used, I don't understand how this would happen at all.
After all that it isn't working as expected. the SA's get set up correctly based on the initiators socket (I'm using semanage_t in this case) but the reciever SA's aren't set up with the receiving process socket context so I get:
Received: Hello, root:system_r:semanage_t:s0-s0:c0.c255 from root:system_r:semanage_t:s0-s0:c0.c255
no matter what context the server is running in.
Further, once that SA is created all domains can use it and it retains the same context, if I rerun the client in unconfined_t I still get:
Received: Hello, root:system_r:semanage_t:s0-s0:c0.c255 from root:system_r:semanage_t:s0-s0:c0.c255
I am running in permissive (I'd hope that wouldn't affect this but I can see how it could) because my policy doesn't yet have flow_in and flow_out permissions (any chance to get a policy patch? :) )
Am I off base here, is this the expected results?
--
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.
Quoted 35 lines · Joshua Brindle
Quoted 6 lines · James Morris
Quoted 3 lines · Eric Paris
I think there is going to need to be a policy change that I'm actually talking with Dan about as I type this e-mail. I think we need
Quoted 10 lines
Quoted 6 lines
allow $1 unlabeled_t:packet {
flow_inflow_out};to be added to policy to allow things to work as they did. I'll post again as soon as we have a policy that appears to let normal networking work in enforcing.
We need this policy in rawhide before the kernel patches are merged upstream, so we can note the required policy version associated with the patches. We've do not want to kill Andrew Morton's box again with this kind of thing.
Using these kernels I'm getting some interesting denials. I labeled the spd's with system_u:object_r:ipsec_spd_t:s0 so that it would be discernible from any socket contexts that may appear.
First I had to add a polmatch rule for
unconfined_ttoipsec_spd_t, so far it makes sense.Next I need polmatch on
unconfined_ttounconfined_t, I assume this is because the SA is going to be labeledunconfined_t, seems reasonable. Racoon also needed setcontext forunconfined_tunconfined_t(not sure what the source and target mean here)the denial I totally don't understand is:
audit(1159877238.937:35): avc: denied { polmatch } for scontext=system_u:object_r:unlabeled_t:s0 tcontext=root:system_r:unconfined_t:s0-s0:c0.c255 tclass=associationthere is no unlabeled anything, except for a non-ipsec connection which isn't being used, I don't understand how this would happen at all.
After all that it isn't working as expected. the SA's get set up correctly based on the initiators socket (I'm using
semanage_tin this case) but the reciever SA's aren't set up with the receiving process socket context so I get:Received: Hello, root:system_r:semanage_t:s0-s0:c0.c255 from root:system_r:semanage_t:s0-s0:c0.c255
no matter what context the server is running in.
Quoted 7 lines
Further, once that SA is created all domains can use it and it retains the same context, if I rerun the client in
unconfined_tI still get:Received: Hello, root:system_r:semanage_t:s0-s0:c0.c255 from root:system_r:semanage_t:s0-s0:c0.c255
I am running in permissive (I'd hope that wouldn't affect this but I can see how it could) because my policy doesn't yet have
flow_inandflow_outpermissions (any chance to get a policy patch? :) )Am I off base here, is this the expected results?
On the bright side localhost connections seem to work well:
# ./client 127.0.0.1 Received: Hello, root:system_r:unconfined_t:s0-s0:c0.c255 from root:system_r:semanage_t:s0-s0:c0.c255
so getpeercon got the right answer on both sides.
--
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.
Quoted 7 lines · James Morris
Quoted 5 lines · Eric Paris
I think there is going to need to be a policy change that I'm actually talking with Dan about as I type this e-mail. I think we need
allow $1 unlabeled_t:packet {
flow_inflow_out};
Quoted 8 lines
Quoted 3 lines
to be added to policy to allow things to work as they did. I'll post again as soon as we have a policy that appears to let normal networking work in enforcing.
We need this policy in rawhide before the kernel patches are merged upstream, so we can note the required policy version associated with the patches. We've do not want to kill Andrew Morton's box again with this kind of thing.
The compat_net support should avoid such breakage, and compat_net is enabled by default in a default kernel config (just not in the Fedora kernel config).
Signature · 8 lines
Stephen Smalley National Security Agency -- 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.
Quoted 13 lines · James Morris
Quoted 9 lines · Eric Paris
I think there is going to need to be a policy change that I'm actually talking with Dan about as I type this e-mail. I think we need
allow $1 unlabeled_t:packet {
flow_inflow_out};to be added to policy to allow things to work as they did. I'll post again as soon as we have a policy that appears to let normal networking work in enforcing.
Quoted 5 lines
We need this policy in rawhide before the kernel patches are merged upstream, so we can note the required policy version associated with the patches. We've do not want to kill Andrew Morton's box again with this kind of thing.
- James
selinux-policy-2.3.18-2 has this policy.
--
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.
Quoted 17 lines · Eric Paris
DO NOT USE THESE KERNELS ON A PRODUCTION SYSTEM!
If you go to http://people.redhat.com/eparis/RHEL5_labeled_networking/
you should find a set of kernels based off of the Red Hat RHEL5 source tree. These should include patches fornetwork labeling support from Venkat
netlabel auditing
ipsec/secmark secid reconciliation
netlabel secid reconciliationI need a very fast response from everyone involved if these kernels
A) boot
B) run without labeled networking (very very important)
C) run with labeled networking
Quoted 5 lines
If you run across a problem feel free to let me or the list know. You may also feel free to open a bug in bugzilla.redhat.com for the product choose Red Hat Enterprise Linux Public Beta and RHEL5. If you open a bug for this labeled networking you can go ahead and assign it to [email protected] so I'm sure to see it and bug the correct people.
So far in my testing I've noticed two things related to "C" using NetLabel and neither seem to be specific to the RHEL5 backport. I'm just getting a handle on both of these issues so no patches yet but I will keep everybody up to date as things progress.
The first is a race condition with the NetLabel cache caused when NetLabel returns a cached security attribute to the LSM layer at the same time that the cache is being invalidated (NOTE: case "B" should not be affected). The result is an Oops with selinux_netlbl_secattr_to_sid() in the stack. I think I have settled on a reasonable fix for this, but I want to dwell on it a bit more. In the meantime the workaround is to disable the cache:
# sysctl -w net.ipv4.cipso_cache_enable=0
The second issue is more of a correctness problem in selinux_ip_postroute_last() and selinux_skb_flow_out() related to what NetLabel uses as it's "base SID"; the changes made in the "v3" draft of the patch messed this up a bit. It's important to note this shouldn't cause any sort of panic/oops/etc. it just results in a incorrect NetLabel context when NetLabel is configured (i.e. case "B" should not be affected).
I'll have more information, patches, bugzillas, etc. as things progress.
Signature · 7 lines
paul moore linux security @ hp -- 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.