Go Back

0 #!/bin/sh

1 if [ ! "$@" ]; then

2 echo "$0 <your.hostname>"

3 exit

4 fi

5 openssl genrsa -out private.key 4096

6 openssl req -new -key private.key -out server.csr -subj "/CN=$@"

7 openssl x509 -sha256 -req -days 365 \

8 -in server.csr \

9 -signkey private.key \

10 -out server.crt

11 mv private.key /etc/ssl/private/$@.key

12 mv server.crt /etc/ssl/$@.crt

13 chmod 600 /etc/ssl/$@.crt

14 chmod 600 /etc/ssl/private/$@.key

15