From 39e1237146c046fd2f02fcc492a73079ee77a96f Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 31 Dec 2015 12:01:44 -0400 Subject: Postfix: Add service property to enable/disable services in master.cf. --- src/Propellor/Property/SiteSpecific/JoeySites.hs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/Propellor/Property/SiteSpecific') diff --git a/src/Propellor/Property/SiteSpecific/JoeySites.hs b/src/Propellor/Property/SiteSpecific/JoeySites.hs index 732714db..d7bd9068 100644 --- a/src/Propellor/Property/SiteSpecific/JoeySites.hs +++ b/src/Propellor/Property/SiteSpecific/JoeySites.hs @@ -694,11 +694,17 @@ kiteMailServer = propertyList "kitenet.net mail server" $ props `describe` "pine configured to use local imap server" & Apt.serviceInstalledRunning "mailman" + + & Postfix.service ssmtp where ctx = Context "kitenet.net" pinescript = "/usr/local/bin/pine" dovecotusers = "/etc/dovecot/users" + ssmtp = Postfix.Service + (Postfix.InetService (Nothing, "ssmtp")) + "smtpd" Postfix.defServiceOpts + -- Configures postfix to relay outgoing mail to kitenet.net, with -- verification via tls cert. postfixClientRelay :: Context -> Property HasInfo -- cgit v1.3-2-g0d8e From 5e73aa446e46b61ebea77af5a6addaa8be517c1d Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 31 Dec 2015 12:19:46 -0400 Subject: propellor spin --- src/Propellor/Property/SiteSpecific/JoeySites.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Propellor/Property/SiteSpecific') diff --git a/src/Propellor/Property/SiteSpecific/JoeySites.hs b/src/Propellor/Property/SiteSpecific/JoeySites.hs index d7bd9068..987b4187 100644 --- a/src/Propellor/Property/SiteSpecific/JoeySites.hs +++ b/src/Propellor/Property/SiteSpecific/JoeySites.hs @@ -702,7 +702,7 @@ kiteMailServer = propertyList "kitenet.net mail server" $ props dovecotusers = "/etc/dovecot/users" ssmtp = Postfix.Service - (Postfix.InetService (Nothing, "ssmtp")) + (Postfix.InetService Nothing "ssmtp") "smtpd" Postfix.defServiceOpts -- Configures postfix to relay outgoing mail to kitenet.net, with -- cgit v1.3-2-g0d8e From bfe8375d46e78bc6dd796ba1d0bdce577dbd123c Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 31 Dec 2015 12:40:42 -0400 Subject: actually parse service lines So whitespace etc changes don't matter --- src/Propellor/Property/Postfix.hs | 17 ++++++++++------- src/Propellor/Property/SiteSpecific/JoeySites.hs | 3 ++- 2 files changed, 12 insertions(+), 8 deletions(-) (limited to 'src/Propellor/Property/SiteSpecific') diff --git a/src/Propellor/Property/Postfix.hs b/src/Propellor/Property/Postfix.hs index b6a1d170..df244061 100644 --- a/src/Propellor/Property/Postfix.hs +++ b/src/Propellor/Property/Postfix.hs @@ -139,14 +139,14 @@ data Service = Service , serviceCommand :: String , serviceOpts :: ServiceOpts } - deriving (Show) + deriving (Show, Eq) data ServiceType = InetService (Maybe HostName) ServicePort | UnixService FilePath PrivateService | FifoService FilePath PrivateService | PassService FilePath PrivateService - deriving (Show) + deriving (Show, Eq) -- Can be a port number or service name such as "smtp". type ServicePort = String @@ -160,7 +160,7 @@ data ServiceOpts = ServiceOpts , serviceWakeupTime :: Maybe Int , serviceProcessLimit :: Maybe Int } - deriving (Show) + deriving (Show, Eq) defServiceOpts :: ServiceOpts defServiceOpts = ServiceOpts @@ -254,13 +254,16 @@ parseServiceLine l = Service -- | Enables a `Service` in postfix's `masterCfFile`. service :: Service -> RevertableProperty NoInfo service s = (enable disable) - `describe` ("enabled postfix service " ++ show (serviceType s)) + `describe` desc where - enable = masterCfFile `File.containsLine` l + desc = "enabled postfix service " ++ show (serviceType s) + enable = masterCfFile `File.containsLine` (formatServiceLine s) `onChange` reloaded - disable = masterCfFile `File.lacksLine` l + disable = File.fileProperty desc (filter (not . matches)) masterCfFile `onChange` reloaded - l = formatServiceLine s + matches l = case parseServiceLine l of + Just s' | s' == s -> True + _ -> False -- | Installs saslauthd and configures it for postfix, authenticating -- against PAM. diff --git a/src/Propellor/Property/SiteSpecific/JoeySites.hs b/src/Propellor/Property/SiteSpecific/JoeySites.hs index 987b4187..f140404d 100644 --- a/src/Propellor/Property/SiteSpecific/JoeySites.hs +++ b/src/Propellor/Property/SiteSpecific/JoeySites.hs @@ -709,7 +709,8 @@ kiteMailServer = propertyList "kitenet.net mail server" $ props -- verification via tls cert. postfixClientRelay :: Context -> Property HasInfo postfixClientRelay ctx = Postfix.mainCfFile `File.containsLines` - [ "relayhost = kitenet.net" + -- Using smtps not smtp because more networks firewall smtp + [ "relayhost = kitenet.net:smtps" , "smtp_tls_CAfile = /etc/ssl/certs/joeyca.pem" , "smtp_tls_cert_file = /etc/ssl/certs/postfix.pem" , "smtp_tls_key_file = /etc/ssl/private/postfix.pem" -- cgit v1.3-2-g0d8e From 8c37f36b64268c24445f7f48247ae988d1f8d5ad Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 2 Jan 2016 22:15:07 -0400 Subject: clean cache on autobuilders --- src/Propellor/Property/SiteSpecific/GitAnnexBuilder.hs | 1 + 1 file changed, 1 insertion(+) (limited to 'src/Propellor/Property/SiteSpecific') diff --git a/src/Propellor/Property/SiteSpecific/GitAnnexBuilder.hs b/src/Propellor/Property/SiteSpecific/GitAnnexBuilder.hs index 2312846c..153d714f 100644 --- a/src/Propellor/Property/SiteSpecific/GitAnnexBuilder.hs +++ b/src/Propellor/Property/SiteSpecific/GitAnnexBuilder.hs @@ -118,6 +118,7 @@ standardAutoBuilder osver@(System _ arch) flavor = & os osver & Apt.stdSourcesList & Apt.unattendedUpgrades + & Apt.cacheCleaned & User.accountFor (User builduser) & tree arch flavor -- cgit v1.3-2-g0d8e