As we move to systemd, we are loosing some functionality from init scripts.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Currently we can setup certain domains to be allowed to execute labeled init scripts. If we go away from init scripts we will need a mechanism for init to look at the calling program label to figure out if it is allowed to start/stop certain domains.
Can webadm_t start/stop mysqld_t? Can webadm_t start/stop httpd_t?
# id -Z staff_u:webadm_r:webadm_t:s0-s0:c0.c1023 # systemctl start httpd.service # systemctl stop httpd.service
Another option would be just whether label /lib/systemd/system/mysqld.service something that webadm_t is not allowed to read.
Ideas?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk4cuKUACgkQrlYvE4MpobMOygCg5fegKSSt82AuW6DtrS6GphDH OPwAn0S6Y0+q4XFyqSBs2hIyrfgWlZ8o
=InWv
-----END PGP SIGNATURE-----
--
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.
Quoted 12 lines · Daniel J Walsh
Currently we can setup certain domains to be allowed to execute labeled init scripts. If we go away from init scripts we will need a mechanism for init to look at the calling program label to figure out if it is allowed to start/stop certain domains.
Can
webadm_tstart/stopmysqld_t? Canwebadm_tstart/stophttpd_t?# id -Z staff_u:webadm_r:webadm_t:s0-s0:c0.c1023 # systemctl start httpd.service # systemctl stop httpd.service
Quoted 5 lines
Another option would be just whether label
/lib/systemd/system/mysqld.servicesomething thatwebadm_tis not allowed to read.Ideas?
Does your suggestion really make it impossible to send a command to systemd to start/stop a service if you cant read that file (eg mysqld.service)? I don't know what the implementation is, but I would guess that systemctl connects to systemd over a unix socket or fifo to give commands? If so, it would seem better for systemd to have some SELinux awareness on its incoming commands.
Signature · 8 lines
Chris PeBenito Tresys Technology, LLC www.tresys.com | oss.tresys.com -- 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.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Quoted 16 lines · Christopher J. PeBenito
Quoted 15 lines · Daniel J Walsh
Currently we can setup certain domains to be allowed to execute labeled init scripts. If we go away from init scripts we will need a mechanism for init to look at the calling program label to figure out if it is allowed to start/stop certain domains.
Can
webadm_tstart/stopmysqld_t? Canwebadm_tstart/stophttpd_t?# id -Z staff_u:webadm_r:webadm_t:s0-s0:c0.c1023 # systemctl start httpd.service # systemctl stop httpd.serviceAnother option would be just whether label
/lib/systemd/system/mysqld.servicesomething thatwebadm_tis not allowed to read.
Quoted 9 lines
Quoted 1 line
Ideas?
Does your suggestion really make it impossible to send a command to systemd to start/stop a service if you cant read that file (eg mysqld.service)? I don't know what the implementation is, but I would guess that systemctl connects to systemd over a unix socket or fifo to give commands? If so, it would seem better for systemd to have some SELinux awareness on its incoming commands.
I agree, but I am not sure of the syntax.
I was thinking that we might want systemd to ask if webadm_t is allowed to execute /lib/systemd/system/mysqld.service, even though it is not really executing the service script. Since we do not know what is going on in the service file, systemd will have a hard time differentiating the access.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk4dn+EACgkQrlYvE4MpobNEAwCgtHNdxRzaIVszkeEyic/jCN3a HwMAnipcsLLpLLpKCTirCU1kFIWHM9fG
=APZx
-----END PGP SIGNATURE-----
--
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.
I dont think that will work. According to my strace systemd performs the work completely on behalf of the user when calling systemctl.
It might be more elegant to solve the problem in software.. ideally with some selinux object manager for systemd that systemctl can be intercepted with.
Say classes of target and service and permissions like start, stop reload, restart etc.
That could take a while to implement though.
Quoted 16 lines · Daniel J Walsh
Currently we can setup certain domains to be allowed to execute labeled init scripts. If we go away from init scripts we will need a mechanism for init to look at the calling program label to figure out if it is allowed to start/stop certain domains.
Can
webadm_tstart/stopmysqld_t? Canwebadm_tstart/stophttpd_t?# id -Z staff_u:webadm_r:webadm_t:s0-s0:c0.c1023 # systemctl start httpd.service # systemctl stop httpd.serviceAnother option would be just whether label
/lib/systemd/system/mysqld.servicesomething thatwebadm_tis not allowed to read.
Quoted 5 lines
Ideas?
--
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.
--
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.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Quoted 12 lines · Matthew Ife
I dont think that will work. According to my strace systemd performs the work completely on behalf of the user when calling systemctl.
It might be more elegant to solve the problem in software.. ideally with some selinux object manager for systemd that systemctl can be intercepted with.
Say classes of target and service and permissions like start, stop reload, restart etc.
That could take a while to implement though.
Right, I was thinking of something simpler, Have systemd become an object manager but only have it check the services file. That way we just put a label on the services file and have systemd check if the user context is allowed to "PROCESS" "EXECUTE" or some other access method on the services file.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk4d2acACgkQrlYvE4MpobP1vwCeOKZ7Z15EU43/I7UN9i86Udcz Qi0AoM71WDDl6Y1N3ZDNbdf/mRcKIWfT
=fDed
-----END PGP SIGNATURE-----
--
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.
Quoted 14 lines · Daniel J Walsh
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1Quoted 10 lines · Matthew Ife
I dont think that will work. According to my strace systemd performs the work completely on behalf of the user when calling systemctl.
It might be more elegant to solve the problem in software.. ideally with some selinux object manager for systemd that systemctl can be intercepted with.
Say classes of target and service and permissions like start, stop reload, restart etc.
Quoted 7 lines
Quoted 2 lines
That could take a while to implement though.
Right, I was thinking of something simpler, Have systemd become an object manager but only have it check the services file. That way we just put a label on the services file and have systemd check if the user context is allowed to "PROCESS" "EXECUTE" or some other access method on the services file.
Don't reuse the kernel classes/permissions please. I know we've done that in e.g. crond in the past, but it conflates their purpose; define new classes/perms for this purpose instead. Also be sure to use the newer interfaces for userspace object managers ala XSELinux so that you use dynamic class/perm mapping. We still need the older userspace object managers to be updated in that regard.
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.
Quoted 2 lines · Stephen Smalley
Don't reuse the kernel classes/permissions please. I know we've done that in e.g. crond in the past, but it conflates their purpose;
The crond operation is to ask the kernel what could happen if the crontab spool file was treated as an executable, and then apply the resulting context for executing the commands that it contains.
While this is not obvious to a SE Linux newbie, it makes sense and it closely matches the ancient crond code for checking UIDs for the Unix permission parts.
While making the operation more obvious to newbies does offer some benefits (including security benefits by avoiding mistakes), I can't think of a good way of achieving such a goal.
If we were to start from the Vixie-cron base and write entirely new SE Linux patches and policy without any legacy today how do you think we would do it better?
Quoted 5 lines
define
new classes/perms for this purpose instead. Also be sure to use the newer interfaces for userspace object managers ala XSELinux so that you use dynamic class/perm mapping. We still need the older userspace object managers to be updated in that regard.
systemd has to use labels on files for all variants of the proposed design so classes aren't an option.
Once we get role support in the filesystem code (how long will that take?) we could use role labels to determine which roles can execute the daemon start scripts. But it would still surely end up with systemd just doing a check of whether the context of systemctl permits executing the /etc/init.d script in question.
Signature · 7 lines
My Main Blog http://etbe.coker.com.au/ My Documents Blog http://doc.coker.com.au/ -- 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.
Quoted 7 lines · Russell Coker
Quoted 2 lines · Stephen Smalley
Don't reuse the kernel classes/permissions please. I know we've done that in e.g. crond in the past, but it conflates their purpose;
The crond operation is to ask the kernel what could happen if the crontab spool file was treated as an executable, and then apply the resulting context for executing the commands that it contains.
Yes, IIRC, that was my idea.
Quoted 11 lines
While this is not obvious to a SE Linux newbie, it makes sense and it closely matches the ancient crond code for checking UIDs for the Unix permission parts.
While making the operation more obvious to newbies does offer some benefits (including security benefits by avoiding mistakes), I can't think of a good way of achieving such a goal.
If we were to start from the Vixie-cron base and write entirely new SE Linux patches and policy without any legacy today how do you think we would do it better?
In retrospect, I think it would have been cleaner to have defined a unique class/perm for this purpose. Both in order to cleanly delineate the kernel classes/permissions from userspace ones and to make clear the semantic difference between an execve of a file and running a cron job from a configuration file.
Quoted 2 lines
systemd has to use labels on files for all variants of the proposed design so classes aren't an option.
It is fine for systemd to use a file label as the object security context if that is the granularity at which we want to control the operations, but systemd can still define and use its own classes and permissions for the permission checks on its operations. In a similar manner, dbusd is using the security context of the destination process as the object security context for its check, yet it defines its own class and permissions for those checks. And of course all of the userspace object managers are using the process context as the subject/source context.
Quoted 6 lines
Once we get role support in the filesystem code (how long will that take?) we could use role labels to determine which roles can execute the daemon start scripts. But it would still surely end up with systemd just doing a check of whether the context of systemctl permits executing the
/etc/init.dscript in question.
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.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I guess we can add something like the attached, and then implement systemd checks on these.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk4gdHEACgkQrlYvE4MpobOg3gCfU23GCTQuktksXCu6j2mGdnh0 TRUAnRRo34V3/OIxe+ikn7mFrI3sLy38
=gJiT
-----END PGP SIGNATURE-----
policy/flask/access_vectors +9 -0
@@ -862,3 +862,12 @@ inherits database implement execute } + +class service +{ + start + stop + status + reload + kill +}
policy/flask/security_classes +4 -0
@@ -131,4 +131,8 @@ class db_view # userspace class db_sequence # userspace class db_language # userspace +# systemd services +class service + + # FLASK