summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJoey Hess2015-12-31 12:40:42 -0400
committerJoey Hess2015-12-31 12:40:42 -0400
commitbfe8375d46e78bc6dd796ba1d0bdce577dbd123c (patch)
tree547acbf0acb730d30f088b481a2ab95b22cc75d2 /src
parent5e73aa446e46b61ebea77af5a6addaa8be517c1d (diff)
actually parse service lines
So whitespace etc changes don't matter
Diffstat (limited to 'src')
-rw-r--r--src/Propellor/Property/Postfix.hs17
-rw-r--r--src/Propellor/Property/SiteSpecific/JoeySites.hs3
2 files changed, 12 insertions, 8 deletions
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"