Skip to content

Instantly share code, notes, and snippets.

@thedoc31
Created April 4, 2016 23:26
Show Gist options
  • Save thedoc31/bb37253f092136cb35a99ab309de6beb to your computer and use it in GitHub Desktop.
Save thedoc31/bb37253f092136cb35a99ab309de6beb to your computer and use it in GitHub Desktop.
Function for .bashrc which takes a commandline param of a name for an SSL cert, creates the right folder for it under /etc/httpd/conf.d and runs openssl with the right parameters to create the csr and key file.
newcsr() {
if [ $# -eq 0 ]
then
echo "Usage: newcsr www.my.sitename"; return
fi
mkdir /etc/httpd/conf.d/"$1".ssl
cd /etc/httpd/conf.d/"$1".ssl
openssl req -new -newkey rsa:2048 -nodes -out "$1".csr -keyout "$1".key
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment