From c4cc227935d8db81ded8f77e896d3fc07b8efac7 Mon Sep 17 00:00:00 2001 From: Mahdi Dibaiee Date: Wed, 22 Feb 2017 14:03:05 +0330 Subject: [PATCH] fix(webserver, dhparam): only generate dhparam if it doesn't exist --- src/System/Serverman/Actions/Nginx.hs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/System/Serverman/Actions/Nginx.hs b/src/System/Serverman/Actions/Nginx.hs index ce596cc..6a5ae97 100644 --- a/src/System/Serverman/Actions/Nginx.hs +++ b/src/System/Serverman/Actions/Nginx.hs @@ -42,12 +42,16 @@ module System.Serverman.Actions.Nginx (nginx) where wait =<< restart when ssl $ do + let dhparamPath = "/etc/ssl/certs/dhparam.pem" + dhExists <- doesFileExist dhparamPath + + when (not dhExists) $ do + dhparam <- async $ execute "openssl" ["dhparam", "-out", dhparamPath, "2048"] "" True + wait dhparam + return () + case serverType of Static -> do - dhparam <- async $ execute "openssl" ["dhparam", "-out", "/etc/ssl/certs/dhparam.pem", "2048"] "" True - - wait dhparam - letsencrypt <- async $ createCert path "letsencrypt" wait letsencrypt