#!/bin/bash CONFIG_PATH="/etc/ainur/ssl/" mkdir -p ${CONFIG_PATH} || true if [ ! -e ${CONFIG_PATH}/private_key.pem || ! -e ${CONFIG_PATH}/public_key.pem ]; then openssl genrsa -out ${CONFIG_PATH}/private_key.pem 2048 openssl rsa -in ${CONFIG_PATH}/private_key.pem -out ${CONFIG_PATH}/public_key.pem -outform PEM -pubout chmod 644 ${CONFIG_PATH}/public_key.pem chmod 660 ${CONFIG_PATH}/private_key.pem chown www-data:www-data ${CONFIG_PATH}/*.pem fi