Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

certdb: Don't restore_context() of new NSSDB #513

Closed
wants to merge 1 commit into from

Conversation

tiran
Copy link
Member

@tiran tiran commented Feb 27, 2017

It's not necesary to restore the context of newly created files. SELinux
ensures that new files have the correct permission. An explicit
restore_context() is only required when either policies have changed or
the context was changed manually.

Signed-off-by: Christian Heimes cheimes@redhat.com

It's not necesary to restore the context of newly created files. SELinux
ensures that new files have the correct permission. An explicit
restore_context() is only required when either policies have changed or
the context was changed manually.

Signed-off-by: Christian Heimes <cheimes@redhat.com>
@tiran tiran requested a review from simo5 February 27, 2017 14:16
@tiran
Copy link
Member Author

tiran commented Feb 27, 2017

I also dropped =1 check. http://man7.org/linux/man-pages/man2/chown.2.html

If the owner or group is specified as -1, then that ID is not changed.

@stlaz stlaz self-assigned this Mar 1, 2017
@MartinBasti
Copy link
Contributor

This is old code, initially added here 49b3658

But I failed to detect why restorecon call has been added for new databases.

LGTM, but I want to think more about it, why it was added there and what we can break with this commit

@stlaz
Copy link
Contributor

stlaz commented Mar 1, 2017

I don't see how this could break anything given that it's been used like that for ages prior to priv-sep patches.

@tiran
Copy link
Member Author

tiran commented Mar 1, 2017

Maybe it was required back then. 7, 8 years is a long time. Nowadays new files are created with correct context:

# rm -f /etc/ipa/nssdb/testfile
# touch /etc/ipa/nssdb/testfile
# ls -laZ /etc/ipa/nssdb/testfile 
-rw-r--r--. 1 root root unconfined_u:object_r:cert_t:s0 0 Mar  1 09:08 /etc/ipa/nssdb/testfile
# restorecon /etc/ipa/nssdb/testfile 
# ls -laZ /etc/ipa/nssdb/testfile 
-rw-r--r--. 1 root root unconfined_u:object_r:cert_t:s0 0 Mar  1 09:08 /etc/ipa/nssdb/testfile

@MartinBasti
Copy link
Contributor

Ok, I agree

@MartinBasti MartinBasti added ack Pull Request approved, can be merged pushed Pull Request has already been pushed labels Mar 1, 2017
@MartinBasti
Copy link
Contributor

master:

  • a163ad7 certdb: Don't restore_context() of new NSSDB

@MartinBasti MartinBasti closed this Mar 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ack Pull Request approved, can be merged pushed Pull Request has already been pushed
Projects
None yet
3 participants