Skip to contentSkip to conversation

Why am I not transitioning correctly?

DISCUSSION Jeremiah Jahn 2 participants 5 messages Feb 6, 2008 SELinux security module

lore
Share & tools
lore
#0 lore raw

I get this error in the audit log:
type=SELINUX_ERR msg=audit(1202327606.098:732): security_compute_sid: invalid context system_u:system_r:monetra_t:s0 for scontext=system_u:system_r:initrc_t:s0 tcontext=system_u:object_r:monetra_server_exec_t:s0 tclass=process type=SYSCALL msg=audit(1202327606.098:732): arch=40000003 syscall=11 success=no exit=-13 a0=9d9f650 a1=9d9f5d8 a2=9d8c728 a3=9d9ff20 items=0 ppid=2575 pid=2593 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) comm="S99monetra" ex e="/bin/bash" subj=system_u:system_r:initrc_t:s0 key=(null)

I was under the assumption that the following would work:
allow initrc_t monetra_server_exec_t:file { read execute getattr}; allow monetra_t monetra_server_exec_t:file { entrypoint }; type_transition initrc_t monetra_server_exec_t:process monetra_t;

I can't do init_daemon_domain(monetra_t,monetra_server_exec_t) because I can't let sysadm_t read anything involving monetra_t. And I'd thought I'd read in "selinux by example" that domain_auto_trans(initrc_t,monetra_server_exec_t,monetra_t) is generally a bad idea.

Yes, but every time I try to see things your way, I get a headache.

#1 lore raw
Quoted 4 lines · Jeremiah Jahn

I get this error in the audit log:
type=SELINUX_ERR msg=audit(1202327606.098:732): security_compute_sid: invalid context system_u:system_r:monetra_t:s0 for scontext=system_u:system_r:initrc_t:s0 tcontext=system_u:object_r:monetra_server_exec_t:s0 tclass=process type=SYSCALL msg=audit(1202327606.098:732): arch=40000003 syscall=11 success=no exit=-13 a0=9d9f650 a1=9d9f5d8 a2=9d8c728 a3=9d9ff20 items=0 ppid=2575 pid=2593 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) comm="S99monetra" ex e="/bin/bash" subj=system_u:system_r:initrc_t:s0 key=(null)

Missing role system_r types monetra_t; statement.

Quoted 4 lines

I was under the assumption that the following would work:
allow initrc_t monetra_server_exec_t:file { read execute getattr}; allow monetra_t monetra_server_exec_t:file { entrypoint }; type_transition initrc_t monetra_server_exec_t:process monetra_t;

Also need:
allow initrc_t monetra_t:process transition;

But why not just use policy interfaces to do that?

Quoted 5 lines

I can't do init_daemon_domain(monetra_t,monetra_server_exec_t) because I can't let sysadm_t read anything involving monetra_t. And I'd thought I'd read in "selinux by example" that domain_auto_trans(initrc_t,monetra_server_exec_t,monetra_t) is generally a bad idea.

Why?

Signature · 8 lines
Stephen Smalley
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.
#2 lore raw
Quoted 8 lines · Stephen Smalley
Quoted 4 lines · Jeremiah Jahn

I get this error in the audit log:
type=SELINUX_ERR msg=audit(1202327606.098:732): security_compute_sid: invalid context system_u:system_r:monetra_t:s0 for scontext=system_u:system_r:initrc_t:s0 tcontext=system_u:object_r:monetra_server_exec_t:s0 tclass=process type=SYSCALL msg=audit(1202327606.098:732): arch=40000003 syscall=11 success=no exit=-13 a0=9d9f650 a1=9d9f5d8 a2=9d8c728 a3=9d9ff20 items=0 ppid=2575 pid=2593 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) comm="S99monetra" ex e="/bin/bash" subj=system_u:system_r:initrc_t:s0 key=(null)

Missing role system_r types monetra_t; statement.

Quoted 7 lines
Quoted 4 lines

I was under the assumption that the following would work:
allow initrc_t monetra_server_exec_t:file { read execute getattr}; allow monetra_t monetra_server_exec_t:file { entrypoint }; type_transition initrc_t monetra_server_exec_t:process monetra_t;

Also need:
allow initrc_t monetra_t:process transition;

this results in the following error:
libsepol.check_assertion_helper: assertion on line 0 violated by allow initrc_t monetra_t:process { transition };

Quoted 2 lines

But why not just use policy interfaces to do that?

Here lies my major problem. My level of understanding is based generally on what I can track down in books. O'reilly's SELinux and Tresys's SElinux by example. The ORA book is incomplete at best, with little or no actual reference value. The Tresys book is far better, and takes a good deal of time explaining PRE-refpolicy. Although it goes into the general ideas behind the refpolicy and some of the macros, that's about it. No where can I find information about the actual format of the .te files for example, perhaps I missed it, but hey. When I look online for something more update from Tresys or the NSA, the documentation seems to focus on very specific things. For example the Interface docs have no real overview of the .te format, "roles seem to need be at the bottom, right before users". Also there seems to really be no docs other than the books that really describe what "non interface" macros are out there. There no really good starting point for someone trying to do something outside all of the examples. In my case, "don't let the sysadm read or touch credit card data."

