mirror of
https://github.com/Kicksecure/security-misc.git
synced 2025-05-02 17:24:49 -04:00
exit non-zero if some line cannot be parsed
therefore make systemd notice this therefore allow the sysadmin to notice this
This commit is contained in:
parent
66bcba8313
commit
278c60c5a0
1 changed files with 6 additions and 0 deletions
|
@ -5,6 +5,8 @@
|
|||
|
||||
set -x
|
||||
|
||||
exit_code=0
|
||||
|
||||
config_file="/etc/permission-hardening.conf"
|
||||
|
||||
shopt -s globstar
|
||||
|
@ -47,11 +49,13 @@ set_file_perms() {
|
|||
if [[ "$line" =~ [0-9a-zA-Z/] ]]; then
|
||||
true OK
|
||||
else
|
||||
exit_code=200
|
||||
echo "ERROR: cannot parse line with invalid character: ${line}" >&2
|
||||
continue
|
||||
fi
|
||||
|
||||
if ! read -r file mode owner group capability <<< "${line}" ; then
|
||||
exit_code=201
|
||||
echo "ERROR: cannot parse line: ${line}" >&2
|
||||
continue
|
||||
fi
|
||||
|
@ -107,3 +111,5 @@ set_file_perms() {
|
|||
}
|
||||
|
||||
set_file_perms
|
||||
|
||||
exit "$exit_code"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue