Unfortunately we do not have control over the privilege escalation
process. We assume that the hacker does it by gaining access through the
web as the tomcat user.
But what we are trying to do here is to limit the capability of this
"tomcat escalated root user" from creating dangerous users(using the
useradd and semanage commands)
with unlimited capabilities . These dangerous users can potentially change
the mode of selinux from enforcing to permissive.
On 9/3/13 10:51 AM, "Daniel J Walsh" <dwalsh(a)redhat.com> wrote:
-----BEGIN PGP SIGNED MESSAGE-----
On 09/03/2013 01:00 PM, Anamitra Dutta Majumdar (anmajumd) wrote:
> Hi Daniel,
> We still need tomcat to be able to run useradd and semanage command.
> Tomcat context is uid=502(tomcat) gid=502(tomcat)
> However we do not want this capability for a "tomcat escalated root"
> So we need to differentiate between a "tomcat escalated root" and the
> "tomcat" users here. We do not want the "tomcat escalated root
> execute useradd and semanage commands but the tomcat "user" Still needs
> that capability.
> Is this doable through type enforcements.
> Thanks, Anamitra
Well you would have two different types.
tomcat_t and tomcat_root_t
SELinux knows nothing about UID. It knows a little about capabilties.
And why should the non root user be allowed to execute semanage and
BTW Both users are allowed to execute those commands but neither is
manipulate /etc/passwd, or /etc/shadow or /etc/selinux/*
> On 9/3/13 5:18 AM, "Daniel J Walsh" <dwalsh(a)redhat.com> wrote:
> On 09/03/2013 02:28 AM, Anamitra Dutta Majumdar (anmajumd) wrote:
>>>> We need to constrain a tomcat escalated root user from executing
>>>> "useradd" and "semanage" commands on RHEL6.
>>>> Can we add a SELinux constraint policy to achieve the same?
>>>> A tomcat escalated root user (I.e when a "tomcat" user
>>>> the "root" user on the system) has the following security
>>>> uid=0(*root*) gid=0(root)
>>>> The logic of this constraint should be be as follows..
>>>> If id="root" and source type="tomcatd_t"
>>>> Then disallow domain transition to both "useradd_/exec_t" as
>>>> 1. Is this something doable through an SELinux constrain policy. 2.
>>>> If so what should be the syntax of the policy.
>>>> -- selinux mailing list selinux(a)lists.fedoraproject.org
> This is a type enforcement issue not a constraint issue. tomcatd can be
> prevented from running useradd_t regardless of its UID, and more
> importantly should not be allowed to write /etc/passwd (etc_t) or
> /etc/shadow (shadow_t).
> No constraint needed to do this. Just don't allow t to write etc_t and
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.14 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
-----END PGP SIGNATURE-----