Created
September 8, 2013 02:30
-
-
Save CaporalDead/6481378 to your computer and use it in GitHub Desktop.
Création d'un certificat auto signé pour un domaine donné
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
#/usr/local/bin/create-cert | |
if [ -z "$1" ]; then | |
echo "First parameter must be a domain" | |
exit 1 | |
fi | |
DOMAIN=$1 | |
DIRECTORY=/data/www/$DOMAIN/ssl | |
if [ ! -d "$DIRECTORY" ]; then | |
echo "$DIRECTORY is not a valid directory" | |
exit 2 | |
fi | |
echo "Deleting old keys" | |
rm -rf $DIRECTORY/{server.key,server.pem} | |
openssl req -x509 -days 365 -newkey rsa:2048 -keyout $DIRECTORY/server.key -nodes -out $DIRECTORY/server.pem | |
chmod 600 $DIRECTORY/* | |
echo "You can now add the following lines to your vhost" | |
echo " " | |
echo "SSLCertificateFile $DIRECTORY/server.pem" | |
echo "SSLCertificateKeyFile $DIRECTORY/server.key" | |
echo " " | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment