Skip to content

Regenerate expired SSL certificate. - #42

Merged
edgurgel merged 1 commit into
edgurgel:masterfrom
fishinthecalculator:master
Nov 3, 2026
Merged

edgurgel merged 1 commit into
edgurgel:masterfrom
fishinthecalculator:master

Conversation

@fishinthecalculator

Copy link
Copy Markdown
Contributor

While the CA is valid until 2034, the certificate expired recently.

These are the commands I used to regenerate everything so it is in sync:

cd priv/ssl && \
ca_days=$(( ($(date -d '+10 years' +%s) - $(date +%s)) / 86400 )) && \ srv_days=$(( ($(date -d '+2 years' +%s) - $(date +%s)) / 86400 )) && \ openssl req -x509 -newkey rsa:2048 -keyout server-ca.key -out server-ca.crt \
  -days "$ca_days" -nodes -subj "/CN=httparrot test CA" \
  -addext "basicConstraints=critical,CA:TRUE,pathlen:0" \
  -addext "keyUsage=critical,keyCertSign,cRLSign" \
  -addext "subjectKeyIdentifier=hash" && \
openssl req -newkey rsa:2048 -keyout server.key -out server.csr \
  -nodes -subj "/CN=localhost" \
  -addext "subjectAltName=DNS:example.com,DNS:*.example.com,DNS:example.test,DNS:localhost,IP:127.0.0.1,IP:::1" \
  -addext "keyUsage=critical,digitalSignature,keyEncipherment" \
  -addext "extendedKeyUsage=serverAuth" && \
openssl x509 -req -in server.csr -CA server-ca.crt -CAkey server-ca.key -CAcreateserial \
  -out server.crt -days "$srv_days" -sha256 -copy_extensions copy && \
rm -f server.csr server-ca.key server-ca.srl && \
cd -

cd priv/ssl && \
ca_days=$(( ($(date -d '+10 years' +%s) - $(date +%s)) / 86400 )) && \
srv_days=$(( ($(date -d '+2 years' +%s) - $(date +%s)) / 86400 )) && \
openssl req -x509 -newkey rsa:2048 -keyout server-ca.key -out server-ca.crt \
  -days "$ca_days" -nodes -subj "/CN=httparrot test CA" \
  -addext "basicConstraints=critical,CA:TRUE,pathlen:0" \
  -addext "keyUsage=critical,keyCertSign,cRLSign" \
  -addext "subjectKeyIdentifier=hash" && \
openssl req -newkey rsa:2048 -keyout server.key -out server.csr \
  -nodes -subj "/CN=localhost" \
  -addext "subjectAltName=DNS:example.com,DNS:*.example.com,DNS:example.test,DNS:localhost,IP:127.0.0.1,IP:::1" \
  -addext "keyUsage=critical,digitalSignature,keyEncipherment" \
  -addext "extendedKeyUsage=serverAuth" && \
openssl x509 -req -in server.csr -CA server-ca.crt -CAkey server-ca.key -CAcreateserial \
  -out server.crt -days "$srv_days" -sha256 -copy_extensions copy && \
rm -f server.csr server-ca.key server-ca.srl && \
cd -
@edgurgel
edgurgel merged commit 83f0bc8 into edgurgel:master Nov 3, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants