1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
#!/bin/sh set -e set -u cd ~/certs if [ "$#" != 1 ]; then echo >&2 "Usage: $0 <fqdn>" exit 1 fi cn="$1" shift if [ -e "$cn.key" ] ; then echo >&2 "$cn.key already exists." exit 1 fi umask 0077 openssl genrsa -out "$cn.key" 4096