mirror of
https://github.com/Kicksecure/security-misc.git
synced 2025-06-07 13:32:39 -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
|
set -x
|
||||||
|
|
||||||
|
exit_code=0
|
||||||
|
|
||||||
config_file="/etc/permission-hardening.conf"
|
config_file="/etc/permission-hardening.conf"
|
||||||
|
|
||||||
shopt -s globstar
|
shopt -s globstar
|
||||||
|
@ -47,11 +49,13 @@ set_file_perms() {
|
||||||
if [[ "$line" =~ [0-9a-zA-Z/] ]]; then
|
if [[ "$line" =~ [0-9a-zA-Z/] ]]; then
|
||||||
true OK
|
true OK
|
||||||
else
|
else
|
||||||
|
exit_code=200
|
||||||
echo "ERROR: cannot parse line with invalid character: ${line}" >&2
|
echo "ERROR: cannot parse line with invalid character: ${line}" >&2
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! read -r file mode owner group capability <<< "${line}" ; then
|
if ! read -r file mode owner group capability <<< "${line}" ; then
|
||||||
|
exit_code=201
|
||||||
echo "ERROR: cannot parse line: ${line}" >&2
|
echo "ERROR: cannot parse line: ${line}" >&2
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
@ -107,3 +111,5 @@ set_file_perms() {
|
||||||
}
|
}
|
||||||
|
|
||||||
set_file_perms
|
set_file_perms
|
||||||
|
|
||||||
|
exit "$exit_code"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue