From 083699737e0d55f6fa63cf41f4dd6fb7319f3c90 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Wed, 28 Jun 2017 15:17:11 +0100 Subject: Apache.httpsVirtualHost' must create ssl/hn/ dir earlier It turns out that IncludeOptional will error out if it is passed non-wildcard directories that do not exist. Signed-off-by: Sean Whitton --- src/Propellor/Property/Apache.hs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/Propellor/Property/Apache.hs b/src/Propellor/Property/Apache.hs index 554a5837..854d0eaa 100644 --- a/src/Propellor/Property/Apache.hs +++ b/src/Propellor/Property/Apache.hs @@ -189,7 +189,7 @@ httpsVirtualHost' domain docroot letos addedcfg = setup teardown `requires` modEnabled "ssl" `before` setuphttps teardown = siteDisabled domain - setuphttp = siteEnabled' domain $ + setuphttp = (siteEnabled' domain $ -- The sslconffile is only created after letsencrypt gets -- the cert. The "*" is needed to make apache not error -- when the file doesn't exist. @@ -201,23 +201,23 @@ httpsVirtualHost' domain docroot letos addedcfg = setup teardown , "RewriteRule ^/.well-known/(.*) - [L]" -- Everything else redirects to https , "RewriteRule ^/(.*) https://" ++ domain ++ "/$1 [L,R,NE]" - ] + ]) + `requires` File.dirExists (takeDirectory cf) setuphttps = LetsEncrypt.letsEncrypt letos domain docroot `onChange` postsetuphttps postsetuphttps = combineProperties (domain ++ " ssl cert installed") $ props - & File.dirExists (takeDirectory cf) & File.hasContent cf sslvhost `onChange` reloaded -- always reload since the cert has changed & reloaded where - cf = sslconffile "letsencrypt" sslvhost = vhost (Port 443) [ "SSLEngine on" , "SSLCertificateFile " ++ LetsEncrypt.certFile domain , "SSLCertificateKeyFile " ++ LetsEncrypt.privKeyFile domain , "SSLCertificateChainFile " ++ LetsEncrypt.chainFile domain ] + cf = sslconffile "letsencrypt" sslconffile s = "/etc/apache2/sites-available/ssl/" ++ domain ++ "/" ++ s ++ ".conf" vhost p ls = [ "" -- cgit v1.2.3