version 1.44.2.1, 2019/07/07 20:49:02
|
version 1.45, 2018/08/07 17:12:17
|
Line 93 sub stop_daemon {
|
Line 93 sub stop_daemon {
|
print(", killed off extraneous processes"); |
print(", killed off extraneous processes"); |
} |
} |
unlink($pidfile); |
unlink($pidfile); |
|
if ($killallname eq 'loncnew') { |
|
&clean_nossl_loncpids(); |
|
} |
print("\n"); |
print("\n"); |
} |
} |
|
|
Line 107 sub clean_sockets {
|
Line 110 sub clean_sockets {
|
} |
} |
} |
} |
|
|
|
sub clean_nossl_loncpids { |
|
my $childpiddir = '/home/httpd/perl/logs/loncpids'; |
|
my $nossldir = '/home/httpd/sockets/nosslverify'; |
|
foreach my $dir ($childpiddir,$nossldir) { |
|
if (-d $dir) { |
|
if (opendir(my $dh,$dir)) { |
|
while (my $fname=readdir($dh)) { |
|
next if ($fname =~ /^\./); |
|
unlink("$dir/$fname"); |
|
} |
|
closedir($dh); |
|
} |
|
} |
|
} |
|
} |
|
|
if (($command eq "restart") || ($command eq 'stop') || |
if (($command eq "restart") || ($command eq 'stop') || |
($command eq 'start') || ($command eq "status")) { |
($command eq 'start') || ($command eq "status")) { |
my $iptables = &LONCAPA::Firewall::get_pathto_iptables(); |
my $iptables = &LONCAPA::Firewall::get_pathto_iptables(); |
my @fw_chains = &LONCAPA::Firewall::get_fw_chains($iptables); |
my @fw_chains = &LONCAPA::Firewall::get_fw_chains($iptables); |
my $lond_port = &LONCAPA::Firewall::get_lond_port(); |
my $lond_port = &LONCAPA::Firewall::get_lond_port(); |
my $firewalld = &LONCAPA::Firewall::uses_firewalld(); |
|
my %iphost; |
my %iphost; |
if ($command eq 'restart') { |
if ($command eq 'restart') { |
print 'Restarting LON-CAPA'."\n"; |
print 'Restarting LON-CAPA'."\n"; |
Line 125 if (($command eq "restart") || ($command
|
Line 143 if (($command eq "restart") || ($command
|
%iphost = &Apache::lonnet::get_iphost('',1); |
%iphost = &Apache::lonnet::get_iphost('',1); |
my $firewall_result = |
my $firewall_result = |
&LONCAPA::Firewall::firewall_close_port($iptables,\@fw_chains, |
&LONCAPA::Firewall::firewall_close_port($iptables,\@fw_chains, |
$lond_port,\%iphost,[$lond_port], |
$lond_port,\%iphost,[$lond_port]); |
$firewalld); |
|
if ($firewall_result) { |
if ($firewall_result) { |
print "$firewall_result\n"; |
print "$firewall_result\n"; |
} |
} |
$firewall_result = |
$firewall_result = |
&LONCAPA::Firewall::firewall_open_port($iptables,\@fw_chains, |
&LONCAPA::Firewall::firewall_open_port($iptables,\@fw_chains, |
$lond_port, \%iphost,[$lond_port], |
$lond_port, \%iphost,[$lond_port]); |
$firewalld); |
|
if (($firewall_result eq 'ok') || ($firewall_result eq 'inactive firewall')) { |
if (($firewall_result eq 'ok') || ($firewall_result eq 'inactive firewall')) { |
if ($firewall_result eq 'inactive firewall') { |
if ($firewall_result eq 'inactive firewall') { |
print "WARNING: iptables firewall is currently inactive\n"; |
print "WARNING: iptables firewall is currently inactive\n"; |
Line 152 if (($command eq "restart") || ($command
|
Line 168 if (($command eq "restart") || ($command
|
&stop_daemon($daemon,$killallname); |
&stop_daemon($daemon,$killallname); |
} |
} |
my $firewall_result = |
my $firewall_result = |
&LONCAPA::Firewall::firewall_close_port($iptables,\@fw_chains, |
&LONCAPA::Firewall::firewall_close_port($iptables,\@fw_chains,$lond_port,\%iphost,[$lond_port]); |
$lond_port,\%iphost,[$lond_port], |
|
$firewalld); |
|
if ($firewall_result) { |
if ($firewall_result) { |
print "$firewall_result\n"; |
print "$firewall_result\n"; |
} |
} |
Line 162 if (($command eq "restart") || ($command
|
Line 176 if (($command eq "restart") || ($command
|
} elsif ($command eq "start") { |
} elsif ($command eq "start") { |
%iphost = &Apache::lonnet::get_iphost('',1); |
%iphost = &Apache::lonnet::get_iphost('',1); |
my $firewall_result = |
my $firewall_result = |
&LONCAPA::Firewall::firewall_open_port($iptables,\@fw_chains, |
&LONCAPA::Firewall::firewall_open_port($iptables,\@fw_chains,$lond_port,\%iphost,[$lond_port]); |
$lond_port,\%iphost,[$lond_port], |
|
$firewalld); |
|
if (($firewall_result eq 'ok') || ($firewall_result eq 'inactive firewall')) { |
if (($firewall_result eq 'ok') || ($firewall_result eq 'inactive firewall')) { |
if ($firewall_result eq 'inactive firewall') { |
if ($firewall_result eq 'inactive firewall') { |
print "WARNING: iptables firewall is currently inactive\n"; |
print "WARNING: iptables firewall is currently inactive\n"; |
Line 196 if (($command eq "restart") || ($command
|
Line 208 if (($command eq "restart") || ($command
|
if ($lond_port) { |
if ($lond_port) { |
my $londopen; |
my $londopen; |
foreach my $fw_chain (@fw_chains) { |
foreach my $fw_chain (@fw_chains) { |
my $numopen = &LONCAPA::Firewall::firewall_is_port_open($iptables,$fw_chain,$lond_port,$lond_port,\%iphost,$firewalld); |
my $numopen = &LONCAPA::Firewall::firewall_is_port_open($iptables,$fw_chain,$lond_port,$lond_port,\%iphost); |
$londopen += $numopen; |
$londopen += $numopen; |
} |
} |
if ($londopen) { |
if ($londopen) { |
print "The LON-CAPA port ($lond_port) is open in firewall.\n"; |
print "The LON-CAPA port ($lond_port) is open in firewall.\n"; |
} elsif (&LONCAPA::Firewall::firewall_is_active()) { |
} elsif (&LONCAPA::Firewall::firewall_is_active) { |
print "The LON-CAPA port ($lond_port) is NOT open in running firewall!\n"; |
print "The LON-CAPA port ($lond_port) is NOT open in running firewall!\n"; |
} |
} |
} else { |
} else { |