FreeBSD Bugzilla – Attachment 198721 Details for
Bug 232764
[ipfw] share/examples/ipfw/change_rules.sh: Support firewall_type=workstation, don't backup or send e-mail if no differences found
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
ipfw-change-rules.patch (text/plain), 2.14 KB, created by
Andreas Sommer
on 2018-10-28 15:09:04 UTC
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Andreas Sommer
Created:
2018-10-28 15:09:04 UTC
Size:
2.14 KB
patch
obsolete
>commit 43e895d978e5a6830944f3a01bca40257df53fcc >Author: Andreas Sommer <andreas.sommer87@googlemail.com> >Date: Sun Oct 28 16:03:29 2018 +0100 > > Support firewall_type=workstation, don't backup or send e-mail if no differences found > >diff --git a/share/examples/ipfw/change_rules.sh b/share/examples/ipfw/change_rules.sh >index 6148630a373..58ac0c0c5be 100755 >--- a/share/examples/ipfw/change_rules.sh >+++ b/share/examples/ipfw/change_rules.sh >@@ -67,7 +67,7 @@ TMPFILE=`mktemp -t ${tempfoo}` || exit 1 > get_yes_no() { > while true > do >- echo -n "$1 (Y/N) ? " >+ echo -n "$1 (Y/N) ? " > read -t 30 a > if [ $? != 0 ]; then > a="No"; >@@ -94,7 +94,8 @@ case "${firewall_type}" in > [Cc][Ll][Oo][Ss][Ee][Dd]|\ > [Oo][Pp][Ee][Nn]|\ > [Ss][Ii][Mm][Pp][Ll][Ee]|\ >-[Uu][Nn][Kk][Nn][Oo][Ww][Nn]) >+[Uu][Nn][Kk][Nn][Oo][Ww][Nn]|\ >+[Ww][Oo][Rr][Kk][Ss][Tt][Aa][Tt][Ii][Oo][Nn]) > edit_file="${firewall_script}" > rules_edit=no > ;; >@@ -109,7 +110,7 @@ esac > if [ -f ${edit_file}.new ]; then > get_yes_no "A new rules file already exists, do you want to use it" > [ $a = 'No' ] && cp ${edit_file} ${edit_file}.new >-else >+else > cp ${edit_file} ${edit_file}.new > fi > >@@ -142,14 +143,21 @@ get_yes_no "Would you like to see the resulting new rules" > get_yes_no "Type y to keep the new rules" > [ $a != 'Yes' ] && restore_rules > >-DATE=`date "+%Y%m%d%H%M"` >-cp ${edit_file} ${edit_file}.$DATE >-mv ${edit_file}.new ${edit_file} >-cat <<! >-The new rules are now installed. The previous rules have been preserved in >-the file ${edit_file}.$DATE >-! >-diff -F "^# .*[A-Za-z]" -u ${edit_file}.$DATE ${edit_file} \ >- | mail -s "`hostname` Firewall rule change" root >+if diff -qF "^# .*[A-Za-z]" -u ${edit_file} ${edit_file}.new > /dev/null; then >+ cat <<-! >+ The new rules are now installed. No difference to previous rules. >+ ! >+else >+ DATE=`date "+%Y%m%d%H%M"` >+ cp ${edit_file} ${edit_file}.$DATE >+ mv ${edit_file}.new ${edit_file} >+ cat <<-! >+ The new rules are now installed. The previous rules have been preserved in >+ the file ${edit_file}.$DATE >+ ! >+ diff -F "^# .*[A-Za-z]" -u ${edit_file}.$DATE ${edit_file} \ >+ | mail -s "`hostname` Firewall rule change" root >+fi >+ > rm ${TMPFILE} > exit 0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 232764
: 198721