Annotation of loncom/configuration/SSL.pm, revision 1.1
1.1 ! raeburn 1: # The LearningOnline Network with CAPA
! 2: # Checksum installed LON-CAPA modules and some configuration files
! 3: #
! 4: # $Id: SSL.pm,v 1.1 2016/07/19 20:58:59 raeburn Exp $
! 5: #
! 6: # The LearningOnline Network with CAPA
! 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: package LONCAPA::SSL;
! 32: use strict;
! 33: use lib '/home/httpd/lib/perl/';
! 34: use Apache::lonlocal();
! 35: use Apache::lonnet();
! 36: use Apache::loncommon();
! 37: use Apache::lonhtmlcommon();
! 38: use LONCAPA;
! 39:
! 40: sub print_certstatus {
! 41: my ($servers,$target,$context) = @_;
! 42: return unless (ref($servers) eq 'HASH');
! 43: my $message;
! 44: my %lt = &Apache::lonlocal::texthash (
! 45: 'file' => 'File',
! 46: 'avai' => 'Available',
! 47: 'yes' => 'Yes',
! 48: 'no' => 'No',
! 49: 'cn' => 'Common Name',
! 50: 'start' => 'Valid From',
! 51: 'end' => 'Valid To',
! 52: 'alg' => 'Signature Algorithm',
! 53: 'size' => 'Public Key Size',
! 54: 'status' => 'Status',
! 55: 'email' => 'E-mail',
! 56: 'key' => 'Private Key',
! 57: 'host' => 'Connections Certificate',
! 58: 'hostname' => 'Replication Certificate',
! 59: 'ca' => 'LON-CAPA CA Certificate',
! 60: );
! 61: my @files = qw(key host hostname ca);
! 62: my @fields = qw(status cn start end alg size email);
! 63: foreach my $server (sort(keys(%{$servers}))) {
! 64: my $hostname = &Apache::lonnet::hostname($server);
! 65: my ($result,$hashref) = &Apache::lonnet::get_servercerts_info($server,$context);
! 66: if ($result eq 'ok' && ref($hashref) eq 'HASH') {
! 67: if ($target eq 'web') {
! 68: $message .= "<fieldset><legend>$hostname ($server)</legend>".
! 69: &Apache::loncommon::start_data_table().
! 70: &Apache::loncommon::start_data_table_header_row()."\n";
! 71: foreach my $item ('file','avai',@fields) {
! 72: $message .= '<th>'.$lt{$item}.'</th>';
! 73: }
! 74: $message .= &Apache::loncommon::end_data_table_header_row()."\n";
! 75: } else {
! 76: $message .= $server.':';
! 77: }
! 78: foreach my $file (@files) {
! 79: if ($target eq 'web') {
! 80: $message .= &Apache::loncommon::start_data_table_row()."\n".
! 81: '<td>'.$lt{$file}.'</td>';
! 82: } else {
! 83: $message .= $file.'=';
! 84: }
! 85: if (ref($hashref->{$file}) eq 'HASH') {
! 86: if ($target eq 'web') {
! 87: $message .= '<td>'.$lt{'yes'}.'</td>';
! 88: } else {
! 89: $message .= $lt{'yes'}.',';
! 90: }
! 91: foreach my $item (@fields) {
! 92: my $display = $hashref->{$file}->{$item};
! 93: if ($target eq 'web') {
! 94: if ($item eq 'status') {
! 95: $display = &Apache::lonhtmlcommon::confirm_success($display);
! 96: }
! 97: $message .= "<td>$display</td>";
! 98: } else {
! 99: $message .= "$display,";
! 100: }
! 101: }
! 102: } else {
! 103: if ($target eq 'web') {
! 104: $message .= '<td>'.$lt{'no'}.'<td>';
! 105: } else {
! 106: $message .= $lt{'no'}.',';
! 107: }
! 108: foreach my $item (@fields) {
! 109: if ($target eq 'web') {
! 110: $message .= '<td> </td>';
! 111: } else {
! 112: $message .= ',';
! 113: }
! 114: }
! 115: if ($target eq 'web') {
! 116: $message .= &Apache::loncommon::end_data_table_row()."\n";
! 117: } else {
! 118: $message =~ s/,$//;
! 119: $message .= '&';
! 120: }
! 121: }
! 122: }
! 123: if ($target eq 'web') {
! 124: $message .= &Apache::loncommon::end_data_table().'</fieldset>';
! 125: } else {
! 126: $message =~ s/\&$//;
! 127: }
! 128: $message .= "\n";
! 129: } else {
! 130: if ($target eq 'web') {
! 131: $message .= "$server error\n";
! 132: } else {
! 133: $message .= "$server error\n";
! 134: }
! 135: }
! 136: }
! 137: return $message;
! 138: }
! 139:
! 140: 1;
! 141:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>