Networking in NSA Security-Enhanced Linux
You could have used ls -Z instead.
Let's see if it works—logged in as root in the staff_r role, using SSH:
$ id -Z root:staff_r:staff_t $ /tmp/echoclient 10.3.1.2 Sending message: 'Hello, cliche' Received message: 'Hello, cliche'
It worked!
You can add auditallow rules to the policy to watch each permission being granted, if you want.
Let's verify that some of the policy rules are actually working.
1) Try to communicate with an IP address outside the intranet. Route the address locally, so you don't accidentally send a packet onto the Internet:
$ ip ro add 196.40.74.92 via 10.3.1.2 dev eth0 $ /tmp/echoclient 196.40.74.92
The program gets a TCP timeout, and the following audit denial message is generated when a packet is sent:
avc: denied { tcp_send } for pid=10831
exe=/tmp/echoclient saddr=10.3.1.1 src=32822
daddr=196.40.74.92 dest=7 netif=eth0
scontext=root:staff_r:echoclient_t
tcontext=system_u:object_r:node_t
tclass=node
As expected, the echoclient_t domain was denied access to transmit a TCP packet to a /node_t/ node, the default generic node context.
2) Try to communicate over the wrong interface. Route the echo server IP via the loopback interface, so packets will be sent there:
$ ip ro add 10.3.1.2 via 127.0.0.2 dev lo
$ /tmp/echoclient 10.3.1.2
avc: denied { tcp_send } for pid=10828
exe=/tmp/echoclient saddr=10.3.1.1 src=32821
daddr=10.3.1.2 dest=7 netif=lo
scontext=root:staff_r:echoclient_t
tcontext=system_u:object_r:netif_lo_t
tclass=netif
This also is working correctly. The echoclient_t domain was denied access to transmit a packet over a netif_lo_t netif.
The echoclient program runs with a very minimal set of rights as defined in the policy. Anything not explicitly allowed is denied. The potential damage arising from a flaw in the program, user error or malicious user would be greatly confined by this policy.
This is a simple demonstration of how to meet network security goals with SELinux policy. A real-world policy would require several extra features, omitted for space and clarity, such as the ability to use ICMP messaging and DNS lookups. See the policy sources package of your distribution for some detailed examples, and also try some of the GUI policy tools.
It is likely that some form of labeled networking will be implemented for SELinux. This is where network traffic itself is labeled and typically is used in military and government environments dealing with classified information. An earlier version of SELinux used IP options to label packets, although it was dropped before merging with the upstream kernel as the hooks it needed were too invasive. A possible alternative is to integrate SELinux with IPSec and label the Security Associations (SAs) instead of the packets. A packet arriving on a specific SA would be labeled implicitly with the context of the SA. A prototype of this scheme was implemented for the preceding Flask Project, and it should be useful as a guideline.
More general integration of SELinux with network security components, such as cryptography and firewalling, also are areas for future exploration.
Thanks to Russell Coker for reviewing this article and providing valuable feedback.
Resources for this article: /article/7864.
James Morris (jmorris@redhat.com) is a kernel hacker from Sydney, Australia, currently working for Red Hat in Boston. He is a kernel maintainer of SELinux, Networking and the Crypto API; an LSM developer, and an Emeritus Netfilter Core Team member.
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Sponsored by AMD
Built-in forensics, incident response, and security with Red Hat Enterprise Linux 6
Every security policy provides guidance and requirements for ensuring adequate protection of information and data, as well as high-level technical and administrative security requirements for a system in a given environment. Traditionally, providing security for a system focuses on the confidentiality of the information on it. However, protecting the data integrity and system and data availability is just as important. For example, when processing United States intelligence information, there are three attributes that require protection: confidentiality, integrity, and availability.
Learn more about catching the bad guy in this free white paper.
Sponsored by DLT Solutions
| Dynamic DNS—an Object Lesson in Problem Solving | May 21, 2013 |
| Using Salt Stack and Vagrant for Drupal Development | May 20, 2013 |
| Making Linux and Android Get Along (It's Not as Hard as It Sounds) | May 16, 2013 |
| Drupal Is a Framework: Why Everyone Needs to Understand This | May 15, 2013 |
| Home, My Backup Data Center | May 13, 2013 |
| Non-Linux FOSS: Seashore | May 10, 2013 |
- RSS Feeds
- Making Linux and Android Get Along (It's Not as Hard as It Sounds)
- Using Salt Stack and Vagrant for Drupal Development
- Dynamic DNS—an Object Lesson in Problem Solving
- New Products
- Validate an E-Mail Address with PHP, the Right Way
- Drupal Is a Framework: Why Everyone Needs to Understand This
- A Topic for Discussion - Open Source Feature-Richness?
- Download the Free Red Hat White Paper "Using an Open Source Framework to Catch the Bad Guy"
- Tech Tip: Really Simple HTTP Server with Python
- Roll your own dynamic dns
2 hours 1 min ago - Please correct the URL for Salt Stack's web site
5 hours 12 min ago - Android is Linux -- why no better inter-operation
7 hours 27 min ago - Connecting Android device to desktop Linux via USB
7 hours 56 min ago - Find new cell phone and tablet pc
8 hours 54 min ago - Epistle
10 hours 23 min ago - Automatically updating Guest Additions
11 hours 31 min ago - I like your topic on android
12 hours 18 min ago - This is the easiest tutorial
18 hours 54 min ago - Ahh, the Koolaid.
1 day 32 min ago
Free Webinar: Hadoop
How to Build an Optimal Hadoop Cluster to Store and Maintain Unlimited Amounts of Data Using Microservers
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Some of key questions to be discussed are:
- What is the “typical” Hadoop cluster and what should be installed on the different machine types?
- Why should you consider the typical workload patterns when making your hardware decisions?
- Are all microservers created equal for Hadoop deployments?
- How do I plan for expansion if I require more compute, memory, storage or networking?




Comments
Total bewilderment
What a wonderful example of why kernel hackers shouldn't write magazine articles! I really wanted to understand this SELinux stuff, but this is an impenetrable mess.
Here's how not to do it: first, ensure you don't define your audience. I initially thought this was aimed at developers, but now I think perhaps it's aimed at systems administrators. Second, throw in a whole load of acronyms, right the beginning: MAC, TE, RBAC DAC, LSM (trying to ensure you never use them again in the rest of the piece). Then make life hard for the reader by giving a "general form" containing 3 lines, followed by an example containing 1 line. Still with us? Great. Throw in a few more undefined terms, like "security context", "target context" and "source context", then a few references to system calls (a couple of dozen should be enough). Next present a config file that is longer than the source of the program it is supposed to protect, plus tweaks to 3 other obscure files, the purpose of each remaining unexplained. Then throw in a "make" command without explaining that either. Finish up with a set of obscure commands to prove the example works, carefully labelling it as a "simple demonstration". Job done!
Perhaps I'm in a flippant mood this morning. Perhaps it's because I'm an application developer, not a sysadmin. Perhaps I haven't had enough caffeine. Or perhaps, just possibly, this article is written from the inside out, and is therefore only accessible to those who already understand what the heck it's on about.
If you want to understand mor
If you want to understand more about the underlying concepts, I'd suggest looking at the Faye Coker article listed in the resources, http://www.linuxjournal.com/article/7864
The article is aimed at anyone interested in how SELinux works underneath, and documents a lot of previously undocumented aspects of the networking. I guess it may have been better to drop the introductory section (instead referring to other resources) and include a short glossary.
There is no Faye Cocker article
I looked at that link, http://www.linuxjournal.com/article/7864
There is no Faye Coker article listed on that page. I did a find on the entire web page for "faye" and "coker", nothing.