Diff for /loncom/configuration/Firewall.pm between versions 1.7 and 1.9

version 1.7, 2010/12/30 18:40:29 version 1.9, 2011/04/26 03:43:17
Line 369  sub get_lond_port { Line 369  sub get_lond_port {
   
 sub get_fw_chains {  sub get_fw_chains {
     my ($iptables) = @_;      my ($iptables) = @_;
       my $perlvarref=&LONCAPA::Configuration::read_conf();
       my $distro;
       if (ref($perlvarref) eq 'HASH') {
           my $path = $perlvarref->{'lonDaemons'};
           if ($path) {
               if (open(PIPE,"$path/distprobe|")) {
                   $distro = <PIPE>;
                   close(PIPE);
               }
           }
       }
     my @fw_chains;      my @fw_chains;
     my $suse_config = "/etc/sysconfig/SuSEfirewall2";      my $suse_config = "/etc/sysconfig/SuSEfirewall2";
       my $ubuntu_config = "/etc/ufw/ufw.conf";
     if (-e $suse_config) {      if (-e $suse_config) {
         push(@fw_chains,'input_ext');          push(@fw_chains,'input_ext');
     } else {      } else {
         if (!-e '/etc/sysconfig/iptables') {          my @posschains;
             if (!-e '/var/lib/iptables') {          if (-e $ubuntu_config) {
                 print("Unable to find iptables file containing static definitions\n");              @posschains = ('ufw-user-input','INPUT');
           } else {
               if ($distro =~ /^(debian|ubuntu|suse|sles)/) {
                   @posschains = ('INPUT'); 
               } else {
                   @posschains = ('RH-Firewall-1-INPUT','INPUT');
               }
               if (!-e '/etc/sysconfig/iptables') {
                   if (!-e '/var/lib/iptables') {
                       unless ($distro =~ /^(debian|ubuntu)/) {
                           print("Unable to find iptables file containing static definitions\n");
                       }
                   }
                   if ($distro =~ /^(fedora|rhes|centos|scientific)/) {
                       push(@fw_chains,'RH-Firewall-1-INPUT');
                   }
             }              }
             push(@fw_chains,'RH-Firewall-1-INPUT');   
         }          }
         if ($iptables eq '') {          if ($iptables eq '') {
             $iptables = &get_pathto_iptables();              $iptables = &get_pathto_iptables();
         }          }
         my %counts;          my %counts;
         my @posschains = ('RH-Firewall-1-INPUT','INPUT');  
         if (open(PIPE,"$iptables -L -n |")) {          if (open(PIPE,"$iptables -L -n |")) {
             while(<PIPE>) {              while(<PIPE>) {
                 foreach my $chain (@posschains) {                  foreach my $chain (@posschains) {
Line 397  sub get_fw_chains { Line 422  sub get_fw_chains {
         }          }
         foreach my $fw_chain (@posschains) {          foreach my $fw_chain (@posschains) {
             if ($counts{$fw_chain}) {              if ($counts{$fw_chain}) {
                 push(@fw_chains,$fw_chain);                  unless(grep(/^\Q$fw_chain\E$/,@fw_chains)) {
                       push(@fw_chains,$fw_chain);
                   }
             }              }
         }          }
     }      }

Removed from v.1.7  
changed lines
  Added in v.1.9


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>