diff --git a/shorewall/config.info b/shorewall/config.info index 26fe492f4..7e28cd24e 100644 --- a/shorewall/config.info +++ b/shorewall/config.info @@ -4,4 +4,6 @@ actions=Standard actions files,9,40,5,\t macros=Macro files directory,0 before_apply_cmd=Command to run before applying configuration,3,None after_apply_cmd=Command to run after applying configuration,3,None +before_refresh_cmd=Command to run before refreshing blacklist,3,None +after_refresh_cmd=Command to run after refreshing blacklist,3,None display_zone_descriptions=Display zone descriptions in rules file?,1,0-No,1-Yes diff --git a/shorewall/refresh.cgi b/shorewall/refresh.cgi index b8b92d70b..509886bf3 100755 --- a/shorewall/refresh.cgi +++ b/shorewall/refresh.cgi @@ -9,13 +9,13 @@ if ($access{'nochange'}) { } &error_setup($text{'refresh_err'}); -$err = &run_before_apply_command(); +$err = &run_before_refresh_command(); &error($err) if ($err); $out = &backquote_logged("$config{'shorewall'} refresh 2>&1"); if ($?) { &error("
$out
"); } -$err = &run_after_apply_command(); +$err = &run_after_refresh_command(); &webmin_log("refresh"); &redirect(""); diff --git a/shorewall/shorewall-lib.pl b/shorewall/shorewall-lib.pl index 2d36a8ea4..3e80bcd6b 100755 --- a/shorewall/shorewall-lib.pl +++ b/shorewall/shorewall-lib.pl @@ -1845,6 +1845,27 @@ if ($config{'after_apply_cmd'}) { } } +# run_before_refresh_command() +# Runs the before-refresh command, if any. If it fails, returns the error +# message output +sub run_before_refresh_command +{ +if ($config{'before_refresh_cmd'}) { + local $out = &backquote_logged("($config{'before_refresh_cmd'}) &1"); + return $out if ($?); + } +return undef; +} + +# run_after_refresh_command() +# Runs the after-refresh command, if any +sub run_after_refresh_command +{ +if ($config{'after_refresh_cmd'}) { + &system_logged("($config{'after_refresh_cmd'}) /dev/null 2>&1"); + } +} + # list_standard_actions() # Returns a list of standard Shorewall actions sub list_standard_actions