[LON-CAPA-cvs] cvs: loncom /configuration Firewall.pm /init.d loncontrol

raeburn raeburn@source.lon-capa.org
Mon, 06 Jul 2009 00:07:19 -0000


raeburn		Mon Jul  6 00:07:19 2009 EDT

  Modified files:              
    /loncom/init.d	loncontrol 
    /loncom/configuration	Firewall.pm 
  Log:
  - Pass $iptables (path to iptables) as arg to &get_fw_chain().
  
  
Index: loncom/init.d/loncontrol
diff -u loncom/init.d/loncontrol:1.37 loncom/init.d/loncontrol:1.38
--- loncom/init.d/loncontrol:1.37	Wed Jun 10 23:51:46 2009
+++ loncom/init.d/loncontrol	Mon Jul  6 00:07:15 2009
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 #
-# $Id: loncontrol,v 1.37 2009/06/10 23:51:46 raeburn Exp $
+# $Id: loncontrol,v 1.38 2009/07/06 00:07:15 raeburn Exp $
 #
 # The LearningOnline Network with CAPA
 #
@@ -119,7 +119,7 @@
     system("su www -c '/home/httpd/perl/loncron --justcheckdaemons'");
 } elsif (($command eq "stop") || ($command eq 'start') || ($command eq 'status')) {
     my $iptables = &LONCAPA::Firewall::get_pathto_iptables();
-    my $fw_chain = &LONCAPA::Firewall::get_fw_chain();
+    my $fw_chain = &LONCAPA::Firewall::get_fw_chain($iptables);
     my $lond_port = &LONCAPA::Firewall::get_lond_port();
     my %iphost = &Apache::lonnet::get_iphost();
     if ($command eq 'stop') {
Index: loncom/configuration/Firewall.pm
diff -u loncom/configuration/Firewall.pm:1.3 loncom/configuration/Firewall.pm:1.4
--- loncom/configuration/Firewall.pm:1.3	Fri Jul  3 17:59:01 2009
+++ loncom/configuration/Firewall.pm	Mon Jul  6 00:07:19 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Firewall configuration to allow internal LON-CAPA communication between servers   
 #
-# $Id: Firewall.pm,v 1.3 2009/07/03 17:59:01 raeburn Exp $
+# $Id: Firewall.pm,v 1.4 2009/07/06 00:07:19 raeburn Exp $
 #
 # The LearningOnline Network with CAPA
 #
@@ -294,6 +294,7 @@
 }
 
 sub get_fw_chain {
+    my ($iptables) = @_;
     my $fw_chain = 'RH-Firewall-1-INPUT';
     my $suse_config = "/etc/sysconfig/SuSEfirewall2";
     if (-e $suse_config) {
@@ -302,6 +303,9 @@
         if (!-e '/etc/sysconfig/iptables') {
             print("Unable to find iptables file containing static definitions\n");
         }
+        if ($iptables eq '') {
+            $iptables = &get_pathto_iptables();
+        }
         my $count = `$iptables -L -n 2>/dev/null |grep $fw_chain |wc -l`;
         chomp($count);
         if (!$count) {