12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- #!/bin/sh
- export KEY_PATH=keys
- export CRT_PATH=certificates
- export CA_PATH=ca
- mkdir -p $KEY_PATH $CRT_PATH $CA_PATH/db $CA_PATH/private $CA_PATH/certificates
- touch $CA_PATH/db/index
- openssl rand -hex 16 > $CA_PATH/db/serial
- openssl genpkey -algorithm ed25519 -out $KEY_PATH/root-ca.key
- openssl genpkey -algorithm ed25519 -out $KEY_PATH/server.key
- openssl genpkey -algorithm ed25519 -out $KEY_PATH/client.key
- openssl pkey -in $KEY_PATH/server.key -pubout -out $KEY_PATH/server.pub
- openssl req -new \
- -config root-ca.cnf -out root-ca.csr \
- -key $KEY_PATH/root-ca.key
- openssl ca -batch \
- -selfsign -config root-ca.cnf \
- -extensions ca_ext \
- -in root-ca.csr -out $CRT_PATH/root-ca.crt -notext
- openssl req -new \
- -config server.cnf -out server.csr \
- -key $KEY_PATH/server.key
- openssl req -text -in server.csr -noout
- openssl ca -batch \
- -config root-ca.cnf \
- -extensions server_ext \
- -extfile server.cnf -extensions ext \
- -in server.csr -out $CRT_PATH/server.crt -notext \
- -days 1825
- openssl req -new \
- -config client.cnf -out client.csr \
- -key $KEY_PATH/client.key
- openssl ca -batch \
- -config root-ca.cnf \
- -extensions client_ext \
- -in client.csr -out $CRT_PATH/client.crt -notext \
- -days 1825
- rm -rf *.csr $CA_PATH
|