APACHE_SYMLINK: Add verbose mode and replace stat by find

This commit is contained in:
Benoît S. 2019-06-04 17:48:19 +02:00
parent cad468af62
commit 982db855aa

View file

@ -538,7 +538,17 @@ check_apachectl() {
# Check if there is regular files in Apache sites-enabled.
check_apachesymlink() {
if is_installed apache2; then
stat -c %F /etc/apache2/sites-enabled/* | grep -q regular && failed "IS_APACHESYMLINK"
apacheFind=$(find /etc/apache2/sites-enabled ! -type l -type f -print)
nbApacheFind=$(wc -m <<< "$apacheFind")
if [[ $nbApacheFind -gt 1 ]]; then
if [[ $VERBOSE == 1 ]]; then
while read -r line; do
failed "IS_APACHESYMLINK" "Not a symlink: $line"
done <<< "$apacheFind"
else
failed "IS_APACHESYMLINK"
fi
fi
fi
}
# Check if there is real IP addresses in Allow/Deny directives (no trailing space, inline comments or so).