An addendum: if a user installs Puppet from a gem or source (for
instance) onto an OS release that doesn't have a working policy for that
version of Puppet, they will probably want to disable the context
switch. Config of this sort, or a command line argument might work?
Indeed, to an extent. I was thinking of something more hard coded for
SELinux contexts, while ensuring a context switch before "puppet ...
--config [path]" allowed reading of arbitrary files
I've reviewed PR 3627 and the puppet-dev mailing list thread, and I think that this issue could use more discussion before we start merging things.
First off, it doesn't seem like a lot of other projects have to deal with this concern. Is this because the executable itself has a context set and the process itself doesn't need to know about the context?
Secondly, how will this impact the JVM? Since (AFAIK) the JVM runs as a single process with multiple services running in that process, is it even possible to switch the SELinux context without breaking everything else inside of the JVM?
And now for more implementation oriented questions:
What domains do we need for Puppet + SELinux? What resources do they need access to?
The current pull request uses the following environment variables:
Right now Puppet doesn't use ENV for configuration; it has a few trivial things like looking at 'PATH' and 'HOME' but doesn't read values out in order to configure itself. Using the environment to configure the SELinux context means that we have a new configuration mechanism that will not be documented along with other settings. Using environment variables for configuration means that if different values are needed, they won't "stick" - there's no way to always apply these settings without modifying init scripts or /etc/profile or the like.
This leads into...
Dominic Cleal indicated that we should change the SELinux context before we read any configuration files, which makes us need an alternate method of configuring SELinux, which the reason of running unconfined for as little time as possible. Why? Doing so makes it more challenging to handle configuration. Is it really that risky to run unconfined until we can read a config file to get SELinux settings? If we do run unconfined long enough to read a config file, what are the potential ramifications of running unconfined for this period?
It was proposed that we don't switch SELinux contexts if Puppet was installed via a gem or run from source. This seems really challenging to implement.
If I'm developing on Puppet and standing up a test master as my own user, I really don't want SELinux turning itself on. How can we prevent this?
The current approach takes an opt-out approach to SELinux; if it's opt-in we avoid the issue of switching contexts for packaged installs vs gem installs. Is this a viable option?
It was mentioned that we can isolate the default values for SELinux domains to an isolated file so that downstream vendors can just patch that file; I think this is a great idea. It seems a lot simpler than using environment variables.
--
You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-dev+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-dev/55152795.3070300%40redhat.com.
For more options, visit https://groups.google.com/d/optout.
Just out of curiosity, are you going to double wrap this in a Java Security Policy for those systems that don't have SELinux?
[snip]
>
> Environment variables vs configuration via a file
>
> Dominic Cleal indicated that we should change the SELinux context before
> we read any configuration files, which makes us need an alternate method
> of configuring SELinux, which the reason of running unconfined for as
> little time as possible. Why? Doing so makes it more challenging to
> handle configuration. Is it really that risky to run unconfined until we
> can read a config file to get SELinux settings? If we do run unconfined
> long enough to read a config file, what are the potential ramifications
> of running unconfined for this period?
I suppose what we would want to avoid is a period in which something
external, such as a user on the network (probably not an issue) or some
untrusted code is loaded or executed that could access resources that
the server wouldn't have access to when confined.
As a hand waving example, if we loaded environments and executed custom
types, or configuration somehow referenced another file (/etc/shadow for
argument's sake) which was read before confining the server, then this
wouldn't be ideal. Confining the process earlier would help.
The current pull request uses the following environment variables:
- NO_PUPPET_SELINUX_DTRANS
- PUPPET_SELINUX_MASTER_DOMAIN
- PUPPET_SELINUX_CA_DOMAIN
Maybe it's just a knee-jerk reaction, but I'm having trouble with the idea that relying on data from the environment could possibly serve a valid system security objective. That's more usually considered a weakness, and environment-based exploits are legion.
Do the contexts used need to be configurable in Puppet at all? Couldn't they be hard-coded, in which case it becomes a matter of system SELinux policy, rather than Puppet configuration, to grant appropriate access to the contexts in which the various subcommands run?
What if there were a command-line option that controlled whether Puppet would attempt to perform a context switch, with a default value configurable at build time? A default build might default to not switching, yet still have the option for the user to request a switch, whereas, say, the RPM build would default to switching (but have the option to suppress a switch).