version 1.7, 2018/10/24 04:19:27
|
version 1.9, 2019/06/09 02:35:37
|
Line 73 if (@ARGV != 1) {
|
Line 73 if (@ARGV != 1) {
|
&Exit(2); |
&Exit(2); |
} |
} |
my $tmpfile = $ARGV[0]; |
my $tmpfile = $ARGV[0]; |
if (-e $tmpfile) { |
if ($tmpfile =~ m{^\Q/home/httpd/perl/tmp/lciptables_iphost_\E\d+$}) { |
if (open(my $fh,"<$tmpfile")) { |
if (-e $tmpfile) { |
while(<$fh>) { |
if (open(my $fh,"<$tmpfile")) { |
chomp(); |
while(<$fh>) { |
$iphost{$_} = 1; |
chomp(); |
|
if (/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/) { |
|
if (($1<=255) && ($2<=255) && ($3<=255) && ($4<=255)) { |
|
$iphost{$_} = 1; |
|
} |
|
} |
|
} |
|
close($fh); |
|
} else { |
|
&Exit(3); |
} |
} |
close($fh); |
|
} else { |
} else { |
&Exit(3); |
print "Error. File containing IP addresses of hosts in cluster does not exist\n" unless $noprint; |
|
&Exit(3); |
} |
} |
} else { |
} else { |
print "Error. File containing IP addresses of hosts in cluster does not exist\n" unless $noprint; |
print "Error. Invalid filename for file containing IP addresses\n" unless $noprint; |
&Exit(3); |
&Exit(3); |
} |
} |
|
|
Line 100 if ($iptables eq '') {
|
Line 109 if ($iptables eq '') {
|
&Exit(3); |
&Exit(3); |
} |
} |
|
|
my $firewalld = &LONCAPA::Firewall::uses_firewalld(); |
my ($firewalld) = &LONCAPA::Firewall::uses_firewalld(); |
|
|
&EnableRoot(); |
&EnableRoot(); |
my @fw_chains = &LONCAPA::Firewall::get_fw_chains(); |
my @fw_chains = &LONCAPA::Firewall::get_fw_chains(); |
Line 108 if ($firewalld) {
|
Line 117 if ($firewalld) {
|
$<=0; |
$<=0; |
} |
} |
$opened = |
$opened = |
&LONCAPA::Firewall::firewall_close_port($iptables,\@fw_chains,$lond_port,\%iphost,[$lond_port]); |
&LONCAPA::Firewall::firewall_close_port($iptables,\@fw_chains,$lond_port,\%iphost,[$lond_port],$firewalld); |
$closed = |
$closed = |
&LONCAPA::Firewall::firewall_open_port($iptables,\@fw_chains,$lond_port,\%iphost,[$lond_port]); |
&LONCAPA::Firewall::firewall_open_port($iptables,\@fw_chains,$lond_port,\%iphost,[$lond_port],$firewalld); |
if ($firewalld) { |
if ($firewalld) { |
$<=$wwwid; |
$<=$wwwid; |
} |
} |