# The LearningOnline Network with CAPA
# Checksum installed LON-CAPA modules and some configuration files
#
# $Id: SSL.pm,v 1.6 2017/05/26 03:43:43 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 DateTime;
use DateTime::Format::x509;
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',
'expired' => 'Expired',
'future' => 'Future validity',
'nokey' => 'No key',
'otherkey' => 'No matching key',
);
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 .= "