File:
[LON-CAPA] /
loncom /
cgi /
ping.pl
Revision
1.9:
download - view:
text,
annotated -
select for diffs
Mon Oct 17 17:23:25 2011 UTC (13 years, 4 months ago) by
raeburn
Branches:
MAIN
CVS tags:
version_2_12_X,
version_2_11_X,
version_2_11_6_msu,
version_2_11_6,
version_2_11_5_msu,
version_2_11_5,
version_2_11_4_uiuc,
version_2_11_4_msu,
version_2_11_4,
version_2_11_3_uiuc,
version_2_11_3_msu,
version_2_11_3,
version_2_11_2_uiuc,
version_2_11_2_msu,
version_2_11_2_educog,
version_2_11_2,
version_2_11_1,
version_2_11_0_RC3,
version_2_11_0_RC2,
version_2_11_0_RC1,
version_2_11_0,
version_2_10_X,
version_2_10_1,
loncapaMITrelate_1,
language_hyphenation_merge,
language_hyphenation,
HEAD,
BZ4492-merge,
BZ4492-feature_horizontal_radioresponse,
BZ4492-feature_Support_horizontal_radioresponse,
BZ4492-Support_horizontal_radioresponse
- Rights to run /cgi-bin/ping.pl on any server in the cluster, from any other host
in the cluster.
- For scripts using lonauthcgi::check_ipbased_access(), access permitted for both 127.0.0.1
and also if remote IP is same as IP of host server.
- check_domain_ip() - new routine: allows access to scripts from any server which belongs
to the same domain as the host server.
- update POD for check_ipbased_access().
- Add new global hash: Apache::lonnet::managerstab to store contents of:
/home/httpd/lonTabs/managers.tab, loaded within BEGIN {} block.
- No automatic access to toggledebug and takeoffline items from server listed in
managers.tab (unlike other keys in %serverstatus_titles).
1: #!/usr/bin/perl
2: # ping cgi-script
3: # $Id: ping.pl,v 1.9 2011/10/17 17:23:25 raeburn Exp $
4: #
5: # Copyright Michigan State University Board of Trustees
6: #
7: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
8: #
9: # LON-CAPA is free software; you can redistribute it and/or modify
10: # it under the terms of the GNU General Public License as published by
11: # the Free Software Foundation; either version 2 of the License, or
12: # (at your option) any later version.
13: #
14: # LON-CAPA is distributed in the hope that it will be useful,
15: # but WITHOUT ANY WARRANTY; without even the implied warranty of
16: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17: # GNU General Public License for more details.
18: #
19: # You should have received a copy of the GNU General Public License
20: # along with LON-CAPA; if not, write to the Free Software
21: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22: #
23: # /home/httpd/html/adm/gpl.txt
24: #
25: # http://www.lon-capa.org/
26: #
27:
28: use strict;
29: $|=1;
30:
31: use lib '/home/httpd/lib/perl/';
32: use Apache::lonnet;
33: use LONCAPA::loncgi;
34: use LONCAPA::lonauthcgi;
35:
36: print("Content-type: text/plain\n\n");
37:
38: &main();
39:
40: sub main {
41: my $remote_ip = $ENV{'REMOTE_ADDR'};
42: my $allowed;
43: my @hosts = &Apache::lonnet::get_hosts_from_ip($remote_ip);
44: if (@hosts > 0) {
45: $allowed = 1;
46: } elsif (&LONCAPA::lonauthcgi::check_ipbased_access('ping',$remote_ip)) {
47: $allowed = 1;
48: } elsif (&LONCAPA::loncgi::check_cookie_and_load_env()) {
49: if (&LONCAPA::lonauthcgi::can_view('ping')) {
50: $allowed = 1;
51: }
52: }
53: if ($allowed) {
54: my $testhost=$ENV{'QUERY_STRING'};
55: $testhost=~s/\W//g;
56: if (&Apache::lonnet::hostname($testhost) ne '') {
57: print &Apache::lonnet::reply('ping',$testhost)."\n";
58: } else {
59: print 'unknown_host';
60: }
61: } else {
62: print 'forbidden';
63: }
64: return;
65: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>