IMP(shellcheck): quoting harmless variables (SC2086)

This commit is contained in:
Thibault Ayanides
2020-11-27 09:29:11 +01:00
parent 4add6ddc33
commit dba1dae963
206 changed files with 1288 additions and 1288 deletions

View File

@ -27,8 +27,8 @@ audit () {
ERRORS=0
for FILE in $($SUDO_CMD find $DIR -xdev -type f -name 'ssh_host_*_key');
do
has_file_correct_permissions $FILE $PERMISSIONS
if [ $FNRET = 0 ]; then
has_file_correct_permissions "$FILE" "$PERMISSIONS"
if [ "$FNRET" = 0 ]; then
ok "$FILE permissions were set to $PERMISSIONS"
else
ERRORS=$((ERRORS+1))
@ -44,8 +44,8 @@ audit () {
ERRORS=0
for FILE in $($SUDO_CMD find $DIR -xdev -type f -name 'ssh_host_*_key');
do
has_file_correct_ownership $FILE $USER $GROUP
if [ $FNRET = 0 ]; then
has_file_correct_ownership "$FILE" "$USER" "$GROUP"
if [ "$FNRET" = 0 ]; then
ok "$FILE ownership was set to $USER:$GROUP"
else
@ -63,8 +63,8 @@ audit () {
apply () {
for FILE in $($SUDO_CMD find $DIR -xdev -type f -name 'ssh_host_*_key');
do
has_file_correct_ownership $FILE $USER $GROUP
if [ $FNRET = 0 ]; then
has_file_correct_ownership "$FILE" "$USER" "$GROUP"
if [ "$FNRET" = 0 ]; then
ok "$FILE ownership was set to $USER:$GROUP"
else
warn "fixing $DIR SSH private keys permissions to $USER:$GROUP"
@ -75,12 +75,12 @@ apply () {
for FILE in $($SUDO_CMD find $DIR -xdev -type f -name 'ssh_host_*_key');
do
has_file_correct_permissions $FILE $PERMISSIONS
if [ $FNRET = 0 ]; then
has_file_correct_permissions "$FILE" "$PERMISSIONS"
if [ "$FNRET" = 0 ]; then
ok "$FILE permissions were set to $PERMISSIONS"
else
warn "fixing $DIR SSH private keys ownership to $PERMISSIONS"
chmod 0$PERMISSIONS $FILE
chmod 0"$PERMISSIONS" "$FILE"
fi
done
@ -90,12 +90,12 @@ apply () {
# This function will check config parameters required
check_config() {
does_user_exist $USER
if [ $FNRET != 0 ]; then
if [ "$FNRET" != 0 ]; then
crit "$USER does not exist"
exit 128
fi
does_group_exist $GROUP
if [ $FNRET != 0 ]; then
if [ "$FNRET" != 0 ]; then
crit "$GROUP does not exist"
exit 128
fi
@ -113,9 +113,9 @@ if [ -z "$CIS_ROOT_DIR" ]; then
fi
# Main function, will call the proper functions given the configuration (audit, enabled, disabled)
if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
if [ -r "$CIS_ROOT_DIR"/lib/main.sh ]; then
# shellcheck source=../../lib/main.sh
. $CIS_ROOT_DIR/lib/main.sh
. "$CIS_ROOT_DIR"/lib/main.sh
else
echo "Cannot find main.sh, have you correctly defined your root directory? Current value is $CIS_ROOT_DIR in /etc/default/cis-hardening"
exit 128