You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
1.0 KiB

# Generate config
if [ ! -f /haraka/config/smtp.ini ]; then
haraka -i /haraka
sed -i -e 's/;user=.*/user=haraka/g' /haraka/config/smtp.ini
sed -i -e 's/;group=.*/group=haraka/g' /haraka/config/smtp.ini
# Specify hostname
echo $HOSTNAME > /haraka/config/host_list
# Create tls directory if it doesn't
mkdir -p /haraka/config/tls
cd /haraka/config/tls
if [ "${USE_LETSENCRYPT,,}" == "yes" -o "${USE_LETSENCRYPT,,}" == "true" ]; then
# Get and install certificates from Let's Encrypt
certbot certonly -n --agree-tos --email "$EMAIL" -d "$HOSTNAME" --standalone --preferred-challenges http
ln -sf /etc/letsencrypt/live/$HOSTNAME/privkey.pem tls-key.pem
ln -sf /etc/letsencrypt/live/$HOSTNAME/fullchain.pem tls-cert.pem
# Generate a self-signed certificate for the hostname provided
rm -f tls-key.pem tls-cert.pem
openssl req -subj "/O=Self Signed Certificate/CN=$HOSTNAME" -new -newkey rsa:4096 -days 365 -nodes -x509 -sha256 -keyout tls-key.pem -out tls-cert.pem
cd -
haraka -c /haraka