Skip to contentSkip to conversation

Adding a new user domain

DISCUSSION Nick Gray 2 participants 5 messages Dec 9, 2004 – Dec 10, 2004 4 messages not in the archive SELinux security module

lore
Share & tools
lore

Nick Gray

author
#0 lore raw

I am stuck!

System: Core 3 Strict/Targeted
Added: selinux-policy-targeted-sources-1.17.30-2.19.noarch.rpm

Problem 1: I am trying to use the instructions s"Getting started with SELinux" and there are a lot of inconsistencies

There was no user.te file so I created one
in /etc/selinux/targeted/src/policy, with the contents:

full_user_role(tomcat)
allow system_r (tomcat)
allow sysadm_r (tomcat)

Then I went into
the /etc/selinux/targeted/src/policy/macros/user_macros.te and added

role tomcat_r types $1;

to this file. I cd'd back up to the policy directory and did a 'make policy' I didn't see any errors.

I am assuming from any user who has user_u:system_r:unconfined_t I should be able to do this:

newrole -r tomcat_r

When I do I get:

Couldn't get default type.

Are there updated instructions that make this less of a hunt and peck operation?

--
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.

#1 lore raw
Quoted 26 lines · Nick Gray

I am stuck!

System: Core 3 Strict/Targeted
Added: selinux-policy-targeted-sources-1.17.30-2.19.noarch.rpm

Problem 1: I am trying to use the instructions s"Getting started with SELinux" and there are a lot of inconsistencies

There was no user.te file so I created one
in /etc/selinux/targeted/src/policy, with the contents:

full_user_role(tomcat)
allow system_r (tomcat)
allow sysadm_r (tomcat)

Then I went into
the /etc/selinux/targeted/src/policy/macros/user_macros.te and added

role tomcat_r types $1;

to this file. I cd'd back up to the policy directory and did a 'make policy' I didn't see any errors.

I am assuming from any user who has user_u:system_r:unconfined_t I should be able to do this:

Quoted 8 lines

newrole -r tomcat_r

When I do I get:

Couldn't get default type.

Are there updated instructions that make this less of a hunt and peck operation?

If you want the strict policy, then do:
yum install selinux-policy-strict selinux-policy-strict-sources run system-config-securitylevel and change to strict or manually:
change SELINUXTYPE to strict in /etc/selinux/config touch /.autorelabel
reboot

targeted policy was introduced by FC3, so none of the sourceforge documentation or NSA documentation is likely to mention it yet.

Signature · 8 lines
Stephen Smalley <[email protected]>
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.
author
#2 lore raw

It appears that the file was in the wrong place

Now I am getting:

domains/user.te:3:ERROR 'syntax error' at token 'allow' on line 6742:
allow sysadm_r tomcat_r
allow system_r tomcat_r
/usr/bin/checkpolicy: error(s) encountered while parsing configuration
make: *** [policy.18] Error 1

Quoted 43 lines · Stephen Smalley
Quoted 26 lines · Nick Gray

I am stuck!

System: Core 3 Strict/Targeted
Added: selinux-policy-targeted-sources-1.17.30-2.19.noarch.rpm

Problem 1: I am trying to use the instructions s"Getting started with SELinux" and there are a lot of inconsistencies

There was no user.te file so I created one
in /etc/selinux/targeted/src/policy, with the contents:

full_user_role(tomcat)
allow system_r (tomcat)
allow sysadm_r (tomcat)

Then I went into
the /etc/selinux/targeted/src/policy/macros/user_macros.te and added

role tomcat_r types $1;

to this file. I cd'd back up to the policy directory and did a 'make policy' I didn't see any errors.

I am assuming from any user who has user_u:system_r:unconfined_t I should be able to do this:

Quoted 8 lines

newrole -r tomcat_r

When I do I get:

Couldn't get default type.

Are there updated instructions that make this less of a hunt and peck operation?

If you want the strict policy, then do:
yum install selinux-policy-strict selinux-policy-strict-sources run system-config-securitylevel and change to strict or manually:
change SELINUXTYPE to strict in /etc/selinux/config touch /.autorelabel
reboot

Quoted 3 lines

targeted policy was introduced by FC3, so none of the sourceforge documentation or NSA documentation is likely to mention it yet.

--
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.

#3 lore raw
Quoted 9 lines · Nick Gray

It appears that the file was in the wrong place

Now I am getting:

domains/user.te:3:ERROR 'syntax error' at token 'allow' on line 6742:
allow sysadm_r tomcat_r
allow system_r tomcat_r
/usr/bin/checkpolicy: error(s) encountered while parsing configuration
make: *** [policy.18] Error 1

First, note that user domains don't exist in targeted policy, so if you want to use them, you first have to convert to strict. But you don't need them if all you want to do is confine a daemon.

Second, you are missing semicolons above.

Signature · 8 lines
Stephen Smalley <[email protected]>
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.

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

author
#8 lore raw
Quoted 8 lines · Stephen Smalley
Quoted 3 lines · Nick Gray

I'm trying to reconcile the difference between SELinux and the current practice of creating a privilege separated user and running a daemon as that user.

For SELinux, you just define a domain for the daemon - you don't need separate SELinux user identities. But you can certainly use a separate Linux uid and a SELinux domain for defense in depth.

I am thinking DISA would smack me on that one eventually since the SRRs they have given me so far have just checked the system as a traditional linux setup. After we are able to get to the next level, which includes having a policy in place, we will work on checking the system with a better focus on SELinux in particular.

Quoted 8 lines
Quoted 5 lines

I noticed that there is not an 'apache' user in the Core 3 setup even with Apache installed and running. Is it the belief that the security model is robust enough that this method of privilege separation is no longer necessary. I guess I can see how that would be the case, it just feels a little odd.

What? I have an apache user on my system, and my httpd.conf says User apache. But that is orthogonal to SELinux.

My mistake, I forgot that I removed apache from the install. I found the Apache doc. and I am beginning the painful process of getting tomcat to run under its own policy. Thanks. All content to be served will be through tomcat

Quoted 10 lines
Quoted 2 lines

Where is the Apache doc? I think it should be able to use it in creating the tomcat policy!

I don't think so, but here you go. Please post questions re Fedora SELinux to the fedora selinux list, not just to me. Also, have you read the Fedora SELinux FAQ?

http://fedora.redhat.com/docs/selinux-apache-fc3/
http://fedora.redhat.com/docs/selinux-faq-fc3/

Yes, I have read everything, several times, until until my brain hurts. We need better step by step documentation as a foundation for promoting this system. (i.e. there is no man page for 'runas')

--
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.