Skip to contentSkip to conversation

selinux, openssh and users

DISCUSSION Ignacio Tripodi 2 participants 2 messages Oct 23, 2003 SELinux security module

lore
Share & tools
lore
#0 lore raw

I just finished setting up a 2.6 selinux kernel environment, and noticed that I can't ssh to it. I found in the list archives that you cannot ssh using an admin_r user (is that still valid?) so I tried to create a regular user and assign the user_r role to it. If I do a "seuser add -R user_r username" it says that it couldn't modify the policy and failed to create the user. Do you know where can I start looking for errors? The policy seems to being loaded just fine (through initrd) and the selinux modules are up.

Also, once I am able to create a regular user, do I need to specify any role/context parameters in order to ssh to this machine? How does the openssh client get around this?
Thanks a lot,

Ignacio Tripodi

--
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 2 lines · Ignacio Tripodi

I just finished setting up a 2.6 selinux kernel environment, and noticed that I can't ssh to it.

Did you label the filesystems and reboot (or at least restart sshd)? If not, sshd is running in the wrong security domain and can't find a reachable user context for you. What does ps -eZ (ps -e --context) show?

Quoted 2 lines

I found in the list archives that you cannot ssh using an
admin_r user (is that still valid?)

The example policy prohibits direct transitions from sshd_t to sysadm_t, but you should be able to login as staff_r:staff_t and then newrole to sysadm_r:sysadm_t.

Quoted 4 lines

so I tried to create a regular user and
assign the user_r role to it. If I do a "seuser add -R user_r username" it says that it couldn't modify the policy and failed to create the user. Do you know where can I start looking for errors?

Your 'dmesg' output or /var/log/messages will show avc denied messages for SELinux access denials. Is your kernel running in enforcing mode? It is a good idea to start with permissive mode until you have worked out any policy issues, as noted in the README.

Quoted 3 lines

Also, once I am able to create a regular user, do I need to specify any role/context parameters in order to ssh to this machine? How does the openssh client get around this?

sshd (via libselinux) asks the kernel what contexts are reachable from its domain for your user identity (kernel determines this based on the policy) and then picks one of the reachable contexts based on either /etc/security/default_contexts or $HOME/.default_contexts. There is no way to specify a context from the client.

Note that a patched sshd isn't necessary if you use Dan's pam_selinux module and alter your PAM sshd configuration to include it. Not sure if his module allows user selection of contexts for ssh sessions (if using the 'multiple' option to the module).

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.