propellor spin
This commit is contained in:
parent
5c3b069f23
commit
614a6a13ac
|
@ -19,22 +19,31 @@ reloaded :: Property
|
|||
reloaded = Service.reloaded "postfix"
|
||||
|
||||
-- | Configures postfix as a satellite system, which
|
||||
-- relats all mail through a relay host, which defaults to smtp.domain.
|
||||
-- relays all mail through a relay host, which defaults to smtp.domain.
|
||||
--
|
||||
-- The smarthost may refuse to relay mail on to other domains, without
|
||||
-- futher coniguration/keys. But this should be enough to get cron job
|
||||
-- mail flowing to a place where it will be seen.
|
||||
satellite :: Property
|
||||
satellite = setup `requires` installed
|
||||
satellite = check norelayhost setup
|
||||
`requires` installed
|
||||
where
|
||||
setup = trivial $ property "postfix satellite system" $ do
|
||||
hn <- asks hostName
|
||||
let (_, domain) = separate (== '.') hn
|
||||
ensureProperty $ Apt.reConfigure "postfix"
|
||||
[ ("postfix/main_mailer_type", "select", "Satellite system")
|
||||
, ("postfix/root_address", "string", "root")
|
||||
, ("postfix/destinations", "string", " ")
|
||||
, ("postfix/mailname", "string", hn)
|
||||
, ("postfix/relayhost", "string", "smtp." ++ domain)
|
||||
]
|
||||
norelayhost = not . any relayhostset . lines
|
||||
<$> readProcess "postconf" []
|
||||
relayhostset l
|
||||
| l == "relayhost =" = False
|
||||
| "relayhost =" `isPrefixOf` l = True
|
||||
| otherwise = False
|
||||
|
||||
-- | Sets up a file by running a property (which the filename is passed
|
||||
-- to). If the setup property makes a change, postmap will be run on the
|
||||
|
|
Loading…
Reference in New Issue