NBISweden / theherdbook

The Herd Book
GNU Affero General Public License v3.0
1 stars 1 forks source link

Set up certificate authority in herdbook server#37 #459

Open jhagberg opened 2 years ago

jhagberg commented 2 years ago

How to handle CA renewals?

jhagberg commented 2 years ago

E.g. (from another repo):

!/bin/bash

mkdir -p config && \ openssl req -x509 -nodes -days 365 \ -newkey rsa:2048 -sha256 \ -subj '/O=root' \ -keyout config/cakey \ -out config/cacert

openssl req -nodes -new -days 365 -newkey rsa:2048 \ -sha256 -subj '/CN=localhost' \ -keyout config/key \ -out config/cert.csr

openssl x509 -req -CAcreateserial -sha256 \ -CA config/cacert \ -CAkey config/cakey \ -in config/cert.csr \ -out config/cert

openssl req -nodes -new -days 365 -newkey rsa:2048 \ -sha256 -subj '/CN=database' \ -keyout config/key2 \ -out config/cert2.csr

openssl x509 -req -CAcreateserial -sha256 \ -CA config/cacert \ -CAkey config/cakey \ -in config/cert2.csr \ -out config/cert2

cat config/key config/cert > config/combined cat config/key2 config/cert2 > config/combined2