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

Fix semanage argument and add recursion and verbose for restorecon #50

Merged
merged 1 commit into from
Jan 27, 2017
Merged

Fix semanage argument and add recursion and verbose for restorecon #50

merged 1 commit into from
Jan 27, 2017

Conversation

ayamshanov
Copy link
Contributor

Files in "apps/", "config/", "data/" stay unconfigured after steps from current instruction.

Example:

Create lab environment (check, that all is not configured):
# cat /etc/centos-release
CentOS Linux release 7.2.1511 (Core)
# mkdir -p /my/test/path
# touch /my/test/path/and_test_file.txt
# semanage fcontext -l | grep /my/test/path
#


Configure by instruction from docs (file 'and_test_file.txt' stay unconfigured):
# semanage fcontext -a -t httpd_sys_rw_content_t '/my/test/path'
# semanage fcontext -l | grep /my/test/path
/my/test/path all files system_u:object_r:httpd_sys_rw_content_t:s0
# ls -Z /my/test/path/
# restorecon -Rv /my/test/path
restorecon reset /my/test/path context unconfined_u:object_r:default_t:s0->unconfined_u:object_r:httpd_sys_rw_content_t:s0
# ls -Z /my/test/path/
-rw-r--r--. root root unconfined_u:object_r:default_t:s0 and_test_file.txt
#


Delete previous setting (check, that all is not configured):
# semanage fcontext -d -t httpd_sys_rw_content_t '/my/test/path'
# semanage fcontext -l | grep /my/test/path
#


Configure by new version of instruction (file 'and_test_file.txt' now is configured too):
# semanage fcontext -a -t httpd_sys_rw_content_t '/my/test/path(/.*)?'
# semanage fcontext -l | grep /my/test/path
/my/test/path(/.*)? all files system_u:object_r:httpd_sys_rw_content_t:s0
# restorecon -Rv /my/test/path
restorecon reset /my/test/path/and_test_file.txt context unconfined_u:object_r:default_t:s0->unconfined_u:object_r:httpd_sys_rw_content_t:s0
# ls -Z /my/test/path/
-rw-r--r--. root root unconfined_u:object_r:httpd_sys_rw_content_t:s0 and_test_file.txt
#

@MorrisJobke
Copy link
Member

cc @LukasReschke

@ayamshanov
Copy link
Contributor Author

One more thing:

Maybe for first clean installation it's enough. But if you recreate some files (or copy config.sample.php to config.php; or restore files from backup, or migrate from anywhere) you must have correct SELinux configuration and rerun restorecon -R ....

@nickvergessen
Copy link
Member

I'm willing to blindly merge this, but would be nice if someone could confirm

@AelricRiggs
Copy link

@nickvergessen
I can confirm that on my CentOS 7 server with selinux enabled I still got unable to write errors using the current version of the commands, but that the install works flawlessly with these new commands. All this change does is make sure that the context change is recursive, so not just the folders get changed.

@nickvergessen nickvergessen merged commit e77205d into nextcloud:master Jan 27, 2017
@nickvergessen
Copy link
Member

Thanks @AelricRiggs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants