diff options
author | Olivier Blin <oblin@mandriva.org> | 2005-09-01 19:50:59 +0000 |
---|---|---|
committer | Olivier Blin <oblin@mandriva.org> | 2005-09-01 19:50:59 +0000 |
commit | 97edb2dd92bb48ec85cdd082da1af1ef7235d644 (patch) | |
tree | ab04061755790fc25d80c04fe09490ad0d55a3a8 /perl-install/network/shorewall.pm | |
parent | cd6afee0de52086ee24b1c83d3d67cfec03e12f5 (diff) | |
download | drakx-backup-do-not-use-97edb2dd92bb48ec85cdd082da1af1ef7235d644.tar drakx-backup-do-not-use-97edb2dd92bb48ec85cdd082da1af1ef7235d644.tar.gz drakx-backup-do-not-use-97edb2dd92bb48ec85cdd082da1af1ef7235d644.tar.bz2 drakx-backup-do-not-use-97edb2dd92bb48ec85cdd082da1af1ef7235d644.tar.xz drakx-backup-do-not-use-97edb2dd92bb48ec85cdd082da1af1ef7235d644.zip |
install and configure Interface Firewall in drakfirewall
Diffstat (limited to 'perl-install/network/shorewall.pm')
-rw-r--r-- | perl-install/network/shorewall.pm | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/perl-install/network/shorewall.pm b/perl-install/network/shorewall.pm index 7e5d97363..463d64a62 100644 --- a/perl-install/network/shorewall.pm +++ b/perl-install/network/shorewall.pm @@ -1,8 +1,5 @@ package network::shorewall; # $Id$ - - - use detect_devices; use network::ethernet; use network::network; @@ -10,7 +7,6 @@ use run_program; use common; use log; - sub check_iptables() { -f "$::prefix/etc/sysconfig/iptables" || $::isStandalone && do { @@ -101,16 +97,21 @@ sub read { $conf{net_interface} && \%conf; } +sub ports_by_proto { + my ($ports) = @_; + my %ports_by_proto; + foreach (split ' ', $ports) { + m!^(\d+(?:\d+)?)/(udp|tcp|icmp)$! or die "bad port $_\n"; + push @{$ports_by_proto{$2}}, $1; + } + \%ports_by_proto; +} + sub write { my ($conf) = @_; my $default_intf = get_ifcfg_interface(); my $use_pptp = $default_intf =~ /^ppp/ && cat_("$::prefix/etc/ppp/peers/$default_intf") =~ /pptp/; - - my %ports_by_proto; - foreach (split ' ', $conf->{ports}) { - m!^(\d+(:\d+)?)/(udp|tcp|icmp)$! or die "bad port $_\n"; - push @{$ports_by_proto{$3}}, $1; - } + my $ports_by_proto = ports_by_proto($conf->{ports}); my $interface_settings = sub { my ($zone, $interface) = @_; @@ -134,7 +135,7 @@ sub write { set_config_file('rules', if_($use_pptp, [ 'ACCEPT', 'fw', 'loc:10.0.0.138', 'tcp', '1723' ]), if_($use_pptp, [ 'ACCEPT', 'fw', 'loc:10.0.0.138', 'gre' ]), - (map_each { [ 'ACCEPT', 'net', 'fw', $::a, join(',', @$::b), '-' ] } %ports_by_proto), + (map_each { [ 'ACCEPT', 'net', 'fw', $::a, join(',', @$::b), '-' ] } %$ports_by_proto), (map { map_each { [ 'REDIRECT', 'loc', $::a, $_, $::b, '-' ] } %{$conf->{redirects}{$_}}; } keys %{$conf->{redirects}}), |