0

We have an ubuntu VM on Azure. We replaced AppArmor with SELinux using Debian packages (selinux-basics_0.5.2_all.deb & selinux-policy-default_2.20140421-9_all.deb).

Everything works well when selinux is in permissive mode but as soon as we change mode to enforcing we are unable to ssh.

I've tried to autorelabel but it didn't help.

I'm new to SELinux and couldn't find where it gone wrong.

Please find the audit logs below:

pam_systemd(sshd:session): Failed to create session: Connection timed out
pam_selinux(sshd:session): Unable to get valid context for <user>
error: ssh_selinux_getctxbyname: Failed to get default SELinux security context for <user>
error: ssh_selinux_getctxbyname: Failed to get default SELinux security context for <user>
error: ssh_selinux_setup_pty: security_compute_relabel: Invalid argument

Any help or pointers would be much appreciated.

0

Try installing policycoreutils and use audit2allow to create an appropriate rule for ssh.

Audit2allow looks at the audit.log file (or whatever file you specify with the log of problem ssh selinux lines) and creates a set of rules you can apply to fix it.

See the manpage for more details on exact usage.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.