mirror of
https://github.com/ovh/debian-cis.git
synced 2024-11-22 05:27:01 +01:00
IMP(shellcheck): add curly bracket to var (SC1087)
This commit is contained in:
parent
ef800954f4
commit
63835dd10c
@ -28,7 +28,7 @@ audit() {
|
|||||||
crit "$FILE does not exist"
|
crit "$FILE does not exist"
|
||||||
else
|
else
|
||||||
ok "$FILE exists, checking configuration"
|
ok "$FILE exists, checking configuration"
|
||||||
does_pattern_exist_in_file $FILE "^$PATTERN[[:space:]]"
|
does_pattern_exist_in_file $FILE "^${PATTERN}[[:space:]]"
|
||||||
if [ "$FNRET" != 0 ]; then
|
if [ "$FNRET" != 0 ]; then
|
||||||
crit "$PATTERN is not present in $FILE"
|
crit "$PATTERN is not present in $FILE"
|
||||||
else
|
else
|
||||||
@ -46,7 +46,7 @@ apply() {
|
|||||||
else
|
else
|
||||||
ok "$FILE exists"
|
ok "$FILE exists"
|
||||||
fi
|
fi
|
||||||
does_pattern_exist_in_file $FILE "^$PATTERN[[:space:]]"
|
does_pattern_exist_in_file $FILE "^${PATTERN}[[:space:]]"
|
||||||
if [ "$FNRET" != 0 ]; then
|
if [ "$FNRET" != 0 ]; then
|
||||||
warn "$PATTERN is not present in $FILE, adding it"
|
warn "$PATTERN is not present in $FILE, adding it"
|
||||||
add_end_of_file $FILE "$PATTERN = $VALUE"
|
add_end_of_file $FILE "$PATTERN = $VALUE"
|
||||||
|
@ -30,7 +30,7 @@ audit() {
|
|||||||
for AUDIT_OPTION in $OPTIONS; do
|
for AUDIT_OPTION in $OPTIONS; do
|
||||||
AUDIT_PARAM=$(echo $AUDIT_OPTION | cut -d= -f 1)
|
AUDIT_PARAM=$(echo $AUDIT_OPTION | cut -d= -f 1)
|
||||||
AUDIT_VALUE=$(echo $AUDIT_OPTION | cut -d= -f 2)
|
AUDIT_VALUE=$(echo $AUDIT_OPTION | cut -d= -f 2)
|
||||||
PATTERN="^$AUDIT_PARAM[[:space:]]*=[[:space:]]*$AUDIT_VALUE"
|
PATTERN="^${AUDIT_PARAM}[[:space:]]*=[[:space:]]*$AUDIT_VALUE"
|
||||||
debug "$AUDIT_PARAM should be set to $AUDIT_VALUE"
|
debug "$AUDIT_PARAM should be set to $AUDIT_VALUE"
|
||||||
does_pattern_exist_in_file $FILE "$PATTERN"
|
does_pattern_exist_in_file $FILE "$PATTERN"
|
||||||
if [ "$FNRET" != 0 ]; then
|
if [ "$FNRET" != 0 ]; then
|
||||||
@ -55,7 +55,7 @@ apply() {
|
|||||||
AUDIT_PARAM=$(echo $AUDIT_OPTION | cut -d= -f 1)
|
AUDIT_PARAM=$(echo $AUDIT_OPTION | cut -d= -f 1)
|
||||||
AUDIT_VALUE=$(echo $AUDIT_OPTION | cut -d= -f 2)
|
AUDIT_VALUE=$(echo $AUDIT_OPTION | cut -d= -f 2)
|
||||||
debug "$AUDIT_PARAM should be set to $AUDIT_VALUE"
|
debug "$AUDIT_PARAM should be set to $AUDIT_VALUE"
|
||||||
PATTERN="^$AUDIT_PARAM[[:space:]]*=[[:space:]]*$AUDIT_VALUE"
|
PATTERN="^${AUDIT_PARAM}[[:space:]]*=[[:space:]]*$AUDIT_VALUE"
|
||||||
does_pattern_exist_in_file $FILE "$PATTERN"
|
does_pattern_exist_in_file $FILE "$PATTERN"
|
||||||
if [ "$FNRET" != 0 ]; then
|
if [ "$FNRET" != 0 ]; then
|
||||||
warn "$PATTERN is not present in $FILE, adding it"
|
warn "$PATTERN is not present in $FILE, adding it"
|
||||||
@ -65,7 +65,7 @@ apply() {
|
|||||||
add_end_of_file $FILE "$AUDIT_PARAM = $AUDIT_VALUE"
|
add_end_of_file $FILE "$AUDIT_PARAM = $AUDIT_VALUE"
|
||||||
else
|
else
|
||||||
info "Parameter $AUDIT_PARAM is present but with the wrong value -- Fixing"
|
info "Parameter $AUDIT_PARAM is present but with the wrong value -- Fixing"
|
||||||
replace_in_file $FILE "^$AUDIT_PARAM[[:space:]]*=.*" "$AUDIT_PARAM = $AUDIT_VALUE"
|
replace_in_file $FILE "^${AUDIT_PARAM}[[:space:]]*=.*" "$AUDIT_PARAM = $AUDIT_VALUE"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
ok "$PATTERN is present in $FILE"
|
ok "$PATTERN is present in $FILE"
|
||||||
|
@ -30,7 +30,7 @@ audit() {
|
|||||||
for AUDIT_OPTION in $OPTIONS; do
|
for AUDIT_OPTION in $OPTIONS; do
|
||||||
AUDIT_PARAM=$(echo $AUDIT_OPTION | cut -d= -f 1)
|
AUDIT_PARAM=$(echo $AUDIT_OPTION | cut -d= -f 1)
|
||||||
AUDIT_VALUE=$(echo $AUDIT_OPTION | cut -d= -f 2)
|
AUDIT_VALUE=$(echo $AUDIT_OPTION | cut -d= -f 2)
|
||||||
PATTERN="^$AUDIT_PARAM[[:space:]]*=[[:space:]]*$AUDIT_VALUE"
|
PATTERN="^${AUDIT_PARAM}[[:space:]]*=[[:space:]]*$AUDIT_VALUE"
|
||||||
debug "$AUDIT_PARAM should be set to $AUDIT_VALUE"
|
debug "$AUDIT_PARAM should be set to $AUDIT_VALUE"
|
||||||
does_pattern_exist_in_file $FILE "$PATTERN"
|
does_pattern_exist_in_file $FILE "$PATTERN"
|
||||||
if [ "$FNRET" != 0 ]; then
|
if [ "$FNRET" != 0 ]; then
|
||||||
@ -55,7 +55,7 @@ apply() {
|
|||||||
AUDIT_PARAM=$(echo $AUDIT_OPTION | cut -d= -f 1)
|
AUDIT_PARAM=$(echo $AUDIT_OPTION | cut -d= -f 1)
|
||||||
AUDIT_VALUE=$(echo $AUDIT_OPTION | cut -d= -f 2)
|
AUDIT_VALUE=$(echo $AUDIT_OPTION | cut -d= -f 2)
|
||||||
debug "$AUDIT_PARAM should be set to $AUDIT_VALUE"
|
debug "$AUDIT_PARAM should be set to $AUDIT_VALUE"
|
||||||
PATTERN="^$AUDIT_PARAM[[:space:]]*=[[:space:]]*$AUDIT_VALUE"
|
PATTERN="^${AUDIT_PARAM}[[:space:]]*=[[:space:]]*$AUDIT_VALUE"
|
||||||
does_pattern_exist_in_file $FILE "$PATTERN"
|
does_pattern_exist_in_file $FILE "$PATTERN"
|
||||||
if [ "$FNRET" != 0 ]; then
|
if [ "$FNRET" != 0 ]; then
|
||||||
warn "$PATTERN is not present in $FILE, adding it"
|
warn "$PATTERN is not present in $FILE, adding it"
|
||||||
@ -65,7 +65,7 @@ apply() {
|
|||||||
add_end_of_file $FILE "$AUDIT_PARAM = $AUDIT_VALUE"
|
add_end_of_file $FILE "$AUDIT_PARAM = $AUDIT_VALUE"
|
||||||
else
|
else
|
||||||
info "Parameter $AUDIT_PARAM is present but with the wrong value -- Fixing"
|
info "Parameter $AUDIT_PARAM is present but with the wrong value -- Fixing"
|
||||||
replace_in_file $FILE "^$AUDIT_PARAM[[:space:]]*=.*" "$AUDIT_PARAM = $AUDIT_VALUE"
|
replace_in_file $FILE "^${AUDIT_PARAM}[[:space:]]*=.*" "$AUDIT_PARAM = $AUDIT_VALUE"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
ok "$PATTERN is present in $FILE"
|
ok "$PATTERN is present in $FILE"
|
||||||
|
@ -31,7 +31,7 @@ audit() {
|
|||||||
for SSH_OPTION in $OPTIONS; do
|
for SSH_OPTION in $OPTIONS; do
|
||||||
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
||||||
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
||||||
PATTERN="^$SSH_PARAM[[:space:]]*$SSH_VALUE"
|
PATTERN="^${SSH_PARAM}[[:space:]]*$SSH_VALUE"
|
||||||
does_pattern_exist_in_file $FILE "$PATTERN"
|
does_pattern_exist_in_file $FILE "$PATTERN"
|
||||||
if [ "$FNRET" = 0 ]; then
|
if [ "$FNRET" = 0 ]; then
|
||||||
ok "$PATTERN is present in $FILE"
|
ok "$PATTERN is present in $FILE"
|
||||||
@ -54,7 +54,7 @@ apply() {
|
|||||||
for SSH_OPTION in $OPTIONS; do
|
for SSH_OPTION in $OPTIONS; do
|
||||||
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
||||||
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
||||||
PATTERN="^$SSH_PARAM[[:space:]]*$SSH_VALUE"
|
PATTERN="^${SSH_PARAM}[[:space:]]*$SSH_VALUE"
|
||||||
does_pattern_exist_in_file $FILE "$PATTERN"
|
does_pattern_exist_in_file $FILE "$PATTERN"
|
||||||
if [ "$FNRET" = 0 ]; then
|
if [ "$FNRET" = 0 ]; then
|
||||||
ok "$PATTERN is present in $FILE"
|
ok "$PATTERN is present in $FILE"
|
||||||
@ -65,7 +65,7 @@ apply() {
|
|||||||
add_end_of_file $FILE "$SSH_PARAM $SSH_VALUE"
|
add_end_of_file $FILE "$SSH_PARAM $SSH_VALUE"
|
||||||
else
|
else
|
||||||
info "Parameter $SSH_PARAM is present but with the wrong value -- Fixing"
|
info "Parameter $SSH_PARAM is present but with the wrong value -- Fixing"
|
||||||
replace_in_file $FILE "^$SSH_PARAM[[:space:]]*.*" "$SSH_PARAM $SSH_VALUE"
|
replace_in_file $FILE "^${SSH_PARAM}[[:space:]]*.*" "$SSH_PARAM $SSH_VALUE"
|
||||||
fi
|
fi
|
||||||
/etc/init.d/ssh reload
|
/etc/init.d/ssh reload
|
||||||
fi
|
fi
|
||||||
|
@ -31,7 +31,7 @@ audit() {
|
|||||||
for SSH_OPTION in $OPTIONS; do
|
for SSH_OPTION in $OPTIONS; do
|
||||||
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
||||||
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
||||||
PATTERN="^$SSH_PARAM[[:space:]]*$SSH_VALUE"
|
PATTERN="^${SSH_PARAM}[[:space:]]*$SSH_VALUE"
|
||||||
does_pattern_exist_in_file $FILE "$PATTERN"
|
does_pattern_exist_in_file $FILE "$PATTERN"
|
||||||
if [ "$FNRET" = 0 ]; then
|
if [ "$FNRET" = 0 ]; then
|
||||||
ok "$PATTERN is present in $FILE"
|
ok "$PATTERN is present in $FILE"
|
||||||
@ -54,18 +54,18 @@ apply() {
|
|||||||
for SSH_OPTION in $OPTIONS; do
|
for SSH_OPTION in $OPTIONS; do
|
||||||
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
||||||
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
||||||
PATTERN="^$SSH_PARAM[[:space:]]*$SSH_VALUE"
|
PATTERN="^${SSH_PARAM}[[:space:]]*$SSH_VALUE"
|
||||||
does_pattern_exist_in_file $FILE "$PATTERN"
|
does_pattern_exist_in_file $FILE "$PATTERN"
|
||||||
if [ "$FNRET" = 0 ]; then
|
if [ "$FNRET" = 0 ]; then
|
||||||
ok "$PATTERN is present in $FILE"
|
ok "$PATTERN is present in $FILE"
|
||||||
else
|
else
|
||||||
warn "$PATTERN is not present in $FILE, adding it"
|
warn "$PATTERN is not present in $FILE, adding it"
|
||||||
does_pattern_exist_in_file $FILE "^$SSH_PARAM"
|
does_pattern_exist_in_file $FILE "^${SSH_PARAM}"
|
||||||
if [ "$FNRET" != 0 ]; then
|
if [ "$FNRET" != 0 ]; then
|
||||||
add_end_of_file $FILE "$SSH_PARAM $SSH_VALUE"
|
add_end_of_file $FILE "$SSH_PARAM $SSH_VALUE"
|
||||||
else
|
else
|
||||||
info "Parameter $SSH_PARAM is present but with the wrong value -- Fixing"
|
info "Parameter $SSH_PARAM is present but with the wrong value -- Fixing"
|
||||||
replace_in_file $FILE "^$SSH_PARAM[[:space:]]*.*" "$SSH_PARAM $SSH_VALUE"
|
replace_in_file $FILE "^${SSH_PARAM}[[:space:]]*.*" "$SSH_PARAM $SSH_VALUE"
|
||||||
fi
|
fi
|
||||||
/etc/init.d/ssh reload
|
/etc/init.d/ssh reload
|
||||||
fi
|
fi
|
||||||
|
@ -31,7 +31,7 @@ audit() {
|
|||||||
for SSH_OPTION in $OPTIONS; do
|
for SSH_OPTION in $OPTIONS; do
|
||||||
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
||||||
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
||||||
PATTERN="^$SSH_PARAM[[:space:]]*$SSH_VALUE"
|
PATTERN="^${SSH_PARAM}[[:space:]]*$SSH_VALUE"
|
||||||
does_pattern_exist_in_file $FILE "$PATTERN"
|
does_pattern_exist_in_file $FILE "$PATTERN"
|
||||||
if [ "$FNRET" = 0 ]; then
|
if [ "$FNRET" = 0 ]; then
|
||||||
ok "$PATTERN is present in $FILE"
|
ok "$PATTERN is present in $FILE"
|
||||||
@ -54,18 +54,18 @@ apply() {
|
|||||||
for SSH_OPTION in $OPTIONS; do
|
for SSH_OPTION in $OPTIONS; do
|
||||||
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
||||||
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
||||||
PATTERN="^$SSH_PARAM[[:space:]]*$SSH_VALUE"
|
PATTERN="^${SSH_PARAM}[[:space:]]*$SSH_VALUE"
|
||||||
does_pattern_exist_in_file $FILE "$PATTERN"
|
does_pattern_exist_in_file $FILE "$PATTERN"
|
||||||
if [ "$FNRET" = 0 ]; then
|
if [ "$FNRET" = 0 ]; then
|
||||||
ok "$PATTERN is present in $FILE"
|
ok "$PATTERN is present in $FILE"
|
||||||
else
|
else
|
||||||
warn "$PATTERN is not present in $FILE, adding it"
|
warn "$PATTERN is not present in $FILE, adding it"
|
||||||
does_pattern_exist_in_file $FILE "^$SSH_PARAM"
|
does_pattern_exist_in_file $FILE "^${SSH_PARAM}"
|
||||||
if [ "$FNRET" != 0 ]; then
|
if [ "$FNRET" != 0 ]; then
|
||||||
add_end_of_file $FILE "$SSH_PARAM $SSH_VALUE"
|
add_end_of_file $FILE "$SSH_PARAM $SSH_VALUE"
|
||||||
else
|
else
|
||||||
info "Parameter $SSH_PARAM is present but with the wrong value -- Fixing"
|
info "Parameter $SSH_PARAM is present but with the wrong value -- Fixing"
|
||||||
replace_in_file $FILE "^$SSH_PARAM[[:space:]]*.*" "$SSH_PARAM $SSH_VALUE"
|
replace_in_file $FILE "^${SSH_PARAM}[[:space:]]*.*" "$SSH_PARAM $SSH_VALUE"
|
||||||
fi
|
fi
|
||||||
/etc/init.d/ssh reload
|
/etc/init.d/ssh reload
|
||||||
fi
|
fi
|
||||||
|
@ -31,7 +31,7 @@ audit() {
|
|||||||
for SSH_OPTION in $OPTIONS; do
|
for SSH_OPTION in $OPTIONS; do
|
||||||
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
||||||
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
||||||
PATTERN="^$SSH_PARAM[[:space:]]*$SSH_VALUE"
|
PATTERN="^${SSH_PARAM}[[:space:]]*$SSH_VALUE"
|
||||||
does_pattern_exist_in_file $FILE "$PATTERN"
|
does_pattern_exist_in_file $FILE "$PATTERN"
|
||||||
if [ "$FNRET" = 0 ]; then
|
if [ "$FNRET" = 0 ]; then
|
||||||
ok "$PATTERN is present in $FILE"
|
ok "$PATTERN is present in $FILE"
|
||||||
@ -54,18 +54,18 @@ apply() {
|
|||||||
for SSH_OPTION in $OPTIONS; do
|
for SSH_OPTION in $OPTIONS; do
|
||||||
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
||||||
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
||||||
PATTERN="^$SSH_PARAM[[:space:]]*$SSH_VALUE"
|
PATTERN="^${SSH_PARAM}[[:space:]]*$SSH_VALUE"
|
||||||
does_pattern_exist_in_file $FILE "$PATTERN"
|
does_pattern_exist_in_file $FILE "$PATTERN"
|
||||||
if [ "$FNRET" = 0 ]; then
|
if [ "$FNRET" = 0 ]; then
|
||||||
ok "$PATTERN is present in $FILE"
|
ok "$PATTERN is present in $FILE"
|
||||||
else
|
else
|
||||||
warn "$PATTERN is not present in $FILE, adding it"
|
warn "$PATTERN is not present in $FILE, adding it"
|
||||||
does_pattern_exist_in_file $FILE "^$SSH_PARAM"
|
does_pattern_exist_in_file $FILE "^${SSH_PARAM}"
|
||||||
if [ "$FNRET" != 0 ]; then
|
if [ "$FNRET" != 0 ]; then
|
||||||
add_end_of_file $FILE "$SSH_PARAM $SSH_VALUE"
|
add_end_of_file $FILE "$SSH_PARAM $SSH_VALUE"
|
||||||
else
|
else
|
||||||
info "Parameter $SSH_PARAM is present but with the wrong value -- Fixing"
|
info "Parameter $SSH_PARAM is present but with the wrong value -- Fixing"
|
||||||
replace_in_file $FILE "^$SSH_PARAM[[:space:]]*.*" "$SSH_PARAM $SSH_VALUE"
|
replace_in_file $FILE "^${SSH_PARAM}[[:space:]]*.*" "$SSH_PARAM $SSH_VALUE"
|
||||||
fi
|
fi
|
||||||
/etc/init.d/ssh reload
|
/etc/init.d/ssh reload
|
||||||
fi
|
fi
|
||||||
|
@ -31,7 +31,7 @@ audit() {
|
|||||||
for SSH_OPTION in $OPTIONS; do
|
for SSH_OPTION in $OPTIONS; do
|
||||||
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
||||||
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
||||||
PATTERN="^$SSH_PARAM[[:space:]]*$SSH_VALUE"
|
PATTERN="^${SSH_PARAM}[[:space:]]*$SSH_VALUE"
|
||||||
does_pattern_exist_in_file_nocase $FILE "$PATTERN"
|
does_pattern_exist_in_file_nocase $FILE "$PATTERN"
|
||||||
if [ "$FNRET" = 0 ]; then
|
if [ "$FNRET" = 0 ]; then
|
||||||
ok "$PATTERN is present in $FILE"
|
ok "$PATTERN is present in $FILE"
|
||||||
@ -54,18 +54,18 @@ apply() {
|
|||||||
for SSH_OPTION in $OPTIONS; do
|
for SSH_OPTION in $OPTIONS; do
|
||||||
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
||||||
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
||||||
PATTERN="^$SSH_PARAM[[:space:]]*$SSH_VALUE"
|
PATTERN="^${SSH_PARAM}[[:space:]]*$SSH_VALUE"
|
||||||
does_pattern_exist_in_file_nocase $FILE "$PATTERN"
|
does_pattern_exist_in_file_nocase $FILE "$PATTERN"
|
||||||
if [ "$FNRET" = 0 ]; then
|
if [ "$FNRET" = 0 ]; then
|
||||||
ok "$PATTERN is present in $FILE"
|
ok "$PATTERN is present in $FILE"
|
||||||
else
|
else
|
||||||
warn "$PATTERN is not present in $FILE, adding it"
|
warn "$PATTERN is not present in $FILE, adding it"
|
||||||
does_pattern_exist_in_file_nocase $FILE "^$SSH_PARAM"
|
does_pattern_exist_in_file_nocase $FILE "^${SSH_PARAM}"
|
||||||
if [ "$FNRET" != 0 ]; then
|
if [ "$FNRET" != 0 ]; then
|
||||||
add_end_of_file $FILE "$SSH_PARAM $SSH_VALUE"
|
add_end_of_file $FILE "$SSH_PARAM $SSH_VALUE"
|
||||||
else
|
else
|
||||||
info "Parameter $SSH_PARAM is present but with the wrong value -- Fixing"
|
info "Parameter $SSH_PARAM is present but with the wrong value -- Fixing"
|
||||||
replace_in_file $FILE "^$SSH_PARAM[[:space:]]*.*" "$SSH_PARAM $SSH_VALUE"
|
replace_in_file $FILE "^${SSH_PARAM}[[:space:]]*.*" "$SSH_PARAM $SSH_VALUE"
|
||||||
fi
|
fi
|
||||||
/etc/init.d/ssh reload >/dev/null 2>&1
|
/etc/init.d/ssh reload >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
|
@ -31,7 +31,7 @@ audit() {
|
|||||||
for SSH_OPTION in $OPTIONS; do
|
for SSH_OPTION in $OPTIONS; do
|
||||||
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
||||||
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
||||||
PATTERN="^$SSH_PARAM[[:space:]]*$SSH_VALUE"
|
PATTERN="^${SSH_PARAM}[[:space:]]*$SSH_VALUE"
|
||||||
does_pattern_exist_in_file_nocase $FILE "$PATTERN"
|
does_pattern_exist_in_file_nocase $FILE "$PATTERN"
|
||||||
if [ "$FNRET" = 0 ]; then
|
if [ "$FNRET" = 0 ]; then
|
||||||
ok "$PATTERN is present in $FILE"
|
ok "$PATTERN is present in $FILE"
|
||||||
@ -54,18 +54,18 @@ apply() {
|
|||||||
for SSH_OPTION in $OPTIONS; do
|
for SSH_OPTION in $OPTIONS; do
|
||||||
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
||||||
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
||||||
PATTERN="^$SSH_PARAM[[:space:]]*$SSH_VALUE"
|
PATTERN="^${SSH_PARAM}[[:space:]]*$SSH_VALUE"
|
||||||
does_pattern_exist_in_file_nocase $FILE "$PATTERN"
|
does_pattern_exist_in_file_nocase $FILE "$PATTERN"
|
||||||
if [ "$FNRET" = 0 ]; then
|
if [ "$FNRET" = 0 ]; then
|
||||||
ok "$PATTERN is present in $FILE"
|
ok "$PATTERN is present in $FILE"
|
||||||
else
|
else
|
||||||
warn "$PATTERN is not present in $FILE, adding it"
|
warn "$PATTERN is not present in $FILE, adding it"
|
||||||
does_pattern_exist_in_file_nocase $FILE "^$SSH_PARAM"
|
does_pattern_exist_in_file_nocase $FILE "^${SSH_PARAM}"
|
||||||
if [ "$FNRET" != 0 ]; then
|
if [ "$FNRET" != 0 ]; then
|
||||||
add_end_of_file $FILE "$SSH_PARAM $SSH_VALUE"
|
add_end_of_file $FILE "$SSH_PARAM $SSH_VALUE"
|
||||||
else
|
else
|
||||||
info "Parameter $SSH_PARAM is present but with the wrong value -- Fixing"
|
info "Parameter $SSH_PARAM is present but with the wrong value -- Fixing"
|
||||||
replace_in_file $FILE "^$SSH_PARAM[[:space:]]*.*" "$SSH_PARAM $SSH_VALUE"
|
replace_in_file $FILE "^${SSH_PARAM}[[:space:]]*.*" "$SSH_PARAM $SSH_VALUE"
|
||||||
fi
|
fi
|
||||||
/etc/init.d/ssh reload >/dev/null 2>&1
|
/etc/init.d/ssh reload >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
|
@ -32,7 +32,7 @@ audit() {
|
|||||||
for SSH_OPTION in $OPTIONS; do
|
for SSH_OPTION in $OPTIONS; do
|
||||||
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
||||||
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
||||||
PATTERN="^$SSH_PARAM[[:space:]]*$SSH_VALUE"
|
PATTERN="^${SSH_PARAM}[[:space:]]*$SSH_VALUE"
|
||||||
does_pattern_exist_in_file $FILE "$PATTERN"
|
does_pattern_exist_in_file $FILE "$PATTERN"
|
||||||
if [ "$FNRET" = 0 ]; then
|
if [ "$FNRET" = 0 ]; then
|
||||||
ok "$PATTERN is present in $FILE"
|
ok "$PATTERN is present in $FILE"
|
||||||
@ -55,18 +55,18 @@ apply() {
|
|||||||
for SSH_OPTION in $OPTIONS; do
|
for SSH_OPTION in $OPTIONS; do
|
||||||
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
||||||
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
||||||
PATTERN="^$SSH_PARAM[[:space:]]*$SSH_VALUE"
|
PATTERN="^${SSH_PARAM}[[:space:]]*$SSH_VALUE"
|
||||||
does_pattern_exist_in_file $FILE "$PATTERN"
|
does_pattern_exist_in_file $FILE "$PATTERN"
|
||||||
if [ "$FNRET" = 0 ]; then
|
if [ "$FNRET" = 0 ]; then
|
||||||
ok "$PATTERN is present in $FILE"
|
ok "$PATTERN is present in $FILE"
|
||||||
else
|
else
|
||||||
warn "$PATTERN is not present in $FILE, adding it"
|
warn "$PATTERN is not present in $FILE, adding it"
|
||||||
does_pattern_exist_in_file $FILE "^$SSH_PARAM"
|
does_pattern_exist_in_file $FILE "^${SSH_PARAM}"
|
||||||
if [ "$FNRET" != 0 ]; then
|
if [ "$FNRET" != 0 ]; then
|
||||||
add_end_of_file $FILE "$SSH_PARAM $SSH_VALUE"
|
add_end_of_file $FILE "$SSH_PARAM $SSH_VALUE"
|
||||||
else
|
else
|
||||||
info "Parameter $SSH_PARAM is present but with the wrong value -- Fixing"
|
info "Parameter $SSH_PARAM is present but with the wrong value -- Fixing"
|
||||||
replace_in_file $FILE "^$SSH_PARAM[[:space:]]*.*" "$SSH_PARAM $SSH_VALUE"
|
replace_in_file $FILE "^${SSH_PARAM}[[:space:]]*.*" "$SSH_PARAM $SSH_VALUE"
|
||||||
fi
|
fi
|
||||||
/etc/init.d/ssh reload
|
/etc/init.d/ssh reload
|
||||||
fi
|
fi
|
||||||
|
@ -31,7 +31,7 @@ audit() {
|
|||||||
for SSH_OPTION in $OPTIONS; do
|
for SSH_OPTION in $OPTIONS; do
|
||||||
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
||||||
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
||||||
PATTERN="^$SSH_PARAM[[:space:]]*$SSH_VALUE"
|
PATTERN="^${SSH_PARAM}[[:space:]]*$SSH_VALUE"
|
||||||
does_pattern_exist_in_file $FILE "$PATTERN"
|
does_pattern_exist_in_file $FILE "$PATTERN"
|
||||||
if [ "$FNRET" = 0 ]; then
|
if [ "$FNRET" = 0 ]; then
|
||||||
ok "$PATTERN is present in $FILE"
|
ok "$PATTERN is present in $FILE"
|
||||||
@ -54,18 +54,18 @@ apply() {
|
|||||||
for SSH_OPTION in $OPTIONS; do
|
for SSH_OPTION in $OPTIONS; do
|
||||||
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
||||||
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
||||||
PATTERN="^$SSH_PARAM[[:space:]]*$SSH_VALUE"
|
PATTERN="^${SSH_PARAM}[[:space:]]*$SSH_VALUE"
|
||||||
does_pattern_exist_in_file $FILE "$PATTERN"
|
does_pattern_exist_in_file $FILE "$PATTERN"
|
||||||
if [ "$FNRET" = 0 ]; then
|
if [ "$FNRET" = 0 ]; then
|
||||||
ok "$PATTERN is present in $FILE"
|
ok "$PATTERN is present in $FILE"
|
||||||
else
|
else
|
||||||
warn "$PATTERN is not present in $FILE, adding it"
|
warn "$PATTERN is not present in $FILE, adding it"
|
||||||
does_pattern_exist_in_file $FILE "^$SSH_PARAM"
|
does_pattern_exist_in_file $FILE "^${SSH_PARAM}"
|
||||||
if [ "$FNRET" != 0 ]; then
|
if [ "$FNRET" != 0 ]; then
|
||||||
add_end_of_file $FILE "$SSH_PARAM $SSH_VALUE"
|
add_end_of_file $FILE "$SSH_PARAM $SSH_VALUE"
|
||||||
else
|
else
|
||||||
info "Parameter $SSH_PARAM is present but with the wrong value -- Fixing"
|
info "Parameter $SSH_PARAM is present but with the wrong value -- Fixing"
|
||||||
replace_in_file $FILE "^$SSH_PARAM[[:space:]]*.*" "$SSH_PARAM $SSH_VALUE"
|
replace_in_file $FILE "^${SSH_PARAM}[[:space:]]*.*" "$SSH_PARAM $SSH_VALUE"
|
||||||
fi
|
fi
|
||||||
/etc/init.d/ssh reload
|
/etc/init.d/ssh reload
|
||||||
fi
|
fi
|
||||||
|
@ -32,7 +32,7 @@ audit() {
|
|||||||
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
||||||
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
||||||
SSH_VALUE=$(sed "s/'//g" <<<$SSH_VALUE)
|
SSH_VALUE=$(sed "s/'//g" <<<$SSH_VALUE)
|
||||||
PATTERN="^$SSH_PARAM[[:space:]]*$SSH_VALUE"
|
PATTERN="^${SSH_PARAM}[[:space:]]*$SSH_VALUE"
|
||||||
does_pattern_exist_in_file $FILE "$PATTERN"
|
does_pattern_exist_in_file $FILE "$PATTERN"
|
||||||
if [ "$FNRET" = 0 ]; then
|
if [ "$FNRET" = 0 ]; then
|
||||||
ok "$PATTERN is present in $FILE"
|
ok "$PATTERN is present in $FILE"
|
||||||
@ -56,18 +56,18 @@ apply() {
|
|||||||
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
||||||
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
||||||
SSH_VALUE=$(sed "s/'//g" <<<$SSH_VALUE)
|
SSH_VALUE=$(sed "s/'//g" <<<$SSH_VALUE)
|
||||||
PATTERN="^$SSH_PARAM[[:space:]]*$SSH_VALUE"
|
PATTERN="^${SSH_PARAM}[[:space:]]*$SSH_VALUE"
|
||||||
does_pattern_exist_in_file $FILE "$PATTERN"
|
does_pattern_exist_in_file $FILE "$PATTERN"
|
||||||
if [ "$FNRET" = 0 ]; then
|
if [ "$FNRET" = 0 ]; then
|
||||||
ok "$PATTERN is present in $FILE"
|
ok "$PATTERN is present in $FILE"
|
||||||
else
|
else
|
||||||
warn "$PATTERN is not present in $FILE, adding it"
|
warn "$PATTERN is not present in $FILE, adding it"
|
||||||
does_pattern_exist_in_file $FILE "^$SSH_PARAM"
|
does_pattern_exist_in_file $FILE "^${SSH_PARAM}"
|
||||||
if [ "$FNRET" != 0 ]; then
|
if [ "$FNRET" != 0 ]; then
|
||||||
add_end_of_file $FILE "$SSH_PARAM $SSH_VALUE"
|
add_end_of_file $FILE "$SSH_PARAM $SSH_VALUE"
|
||||||
else
|
else
|
||||||
info "Parameter $SSH_PARAM is present but with the wrong value -- Fixing"
|
info "Parameter $SSH_PARAM is present but with the wrong value -- Fixing"
|
||||||
replace_in_file $FILE "^$SSH_PARAM[[:space:]]*.*" "$SSH_PARAM $SSH_VALUE"
|
replace_in_file $FILE "^${SSH_PARAM}[[:space:]]*.*" "$SSH_PARAM $SSH_VALUE"
|
||||||
fi
|
fi
|
||||||
/etc/init.d/ssh reload
|
/etc/init.d/ssh reload
|
||||||
fi
|
fi
|
||||||
|
@ -30,7 +30,7 @@ audit() {
|
|||||||
ok "$PACKAGE is installed"
|
ok "$PACKAGE is installed"
|
||||||
for SSH_OPTION in $OPTIONS; do
|
for SSH_OPTION in $OPTIONS; do
|
||||||
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
||||||
PATTERN="^$SSH_PARAM[[:space:]]*"
|
PATTERN="^${SSH_PARAM}[[:space:]]*"
|
||||||
does_pattern_exist_in_file $FILE "$PATTERN"
|
does_pattern_exist_in_file $FILE "$PATTERN"
|
||||||
if [ "$FNRET" = 0 ]; then
|
if [ "$FNRET" = 0 ]; then
|
||||||
ok "$PATTERN is present in $FILE"
|
ok "$PATTERN is present in $FILE"
|
||||||
@ -53,13 +53,13 @@ apply() {
|
|||||||
for SSH_OPTION in $OPTIONS; do
|
for SSH_OPTION in $OPTIONS; do
|
||||||
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
||||||
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
||||||
PATTERN="^$SSH_PARAM[[:space:]]*$SSH_VALUE"
|
PATTERN="^${SSH_PARAM}[[:space:]]*$SSH_VALUE"
|
||||||
does_pattern_exist_in_file $FILE "$PATTERN"
|
does_pattern_exist_in_file $FILE "$PATTERN"
|
||||||
if [ "$FNRET" = 0 ]; then
|
if [ "$FNRET" = 0 ]; then
|
||||||
ok "$PATTERN is present in $FILE"
|
ok "$PATTERN is present in $FILE"
|
||||||
else
|
else
|
||||||
warn "$PATTERN is not present in $FILE, adding it"
|
warn "$PATTERN is not present in $FILE, adding it"
|
||||||
does_pattern_exist_in_file $FILE "^$SSH_PARAM"
|
does_pattern_exist_in_file $FILE "^${SSH_PARAM}"
|
||||||
if [ "$FNRET" != 0 ]; then
|
if [ "$FNRET" != 0 ]; then
|
||||||
add_end_of_file $FILE "$SSH_PARAM $SSH_VALUE"
|
add_end_of_file $FILE "$SSH_PARAM $SSH_VALUE"
|
||||||
else
|
else
|
||||||
|
@ -31,7 +31,7 @@ audit() {
|
|||||||
for SSH_OPTION in $OPTIONS; do
|
for SSH_OPTION in $OPTIONS; do
|
||||||
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
||||||
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
||||||
PATTERN="^$SSH_PARAM[[:space:]]*$SSH_VALUE"
|
PATTERN="^${SSH_PARAM}[[:space:]]*$SSH_VALUE"
|
||||||
does_pattern_exist_in_file $FILE "$PATTERN"
|
does_pattern_exist_in_file $FILE "$PATTERN"
|
||||||
if [ "$FNRET" = 0 ]; then
|
if [ "$FNRET" = 0 ]; then
|
||||||
ok "$PATTERN is present in $FILE"
|
ok "$PATTERN is present in $FILE"
|
||||||
@ -54,18 +54,18 @@ apply() {
|
|||||||
for SSH_OPTION in $OPTIONS; do
|
for SSH_OPTION in $OPTIONS; do
|
||||||
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
||||||
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
||||||
PATTERN="^$SSH_PARAM[[:space:]]*$SSH_VALUE"
|
PATTERN="^${SSH_PARAM}[[:space:]]*$SSH_VALUE"
|
||||||
does_pattern_exist_in_file $FILE "$PATTERN"
|
does_pattern_exist_in_file $FILE "$PATTERN"
|
||||||
if [ "$FNRET" = 0 ]; then
|
if [ "$FNRET" = 0 ]; then
|
||||||
ok "$PATTERN is present in $FILE"
|
ok "$PATTERN is present in $FILE"
|
||||||
else
|
else
|
||||||
warn "$PATTERN is not present in $FILE, adding it"
|
warn "$PATTERN is not present in $FILE, adding it"
|
||||||
does_pattern_exist_in_file $FILE "^$SSH_PARAM"
|
does_pattern_exist_in_file $FILE "^${SSH_PARAM}"
|
||||||
if [ "$FNRET" != 0 ]; then
|
if [ "$FNRET" != 0 ]; then
|
||||||
add_end_of_file $FILE "$SSH_PARAM $SSH_VALUE"
|
add_end_of_file $FILE "$SSH_PARAM $SSH_VALUE"
|
||||||
else
|
else
|
||||||
info "Parameter $SSH_PARAM is present but with the wrong value -- Fixing"
|
info "Parameter $SSH_PARAM is present but with the wrong value -- Fixing"
|
||||||
replace_in_file $FILE "^$SSH_PARAM[[:space:]]*.*" "$SSH_PARAM $SSH_VALUE"
|
replace_in_file $FILE "^${SSH_PARAM}[[:space:]]*.*" "$SSH_PARAM $SSH_VALUE"
|
||||||
fi
|
fi
|
||||||
/etc/init.d/ssh reload >/dev/null 2>&1
|
/etc/init.d/ssh reload >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
|
@ -32,7 +32,7 @@ audit() {
|
|||||||
for SSH_OPTION in $OPTIONS; do
|
for SSH_OPTION in $OPTIONS; do
|
||||||
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
||||||
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
||||||
PATTERN="^$SSH_PARAM[[:space:]]*$SSH_VALUE"
|
PATTERN="^${SSH_PARAM}[[:space:]]*$SSH_VALUE"
|
||||||
does_pattern_exist_in_file_nocase $FILE "$PATTERN"
|
does_pattern_exist_in_file_nocase $FILE "$PATTERN"
|
||||||
if [ "$FNRET" = 0 ]; then
|
if [ "$FNRET" = 0 ]; then
|
||||||
ok "$PATTERN is present in $FILE"
|
ok "$PATTERN is present in $FILE"
|
||||||
@ -55,18 +55,18 @@ apply() {
|
|||||||
for SSH_OPTION in $OPTIONS_TO_APPLY; do
|
for SSH_OPTION in $OPTIONS_TO_APPLY; do
|
||||||
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
||||||
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
||||||
PATTERN="^$SSH_PARAM[[:space:]]*$SSH_VALUE"
|
PATTERN="^${SSH_PARAM}[[:space:]]*$SSH_VALUE"
|
||||||
does_pattern_exist_in_file_nocase $FILE "$PATTERN"
|
does_pattern_exist_in_file_nocase $FILE "$PATTERN"
|
||||||
if [ "$FNRET" = 0 ]; then
|
if [ "$FNRET" = 0 ]; then
|
||||||
ok "$PATTERN is present in $FILE"
|
ok "$PATTERN is present in $FILE"
|
||||||
else
|
else
|
||||||
warn "$PATTERN is not present in $FILE, adding it"
|
warn "$PATTERN is not present in $FILE, adding it"
|
||||||
does_pattern_exist_in_file $FILE "^$SSH_PARAM"
|
does_pattern_exist_in_file $FILE "^${SSH_PARAM}"
|
||||||
if [ "$FNRET" != 0 ]; then
|
if [ "$FNRET" != 0 ]; then
|
||||||
add_end_of_file $FILE "$SSH_PARAM $SSH_VALUE"
|
add_end_of_file $FILE "$SSH_PARAM $SSH_VALUE"
|
||||||
else
|
else
|
||||||
info "Parameter $SSH_PARAM is present but with the wrong value -- Fixing"
|
info "Parameter $SSH_PARAM is present but with the wrong value -- Fixing"
|
||||||
replace_in_file $FILE "^$SSH_PARAM[[:space:]]*.*" "$SSH_PARAM $SSH_VALUE"
|
replace_in_file $FILE "^${SSH_PARAM}[[:space:]]*.*" "$SSH_PARAM $SSH_VALUE"
|
||||||
fi
|
fi
|
||||||
/etc/init.d/ssh reload >/dev/null 2>&1
|
/etc/init.d/ssh reload >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
|
@ -31,7 +31,7 @@ audit() {
|
|||||||
for SSH_OPTION in $OPTIONS; do
|
for SSH_OPTION in $OPTIONS; do
|
||||||
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
||||||
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
||||||
PATTERN="^$SSH_PARAM[[:space:]]*$SSH_VALUE"
|
PATTERN="^${SSH_PARAM}[[:space:]]*$SSH_VALUE"
|
||||||
does_pattern_exist_in_file $FILE "$PATTERN"
|
does_pattern_exist_in_file $FILE "$PATTERN"
|
||||||
if [ "$FNRET" = 0 ]; then
|
if [ "$FNRET" = 0 ]; then
|
||||||
ok "$PATTERN is present in $FILE"
|
ok "$PATTERN is present in $FILE"
|
||||||
@ -54,18 +54,18 @@ apply() {
|
|||||||
for SSH_OPTION in $OPTIONS; do
|
for SSH_OPTION in $OPTIONS; do
|
||||||
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
||||||
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
||||||
PATTERN="^$SSH_PARAM[[:space:]]*$SSH_VALUE"
|
PATTERN="^${SSH_PARAM}[[:space:]]*$SSH_VALUE"
|
||||||
does_pattern_exist_in_file $FILE "$PATTERN"
|
does_pattern_exist_in_file $FILE "$PATTERN"
|
||||||
if [ "$FNRET" = 0 ]; then
|
if [ "$FNRET" = 0 ]; then
|
||||||
ok "$PATTERN is present in $FILE"
|
ok "$PATTERN is present in $FILE"
|
||||||
else
|
else
|
||||||
warn "$PATTERN is not present in $FILE, adding it"
|
warn "$PATTERN is not present in $FILE, adding it"
|
||||||
does_pattern_exist_in_file $FILE "^$SSH_PARAM"
|
does_pattern_exist_in_file $FILE "^${SSH_PARAM}"
|
||||||
if [ "$FNRET" != 0 ]; then
|
if [ "$FNRET" != 0 ]; then
|
||||||
add_end_of_file $FILE "$SSH_PARAM $SSH_VALUE"
|
add_end_of_file $FILE "$SSH_PARAM $SSH_VALUE"
|
||||||
else
|
else
|
||||||
info "Parameter $SSH_PARAM is present but with the wrong value -- Fixing"
|
info "Parameter $SSH_PARAM is present but with the wrong value -- Fixing"
|
||||||
replace_in_file $FILE "^$SSH_PARAM[[:space:]]*.*" "$SSH_PARAM $SSH_VALUE"
|
replace_in_file $FILE "^${SSH_PARAM}[[:space:]]*.*" "$SSH_PARAM $SSH_VALUE"
|
||||||
fi
|
fi
|
||||||
/etc/init.d/ssh reload >/dev/null 2>&1
|
/etc/init.d/ssh reload >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
|
@ -31,7 +31,7 @@ audit() {
|
|||||||
for SSH_OPTION in $OPTIONS; do
|
for SSH_OPTION in $OPTIONS; do
|
||||||
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
||||||
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
||||||
PATTERN="^$SSH_PARAM[[:space:]]*$SSH_VALUE"
|
PATTERN="^${SSH_PARAM}[[:space:]]*$SSH_VALUE"
|
||||||
does_pattern_exist_in_file $FILE "$PATTERN"
|
does_pattern_exist_in_file $FILE "$PATTERN"
|
||||||
if [ "$FNRET" = 0 ]; then
|
if [ "$FNRET" = 0 ]; then
|
||||||
ok "$PATTERN is present in $FILE"
|
ok "$PATTERN is present in $FILE"
|
||||||
@ -54,18 +54,18 @@ apply() {
|
|||||||
for SSH_OPTION in $OPTIONS; do
|
for SSH_OPTION in $OPTIONS; do
|
||||||
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
||||||
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
||||||
PATTERN="^$SSH_PARAM[[:space:]]*$SSH_VALUE"
|
PATTERN="^${SSH_PARAM}[[:space:]]*$SSH_VALUE"
|
||||||
does_pattern_exist_in_file $FILE "$PATTERN"
|
does_pattern_exist_in_file $FILE "$PATTERN"
|
||||||
if [ "$FNRET" = 0 ]; then
|
if [ "$FNRET" = 0 ]; then
|
||||||
ok "$PATTERN is present in $FILE"
|
ok "$PATTERN is present in $FILE"
|
||||||
else
|
else
|
||||||
warn "$PATTERN is not present in $FILE, adding it"
|
warn "$PATTERN is not present in $FILE, adding it"
|
||||||
does_pattern_exist_in_file $FILE "^$SSH_PARAM"
|
does_pattern_exist_in_file $FILE "^${SSH_PARAM}"
|
||||||
if [ "$FNRET" != 0 ]; then
|
if [ "$FNRET" != 0 ]; then
|
||||||
add_end_of_file $FILE "$SSH_PARAM $SSH_VALUE"
|
add_end_of_file $FILE "$SSH_PARAM $SSH_VALUE"
|
||||||
else
|
else
|
||||||
info "Parameter $SSH_PARAM is present but with the wrong value -- Fixing"
|
info "Parameter $SSH_PARAM is present but with the wrong value -- Fixing"
|
||||||
replace_in_file $FILE "^$SSH_PARAM[[:space:]]*.*" "$SSH_PARAM $SSH_VALUE"
|
replace_in_file $FILE "^${SSH_PARAM}[[:space:]]*.*" "$SSH_PARAM $SSH_VALUE"
|
||||||
fi
|
fi
|
||||||
/etc/init.d/ssh reload
|
/etc/init.d/ssh reload
|
||||||
fi
|
fi
|
||||||
|
@ -31,7 +31,7 @@ audit() {
|
|||||||
for SSH_OPTION in $OPTIONS; do
|
for SSH_OPTION in $OPTIONS; do
|
||||||
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
||||||
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
||||||
PATTERN="^$SSH_PARAM[[:space:]]*$SSH_VALUE"
|
PATTERN="^${SSH_PARAM}[[:space:]]*$SSH_VALUE"
|
||||||
does_pattern_exist_in_file $FILE "$PATTERN"
|
does_pattern_exist_in_file $FILE "$PATTERN"
|
||||||
if [ "$FNRET" = 0 ]; then
|
if [ "$FNRET" = 0 ]; then
|
||||||
ok "$PATTERN is present in $FILE"
|
ok "$PATTERN is present in $FILE"
|
||||||
@ -54,18 +54,18 @@ apply() {
|
|||||||
for SSH_OPTION in $OPTIONS; do
|
for SSH_OPTION in $OPTIONS; do
|
||||||
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
||||||
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
||||||
PATTERN="^$SSH_PARAM[[:space:]]*$SSH_VALUE"
|
PATTERN="^${SSH_PARAM}[[:space:]]*$SSH_VALUE"
|
||||||
does_pattern_exist_in_file $FILE "$PATTERN"
|
does_pattern_exist_in_file $FILE "$PATTERN"
|
||||||
if [ "$FNRET" = 0 ]; then
|
if [ "$FNRET" = 0 ]; then
|
||||||
ok "$PATTERN is present in $FILE"
|
ok "$PATTERN is present in $FILE"
|
||||||
else
|
else
|
||||||
warn "$PATTERN is not present in $FILE, adding it"
|
warn "$PATTERN is not present in $FILE, adding it"
|
||||||
does_pattern_exist_in_file $FILE "^$SSH_PARAM"
|
does_pattern_exist_in_file $FILE "^${SSH_PARAM}"
|
||||||
if [ "$FNRET" != 0 ]; then
|
if [ "$FNRET" != 0 ]; then
|
||||||
add_end_of_file $FILE "$SSH_PARAM $SSH_VALUE"
|
add_end_of_file $FILE "$SSH_PARAM $SSH_VALUE"
|
||||||
else
|
else
|
||||||
info "Parameter $SSH_PARAM is present but with the wrong value -- Fixing"
|
info "Parameter $SSH_PARAM is present but with the wrong value -- Fixing"
|
||||||
replace_in_file $FILE "^$SSH_PARAM[[:space:]]*.*" "$SSH_PARAM $SSH_VALUE"
|
replace_in_file $FILE "^${SSH_PARAM}[[:space:]]*.*" "$SSH_PARAM $SSH_VALUE"
|
||||||
fi
|
fi
|
||||||
/etc/init.d/ssh reload
|
/etc/init.d/ssh reload
|
||||||
fi
|
fi
|
||||||
|
@ -31,7 +31,7 @@ audit() {
|
|||||||
for SSH_OPTION in $OPTIONS; do
|
for SSH_OPTION in $OPTIONS; do
|
||||||
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
||||||
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
||||||
PATTERN="^$SSH_PARAM[[:space:]]*$SSH_VALUE"
|
PATTERN="^${SSH_PARAM}[[:space:]]*$SSH_VALUE"
|
||||||
does_pattern_exist_in_file $FILE "$PATTERN"
|
does_pattern_exist_in_file $FILE "$PATTERN"
|
||||||
if [ "$FNRET" = 0 ]; then
|
if [ "$FNRET" = 0 ]; then
|
||||||
ok "$PATTERN is present in $FILE"
|
ok "$PATTERN is present in $FILE"
|
||||||
@ -54,18 +54,18 @@ apply() {
|
|||||||
for SSH_OPTION in $OPTIONS; do
|
for SSH_OPTION in $OPTIONS; do
|
||||||
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
||||||
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
||||||
PATTERN="^$SSH_PARAM[[:space:]]*$SSH_VALUE"
|
PATTERN="^${SSH_PARAM}[[:space:]]*$SSH_VALUE"
|
||||||
does_pattern_exist_in_file $FILE "$PATTERN"
|
does_pattern_exist_in_file $FILE "$PATTERN"
|
||||||
if [ "$FNRET" = 0 ]; then
|
if [ "$FNRET" = 0 ]; then
|
||||||
ok "$PATTERN is present in $FILE"
|
ok "$PATTERN is present in $FILE"
|
||||||
else
|
else
|
||||||
warn "$PATTERN is not present in $FILE, adding it"
|
warn "$PATTERN is not present in $FILE, adding it"
|
||||||
does_pattern_exist_in_file $FILE "^$SSH_PARAM"
|
does_pattern_exist_in_file $FILE "^${SSH_PARAM}"
|
||||||
if [ "$FNRET" != 0 ]; then
|
if [ "$FNRET" != 0 ]; then
|
||||||
add_end_of_file $FILE "$SSH_PARAM $SSH_VALUE"
|
add_end_of_file $FILE "$SSH_PARAM $SSH_VALUE"
|
||||||
else
|
else
|
||||||
info "Parameter $SSH_PARAM is present but with the wrong value -- Fixing"
|
info "Parameter $SSH_PARAM is present but with the wrong value -- Fixing"
|
||||||
replace_in_file $FILE "^$SSH_PARAM[[:space:]]*.*" "$SSH_PARAM $SSH_VALUE"
|
replace_in_file $FILE "^${SSH_PARAM}[[:space:]]*.*" "$SSH_PARAM $SSH_VALUE"
|
||||||
fi
|
fi
|
||||||
/etc/init.d/ssh reload
|
/etc/init.d/ssh reload
|
||||||
fi
|
fi
|
||||||
|
@ -41,7 +41,7 @@ audit() {
|
|||||||
for PW_OPT in $OPTIONS; do
|
for PW_OPT in $OPTIONS; do
|
||||||
PW_PARAM=$(echo $PW_OPT | cut -d= -f1)
|
PW_PARAM=$(echo $PW_OPT | cut -d= -f1)
|
||||||
PW_VALUE=$(echo $PW_OPT | cut -d= -f2)
|
PW_VALUE=$(echo $PW_OPT | cut -d= -f2)
|
||||||
PATTERN="^$PW_PARAM[[:space:]]+=[[:space:]]+$PW_VALUE"
|
PATTERN="^${PW_PARAM}[[:space:]]+=[[:space:]]+$PW_VALUE"
|
||||||
does_pattern_exist_in_file $FILE_QUALITY "$PATTERN"
|
does_pattern_exist_in_file $FILE_QUALITY "$PATTERN"
|
||||||
|
|
||||||
if [ "$FNRET" = 0 ]; then
|
if [ "$FNRET" = 0 ]; then
|
||||||
@ -73,18 +73,18 @@ apply() {
|
|||||||
for PW_OPT in $OPTIONS; do
|
for PW_OPT in $OPTIONS; do
|
||||||
PW_PARAM=$(echo $PW_OPT | cut -d= -f1)
|
PW_PARAM=$(echo $PW_OPT | cut -d= -f1)
|
||||||
PW_VALUE=$(echo $PW_OPT | cut -d= -f2)
|
PW_VALUE=$(echo $PW_OPT | cut -d= -f2)
|
||||||
PATTERN="^$PW_PARAM[[:space:]]+=[[:space:]]+$PW_VALUE"
|
PATTERN="^${PW_PARAM}[[:space:]]+=[[:space:]]+$PW_VALUE"
|
||||||
does_pattern_exist_in_file $FILE_QUALITY $PATTERN
|
does_pattern_exist_in_file $FILE_QUALITY $PATTERN
|
||||||
if [ "$FNRET" = 0 ]; then
|
if [ "$FNRET" = 0 ]; then
|
||||||
ok "$PATTERN is present in $FILE_QUALITY"
|
ok "$PATTERN is present in $FILE_QUALITY"
|
||||||
else
|
else
|
||||||
warn "$PATTERN is not present in $FILE_QUALITY, adding it"
|
warn "$PATTERN is not present in $FILE_QUALITY, adding it"
|
||||||
does_pattern_exist_in_file $FILE_QUALITY "^$PW_PARAM"
|
does_pattern_exist_in_file $FILE_QUALITY "^${PW_PARAM}"
|
||||||
if [ "$FNRET" != 0 ]; then
|
if [ "$FNRET" != 0 ]; then
|
||||||
add_end_of_file $FILE_QUALITY "$PW_PARAM = $PW_VALUE"
|
add_end_of_file $FILE_QUALITY "$PW_PARAM = $PW_VALUE"
|
||||||
else
|
else
|
||||||
info "Parameter $SSH_PARAM is present but with the wrong value -- Fixing"
|
info "Parameter $SSH_PARAM is present but with the wrong value -- Fixing"
|
||||||
replace_in_file $FILE_QUALITY "^$PW_PARAM*.*" "$PW_PARAM = $PW_VALUE"
|
replace_in_file $FILE_QUALITY "^${PW_PARAM}*.*" "$PW_PARAM = $PW_VALUE"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
@ -31,7 +31,7 @@ audit() {
|
|||||||
for SHADOW_OPTION in $OPTIONS; do
|
for SHADOW_OPTION in $OPTIONS; do
|
||||||
SHADOW_PARAM=$(echo $SHADOW_OPTION | cut -d= -f 1)
|
SHADOW_PARAM=$(echo $SHADOW_OPTION | cut -d= -f 1)
|
||||||
SHADOW_VALUE=$(echo $SHADOW_OPTION | cut -d= -f 2)
|
SHADOW_VALUE=$(echo $SHADOW_OPTION | cut -d= -f 2)
|
||||||
PATTERN="^$SHADOW_PARAM[[:space:]]*$SHADOW_VALUE"
|
PATTERN="^${SHADOW_PARAM}[[:space:]]*$SHADOW_VALUE"
|
||||||
does_pattern_exist_in_file $FILE "$PATTERN"
|
does_pattern_exist_in_file $FILE "$PATTERN"
|
||||||
if [ "$FNRET" = 0 ]; then
|
if [ "$FNRET" = 0 ]; then
|
||||||
ok "$PATTERN is present in $FILE"
|
ok "$PATTERN is present in $FILE"
|
||||||
@ -54,18 +54,18 @@ apply() {
|
|||||||
for SHADOW_OPTION in $OPTIONS; do
|
for SHADOW_OPTION in $OPTIONS; do
|
||||||
SHADOW_PARAM=$(echo $SHADOW_OPTION | cut -d= -f 1)
|
SHADOW_PARAM=$(echo $SHADOW_OPTION | cut -d= -f 1)
|
||||||
SHADOW_VALUE=$(echo $SHADOW_OPTION | cut -d= -f 2)
|
SHADOW_VALUE=$(echo $SHADOW_OPTION | cut -d= -f 2)
|
||||||
PATTERN="^$SHADOW_PARAM[[:space:]]*$SHADOW_VALUE"
|
PATTERN="^${SHADOW_PARAM}[[:space:]]*$SHADOW_VALUE"
|
||||||
does_pattern_exist_in_file $FILE "$PATTERN"
|
does_pattern_exist_in_file $FILE "$PATTERN"
|
||||||
if [ "$FNRET" = 0 ]; then
|
if [ "$FNRET" = 0 ]; then
|
||||||
ok "$PATTERN is present in $FILE"
|
ok "$PATTERN is present in $FILE"
|
||||||
else
|
else
|
||||||
warn "$PATTERN is not present in $FILE, adding it"
|
warn "$PATTERN is not present in $FILE, adding it"
|
||||||
does_pattern_exist_in_file $FILE "^$SHADOW_PARAM"
|
does_pattern_exist_in_file $FILE "^${SHADOW_PARAM}"
|
||||||
if [ "$FNRET" != 0 ]; then
|
if [ "$FNRET" != 0 ]; then
|
||||||
add_end_of_file $FILE "$SHADOW_PARAM $SHADOW_VALUE"
|
add_end_of_file $FILE "$SHADOW_PARAM $SHADOW_VALUE"
|
||||||
else
|
else
|
||||||
info "Parameter $SHADOW_PARAM is present but with the wrong value -- Fixing"
|
info "Parameter $SHADOW_PARAM is present but with the wrong value -- Fixing"
|
||||||
replace_in_file $FILE "^$SHADOW_PARAM[[:space:]]*.*" "$SHADOW_PARAM $SHADOW_VALUE"
|
replace_in_file $FILE "^${SHADOW_PARAM}[[:space:]]*.*" "$SHADOW_PARAM $SHADOW_VALUE"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
@ -31,7 +31,7 @@ audit() {
|
|||||||
for SHADOW_OPTION in $OPTIONS; do
|
for SHADOW_OPTION in $OPTIONS; do
|
||||||
SHADOW_PARAM=$(echo $SHADOW_OPTION | cut -d= -f 1)
|
SHADOW_PARAM=$(echo $SHADOW_OPTION | cut -d= -f 1)
|
||||||
SHADOW_VALUE=$(echo $SHADOW_OPTION | cut -d= -f 2)
|
SHADOW_VALUE=$(echo $SHADOW_OPTION | cut -d= -f 2)
|
||||||
PATTERN="^$SHADOW_PARAM[[:space:]]*$SHADOW_VALUE"
|
PATTERN="^${SHADOW_PARAM}[[:space:]]*$SHADOW_VALUE"
|
||||||
does_pattern_exist_in_file $FILE "$PATTERN"
|
does_pattern_exist_in_file $FILE "$PATTERN"
|
||||||
if [ "$FNRET" = 0 ]; then
|
if [ "$FNRET" = 0 ]; then
|
||||||
ok "$PATTERN is present in $FILE"
|
ok "$PATTERN is present in $FILE"
|
||||||
@ -54,18 +54,18 @@ apply() {
|
|||||||
for SHADOW_OPTION in $OPTIONS; do
|
for SHADOW_OPTION in $OPTIONS; do
|
||||||
SHADOW_PARAM=$(echo $SHADOW_OPTION | cut -d= -f 1)
|
SHADOW_PARAM=$(echo $SHADOW_OPTION | cut -d= -f 1)
|
||||||
SHADOW_VALUE=$(echo $SHADOW_OPTION | cut -d= -f 2)
|
SHADOW_VALUE=$(echo $SHADOW_OPTION | cut -d= -f 2)
|
||||||
PATTERN="^$SHADOW_PARAM[[:space:]]*$SHADOW_VALUE"
|
PATTERN="^${SHADOW_PARAM}[[:space:]]*$SHADOW_VALUE"
|
||||||
does_pattern_exist_in_file $FILE "$PATTERN"
|
does_pattern_exist_in_file $FILE "$PATTERN"
|
||||||
if [ "$FNRET" = 0 ]; then
|
if [ "$FNRET" = 0 ]; then
|
||||||
ok "$PATTERN is present in $FILE"
|
ok "$PATTERN is present in $FILE"
|
||||||
else
|
else
|
||||||
warn "$PATTERN is not present in $FILE, adding it"
|
warn "$PATTERN is not present in $FILE, adding it"
|
||||||
does_pattern_exist_in_file $FILE "^$SHADOW_PARAM"
|
does_pattern_exist_in_file $FILE "^${SHADOW_PARAM}"
|
||||||
if [ "$FNRET" != 0 ]; then
|
if [ "$FNRET" != 0 ]; then
|
||||||
add_end_of_file $FILE "$SHADOW_PARAM $SHADOW_VALUE"
|
add_end_of_file $FILE "$SHADOW_PARAM $SHADOW_VALUE"
|
||||||
else
|
else
|
||||||
info "Parameter $SHADOW_PARAM is present but with the wrong value -- Fixing"
|
info "Parameter $SHADOW_PARAM is present but with the wrong value -- Fixing"
|
||||||
replace_in_file $FILE "^$SHADOW_PARAM[[:space:]]*.*" "$SHADOW_PARAM $SHADOW_VALUE"
|
replace_in_file $FILE "^${SHADOW_PARAM}[[:space:]]*.*" "$SHADOW_PARAM $SHADOW_VALUE"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
@ -31,7 +31,7 @@ audit() {
|
|||||||
for SHADOW_OPTION in $OPTIONS; do
|
for SHADOW_OPTION in $OPTIONS; do
|
||||||
SHADOW_PARAM=$(echo $SHADOW_OPTION | cut -d= -f 1)
|
SHADOW_PARAM=$(echo $SHADOW_OPTION | cut -d= -f 1)
|
||||||
SHADOW_VALUE=$(echo $SHADOW_OPTION | cut -d= -f 2)
|
SHADOW_VALUE=$(echo $SHADOW_OPTION | cut -d= -f 2)
|
||||||
PATTERN="^$SHADOW_PARAM[[:space:]]*$SHADOW_VALUE"
|
PATTERN="^${SHADOW_PARAM}[[:space:]]*$SHADOW_VALUE"
|
||||||
does_pattern_exist_in_file $FILE "$PATTERN"
|
does_pattern_exist_in_file $FILE "$PATTERN"
|
||||||
if [ "$FNRET" = 0 ]; then
|
if [ "$FNRET" = 0 ]; then
|
||||||
ok "$PATTERN is present in $FILE"
|
ok "$PATTERN is present in $FILE"
|
||||||
@ -54,18 +54,18 @@ apply() {
|
|||||||
for SHADOW_OPTION in $OPTIONS; do
|
for SHADOW_OPTION in $OPTIONS; do
|
||||||
SHADOW_PARAM=$(echo $SHADOW_OPTION | cut -d= -f 1)
|
SHADOW_PARAM=$(echo $SHADOW_OPTION | cut -d= -f 1)
|
||||||
SHADOW_VALUE=$(echo $SHADOW_OPTION | cut -d= -f 2)
|
SHADOW_VALUE=$(echo $SHADOW_OPTION | cut -d= -f 2)
|
||||||
PATTERN="^$SHADOW_PARAM[[:space:]]*$SHADOW_VALUE"
|
PATTERN="^${SHADOW_PARAM}[[:space:]]*$SHADOW_VALUE"
|
||||||
does_pattern_exist_in_file $FILE "$PATTERN"
|
does_pattern_exist_in_file $FILE "$PATTERN"
|
||||||
if [ "$FNRET" = 0 ]; then
|
if [ "$FNRET" = 0 ]; then
|
||||||
ok "$PATTERN is present in $FILE"
|
ok "$PATTERN is present in $FILE"
|
||||||
else
|
else
|
||||||
warn "$PATTERN is not present in $FILE, adding it"
|
warn "$PATTERN is not present in $FILE, adding it"
|
||||||
does_pattern_exist_in_file $FILE "^$SHADOW_PARAM"
|
does_pattern_exist_in_file $FILE "^${SHADOW_PARAM}"
|
||||||
if [ "$FNRET" != 0 ]; then
|
if [ "$FNRET" != 0 ]; then
|
||||||
add_end_of_file $FILE "$SHADOW_PARAM $SHADOW_VALUE"
|
add_end_of_file $FILE "$SHADOW_PARAM $SHADOW_VALUE"
|
||||||
else
|
else
|
||||||
info "Parameter $SHADOW_PARAM is present but with the wrong value -- Fixing"
|
info "Parameter $SHADOW_PARAM is present but with the wrong value -- Fixing"
|
||||||
replace_in_file $FILE "^$SHADOW_PARAM[[:space:]]*.*" "$SHADOW_PARAM $SHADOW_VALUE"
|
replace_in_file $FILE "^${SHADOW_PARAM}[[:space:]]*.*" "$SHADOW_PARAM $SHADOW_VALUE"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
@ -117,7 +117,7 @@ fi
|
|||||||
|
|
||||||
# Main function, will call the proper functions given the configuration (audit, enabled, disabled)
|
# 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.h
|
# shellcheck source=../../lib/main.sh
|
||||||
. "$CIS_ROOT_DIR"/lib/main.sh
|
. "$CIS_ROOT_DIR"/lib/main.sh
|
||||||
else
|
else
|
||||||
echo "Cannot find main.sh, have you correctly defined your root directory? Current value is $CIS_ROOT_DIR in /etc/default/cis-hardening"
|
echo "Cannot find main.sh, have you correctly defined your root directory? Current value is $CIS_ROOT_DIR in /etc/default/cis-hardening"
|
||||||
|
@ -31,7 +31,7 @@ audit() {
|
|||||||
for SSH_OPTION in $OPTIONS; do
|
for SSH_OPTION in $OPTIONS; do
|
||||||
SSH_PARAM=$(echo "$SSH_OPTION" | cut -d= -f 1)
|
SSH_PARAM=$(echo "$SSH_OPTION" | cut -d= -f 1)
|
||||||
SSH_VALUE=$(echo "$SSH_OPTION" | cut -d= -f 2)
|
SSH_VALUE=$(echo "$SSH_OPTION" | cut -d= -f 2)
|
||||||
PATTERN="^$SSH_PARAM[[:space:]]+$SSH_VALUE"
|
PATTERN="^${SSH_PARAM}[[:space:]]+$SSH_VALUE"
|
||||||
does_pattern_exist_in_file_nocase $FILE "$PATTERN"
|
does_pattern_exist_in_file_nocase $FILE "$PATTERN"
|
||||||
if [ "$FNRET" = 0 ]; then
|
if [ "$FNRET" = 0 ]; then
|
||||||
ok "$PATTERN is present in $FILE"
|
ok "$PATTERN is present in $FILE"
|
||||||
@ -54,18 +54,18 @@ apply() {
|
|||||||
for SSH_OPTION in $OPTIONS; do
|
for SSH_OPTION in $OPTIONS; do
|
||||||
SSH_PARAM=$(echo "$SSH_OPTION" | cut -d= -f 1)
|
SSH_PARAM=$(echo "$SSH_OPTION" | cut -d= -f 1)
|
||||||
SSH_VALUE=$(echo "$SSH_OPTION" | cut -d= -f 2)
|
SSH_VALUE=$(echo "$SSH_OPTION" | cut -d= -f 2)
|
||||||
PATTERN="^$SSH_PARAM[[:space:]]+$SSH_VALUE"
|
PATTERN="^${SSH_PARAM}[[:space:]]+$SSH_VALUE"
|
||||||
does_pattern_exist_in_file_nocase $FILE "$PATTERN"
|
does_pattern_exist_in_file_nocase $FILE "$PATTERN"
|
||||||
if [ "$FNRET" = 0 ]; then
|
if [ "$FNRET" = 0 ]; then
|
||||||
ok "$PATTERN is present in $FILE"
|
ok "$PATTERN is present in $FILE"
|
||||||
else
|
else
|
||||||
warn "$PATTERN is not present in $FILE, adding it"
|
warn "$PATTERN is not present in $FILE, adding it"
|
||||||
does_pattern_exist_in_file_nocase $FILE "^$SSH_PARAM"
|
does_pattern_exist_in_file_nocase $FILE "^${SSH_PARAM}"
|
||||||
if [ "$FNRET" != 0 ]; then
|
if [ "$FNRET" != 0 ]; then
|
||||||
add_end_of_file $FILE "$SSH_PARAM $SSH_VALUE"
|
add_end_of_file $FILE "$SSH_PARAM $SSH_VALUE"
|
||||||
else
|
else
|
||||||
info "Parameter $SSH_PARAM is present but with the wrong value -- Fixing"
|
info "Parameter $SSH_PARAM is present but with the wrong value -- Fixing"
|
||||||
replace_in_file $FILE "^$SSH_PARAM[[:space:]]+.*" "$SSH_PARAM $SSH_VALUE"
|
replace_in_file $FILE "^${SSH_PARAM}[[:space:]]+.*" "$SSH_PARAM $SSH_VALUE"
|
||||||
fi
|
fi
|
||||||
/etc/init.d/ssh reload >/dev/null 2>&1
|
/etc/init.d/ssh reload >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
|
@ -46,7 +46,7 @@ audit() {
|
|||||||
for SSH_OPTION in $OPTIONS; do
|
for SSH_OPTION in $OPTIONS; do
|
||||||
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
||||||
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
||||||
PATTERN="^$SSH_PARAM[[:space:]]*$SSH_VALUE"
|
PATTERN="^${SSH_PARAM}[[:space:]]*$SSH_VALUE"
|
||||||
does_pattern_exist_in_file_nocase $FILE "$PATTERN"
|
does_pattern_exist_in_file_nocase $FILE "$PATTERN"
|
||||||
if [ "$FNRET" = 0 ]; then
|
if [ "$FNRET" = 0 ]; then
|
||||||
ok "$PATTERN is present in $FILE"
|
ok "$PATTERN is present in $FILE"
|
||||||
@ -69,19 +69,19 @@ apply() {
|
|||||||
for SSH_OPTION in $OPTIONS; do
|
for SSH_OPTION in $OPTIONS; do
|
||||||
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
||||||
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
||||||
PATTERN="^$SSH_PARAM[[:space:]]*$SSH_VALUE"
|
PATTERN="^${SSH_PARAM}[[:space:]]*$SSH_VALUE"
|
||||||
does_pattern_exist_in_file_nocase $FILE "$PATTERN"
|
does_pattern_exist_in_file_nocase $FILE "$PATTERN"
|
||||||
if [ "$FNRET" = 0 ]; then
|
if [ "$FNRET" = 0 ]; then
|
||||||
ok "$PATTERN is present in $FILE"
|
ok "$PATTERN is present in $FILE"
|
||||||
else
|
else
|
||||||
warn "$PATTERN is not present in $FILE, adding it"
|
warn "$PATTERN is not present in $FILE, adding it"
|
||||||
does_pattern_exist_in_file_nocase $FILE "^$SSH_PARAM"
|
does_pattern_exist_in_file_nocase $FILE "^${SSH_PARAM}"
|
||||||
if [ "$FNRET" != 0 ]; then
|
if [ "$FNRET" != 0 ]; then
|
||||||
SSH_VALUE=$(sed 's/\\s+/ /' <<<"$SSH_VALUE")
|
SSH_VALUE=$(sed 's/\\s+/ /' <<<"$SSH_VALUE")
|
||||||
add_end_of_file $FILE "$SSH_PARAM $SSH_VALUE"
|
add_end_of_file $FILE "$SSH_PARAM $SSH_VALUE"
|
||||||
else
|
else
|
||||||
info "Parameter $SSH_PARAM is present but with the wrong value -- Fixing"
|
info "Parameter $SSH_PARAM is present but with the wrong value -- Fixing"
|
||||||
replace_in_file $FILE "^$SSH_PARAM[[:space:]]*.*" "$SSH_PARAM $SSH_VALUE"
|
replace_in_file $FILE "^${SSH_PARAM}[[:space:]]*.*" "$SSH_PARAM $SSH_VALUE"
|
||||||
fi
|
fi
|
||||||
/etc/init.d/ssh reload >/dev/null 2>&1
|
/etc/init.d/ssh reload >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
|
@ -30,7 +30,7 @@ audit() {
|
|||||||
for SSH_OPTION in $OPTIONS; do
|
for SSH_OPTION in $OPTIONS; do
|
||||||
SSH_PARAM=$(echo "$SSH_OPTION" | cut -d= -f 1)
|
SSH_PARAM=$(echo "$SSH_OPTION" | cut -d= -f 1)
|
||||||
SSH_VALUE=$(echo "$SSH_OPTION" | cut -d= -f 2)
|
SSH_VALUE=$(echo "$SSH_OPTION" | cut -d= -f 2)
|
||||||
PATTERN="^$SSH_PARAM[[:space:]]*$SSH_VALUE"
|
PATTERN="^${SSH_PARAM}[[:space:]]*$SSH_VALUE"
|
||||||
does_pattern_exist_in_file_nocase $FILE "$PATTERN"
|
does_pattern_exist_in_file_nocase $FILE "$PATTERN"
|
||||||
if [ "$FNRET" = 0 ]; then
|
if [ "$FNRET" = 0 ]; then
|
||||||
ok "$PATTERN is present in $FILE"
|
ok "$PATTERN is present in $FILE"
|
||||||
@ -53,18 +53,18 @@ apply() {
|
|||||||
for SSH_OPTION in $OPTIONS; do
|
for SSH_OPTION in $OPTIONS; do
|
||||||
SSH_PARAM=$(echo "$SSH_OPTION" | cut -d= -f 1)
|
SSH_PARAM=$(echo "$SSH_OPTION" | cut -d= -f 1)
|
||||||
SSH_VALUE=$(echo "$SSH_OPTION" | cut -d= -f 2)
|
SSH_VALUE=$(echo "$SSH_OPTION" | cut -d= -f 2)
|
||||||
PATTERN="^$SSH_PARAM[[:space:]]*$SSH_VALUE"
|
PATTERN="^${SSH_PARAM}[[:space:]]*$SSH_VALUE"
|
||||||
does_pattern_exist_in_file_nocase $FILE "$PATTERN"
|
does_pattern_exist_in_file_nocase $FILE "$PATTERN"
|
||||||
if [ "$FNRET" = 0 ]; then
|
if [ "$FNRET" = 0 ]; then
|
||||||
ok "$PATTERN is present in $FILE"
|
ok "$PATTERN is present in $FILE"
|
||||||
else
|
else
|
||||||
warn "$PATTERN is not present in $FILE, adding it"
|
warn "$PATTERN is not present in $FILE, adding it"
|
||||||
does_pattern_exist_in_file_nocase $FILE "^$SSH_PARAM"
|
does_pattern_exist_in_file_nocase $FILE "^${SSH_PARAM}"
|
||||||
if [ "$FNRET" != 0 ]; then
|
if [ "$FNRET" != 0 ]; then
|
||||||
add_end_of_file $FILE "$SSH_PARAM $SSH_VALUE"
|
add_end_of_file $FILE "$SSH_PARAM $SSH_VALUE"
|
||||||
else
|
else
|
||||||
info "Parameter $SSH_PARAM is present but with the wrong value -- Fixing"
|
info "Parameter $SSH_PARAM is present but with the wrong value -- Fixing"
|
||||||
replace_in_file $FILE "^$SSH_PARAM[[:space:]]*.*" "$SSH_PARAM $SSH_VALUE"
|
replace_in_file $FILE "^${SSH_PARAM}[[:space:]]*.*" "$SSH_PARAM $SSH_VALUE"
|
||||||
fi
|
fi
|
||||||
/etc/init.d/ssh reload >/dev/null 2>&1
|
/etc/init.d/ssh reload >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
|
@ -29,7 +29,7 @@ audit() {
|
|||||||
for SSH_OPTION in $OPTIONS; do
|
for SSH_OPTION in $OPTIONS; do
|
||||||
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
||||||
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
||||||
PATTERN="^$SSH_PARAM[[:space:]]*$SSH_VALUE"
|
PATTERN="^${SSH_PARAM}[[:space:]]*$SSH_VALUE"
|
||||||
does_pattern_exist_in_file_nocase $FILE "$PATTERN"
|
does_pattern_exist_in_file_nocase $FILE "$PATTERN"
|
||||||
if [ "$FNRET" = 0 ]; then
|
if [ "$FNRET" = 0 ]; then
|
||||||
ok "$PATTERN is present in $FILE"
|
ok "$PATTERN is present in $FILE"
|
||||||
@ -52,18 +52,18 @@ apply() {
|
|||||||
for SSH_OPTION in $OPTIONS; do
|
for SSH_OPTION in $OPTIONS; do
|
||||||
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
||||||
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
||||||
PATTERN="^$SSH_PARAM[[:space:]]*$SSH_VALUE"
|
PATTERN="^${SSH_PARAM}[[:space:]]*$SSH_VALUE"
|
||||||
does_pattern_exist_in_file_nocase $FILE "$PATTERN"
|
does_pattern_exist_in_file_nocase $FILE "$PATTERN"
|
||||||
if [ "$FNRET" = 0 ]; then
|
if [ "$FNRET" = 0 ]; then
|
||||||
ok "$PATTERN is present in $FILE"
|
ok "$PATTERN is present in $FILE"
|
||||||
else
|
else
|
||||||
warn "$PATTERN is not present in $FILE, adding it"
|
warn "$PATTERN is not present in $FILE, adding it"
|
||||||
does_pattern_exist_in_file_nocase $FILE "^$SSH_PARAM"
|
does_pattern_exist_in_file_nocase $FILE "^${SSH_PARAM}"
|
||||||
if [ "$FNRET" != 0 ]; then
|
if [ "$FNRET" != 0 ]; then
|
||||||
add_end_of_file $FILE "$SSH_PARAM $SSH_VALUE"
|
add_end_of_file $FILE "$SSH_PARAM $SSH_VALUE"
|
||||||
else
|
else
|
||||||
info "Parameter $SSH_PARAM is present but with the wrong value -- Fixing"
|
info "Parameter $SSH_PARAM is present but with the wrong value -- Fixing"
|
||||||
replace_in_file $FILE "^$SSH_PARAM[[:space:]]*.*" "$SSH_PARAM $SSH_VALUE"
|
replace_in_file $FILE "^${SSH_PARAM}[[:space:]]*.*" "$SSH_PARAM $SSH_VALUE"
|
||||||
fi
|
fi
|
||||||
/etc/init.d/ssh reload >/dev/null 2>&1
|
/etc/init.d/ssh reload >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
|
@ -57,7 +57,7 @@ apply() {
|
|||||||
add_end_of_file $FILE "$PATTERN"
|
add_end_of_file $FILE "$PATTERN"
|
||||||
else
|
else
|
||||||
info "Parameter $SSH_PARAM is present but with the wrong value -- Fixing"
|
info "Parameter $SSH_PARAM is present but with the wrong value -- Fixing"
|
||||||
replace_in_file $FILE "^$SSH_PARAM[[:space:]]*.*" "$PATTERN"
|
replace_in_file $FILE "^${SSH_PARAM}[[:space:]]*.*" "$PATTERN"
|
||||||
fi
|
fi
|
||||||
/etc/init.d/ssh reload >/dev/null 2>&1
|
/etc/init.d/ssh reload >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
|
@ -31,7 +31,7 @@ audit() {
|
|||||||
for SSH_OPTION in $OPTIONS; do
|
for SSH_OPTION in $OPTIONS; do
|
||||||
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
||||||
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
||||||
PATTERN="^$SSH_PARAM[[:space:]]*$SSH_VALUE"
|
PATTERN="^${SSH_PARAM}[[:space:]]*$SSH_VALUE"
|
||||||
does_pattern_exist_in_file_nocase $FILE "$PATTERN"
|
does_pattern_exist_in_file_nocase $FILE "$PATTERN"
|
||||||
if [ "$FNRET" = 0 ]; then
|
if [ "$FNRET" = 0 ]; then
|
||||||
ok "$PATTERN is present in $FILE"
|
ok "$PATTERN is present in $FILE"
|
||||||
@ -54,18 +54,18 @@ apply() {
|
|||||||
for SSH_OPTION in $OPTIONS; do
|
for SSH_OPTION in $OPTIONS; do
|
||||||
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
||||||
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
||||||
PATTERN="^$SSH_PARAM[[:space:]]*$SSH_VALUE"
|
PATTERN="^${SSH_PARAM}[[:space:]]*$SSH_VALUE"
|
||||||
does_pattern_exist_in_file_nocase $FILE "$PATTERN"
|
does_pattern_exist_in_file_nocase $FILE "$PATTERN"
|
||||||
if [ "$FNRET" = 0 ]; then
|
if [ "$FNRET" = 0 ]; then
|
||||||
ok "$PATTERN is present in $FILE"
|
ok "$PATTERN is present in $FILE"
|
||||||
else
|
else
|
||||||
warn "$PATTERN is not present in $FILE, adding it"
|
warn "$PATTERN is not present in $FILE, adding it"
|
||||||
does_pattern_exist_in_file_nocase $FILE "^$SSH_PARAM"
|
does_pattern_exist_in_file_nocase $FILE "^${SSH_PARAM}"
|
||||||
if [ "$FNRET" != 0 ]; then
|
if [ "$FNRET" != 0 ]; then
|
||||||
add_end_of_file $FILE "$SSH_PARAM $SSH_VALUE"
|
add_end_of_file $FILE "$SSH_PARAM $SSH_VALUE"
|
||||||
else
|
else
|
||||||
info "Parameter $SSH_PARAM is present but with the wrong value -- Fixing"
|
info "Parameter $SSH_PARAM is present but with the wrong value -- Fixing"
|
||||||
replace_in_file $FILE "^$SSH_PARAM[[:space:]]*.*" "$SSH_PARAM $SSH_VALUE"
|
replace_in_file $FILE "^${SSH_PARAM}[[:space:]]*.*" "$SSH_PARAM $SSH_VALUE"
|
||||||
fi
|
fi
|
||||||
/etc/init.d/ssh reload >/dev/null 2>&1
|
/etc/init.d/ssh reload >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
|
@ -31,7 +31,7 @@ audit() {
|
|||||||
for SSH_OPTION in $OPTIONS; do
|
for SSH_OPTION in $OPTIONS; do
|
||||||
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
||||||
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
||||||
PATTERN="^$SSH_PARAM[[:space:]]*$SSH_VALUE"
|
PATTERN="^${SSH_PARAM}[[:space:]]*$SSH_VALUE"
|
||||||
does_pattern_exist_in_file_nocase $FILE "$PATTERN"
|
does_pattern_exist_in_file_nocase $FILE "$PATTERN"
|
||||||
if [ "$FNRET" = 0 ]; then
|
if [ "$FNRET" = 0 ]; then
|
||||||
ok "$PATTERN is present in $FILE"
|
ok "$PATTERN is present in $FILE"
|
||||||
@ -54,18 +54,18 @@ apply() {
|
|||||||
for SSH_OPTION in $OPTIONS; do
|
for SSH_OPTION in $OPTIONS; do
|
||||||
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
||||||
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
||||||
PATTERN="^$SSH_PARAM[[:space:]]*$SSH_VALUE"
|
PATTERN="^${SSH_PARAM}[[:space:]]*$SSH_VALUE"
|
||||||
does_pattern_exist_in_file_nocase $FILE "$PATTERN"
|
does_pattern_exist_in_file_nocase $FILE "$PATTERN"
|
||||||
if [ "$FNRET" = 0 ]; then
|
if [ "$FNRET" = 0 ]; then
|
||||||
ok "$PATTERN is present in $FILE"
|
ok "$PATTERN is present in $FILE"
|
||||||
else
|
else
|
||||||
warn "$PATTERN is not present in $FILE, adding it"
|
warn "$PATTERN is not present in $FILE, adding it"
|
||||||
does_pattern_exist_in_file_nocase $FILE "^$SSH_PARAM"
|
does_pattern_exist_in_file_nocase $FILE "^${SSH_PARAM}"
|
||||||
if [ "$FNRET" != 0 ]; then
|
if [ "$FNRET" != 0 ]; then
|
||||||
add_end_of_file $FILE "$SSH_PARAM $SSH_VALUE"
|
add_end_of_file $FILE "$SSH_PARAM $SSH_VALUE"
|
||||||
else
|
else
|
||||||
info "Parameter $SSH_PARAM is present but with the wrong value -- Fixing"
|
info "Parameter $SSH_PARAM is present but with the wrong value -- Fixing"
|
||||||
replace_in_file $FILE "^$SSH_PARAM[[:space:]]*.*" "$SSH_PARAM $SSH_VALUE"
|
replace_in_file $FILE "^${SSH_PARAM}[[:space:]]*.*" "$SSH_PARAM $SSH_VALUE"
|
||||||
fi
|
fi
|
||||||
/etc/init.d/ssh reload >/dev/null 2>&1
|
/etc/init.d/ssh reload >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
|
@ -324,12 +324,12 @@ is_mounted() {
|
|||||||
has_mount_option() {
|
has_mount_option() {
|
||||||
local PARTITION=$1
|
local PARTITION=$1
|
||||||
local OPTION=$2
|
local OPTION=$2
|
||||||
if $(grep "[[:space:]]$PARTITION[[:space:]]" /etc/fstab | grep -vE "^#" | awk {'print $4'} | grep -q "bind"); then
|
if $(grep "[[:space:]]${PARTITION}[[:space:]]" /etc/fstab | grep -vE "^#" | awk {'print $4'} | grep -q "bind"); then
|
||||||
local actual_partition="$(grep "[[:space:]]$PARTITION[[:space:]]" /etc/fstab | grep -vE "^#" | awk {'print $1'})"
|
local actual_partition="$(grep "[[:space:]]${PARTITION}[[:space:]]" /etc/fstab | grep -vE "^#" | awk {'print $1'})"
|
||||||
debug "$PARTITION is a bind mount of $actual_partition"
|
debug "$PARTITION is a bind mount of $actual_partition"
|
||||||
PARTITION="$actual_partition"
|
PARTITION="$actual_partition"
|
||||||
fi
|
fi
|
||||||
if $(grep "[[:space:]]$PARTITION[[:space:]]" /etc/fstab | grep -vE "^#" | awk {'print $4'} | grep -q "$OPTION"); then
|
if $(grep "[[:space:]]${PARTITION}[[:space:]]" /etc/fstab | grep -vE "^#" | awk {'print $4'} | grep -q "$OPTION"); then
|
||||||
debug "$OPTION has been detected in fstab for partition $PARTITION"
|
debug "$OPTION has been detected in fstab for partition $PARTITION"
|
||||||
FNRET=0
|
FNRET=0
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user