Skip to content

Instantly share code, notes, and snippets.

@adi-li
Last active August 22, 2016 07:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adi-li/dbeeff0f44e88f328b4c2deaadfa02bf to your computer and use it in GitHub Desktop.
Save adi-li/dbeeff0f44e88f328b4c2deaadfa02bf to your computer and use it in GitHub Desktop.
Generate self-signed certificate and key in bash.
#!/bin/bash
generate-self-signed-certificate () {
if [[ $1 ]]; then
openssl req -nodes -x509 -newkey rsa:2048 -keyout $1.key -out $1.crt -days 3650
return 0
fi
echo -e "\033[0;31mPlease provide the name of the key.\033[0m" 1>&2
return 1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment