--- loncom/configuration/Firewall.pm 2013/09/22 15:50:35 1.13 +++ loncom/configuration/Firewall.pm 2014/03/17 14:47:46 1.14 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Firewall configuration to allow internal LON-CAPA communication between servers # -# $Id: Firewall.pm,v 1.13 2013/09/22 15:50:35 raeburn Exp $ +# $Id: Firewall.pm,v 1.14 2014/03/17 14:47:46 bisitz Exp $ # # The LearningOnline Network with CAPA # @@ -51,7 +51,7 @@ sub firewall_open_port { } } if (!@okchains) { - return 'None of the chain names has the expected format'."\n"; + return 'None of the chain names has the expected format.'."\n"; } if (ref($ports) ne 'ARRAY') { return 'List of ports to open needed.'; @@ -61,7 +61,7 @@ sub firewall_open_port { if ($portnum =~ /^(\d+)$/) { $port = $1; } else { - print "Skipped non-numeric port: $portnum\n"; + print "Skipped non-numeric port: $portnum.\n"; next; } print "Opening firewall access on port $port.\n"; @@ -84,11 +84,11 @@ sub firewall_open_port { if (($1<=255) && ($2<=255) && ($3<=255) && ($4<=255)) { $ip = "$1.$2.$3.$4"; } else { - print "IP address: $key does not have expected format\n"; + print "IP address: $key does not have expected format.\n"; next; } } else { - print "IP address: $key does not have expected format\n"; + print "IP address: $key does not have expected format.\n"; next; } if ($curropen{$ip}) { @@ -122,13 +122,13 @@ sub firewall_open_port { unless (grep(/^\Q$port\E$/,@opened)) { push(@opened,$port); } - print "Port already open for ".scalar(@lond_port_curropen)." IP addresses\n"; + print "Port already open for ".scalar(@lond_port_curropen)." IP addresses.\n"; } if (@lond_port_open) { unless (grep(/^\Q$port\E$/,@opened)) { push(@opened,$port); } - print "Port opened for ".scalar(@lond_port_open)." IP addresses\n"; + print "Port opened for ".scalar(@lond_port_open)." IP addresses.\n"; } if (@port_error) { print "Error opening port for following IP addresses: ".join(', ',@port_error)."\n"; @@ -238,7 +238,7 @@ sub firewall_close_port { } } if (!@okchains) { - return 'None of the chain names has the expected format'."\n"; + return 'None of the chain names has the expected format.'."\n"; } if (ref($ports) ne 'ARRAY') { return 'List of ports to close needed.'; @@ -292,7 +292,7 @@ sub firewall_close_port { } } if (@lond_port_close) { - $output .= "Port closed for ".scalar(@lond_port_close)." IP addresses\n"; + $output .= "Port closed for ".scalar(@lond_port_close)." IP addresses.\n"; } if (@port_error) { $output .= "Error closing port for following IP addresses: ".join(', ',@port_error)."\n"; @@ -353,7 +353,7 @@ sub firewall_close_anywhere { system($firewall_command); my $return_status = $?>>8; if ($return_status == 1) { - print 'Error closing port '.$port.' for source "anywhere"'."\n"; + print 'Error closing port '.$port.' for source "anywhere".'."\n"; } elsif ($return_status == 2) { print 'Bad command error closing port '.$port.' for source "anywhere". Command was'."\n". ' '.$firewall_command."\n"; @@ -401,7 +401,7 @@ sub get_fw_chains { if (!-e '/etc/sysconfig/iptables') { if (!-e '/var/lib/iptables') { unless ($distro =~ /^(debian|ubuntu)/) { - print("Unable to find iptables file containing static definitions\n"); + print("Unable to find iptables file containing static definitions.\n"); } } if ($distro =~ /^(fedora|rhes|centos|scientific)/) { @@ -441,7 +441,7 @@ sub get_pathto_iptables { } elsif (-e '/usr/sbin/iptables') { $iptables = '/usr/sbin/iptables'; } else { - print("Unable to find iptables command\n"); + print("Unable to find iptables command.\n"); } return $iptables; }