Skip to contentSkip to conversation

SElinux troubles

DISCUSSION Daniel J Walsh 2 participants 6 messages Sep 28, 2009 – Sep 29, 2009 14 messages not in the archive SELinux security module

lore
Share & tools
lore
#11 lore raw
In reply to a message not in the archive
Quoted 39 lines · Orion Poplawski
Quoted 38 lines · Daniel J Walsh
Quoted 37 lines · Orion Poplawski
Quoted 26 lines · Daniel J Walsh
Quoted 25 lines · Orion Poplawski
Quoted 2 lines · Daniel J Walsh

Do you have labels on the rest of the system? Do you have seedit installed?

Yes, e.g.:

# ls -Za /etc/ssh
drwxr-xr-x  root root system_u:object_r:etc_t          .
drwxr-xr-x  root root system_u:object_r:etc_t          ..
(quoted diff) +0 -4
-rw-------  root root system_u:object_r:etc_t          moduli
-rw-r--r--  root root user_u:object_r:etc_t            ssh_config
-rw-------  root root system_u:object_r:etc_t          sshd_config
-rw-------  root root system_u:object_r:sshd_key_t    

ssh_host_dsa_key
-rw-r--r-- root root root:object_r:etc_t
ssh_host_dsa_key.pub

(quoted diff) +0 -2
-rw-------  root root system_u:object_r:sshd_key_t     ssh_host_key
-rw-r--r--  root root root:object_r:etc_t             

ssh_host_key.pub
-rw------- root root system_u:object_r:sshd_key_t ssh_host_rsa_key
-rw-r--r-- root root root:object_r:etc_t ssh_host_rsa_key.pub
-rw-r--r-- root root user_u:object_r:etc_t ssh_known_hosts

Quoted 7 lines
Quoted 2 lines

Don't appear to have seedit, never heard of it.

Right now as root you execute

# chcon system_u:object_r:etc_t:s0 /etc/ssh

It gives you an error?

yup.

Quoted 10 lines
Quoted 6 lines
Quoted 4 lines
# chcon system_u:object_r:etc_t:s0 /etc/ssh
chcon: failed to change context of /etc/ssh to
system_u:object_r:etc_t:s0: Operation not permitted

Just back from linuxcon. Can we bring this to the list?

Definitely, which one?

SE Linux <[email protected]>

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

#12 lore raw
Quoted 36 lines · Daniel J Walsh
Quoted 35 lines · Orion Poplawski
Quoted 34 lines · Daniel J Walsh
Quoted 33 lines · Orion Poplawski
Quoted 32 lines · Daniel J Walsh
Quoted 25 lines · Orion Poplawski
Quoted 2 lines · Daniel J Walsh

Do you have labels on the rest of the system? Do you have seedit installed?

Yes, e.g.:

# ls -Za /etc/ssh
drwxr-xr-x  root root system_u:object_r:etc_t          .
drwxr-xr-x  root root system_u:object_r:etc_t          ..
(quoted diff) +0 -4
-rw-------  root root system_u:object_r:etc_t          moduli
-rw-r--r--  root root user_u:object_r:etc_t            ssh_config
-rw-------  root root system_u:object_r:etc_t          sshd_config
-rw-------  root root system_u:object_r:sshd_key_t    

ssh_host_dsa_key
-rw-r--r-- root root root:object_r:etc_t
ssh_host_dsa_key.pub

(quoted diff) +0 -2
-rw-------  root root system_u:object_r:sshd_key_t     ssh_host_key
-rw-r--r--  root root root:object_r:etc_t             

ssh_host_key.pub
-rw------- root root system_u:object_r:sshd_key_t ssh_host_rsa_key
-rw-r--r-- root root root:object_r:etc_t ssh_host_rsa_key.pub
-rw-r--r-- root root user_u:object_r:etc_t ssh_known_hosts

Quoted 2 lines

Don't appear to have seedit, never heard of it.

Right now as root you execute

# chcon system_u:object_r:etc_t:s0 /etc/ssh
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 1 line

It gives you an error?

yup.

# chcon system_u:object_r:etc_t:s0 /etc/ssh
chcon: failed to change context of /etc/ssh to
system_u:object_r:etc_t:s0: Operation not permitted

