Annotation of loncom/cgi/loncertstatus.pl, revision 1.1

1.1     ! raeburn     1: #!/usr/bin/perl
        !             2: $|=1;
        !             3: # Displays status of LON-CAPA SSL certificates in /home/httpd/lonCerts
        !             4: # on domain's servers.
        !             5: #
        !             6: # $Id: loncertstatus.pl,v 1.1 2016/07/11 13:58:15 raeburn Exp $
        !             7: #
        !             8: # Copyright Michigan State University Board of Trustees
        !             9: #
        !            10: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
        !            11: #
        !            12: # LON-CAPA is free software; you can redistribute it and/or modify
        !            13: # it under the terms of the GNU General Public License as published by
        !            14: # the Free Software Foundation; either version 2 of the License, or
        !            15: # (at your option) any later version.
        !            16: #
        !            17: # LON-CAPA is distributed in the hope that it will be useful,
        !            18: # but WITHOUT ANY WARRANTY; without even the implied warranty of
        !            19: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        !            20: # GNU General Public License for more details.
        !            21: #
        !            22: # You should have received a copy of the GNU General Public License
        !            23: # along with LON-CAPA; if not, write to the Free Software
        !            24: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
        !            25: #
        !            26: # /home/httpd/html/adm/gpl.txt
        !            27: #
        !            28: # http://www.lon-capa.org/
        !            29: #
        !            30: 
        !            31: use strict;
        !            32: 
        !            33: use lib '/home/httpd/lib/perl/';
        !            34: use Apache::lonlocal();
        !            35: use Apache::lonhtmlcommon;
        !            36: use LONCAPA::Configuration();
        !            37: use LONCAPA::loncgi();
        !            38: use LONCAPA::lonauthcgi();
        !            39: use LONCAPA::SSL();
        !            40: 
        !            41: my $perlvar=&LONCAPA::Configuration::read_conf('loncapa.conf');
        !            42: my $lonhost;
        !            43: if (ref($perlvar) eq 'HASH') {
        !            44:     my @reqd = qw(lonnetPrivateKey lonnetCertificate lonnetHostnameCertificate 
        !            45:                   lonnetCertificateAuthority lonCertificateDirectory);
        !            46:     $lonhost = $perlvar->{'lonHostID'};
        !            47:     foreach my $key (keys(%{$perlvar})) {
        !            48:         unless (grep(/^\Q$key\E$/,@reqd)) {
        !            49:             delete($perlvar->{$key});
        !            50:         }
        !            51:     }
        !            52: }
        !            53: 
        !            54: print &LONCAPA::loncgi::cgi_header('text/html',1);
        !            55: &main($lonhost);
        !            56: 
        !            57: sub main {
        !            58:     my ($lonhost) = @_;
        !            59:     my $machine_dom = &Apache::lonnet::host_domain($lonhost);
        !            60:     if (&LONCAPA::lonauthcgi::check_ipbased_access('certstatus')) {
        !            61:         &LONCAPA::loncgi::check_cookie_and_load_env();
        !            62:     } else {
        !            63:         if (!&LONCAPA::loncgi::check_cookie_and_load_env()) {
        !            64:             &Apache::lonlocal::get_language_handle();
        !            65:             print(&LONCAPA::loncgi::missing_cookie_msg());
        !            66:             return;
        !            67:         }
        !            68:         if (!&LONCAPA::lonauthcgi::can_view('certstatus')) {
        !            69:             &Apache::lonlocal::get_language_handle();
        !            70:             print(&LONCAPA::lonauthcgi::unauthorized_msg('certstatus'));
        !            71:             return;
        !            72:         }
        !            73:     }
        !            74:     my %domservers = &Apache::lonnet::get_servers($machine_dom);
        !            75:     &Apache::lonlocal::get_language_handle();
        !            76:     &Apache::lonhtmlcommon::add_breadcrumb(
        !            77:         {href=>"/cgi-bin/loncertstatus.pl",
        !            78:          text=>"LON-CAPA Certificate Status"});
        !            79:     print &Apache::loncommon::start_page('LON-CAPA SSL Certificates Status').
        !            80:           &Apache::lonhtmlcommon::breadcrumbs('SSL Certificates');
        !            81:     print &LONCAPA::SSL::print_certstatus(\%domservers,'web','cgi');
        !            82:     print &Apache::loncommon::end_page();
        !            83:     return;
        !            84: }
        !            85: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>