From b1b1034921fe016fe913974660b561ec1ccdbefc Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Wed, 28 Dec 2005 11:15:48 +0000 Subject: don't install and configure mandi-ifw if ifw is disabled --- perl-install/network/drakfirewall.pm | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/perl-install/network/drakfirewall.pm b/perl-install/network/drakfirewall.pm index c5235cc0c..0e7b4e320 100644 --- a/perl-install/network/drakfirewall.pm +++ b/perl-install/network/drakfirewall.pm @@ -214,19 +214,21 @@ You can also give a range of ports (eg: 24300:24350/udp)", $invalid_port)); sub set_ifw { my ($do_pkgs, $enabled, $rules, $ports) = @_; - $do_pkgs->ensure_is_installed('mandi-ifw', '/etc/ifw/start', $::isInstall) or return; + if ($enabled) { + $do_pkgs->ensure_is_installed('mandi-ifw', '/etc/ifw/start', $::isInstall) or return; - my $ports_by_proto = network::shorewall::ports_by_proto($ports); - output_with_perm("$::prefix/etc/ifw/rules", 0644, map { "$_\n" } ( - (map { "source /etc/ifw/rules.d/$_" } @$rules), - map { - my $proto = $_; + my $ports_by_proto = network::shorewall::ports_by_proto($ports); + output_with_perm("$::prefix/etc/ifw/rules", 0644, map { "$_\n" } ( + (map { "source /etc/ifw/rules.d/$_" } @$rules), map { - my $multiport = /:/ && " -m multiport"; - "iptables -A Ifw -m state --state NEW -p $proto$multiport --dport $_ -j IFWLOG --log-prefix NEW\n"; - } @{$ports_by_proto->{$proto}}; - } keys %$ports_by_proto, - )); + my $proto = $_; + map { + my $multiport = /:/ && " -m multiport"; + "iptables -A Ifw -m state --state NEW -p $proto$multiport --dport $_ -j IFWLOG --log-prefix NEW\n"; + } @{$ports_by_proto->{$proto}}; + } keys %$ports_by_proto, + )); + } my $set_in_file = sub { my ($file, @list) = @_; @@ -244,7 +246,7 @@ sub choose_watched_services { my @l = (@ifw_rules, @$servers, map { { ports => $_ } } split(' ', $unlisted)); my $enabled = 1; - $_->{ifw} = 1 foreach @ifw_rules; + $_->{ifw} = 1 foreach @l; $in->ask_from_({ messages => @@ -258,7 +260,7 @@ Please select which network activity should be watched."), map { my $e = $_; { text => (exists $_->{name} ? translate($_->{name}) : $_->{ports}), val => \$_->{ifw}, - type => 'bool', disabled => sub { !member($e, @ifw_rules) || !$enabled }, + type => 'bool', disabled => sub { !$enabled }, } } @l, ]) or return; my ($rules, $ports) = partition { exists $_->{ifw_rule} } grep { $_->{ifw} } @l; -- cgit v1.2.1