Correct permissions of files created by the 'save' command

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2016-10-01 13:49:35 -07:00
parent 72dbb4c3c3
commit 1b032f7524
No known key found for this signature in database
GPG Key ID: 96E6B3F2423A4D10

View File

@ -466,7 +466,8 @@ do_save() {
if $iptables_save | grep -v -- '-A dynamic.* -j ACCEPT' > ${VARDIR}/restore-$$; then if $iptables_save | grep -v -- '-A dynamic.* -j ACCEPT' > ${VARDIR}/restore-$$; then
cp -f ${VARDIR}/firewall $g_restorepath cp -f ${VARDIR}/firewall $g_restorepath
mv -f ${VARDIR}/restore-$$ ${g_restorepath}-iptables mv -f ${VARDIR}/restore-$$ ${g_restorepath}-iptables
chmod +x $g_restorepath chmod 700 $g_restorepath
chmod 600 ${g_restorepath}-iptables
echo " Currently-running Configuration Saved to $g_restorepath" echo " Currently-running Configuration Saved to $g_restorepath"
run_user_exit save run_user_exit save
else else
@ -487,6 +488,7 @@ do_save() {
if ${arptables}-save > ${VARDIR}/restore-$$; then if ${arptables}-save > ${VARDIR}/restore-$$; then
if grep -q '^-A' ${VARDIR}/restore-$$; then if grep -q '^-A' ${VARDIR}/restore-$$; then
mv -f ${VARDIR}/restore-$$ ${g_restorepath}-arptables mv -f ${VARDIR}/restore-$$ ${g_restorepath}-arptables
chmod 600 ${g_restorepath}-arptables
else else
rm -f ${VARDIR}/restore-$$ rm -f ${VARDIR}/restore-$$
fi fi
@ -533,7 +535,7 @@ do_save() {
# #
# Don't save an 'empty' file # Don't save an 'empty' file
# #
grep -qE -- '^(-N|create )' ${VARDIR}/ipsets.tmp && mv -f ${VARDIR}/ipsets.tmp ${g_restorepath}-ipsets grep -qE -- '^(-N|create )' ${VARDIR}/ipsets.tmp && mv -f ${VARDIR}/ipsets.tmp ${g_restorepath}-ipsets && chmod 600 ${g_restorepath}-ipsets
fi fi
fi fi
;; ;;