Fix some bugs.
This commit is contained in:
parent
a3a0c25d1a
commit
5f9346486d
|
@ -16,7 +16,7 @@ HARDENING_LEVEL=2
|
||||||
# Quick factoring as many script use the same logic
|
# Quick factoring as many script use the same logic
|
||||||
PARTITION="/tmp"
|
PARTITION="/tmp"
|
||||||
OPTION="nodev"
|
OPTION="nodev"
|
||||||
SERVICEPATH="/etc/systemd/system/tmp.mount"
|
SERVICEPATH="/usr/share/systemd/tmp.mount"
|
||||||
SERVICENAME="tmp.mount"
|
SERVICENAME="tmp.mount"
|
||||||
|
|
||||||
# This function will be called if the script status is on enabled / audit mode
|
# This function will be called if the script status is on enabled / audit mode
|
||||||
|
|
|
@ -61,7 +61,7 @@ apply () {
|
||||||
done
|
done
|
||||||
elif [ $FNRET = 2 ]; then
|
elif [ $FNRET = 2 ]; then
|
||||||
warn "Set ${SETSTRING} to ${GRUBFILE} in ${GRUBFILE}, need to reboot the system and enable AppArmor profiles after setting it."
|
warn "Set ${SETSTRING} to ${GRUBFILE} in ${GRUBFILE}, need to reboot the system and enable AppArmor profiles after setting it."
|
||||||
sed -ie "s;\(${KEYWORD}=\)\(\".*\)\(\"\);\1\2 ${SETSTRING}\3;" ${GRUBFILE}
|
sed -i "s;\(${KEYWORD}=\)\(\".*\)\(\"\);\1\2 ${SETSTRING}\3;" ${GRUBFILE}
|
||||||
/usr/sbin/update-grub2
|
/usr/sbin/update-grub2
|
||||||
elif [ $FNRET = 3 ]; then
|
elif [ $FNRET = 3 ]; then
|
||||||
warn "Enable AppArmor profiles in the system "
|
warn "Enable AppArmor profiles in the system "
|
||||||
|
|
|
@ -53,11 +53,11 @@ apply () {
|
||||||
touch $FILE
|
touch $FILE
|
||||||
elif [ $FNRET = 2 ]; then
|
elif [ $FNRET = 2 ]; then
|
||||||
warn "$OPTION is not present in $FILE, add it to $KEYWORD line, need to reboot the system after setting it"
|
warn "$OPTION is not present in $FILE, add it to $KEYWORD line, need to reboot the system after setting it"
|
||||||
sed -ie "s;\(${KEYWORD}=\)\(\".*\)\(\"\);\1\2 ${OPTION}=${SETVAL}\3;" $FILE
|
sed -i "s;\(${KEYWORD}=\)\(\".*\)\(\"\);\1\2 ${OPTION}=${SETVAL}\3;" $FILE
|
||||||
/usr/sbin/update-grub2
|
/usr/sbin/update-grub2
|
||||||
elif [ $FNRET = 3 ]; then
|
elif [ $FNRET = 3 ]; then
|
||||||
warn "Parameter $OPTION is present but with the wrong value -- Fixing, need to reboot the system after setting it"
|
warn "Parameter $OPTION is present but with the wrong value -- Fixing, need to reboot the system after setting it"
|
||||||
sed -ie "s/${OPTION}=./${OPTION}=${SETVAL}/" $FILE
|
sed -i "s/${OPTION}=./${OPTION}=${SETVAL}/" $FILE
|
||||||
/usr/sbin/update-grub2
|
/usr/sbin/update-grub2
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
|
@ -382,6 +382,7 @@ add_option_to_systemd() {
|
||||||
#debug "Sed command : sed -ie "s;\(^Options.*=mode=[1,2,4,7][1,2,4,7][1,2,4,7][1,2,4,7].*\);\1,$OPTION;\" $SERVICEPATH"
|
#debug "Sed command : sed -ie "s;\(^Options.*=mode=[1,2,4,7][1,2,4,7][1,2,4,7][1,2,4,7].*\);\1,$OPTION;\" $SERVICEPATH"
|
||||||
sed -ie "s;\(^Options.*=mode=[1,2,4,7][1,2,4,7][1,2,4,7][1,2,4,7].*\);\1,$OPTION;" $SERVICEPATH
|
sed -ie "s;\(^Options.*=mode=[1,2,4,7][1,2,4,7][1,2,4,7][1,2,4,7].*\);\1,$OPTION;" $SERVICEPATH
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
|
systemctl start $SERVICENAME
|
||||||
}
|
}
|
||||||
|
|
||||||
remount_partition_by_systemd() {
|
remount_partition_by_systemd() {
|
||||||
|
|
Loading…
Reference in New Issue