[SOLVED] SELinux: command output printed on serial but not on ssh
Linux - Embedded & Single-board computerThis forum is for the discussion of Linux on both embedded devices and single-board computers (such as the Raspberry Pi, BeagleBoard and PandaBoard). Discussions involving Arduino, plug computers and other micro-controller like devices are also welcome.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Well, obviously access is denied somewhere due to SELinux. I don't know SeLinux, sorry, but probably a good start would be audit logs (/var/log/audit/audit.log) or /var/log/messages if you have no audit. Or some of the solutions here to get more info on the issue: https://wiki.gentoo.org/wiki/SELinux...denial_details
If you don't have any tools, it might be better to dig around in securityfs /sys/kernel/security if you have sysfs.
Since SELinux is not pathname based, I would guess that SSH/ping would be granted the same access as TTY/ping if you have granted SSH access to execute ping, or maybe I am wrong. Maybe you need to grant all the EXACT access ping needs, seperately for SSH/ping that TTY/ping (which works) already have. Most obvious is network access and send network data.
That's just my guess though, but it would be interesting to see what you find out and how things go.
Maybe also post the output of ls -Z /usr/bin/ping and id -Z (both from serial and ssh).
Well, obviously access is denied somewhere due to SELinux. I don't know SeLinux, sorry, but probably a good start would be audit logs (/var/log/audit/audit.log) or /var/log/messages if you have no audit. Or some of the solutions here to get more info on the issue: https://wiki.gentoo.org/wiki/SELinux...denial_details
If you don't have any tools, it might be better to dig around in securityfs /sys/kernel/security if you have sysfs.
Since SELinux is not pathname based, I would guess that SSH/ping would be granted the same access as TTY/ping if you have granted SSH access to execute ping, or maybe I am wrong. Maybe you need to grant all the EXACT access ping needs, seperately for SSH/ping that TTY/ping (which works) already have. Most obvious is network access and send network data.
That's just my guess though, but it would be interesting to see what you find out and how things go.
Maybe also post the output of ls -Z /usr/bin/ping and id -Z (both from serial and ssh).
Hi there,
thank your for the reply and sorry for me being late.
Launching:
Code:
~# which ping
/bin/ping
Then, on serial:
Code:
~# ls -lZ /bin/ping
lrwxrwxrwx. 1 root root system_u:object_r:bin_t:s0 17 Aug 4 2021 /bin/ping -> /bin/ping.iputils
~# ls -lZ /bin/ping.iputils
-r-sr-xr-x. 1 root root system_u:object_r:ping_exec_t:s0 42888 Aug 4 2021 /bin/ping.iputils
~# id -Z
root:sysadm_r:sysadm_t:s0-s15:c0.c1023
Whereas, on ssh:
Code:
~# ls -lZ /bin/ping
lrwxrwxrwx. 1 root root system_u:object_r:bin_t:s0 17 Aug 4 2021 /bin/ping -> /bin/ping.iputils
~# ls -lZ /bin/ping.iputils
-r-sr-xr-x. 1 root root system_u:object_r:ping_exec_t:s0 42888 Aug 4 2021 /bin/ping.iputils
~# id -Z
root:sysadm_r:sysadm_t:s0
Is there anything meaningful from these command output?
Meanwhile, I will try to analyze the source you linked in order to find more details about the matter, if possible.
Then compiling the patch, it seems that issue is fixed. I added specific patches on yocto for ping e ifconfig on the *.te files where their type is declared
Last edited by JuventusFC; 08-24-2021 at 05:11 AM.
serial
root:sysadm_r:sysadm_t:s0-s15:c0.c1023
ssh
root:sysadm_r:sysadm_t:s0
Quote:
Is there anything meaningful from these command output?
Yes. If you analyze the "diff" on the output, that is what you are left with, and most likely the reason for the problem. Everything else looks the same. But, like I said, I know some LSM, but not SELinux specifically. But that's the first thing I would look into.
"pts" is pseudoterminal aka terminal emulator, and if you want the same result with ssh and serial on pts, it should have the same attributes in SELinux, most likely.
Then compiling the patch, it seems that issue is fixed. I added specific patches on yocto for ping e ifconfig on the *.te files where their type is declared
So it now works? Good to hear, well done in rolling your sleeves up etc
But I don't know why parts of the output mentions "permissive", specifically the ones tailing what I mentioned with "diff".
And.. From what I understand, you added full SELinux audit, which is good, but you probably need to take some steps to rotate and flush logs to prevent huge audit log files.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.