# The LearningOnline Network with CAPA # Checksum installed LON-CAPA modules and some configuration files # # $Id: SSL.pm,v 1.3 2016/08/01 18:03:53 raeburn Exp $ # # The LearningOnline Network with CAPA # # Copyright Michigan State University Board of Trustees # # This file is part of the LearningOnline Network with CAPA (LON-CAPA). # # LON-CAPA is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # LON-CAPA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with LON-CAPA; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # /home/httpd/html/adm/gpl.txt # # http://www.lon-capa.org/ # package LONCAPA::SSL; use strict; use lib '/home/httpd/lib/perl/'; use Apache::lonlocal(); use Apache::lonnet(); use Apache::loncommon(); use Apache::lonhtmlcommon(); use LONCAPA; sub print_certstatus { my ($servers,$target,$context) = @_; return unless (ref($servers) eq 'HASH'); my $message; my %lt = &Apache::lonlocal::texthash ( 'file' => 'File', 'avai' => 'Available', 'yes' => 'Yes', 'no' => 'No', 'cn' => 'Common Name', 'start' => 'Valid From', 'end' => 'Valid To', 'alg' => 'Signature Algorithm', 'size' => 'Public Key Size', 'status' => 'Status', 'email' => 'E-mail', 'key' => 'Private Key', 'host' => 'Connections Certificate', 'hostname' => 'Replication Certificate', 'ca' => 'LON-CAPA CA Certificate', ); my @files = qw(key host hostname ca); my @fields = qw(status cn start end alg size email); foreach my $server (sort(keys(%{$servers}))) { my ($result,$hashref) = &Apache::lonnet::get_servercerts_info($server,$context); if ($result eq 'ok' && ref($hashref) eq 'HASH') { if ($target eq 'web') { my $hostname = &Apache::lonnet::hostname($server); $message .= "
$hostname ($server)". &Apache::loncommon::start_data_table(). &Apache::loncommon::start_data_table_header_row()."\n"; foreach my $item ('file','avai',@fields) { $message .= ''.$lt{$item}.''; } $message .= &Apache::loncommon::end_data_table_header_row()."\n"; } else { $message .= $server.':'; } foreach my $file (@files) { if ($target eq 'web') { $message .= &Apache::loncommon::start_data_table_row()."\n". ''.$lt{$file}.''; } else { $message .= $file.'='; } if (ref($hashref->{$file}) eq 'HASH') { if ($target eq 'web') { $message .= ''.$lt{'yes'}.''; } else { $message .= $lt{'yes'}.','; } foreach my $item (@fields) { my $display = $hashref->{$file}->{$item}; if ($target eq 'web') { if ($item eq 'status') { $display = &Apache::lonhtmlcommon::confirm_success($display); } $message .= "$display"; } else { $message .= "$display,"; } } } else { if ($target eq 'web') { $message .= ''.$lt{'no'}.''; } else { $message .= $lt{'no'}.','; } foreach my $item (@fields) { if ($target eq 'web') { $message .= ' '; } else { $message .= ','; } } } if ($target eq 'web') { $message .= &Apache::loncommon::end_data_table_row()."\n"; } else { $message =~ s/,$//; $message .= '&'; } } if ($target eq 'web') { $message .= &Apache::loncommon::end_data_table().'
'; } else { $message =~ s/\&$//; } $message .= "\n"; } else { if ($target eq 'web') { $message .= "$server:error\n"; } else { $message .= "$server:error\n"; } } } return $message; } 1;