Skip to content

Commit

Permalink
only generate not existing files (huan#51 huan#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
huan committed Jun 7, 2019
1 parent f7d64a0 commit 6449e49
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions install/init-openssl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
}

cd /etc/postfix/cert

# skip generation of certificate if one exists (by mounting a volume)
if [ ! -f "smtp.cert" ] || [ ! -f "smtp.ec.cert" ]; then
if [ ! -f "smtp.cert" ]; then
openssl req \
-new \
-outform PEM \
Expand All @@ -19,7 +20,9 @@ if [ ! -f "smtp.cert" ] || [ ! -f "smtp.ec.cert" ]; then
-newkey rsa:2048 \
-keyout smtp.key \
-out smtp.cert
fi

if [ ! -f "smtp.ec.cert" ]; then
openssl req \
-new \
-outform PEM \
Expand All @@ -32,7 +35,7 @@ if [ ! -f "smtp.cert" ] || [ ! -f "smtp.ec.cert" ]; then
-newkey ec:<(openssl ecparam -name secp384r1) \
-keyout smtp.ec.key \
-out smtp.ec.cert

chown -R root.postfix /etc/postfix/cert/
chmod -R 750 /etc/postfix/cert/
fi

chown -R root.postfix /etc/postfix/cert/
chmod -R 750 /etc/postfix/cert/

0 comments on commit 6449e49

Please sign in to comment.