Only set ldap allowlist if file exists and is not empty
This commit is contained in:
@@ -14,15 +14,4 @@ fi
|
||||
|
||||
[[ "${BOX_ENV}" == "test" ]] && exit
|
||||
|
||||
ipset flush cloudron_ldap_allowlist
|
||||
|
||||
ldap_allowlist_json="/home/yellowtent/platformdata/firewall/ldap_allowlist.txt"
|
||||
|
||||
if [[ -f "${ldap_allowlist_json}" ]]; then
|
||||
# without the -n block, any last line without a new line won't be read it!
|
||||
while read -r line || [[ -n "$line" ]]; do
|
||||
[[ -z "${line}" ]] && continue # ignore empty lines
|
||||
[[ "$line" =~ ^#.*$ ]] && continue # ignore lines starting with #
|
||||
ipset add -! cloudron_ldap_allowlist "${line}" # the -! ignore duplicates
|
||||
done < "${ldap_allowlist_json}"
|
||||
fi
|
||||
systemctl restart cloudron-firewall
|
||||
|
||||
Reference in New Issue
Block a user