Created
February 27, 2015 20:58
-
-
Save Red5d/231274b372039eeb8783 to your computer and use it in GitHub Desktop.
This file contains 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/bash | |
# Author: Red5d | |
# Commands adapted from: https://www.digitalocean.com/community/tutorials/how-to-install-an-ssl-certificate-from-a-commercial-certificate-authority | |
if [ $(which openssl) -eq "" ];then | |
echo "Can't find openssl command. Exiting..." | |
exit 1 | |
fi | |
apacheFolder=$(ls /etc | grep -e apache -e httpd) | |
if [ $apacheFolder -eq "" ];then | |
echo "Can't find an Apache installation. Exiting..." | |
exit 1 | |
fi | |
echo -n "Enter the path to a folder put your certificates in: " | |
read certLoc | |
echo | |
mkdir -p $certLoc 2>/dev/null | |
cd $certLoc | |
echo -n "Enter your domain name: " | |
read domain | |
echo | |
echo "Generating CSR and Private Key..." | |
openssl req -newkey rsa:2048 -nodes -keyout $domain.key -out $domain.csr | |
echo "Select an option:" | |
echo "1. Use a certificate from a commercial certificate authority." | |
echo "2. Use a self-signed certificate." | |
echo -n "Option #: " | |
read option | |
if [ $option == 1 ];then | |
echo "You're on your own for getting that certificate. Use the CSR we just generated." | |
# TODO: Add code for setting up Apache with certificates from a vendor. | |
exit 0 | |
fi | |
# TODO: Add code for setting up Apache with self-signed certificates." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment