Re: MCS NetLabel

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Apr 18, 2021 at 4:02 PM Paul R. Tagliamonte <paultag@xxxxxxxxx> wrote:
> Hello SELinux folks,

Hello fellow Paul.

> I'm running a test system using MCS and just starting to get to the
> point where I'm interested in enabling NetLabel + CIPSO to pass along
> context on a LAN. As a first step, I was able to get it working off
> `localhost` before adding in CIPSO or other boxen.
>
> I'm able to run in enforcing mode (amazing!) and get the peer context
> (even more amazing!) -- which I can use to calculate the effective
> "connection context" for logical filtering on common categories.
> That's really great!

I'll admit to being a bit biased, but yeah, it is pretty cool ;)

However, there are a few words of caution I should share.  First, you
will want to make sure that you protect your IPv4 header if you are
sending CIPSO traffic across an untrusted network.  Second, you need
to make sure that any of your network hops/middle-boxes don't strip
IPv4 options; if they do, you'll lose your CIPSO labels.  The good
news is that in both cases encapsulating your network traffic in a VPN
or some other form of protected tunnel should solve both problems.  If
you use IPv6, CALIPSO has similar concerns, although due to the nature
of CALIPSO and IPv6 the middle-box problem shouldn't really be an
issue.

There is also labeled IPsec, but it is SELinux only and if you don't
carefully synchronize your policies across nodes you can get into some
odd/dangerous situations.  People really like labeled IPsec because
you can transmit the full SELinux label over the wire and not just the
MLS/MCS information, but it's a bad design IMHO; you're better off
with CIPSO/CALIPS+IPsec if you can get by with just the MLS/MCS
information.

> I'm a bit confused with some of the enforcement on this, though. When
> I run my server (with a user and binary at the level of `s0:c1`),
> connecting to localhost via a user at `s0` results in a connection
> getting established.
>
> While I understand this isn't the same as MLS / sensitivity level, I'm
> a bit surprised that it didn't refuse to connect to the privileged
> resource. Certainly I can't cat a file from a user at `s0` that's at
> `s0:c1`, or likely (I haven't tried, but it stands to reason) a UNIX
> Socket with `c1` -- so the TCP connection going through was a bit
> surprising. I can see in the peer context that the user is at `s0`
> (without `c1`), so it'd be possible to filter this software-side, but
> it'd also be a bit more of a mental relief if only processes with the
> `c1` category could connect.
>
> Is there any documentation on how to set that particular type of enforcement?

You didn't mention what distro and/or policy you are using (other than
MCS), but my guess is you are running into a situation where the
SELinux policy constraints are not set as expected.  I know in the
past the MCS labeled networking constraints were a bit lax, even
outright missing at one point, so that would be a good place to start.

However, since most people are a bit lost when it comes to policy
constraints, let me introduce you to The SELinux Notebook:

* https://github.com/SELinuxProject/selinux-notebook

... it is an *amazing* freely available resource, that I would
encourage you to take a look at if you haven't already.  It's source
material is in GitHub friendly Markdown, and you can render it into
HTML and PDF if you like using the provided Makefile.  The Notebook
has a section on policy constraints where it provides some expalantion
of the "mlscontrain" statement, which I believe is where your problem
lies:

* https://github.com/SELinuxProject/selinux-notebook/blob/main/src/constraint_statements.md
* https://github.com/SELinuxProject/selinux-notebook/blob/main/src/constraint_statements.md#mlsconstrain

... from there it is a matter of inspecting your policy to see what it
specifies for the MLS/MCS network controls - good luck!

-- 
paul moore
www.paul-moore.com



[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux