fix(webserver, dhparam): only generate dhparam if it doesn't exist

This commit is contained in:
Mahdi Dibaiee 2017-02-22 14:03:05 +03:30
parent 4f38e2bd83
commit c4cc227935

View File

@ -42,12 +42,16 @@ module System.Serverman.Actions.Nginx (nginx) where
wait =<< restart wait =<< restart
when ssl $ do 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 case serverType of
Static -> do Static -> do
dhparam <- async $ execute "openssl" ["dhparam", "-out", "/etc/ssl/certs/dhparam.pem", "2048"] "" True
wait dhparam
letsencrypt <- async $ createCert path "letsencrypt" letsencrypt <- async $ createCert path "letsencrypt"
wait letsencrypt wait letsencrypt