From f145fb02cf578882940880876bd251b45185bc03 Mon Sep 17 00:00:00 2001 From: Jamie Cameron Date: Sun, 7 Jun 2015 23:10:21 -0700 Subject: [PATCH] Script to enable or diosable at boot --- firewalld/bootup.cgi | 18 ++++++++++++++++++ firewalld/index.cgi | 13 ++++++++----- 2 files changed, 26 insertions(+), 5 deletions(-) create mode 100755 firewalld/bootup.cgi diff --git a/firewalld/bootup.cgi b/firewalld/bootup.cgi new file mode 100755 index 000000000..81d02ed01 --- /dev/null +++ b/firewalld/bootup.cgi @@ -0,0 +1,18 @@ +#!/usr/local/bin/perl +# Enable or disable firewalld at boot time + +use strict; +use warnings; +require './firewalld-lib.pl'; +our (%in, %config); +&ReadParse(); +&foreign_require("init"); +if ($in{'boot'}) { + &init::enable_at_boot($config{'init_name'}); + } +else { + &init::disable_at_boot($config{'init_name'}); + } +&webmin_log($in{'boot'} ? "bootup" : "bootdown"); +&redirect("index.cgi?zone=".&urlize($in{'zone'})); + diff --git a/firewalld/index.cgi b/firewalld/index.cgi index 46a8d282f..1ffbba265 100644 --- a/firewalld/index.cgi +++ b/firewalld/index.cgi @@ -92,11 +92,14 @@ else { # Enable at boot &foreign_require("init"); -my $atboot = &init::action_status($config{'init_name'}) == 2 ? 1 : 0; -print &ui_buttons_row("bootup.cgi", $text{'index_bootup'}, - $text{'index_bootupdesc'}, - undef, - &ui_yesno_radio("boot", $atboot)); +my $st = &init::action_status($config{'init_name'}); +if ($st) { + my $atboot = $st == 2 ? 1 : 0; + print &ui_buttons_row("bootup.cgi", $text{'index_bootup'}, + $text{'index_bootupdesc'}, + [ [ "zone", $zone->{'name'} ] ], + &ui_yesno_radio("boot", $atboot)); + } print &ui_buttons_end();