I think I'm missing context for this discussion. But it might help to know:
1) Output of id command,
2) Policy type that is being used (targeted, mls, ...?)
3) Policy version
4) Kernel version

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.
#14 lore raw
In reply to a message not in the archive
Quoted 54 lines · Orion Poplawski
Quoted 45 lines · Stephen Smalley
Quoted 36 lines · Daniel J Walsh
Quoted 35 lines · Orion Poplawski
Quoted 34 lines · Daniel J Walsh
Quoted 33 lines · Orion Poplawski
Quoted 32 lines · Daniel J Walsh
Quoted 25 lines · Orion Poplawski
Quoted 2 lines · Daniel J Walsh

Do you have labels on the rest of the system? Do you have seedit installed?

Yes, e.g.:

# ls -Za /etc/ssh
drwxr-xr-x  root root system_u:object_r:etc_t          .
drwxr-xr-x  root root system_u:object_r:etc_t          ..
(quoted diff) +0 -4
-rw-------  root root system_u:object_r:etc_t          moduli
-rw-r--r--  root root user_u:object_r:etc_t            ssh_config
-rw-------  root root system_u:object_r:etc_t          sshd_config
-rw-------  root root system_u:object_r:sshd_key_t

ssh_host_dsa_key
-rw-r--r-- root root root:object_r:etc_t
ssh_host_dsa_key.pub

(quoted diff) +0 -2
-rw-------  root root system_u:object_r:sshd_key_t     ssh_host_key
-rw-r--r--  root root root:object_r:etc_t

ssh_host_key.pub
-rw------- root root system_u:object_r:sshd_key_t ssh_host_rsa_key
-rw-r--r-- root root root:object_r:etc_t ssh_host_rsa_key.pub
-rw-r--r-- root root user_u:object_r:etc_t ssh_known_hosts

Quoted 2 lines

Don't appear to have seedit, never heard of it.

Right now as root you execute

# chcon system_u:object_r:etc_t:s0 /etc/ssh
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 1 line

It gives you an error?

yup.

# chcon system_u:object_r:etc_t:s0 /etc/ssh
chcon: failed to change context of /etc/ssh to
system_u:object_r:etc_t:s0: Operation not permitted
Quoted 7 lines

I think I'm missing context for this discussion. But it might help to know:
1) Output of id command,
2) Policy type that is being used (targeted, mls, ...?)
3) Policy version
4) Kernel version

Quoted 3 lines

uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel) context=user_u:system_r:unconfined_t

Dan, is this supposed to be user_u:system_r in RHEL5? Or should it be unconfined_u:unconfined_r as in current Fedora?

Do you get any avc denial in /var/log/audit/audit.log or /var/log/messages? If so, what does audit2why say about it?

Quoted 16 lines

selinux-policy-targeted-2.4.6-257.el5

2.6.18-128.7.1.el5

Basically, I'm running CentOS 5.3, but with Dan Walsh's selinux repository enabled. For some reason it appears to be preventing the above labeling operation, which it happening during the installation of openssh:

Installing : openssh [1/5]
Error unpacking rpm package openssh-4.3p2-36.el5.i386
error: unpacking of archive failed on file /etc/ssh: cpio: lsetfilecon

I probably should reboot to 2.6.18-164.el5 soon, but am kind of scared due to the intermediate state of openssh.

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.
#15 lore raw
Quoted 55 lines · Stephen Smalley
Quoted 54 lines · Orion Poplawski
Quoted 52 lines · Stephen Smalley
Quoted 36 lines · Daniel J Walsh
Quoted 35 lines · Orion Poplawski
Quoted 34 lines · Daniel J Walsh
Quoted 33 lines · Orion Poplawski
Quoted 32 lines · Daniel J Walsh
Quoted 25 lines · Orion Poplawski
Quoted 2 lines · Daniel J Walsh

Do you have labels on the rest of the system? Do you have seedit installed?

Yes, e.g.:

# ls -Za /etc/ssh
drwxr-xr-x  root root system_u:object_r:etc_t          .
drwxr-xr-x  root root system_u:object_r:etc_t          ..
(quoted diff) +0 -4
-rw-------  root root system_u:object_r:etc_t          moduli
-rw-r--r--  root root user_u:object_r:etc_t            ssh_config
-rw-------  root root system_u:object_r:etc_t          sshd_config
-rw-------  root root system_u:object_r:sshd_key_t

