Add more prelims

This commit is contained in:
Salt 2024-12-01 21:39:08 -06:00
parent bb7f613f0c
commit 0210515b8c

View File

@ -27,12 +27,18 @@
set -e
set -o pipefail
# For each file we're interested in
# Iterate over each file we're interested in
for file in /etc/shadow /etc/gshadow; do
# Prelim check for zero-byte files (shouldn't proc)
if ! [ -s "$file" ]; then
echo "File is missing or empty: $file"
continue
fi
# Prelim check to ensure we can read the file
if ! [ -r "$file" ]; then
echo "Unable to read file: $file"
continue
fi
# Prelim checks succeeded, move forward
echo "Parsing $file for junk"
done