Skip to contentSkip to conversation

semanage: is __default__ login map required?

DISCUSSION Arnold, Paul C CTR USARMY PEO STRI (US) 3 participants 5 messages May 3, 2017 – May 10, 2017 SELinux security module

lore
Share & tools
lore
#0 lore raw

I have been having problems mapping logins since removing __default__ from the policy. Is the __default__ login map required in order for semanage to set a new mapping?

The error, specifically:

$ sudo semanage login -a -s existing_u existing_login
libsemanage.dbase_llist_query: could not query record value
semanage: Could not query user for existing_login

Policy is based upon refpolicy, but all utils are RHEL6 dist.

Signature · 2 lines
Paul Arnold, CISSP
Cole Engineering Services, Inc.
#1 lore raw
Quoted 5 lines · Paul C CTR USARMY PEO STRI (US)

I have been having problems mapping logins since removing __default__
from the policy.  Is the __default__ login map required in order for semanage to set a new mapping?

Quoted 8 lines

The error, specifically:

$ sudo semanage login -a -s existing_u existing_login
libsemanage.dbase_llist_query: could not query record value
semanage: Could not query user for existing_login

Policy is based upon refpolicy, but all utils are RHEL6 dist.

Not sure what is in RHEL6, but upstream it looks like the code tries to look up the old login/user information before making the change so that
it can audit the old and new values. Probably ought to be handling an
exception there and recovering cleanly.

https://github.com/SELinuxProject/selinux/blob/master/python/semanage/seobject.py#L537

https://github.com/SELinuxProject/selinux/commit/a0e538c208e5af07fecb8c045e6341397d0df44a

#2 lore raw
Quoted 25 lines · Stephen Smalley
Quoted 6 lines · Paul C CTR USARMY PEO STRI (US)

I have been having problems mapping logins since removing __default__
from the policy.  Is the __default__ login map required in order for
semanage to set a new mapping?

Quoted 8 lines

The error, specifically:

$ sudo semanage login -a -s existing_u existing_login
libsemanage.dbase_llist_query: could not query record value
semanage: Could not query user for existing_login

Policy is based upon refpolicy, but all utils are RHEL6 dist.

Not sure what is in RHEL6, but upstream it looks like the code tries to
look up the old login/user information before making the change so that
 it can audit the old and new values.  Probably ought to be handling an
exception there and recovering cleanly.

Quoted 5 lines

https://github.com/SELinuxProject/selinux/blob/master/python/semanage
/seobject.py#L537

https://github.com/SELinuxProject/selinux/commit/a0e538c208e5af07fecb
8c045e6341397d0df44a

That said, maybe the first question is why do you want to remove the __default__ mapping. Not sure that is even supported via semanage login -d, and you're likely to end up having it get regenerated automatically on any subsequent semodule/semanage commands even if you manually remove it (unless you removed it from the source policy before building in the first place).

Just set it to the most restrictive values possible, like user_u, s0 or guest_u, s0.

#3 lore raw
Quoted 37 lines · Stephen Smalley
Quoted 24 lines · Stephen Smalley
Quoted 6 lines · Paul C CTR USARMY PEO STRI (US)

I have been having problems mapping logins since removing __default__
from the policy. Is the __default__ login map required in order for
semanage to set a new mapping?

Quoted 8 lines

The error, specifically:

$ sudo semanage login -a -s existing_u existing_login
libsemanage.dbase_llist_query: could not query record value
semanage: Could not query user for existing_login

Policy is based upon refpolicy, but all utils are RHEL6 dist.

Not sure what is in RHEL6, but upstream it looks like the code tries to
look up the old login/user information before making the change so that
it can audit the old and new values. Probably ought to be handling
an
exception there and recovering cleanly.

Quoted 5 lines

Caution-https://github.com/SELinuxProject/selinux/blob/master/python/semanage /seobject.py#L537

Caution-https://github.com/SELinuxProject/selinux/commit/a0e538c208e5af07fecb 8c045e6341397d0df44a

That said, maybe the first question is why do you want to remove the __default__ mapping. Not sure that is even supported via semanage login -d, and you're likely to end up having it get regenerated automatically on any subsequent semodule/semanage commands even if you manually remove it (unless you removed it from the source policy before building in the first place).

Quoted 3 lines

Just set it to the most restrictive values possible, like user_u, s0 or guest_u, s0.

Thanks Stephen. As for why, this is for a high assurance solution for which I do not make the requirements.

__default__ is removed from source policy. I don't think semanage can remove logins defined in base policy, and I wouldn't want to due to regeneration concerns you already mentioned.

Thank you for the commit reference; that makes it much clearer for me. I'll do some testing, perhaps just write another python script to add new mappings if I absolutely cannot have __default__ defined.

Regards,

Signature · 2 lines
Paul Arnold, CISSP
Cole Engineering Services, Inc.
#4 lore raw
Quoted 41 lines · Paul C CTR USARMY PEO STRI (US)
Quoted 39 lines · Stephen Smalley
Quoted 25 lines · Stephen Smalley
Quoted 6 lines · Paul C CTR USARMY PEO STRI (US)

I have been having problems mapping logins since removing __default__
from the policy. Is the __default__ login map required in order for
semanage to set a new mapping?

Quoted 8 lines

The error, specifically:

$ sudo semanage login -a -s existing_u existing_login
libsemanage.dbase_llist_query: could not query record value
semanage: Could not query user for existing_login

Policy is based upon refpolicy, but all utils are RHEL6 dist.

Not sure what is in RHEL6, but upstream it looks like the code tries to
look up the old login/user information before making the change so that
it can audit the old and new values. Probably ought to be handling
an
exception there and recovering cleanly.

Quoted 5 lines

Caution-https://github.com/SELinuxProject/selinux/blob/master/python/semanage /seobject.py#L537

Caution-https://github.com/SELinuxProject/selinux/commit/a0e538c208e5af07fecb 8c045e6341397d0df44a

That said, maybe the first question is why do you want to remove the __default__ mapping. Not sure that is even supported via semanage login -d, and you're likely to end up having it get regenerated automatically on any subsequent semodule/semanage commands even if you manually remove it (unless you removed it from the source policy before building in the first place).

Quoted 6 lines
Quoted 3 lines

Just set it to the most restrictive values possible, like user_u, s0 or guest_u, s0.

Thanks Stephen. As for why, this is for a high assurance solution for which I do not make the requirements.

Many high assurance systems I've built or reviewed simply map default to a user domain with no privileges. It's quite likely that this is for systems with requirements similar to what you are dealing with.

If you want to send me a private email I can likely give you some more helpful details.

Karl

Quoted 14 lines

__default__ is removed from source policy. I don't think semanage can remove logins defined in base policy, and I wouldn't want to due to regeneration concerns you already mentioned.

Thank you for the commit reference; that makes it much clearer for me. I'll do some testing, perhaps just write another python script to add new mappings if I absolutely cannot have __default__ defined.

Regards,

Signature · 2 lines
Paul Arnold, CISSP
Cole Engineering Services, Inc.