ssh_host_dsa_key
-rw-r--r-- root root root:object_r:etc_t
ssh_host_dsa_key.pub

(quoted diff) +0 -2
-rw-------  root root system_u:object_r:sshd_key_t     ssh_host_key
-rw-r--r--  root root root:object_r:etc_t

ssh_host_key.pub
-rw------- root root system_u:object_r:sshd_key_t ssh_host_rsa_key
-rw-r--r-- root root root:object_r:etc_t ssh_host_rsa_key.pub
-rw-r--r-- root root user_u:object_r:etc_t ssh_known_hosts

Quoted 2 lines

Don't appear to have seedit, never heard of it.

Right now as root you execute

# chcon system_u:object_r:etc_t:s0 /etc/ssh
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 1 line

It gives you an error?

yup.

# chcon system_u:object_r:etc_t:s0 /etc/ssh
chcon: failed to change context of /etc/ssh to
system_u:object_r:etc_t:s0: Operation not permitted

I think I'm missing context for this discussion. But it might help to know:
1) Output of id command,
2) Policy type that is being used (targeted, mls, ...?)
3) Policy version
4) Kernel version

Quoted 4 lines
Quoted 3 lines

uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel) context=user_u:system_r:unconfined_t

That is correct for RHEL5.

Quoted 3 lines

Dan, is this supposed to be user_u:system_r in RHEL5? Or should it be unconfined_u:unconfined_r as in current Fedora?

Can you apply the context in permissive mode?
If you turn off mcstrans does it succeed?

Quoted 20 lines

Do you get any avc denial in /var/log/audit/audit.log or /var/log/messages? If so, what does audit2why say about it?

Quoted 16 lines

selinux-policy-targeted-2.4.6-257.el5

2.6.18-128.7.1.el5

Basically, I'm running CentOS 5.3, but with Dan Walsh's selinux repository enabled. For some reason it appears to be preventing the above labeling operation, which it happening during the installation of openssh:

Installing : openssh [1/5]
Error unpacking rpm package openssh-4.3p2-36.el5.i386
error: unpacking of archive failed on file /etc/ssh: cpio: lsetfilecon

I probably should reboot to 2.6.18-164.el5 soon, but am kind of scared due to the intermediate state of openssh.

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

#17 lore raw
In reply to a message not in the archive
Quoted 6 lines · Orion Poplawski
Quoted 2 lines · Stephen Smalley

Do you get any avc denial in /var/log/audit/audit.log or /var/log/messages? If so, what does audit2why say about it?

No denial messages.

Any chance you have an acl set on this directory or Immutable

lsattr /etc/ssh

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

#19 lore raw
In reply to a message not in the archive
Quoted 26 lines · Orion Poplawski
Quoted 10 lines · Daniel J Walsh
Quoted 6 lines · Orion Poplawski
Quoted 2 lines · Stephen Smalley

Do you get any avc denial in /var/log/audit/audit.log or /var/log/messages? If so, what does audit2why say about it?

No denial messages.

Any chance you have an acl set on this directory or Immutable

lsattr /etc/ssh

That was it:

# lsattr /etc/ssh
s---ia------- /etc/ssh/ssh_host_rsa_key.pub
s---ia------- /etc/ssh/ssh_host_dsa_key.pub
s---ia------- /etc/ssh/ssh_config
s---ia------- /etc/ssh/ssh_host_key
s---ia------- /etc/ssh/sshd_config
s---ia------- /etc/ssh/moduli
s---ia------- /etc/ssh/ssh_host_key.pub
s---ia------- /etc/ssh/ssh_known_hosts
s---ia------- /etc/ssh/ssh_host_rsa_key
s---ia------- /etc/ssh/ssh_host_dsa_key
Quoted 11 lines

no idea how these got set as this was the first time I've heard of these attributes.

Thanks!

Signature · 5 lines
Orion Poplawski
Technical Manager                     303-415-9701 x222
NWRA/CoRA Division                    FAX: 303-415-9702
3380 Mitchell Lane                  [email protected]
Boulder, CO 80301              http://www.cora.nwra.com

And it wasn't even caused by SELinux. (I hope).

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