Annotation of loncom/CrGenerate.pl, revision 1.1

1.1     ! foxr        1: #!/usr/bin/perl
        !             2: # The LearningOnline Network
        !             3: # CrGenerate - Generate a loncapa certificate request.
        !             4: #
        !             5: # $Id$
        !             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: $SSLCommand;			# Full path to openssl command.
        !            58: $CertificateDirectory;		# LONCAPA Certificate directory.
        !            59: $KeyFilename;			# Key filename (within CertificateDirectory).
        !            60: $Passphrase="loncapawhatever";	# Initial passphrase for keyfile
        !            61: $RequestEmail;			# Email address of loncapa cert admin.
        !            62: 
        !            63: #   Debug/log support:
        !            64: #
        !            65: 
        !            66: $DEBUG = 1;			# 1 for on, 0 for off.
        !            67: 
        !            68: # Send debugging to stderr.
        !            69: # Parameters:
        !            70: #     msg   - Message to send to stderr.
        !            71: # Implicit Inputs:
        !            72: #    $DEBUG - message is only written if this is true.
        !            73: #
        !            74: sub Debug {
        !            75:     $msg  = shift;
        !            76:     if($DEBUG) {
        !            77: 	print STDERR "$msg\n";
        !            78:     }
        !            79: }
        !            80: 
        !            81: 
        !            82: sub ReadConfig {}
        !            83: sub GenerateRequest {}
        !            84: sub InstallKey {}
        !            85: sub MailRequest {}
        !            86: sub Cleanup {}
        !            87: 
        !            88: 
        !            89: 
        !            90: #  Entry point:
        !            91: 
        !            92: Debug("Starting program");
        !            93: ReadConfig;			# Read loncapa apache config file.
        !            94: GenerateRequest;		# Generate certificate request.
        !            95: InstallKey;			# Install the user's key.
        !            96: MailRequest;			# Mail certificate request to loncapa 
        !            97: Cleanup;			# Cleanup temp files created.
        !            98: 
        !            99: Debug("Done");

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