Fix semanage argument and add recursion and verbose for restorecon #50
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:s0and_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:s0and_test_file.txt
#