Hiawatha-compatible Cert Generation Script for LetsEncrypt

2020-02-23 -
hiawatha scripts

Hiawatha's cert format requires spaces between each cert in the file which, as far as I can tell, isn't exactly standard. I got tired of making this from scratch, so I made a small script to do it for me.

Note that $CERT is the path to the destination certificate and $DOMAIN is the domain you used with LetsEncrypt.


#!/bin/sh

CERT="/etc/hiawatha/tls/cert.pem"
DOMAIN="domain.com"

cat /etc/letsencrypt/live/$DOMAIN/privkey.pem > $CERT
echo >> $CERT
cat /etc/letsencrypt/live/$DOMAIN/cert.pem >> $CERT
echo >> $CERT
cat /etc/letsencrypt/live/$DOMAIN/chain.pem >> $CERT
chmod 400 $CERT