Skip to contentSkip to conversation

Quick question

DISCUSSION Ioannis Aslanidis 2 participants 6 messages May 27, 2008 SELinux security module

lore
Share & tools
lore
#0 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello,

I do not know if this is the proper place for this; however, neither on IRC in #selinux on freenode nor in other places related to SELinux I was able to get the appropriate help. I have also spent over a month reading through documentation and googling around to find something similar to what I needed, but to no avail.

I would like to know how to create a module or policy or modify the current policy so that users of the system are:
1. Unable to list the /home directory
2. Unable to get into other users directory using SELinux rules
3. (optional) Be able to list /home, but be unable to see anything apart from his home.

I have specific needs in my production environment which require these specifications. Normal permissions are not an option in my environment, because of shared permissions of nfs mounts.

Getting a template and working over it or converting deny rules to allow rules is not an option for me, as I need to be able to understand and allow others to understand the text and be able to easily maintainy and modify it.

In order to prevent the users from getting any data in /etc/passwd I plan to use PAM + LDAP or a similar solution.

I hope you can give me a hand with this.

Regards,

Ioannis
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iD8DBQFIPEb6Fq+8w76sCAARArB0AKCTYt7EWWnjnhvx86wJDHj/NuUTLgCgrex7 RoyVndANCtwStrM+7+WsX5E=
=vSb3
-----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.

#1 lore raw
Quoted 27 lines · Ioannis Aslanidis

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello,

I do not know if this is the proper place for this; however, neither on IRC in #selinux on freenode nor in other places related to SELinux I was able to get the appropriate help. I have also spent over a month reading through documentation and googling around to find something similar to what I needed, but to no avail.

I would like to know how to create a module or policy or modify the current policy so that users of the system are:
1. Unable to list the /home directory
2. Unable to get into other users directory using SELinux rules
3. (optional) Be able to list /home, but be unable to see anything apart from his home.

I have specific needs in my production environment which require these specifications. Normal permissions are not an option in my environment, because of shared permissions of nfs mounts.

Getting a template and working over it or converting deny rules to allow rules is not an option for me, as I need to be able to understand and allow others to understand the text and be able to easily maintainy and modify it.

Quoted 4 lines

In order to prevent the users from getting any data in /etc/passwd I plan to use PAM + LDAP or a similar solution.

I hope you can give me a hand with this.

If I understand correctly, you want to provide separation on a per-user basis (not just per-role) for NFS-mounted home directories. I don't think that is realistically supportable by SELinux today, as 1) SELinux distinguishes based on security context/label, not uid, and 2) NFS doesn't support file labeling yet. Sounds more like a job for 'normal permissions' i.e. discretionary access modes and/or ACLs. There is ongoing work to support file labeling in NFSv4, but it is still in development, and even then, instantiating a separate role for every user is going to be problematic for any large number of users.

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.
#2 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 11 lines · Stephen Smalley

If I understand correctly, you want to provide separation on a per-user basis (not just per-role) for NFS-mounted home directories. I don't think that is realistically supportable by SELinux today, as 1) SELinux distinguishes based on security context/label, not uid, and 2) NFS doesn't support file labeling yet. Sounds more like a job for 'normal permissions' i.e. discretionary access modes and/or ACLs. There is ongoing work to support file labeling in NFSv4, but it is still in development, and even then, instantiating a separate role for every user is going to be problematic for any large number of users.

And would there be a way to do something so that each user has a different context? That is to say, I can assign a different context to each user and have something easily maintained. Do you see that viable? -----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iD8DBQFIPE4SFq+8w76sCAARAjn1AJ9WOkv51PzZTueUkD8jCYAN1z/U8wCcDsyj r2FnoXXpA0la49+Li2jAuK4=
=h8RH
-----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.

#3 lore raw
Quoted 17 lines · Ioannis Aslanidis

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 11 lines · Stephen Smalley

If I understand correctly, you want to provide separation on a per-user basis (not just per-role) for NFS-mounted home directories. I don't think that is realistically supportable by SELinux today, as 1) SELinux distinguishes based on security context/label, not uid, and 2) NFS doesn't support file labeling yet. Sounds more like a job for 'normal permissions' i.e. discretionary access modes and/or ACLs. There is ongoing work to support file labeling in NFSv4, but it is still in development, and even then, instantiating a separate role for every user is going to be problematic for any large number of users.

Quoted 3 lines

And would there be a way to do something so that each user has a different context? That is to say, I can assign a different context to each user and have something easily maintained. Do you see that viable?

It can be done (e.g. you can define a SELinux user in policy for each of your users and then use a policy constraint on the user identity field to enforce the separation, or you can define per-user roles in policy and use the RBAC support), but I'm not sure how practical it is. But even if it were done, without labeling support in NFS, you can't use it for NFS-mounted home directories (you are limited to a single context per filesystem there at present).

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.
#4 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Understood. That changes a little the policy, but I could still create one mount point per user inside his own home. That still leaves me with the possibility of listing /home, which could be achieved by removing the read flag on the directory on normal permission mode and so on, so I guess SELinux wouldn't be needed in that case.

Thanks for your help. If you have any comments or proposals I am open to them.

Thanks once again,

Ioannis

Quoted 20 lines · Stephen Smalley
Quoted 15 lines · Ioannis Aslanidis

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 10 lines · Stephen Smalley

If I understand correctly, you want to provide separation on a per-user basis (not just per-role) for NFS-mounted home directories. I don't think that is realistically supportable by SELinux today, as 1) SELinux distinguishes based on security context/label, not uid, and 2) NFS doesn't support file labeling yet. Sounds more like a job for 'normal permissions' i.e. discretionary access modes and/or ACLs. There is ongoing work to support file labeling in NFSv4, but it is still in development, and even then, instantiating a separate role for every user is going to be problematic for any large number of users.

Quoted 3 lines

And would there be a way to do something so that each user has a different context? That is to say, I can assign a different context to each user and have something easily maintained. Do you see that viable?

Quoted 8 lines

It can be done (e.g. you can define a SELinux user in policy for each of your users and then use a policy constraint on the user identity field to enforce the separation, or you can define per-user roles in policy and use the RBAC support), but I'm not sure how practical it is. But even if it were done, without labeling support in NFS, you can't use it for NFS-mounted home directories (you are limited to a single context per filesystem there at present).

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iD8DBQFIPF0zFq+8w76sCAARAmICAJ9BzLJdQv1f9tWKt9SbCXAES89FvACgswzB GV7yhgfJEZCmxUlgpq/0U4g=
=CwtZ
-----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.

#5 lore raw
Quoted 5 lines · Ioannis Aslanidis

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Understood. That changes a little the policy, but I could still create one mount point per user inside his own home.

I don't think so; you are limited to per-filesystem/superblock granularity at present, not per-mount. If you make multiple mounts from the same filesystem on the server, they'll be labeled identically. You'd need genuine labeled NFS support, which is yet to come (in progress).

Quoted 7 lines

That still leaves me with
the possibility of listing /home, which could be achieved by removing the read flag on the directory on normal permission mode and so on, so I guess SELinux wouldn't be needed in that case.

Thanks for your help. If you have any comments or proposals I am open to them.

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.