</rant>

I truly am grateful for the amount of hard work everyone has put into SELinux, it's a huge undertaking, and makes my job possible. But ohy vey is it confusing.

Quoted 8 lines
Quoted 6 lines

I can't do init_daemon_domain(monetra_t,monetra_server_exec_t) because I can't let sysadm_t read anything involving monetra_t. And I'd thought I'd read in "selinux by example" that domain_auto_trans(initrc_t,monetra_server_exec_t,monetra_t) is generally a bad idea.

Why?

don't have my book in front of me..:) Couldn't tell you.

Quoted 1 line

If you think the United States has stood still, who built the largest shopping center in the world? -- Richard M. Nixon

#3 lore raw
Quoted 15 lines · Jeremiah Jahn
Quoted 13 lines · Stephen Smalley
Quoted 4 lines · Jeremiah Jahn

I get this error in the audit log:
type=SELINUX_ERR msg=audit(1202327606.098:732): security_compute_sid: invalid context system_u:system_r:monetra_t:s0 for scontext=system_u:system_r:initrc_t:s0 tcontext=system_u:object_r:monetra_server_exec_t:s0 tclass=process type=SYSCALL msg=audit(1202327606.098:732): arch=40000003 syscall=11 success=no exit=-13 a0=9d9f650 a1=9d9f5d8 a2=9d8c728 a3=9d9ff20 items=0 ppid=2575 pid=2593 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) comm="S99monetra" ex e="/bin/bash" subj=system_u:system_r:initrc_t:s0 key=(null)

Missing role system_r types monetra_t; statement.

Quoted 4 lines

I was under the assumption that the following would work:
allow initrc_t monetra_server_exec_t:file { read execute getattr}; allow monetra_t monetra_server_exec_t:file { entrypoint }; type_transition initrc_t monetra_server_exec_t:process monetra_t;

Quoted 4 lines
Quoted 2 lines

Also need:
allow initrc_t monetra_t:process transition;

this results in the following error:
libsepol.check_assertion_helper: assertion on line 0 violated by allow initrc_t monetra_t:process { transition };

That means you didn't declare monetra_t as a domain, i.e. domain_type(monetra_t)

The best way to start is to look an existing .te file and follow its example. refpolicy has pretty extensive documentation of all of its interfaces, although it can be hard to find the one you want. SLIDE seems promising; possibly you should try using it and its domain builder.

SELinux by Example does walk you through writing a simple domain from scratch, I think.

Nothing wrong with domain_auto_trans() AFAIK, and I see it used throughout refpolicy.

Signature · 8 lines
Stephen Smalley
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.
#4 lore raw
Quoted 16 lines · Stephen Smalley
Quoted 15 lines · Jeremiah Jahn
Quoted 13 lines · Stephen Smalley
Quoted 4 lines · Jeremiah Jahn

I get this error in the audit log:
type=SELINUX_ERR msg=audit(1202327606.098:732): security_compute_sid: invalid context system_u:system_r:monetra_t:s0 for scontext=system_u:system_r:initrc_t:s0 tcontext=system_u:object_r:monetra_server_exec_t:s0 tclass=process type=SYSCALL msg=audit(1202327606.098:732): arch=40000003 syscall=11 success=no exit=-13 a0=9d9f650 a1=9d9f5d8 a2=9d8c728 a3=9d9ff20 items=0 ppid=2575 pid=2593 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) comm="S99monetra" ex e="/bin/bash" subj=system_u:system_r:initrc_t:s0 key=(null)

Missing role system_r types monetra_t; statement.

Quoted 4 lines

I was under the assumption that the following would work:
allow initrc_t monetra_server_exec_t:file { read execute getattr}; allow monetra_t monetra_server_exec_t:file { entrypoint }; type_transition initrc_t monetra_server_exec_t:process monetra_t;

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Also need:
allow initrc_t monetra_t:process transition;

this results in the following error:
libsepol.check_assertion_helper: assertion on line 0 violated by allow initrc_t monetra_t:process { transition };

That means you didn't declare monetra_t as a domain, i.e. domain_type(monetra_t)

thanx. I did initially use the refpolicy interfaces, but they were a little broad, and allowed sysadm_t to read some files just because initrc_t could. So I'm trying to simplify/ do explicitly what I understand.

Quoted 6 lines

The best way to start is to look an existing .te file and follow its example. refpolicy has pretty extensive documentation of all of its interfaces, although it can be hard to find the one you want. SLIDE seems promising; possibly you should try using it and its domain builder.

None of the .te files I could find really did what I wanted, or they interface that were a little vague in what they did. I'm learning to build the policy, and see how the macro expands to see what it does.

Quoted 3 lines

SELinux by Example does walk you through writing a simple domain from scratch, I think.

It does, but leaves a few things out, and nobody has an example of creating a whole separate domain that root/sysadm_t can't use, but can start up at boot.

Quoted 4 lines

Nothing wrong with domain_auto_trans() AFAIK, and I see it used throughout refpolicy.

this was my bad, domain_dyntrans_type( domain ) was what I was thinking of.

There can be no twisted thought without a twisted molecule. -- R. W. Gerard