File:  [LON-CAPA] / loncom / CrGenerate.pl
Revision 1.2: download - view: text, annotated - select for diffs
Tue Jun 29 11:13:08 2004 UTC (19 years, 9 months ago) by foxr
Branches: MAIN
CVS tags: HEAD
Get some packaging stuff actually right.

    1: #!/usr/bin/perl
    2: # The LearningOnline Network
    3: # CrGenerate - Generate a loncapa certificate request.
    4: #
    5: # $Id: CrGenerate.pl,v 1.2 2004/06/29 11:13:08 foxr Exp $
    6: #
    7: # Copyright Michigan State University Board of Trustees
    8: #
    9: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
   10: #
   11: # LON-CAPA is free software; you can redistribute it and/or modify
   12: # it under the terms of the GNU General Public License as published by
   13: # the Free Software Foundation; either version 2 of the License, or 
   14: # (at your option) any later version.
   15: #
   16: # LON-CAPA is distributed in the hope that it will be useful,
   17: # but WITHOUT ANY WARRANTY; without even the implied warranty of
   18: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   19: # GNU General Public License for more details.
   20: #
   21: # You should have received a copy of the GNU General Public License
   22: # along with LON-CAPA; if not, write to the Free Software
   23: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   24: #
   25: # /home/httpd/html/adm/gpl.txt
   26: #
   27: 
   28: 
   29: # http://www.lon-capa.org/
   30: #
   31: #
   32: #  This script:
   33: #  1. Generates a private host key and certificate request/
   34: #  2. Decodes the private host key
   35: #  3. Installs the private host key with appropriate permissions
   36: #     in the  appropriate directory (sorry to be vague about this, but
   37: #     the installation directory is determined by external configuration
   38: #     info).
   39: # 4. Constructs an email to the loncapa cluster administrator
   40: #    consisting of a generic heading and the certificate request as a MIME
   41: #    attachment.
   42: # 5. Sends the email and
   43: # 6. Cleans up after itself by removing any temp files generated.
   44: #
   45: #
   46: 
   47: 
   48: # Import section:
   49: 
   50: use strict;
   51: use MIME::Entity;
   52: use Mail::Mailer;
   53: use LONCAPA::Configuration;
   54: 
   55: #  Global variable declarations:
   56: 
   57: my $SSLCommand;			  # Full path to openssl command.
   58: my $CertificateDirectory;	  # LONCAPA Certificate directory.
   59: my $KeyFilename;	          # Key filename (within CertificateDirectory).
   60: my $Passphrase="loncapawhatever"; # Initial passphrase for keyfile
   61: my $RequestEmail;		  # Email address of loncapa cert admin.
   62: 
   63: #   Debug/log support:
   64: #
   65: my $DEBUG = 1;			# 1 for on, 0 for off.
   66: 
   67: # Send debugging to stderr.
   68: # Parameters:
   69: #     msg   - Message to send to stderr.
   70: # Implicit Inputs:
   71: #    $DEBUG - message is only written if this is true.
   72: #
   73: sub Debug {
   74:     my $msg  = shift;
   75:     if($DEBUG) {
   76: 	print STDERR "$msg\n";
   77:     }
   78: }
   79: 
   80: 
   81: sub ReadConfig {}
   82: sub GenerateRequest {}
   83: sub InstallKey {}
   84: sub MailRequest {}
   85: sub Cleanup {}
   86: 
   87: 
   88: 
   89: #  Entry point:
   90: 
   91: Debug("Starting program");
   92: ReadConfig;			# Read loncapa apache config file.
   93: GenerateRequest;		# Generate certificate request.
   94: InstallKey;			# Install the user's key.
   95: MailRequest;			# Mail certificate request to loncapa 
   96: Cleanup;			# Cleanup temp files created.
   97: 
   98: Debug("Done");

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