diff --git a/firewalld/firewalld-lib.pl b/firewalld/firewalld-lib.pl index bb80f7703..851199396 100644 --- a/firewalld/firewalld-lib.pl +++ b/firewalld/firewalld-lib.pl @@ -7,8 +7,6 @@ # XXX detect use of firewalld in iptables modules # XXX locking and logging # XXX default action for a zone -# XXX actually apply rules -# XXX bootup script BEGIN { push(@INC, ".."); }; use strict; @@ -126,5 +124,13 @@ my $out = &backquote_logged("$config{'firewall_cmd'} ". return $? ? $out : undef; } +# apply_firewalld() +# Make the current saved config active +sub apply_firewalld +{ +my $out = &backquote_logged("$config{'firewall_cmd'} --reload 2>&1"); +return $? ? $out : undef; +} + 1; diff --git a/firewalld/index.cgi b/firewalld/index.cgi index f548198e5..a747faf4f 100644 --- a/firewalld/index.cgi +++ b/firewalld/index.cgi @@ -82,13 +82,16 @@ print &ui_buttons_start(); my $ok = &is_firewalld_running(); if ($ok) { print &ui_buttons_row("restart.cgi", $text{'index_restart'}, - $text{'index_restartdesc'}); + $text{'index_restartdesc'}, + [ [ "zone", $zone->{'name'} ] ]); print &ui_buttons_row("stop.cgi", $text{'index_stop'}, - $text{'index_stopdesc'}); + $text{'index_stopdesc'}, + [ [ "zone", $zone->{'name'} ] ]); } else { print &ui_buttons_row("start.cgi", $text{'index_start'}, - $text{'index_startdesc'}); + $text{'index_startdesc'}, + [ [ "zone", $zone->{'name'} ] ]); } # Enable at boot diff --git a/firewalld/lang/en b/firewalld/lang/en index e3bbc189f..53f7b3d96 100644 --- a/firewalld/lang/en +++ b/firewalld/lang/en @@ -5,7 +5,7 @@ index_bootupdesc=Change this option to control whether your firewall is activate index_apply=Apply Configuration index_applydesc=Click this button to make the firewall configuration listed above active. Any firewall rules currently in effect will be flushed and replaced index_restart=Apply Configuration -index_restartdesc=Activate all the rules listed above for all zones. +index_restartdesc=Activate all the allowed services and ports listed above, in all zones. Any active rules that were not permanently created will be replaced. index_start=Start FirewallD index_startdesc=Start the FirewallD server and apply the rules listed above. index_stop=Stop FirewallD diff --git a/firewalld/restart.cgi b/firewalld/restart.cgi new file mode 100644 index 000000000..f06d1c86d --- /dev/null +++ b/firewalld/restart.cgi @@ -0,0 +1,12 @@ +#!/usr/local/bin/perl +# Activate all saved firewalld rules + +use strict; +use warnings; +require './firewalld-lib.pl'; +our (%text); +&error_setup($text{'restart_err'}); +my $err = &apply_firewalld(); +&error($err) if ($err); +&webmin_log("restart"); +&redirect("index.cgi?zone=".&urlize($in{'zone'}));