#! /bin/sh
# This script generates a self-signed certificate

echo ""
echo "This program generates a self-signed SSL certificate for the APACHE"
echo "Web Server."

echo ""

# Generate new private key.
openssl genrsa -des3 -out server.key.encrypted 1024

# Create a self-signed certificate.
openssl req -new -x509 -days 365 -key server.key.encrypted -out server.crt

# Unencrypt the server.key so the web server can start up automatically
# without asking for a password.
openssl rsa -in server.key.encrypted -out server.key

echo ""
echo "This program has generated three files for you:"
echo "The server.key and server.key.encrypted files go in the"
echo "/etc/httpd/conf/ssl.key directory."
echo "The server.crt file goes in the /etc/httpd/conf/ssl.crt directory."
echo ""
