propellor spin

This commit is contained in:
Joey Hess 2014-07-18 01:03:05 -04:00
parent fddcf13973
commit 2812719e54
Failed to extract signature
2 changed files with 19 additions and 8 deletions

View File

@ -3,6 +3,7 @@ module Propellor.Property.Postfix where
import Propellor import Propellor
import qualified Propellor.Property.Apt as Apt import qualified Propellor.Property.Apt as Apt
import Propellor.Property.File import Propellor.Property.File
import qualified Propellor.Property.Service as Service
import qualified Data.Map as M import qualified Data.Map as M
import Data.List import Data.List
@ -11,6 +12,9 @@ import Data.Char
installed :: Property installed :: Property
installed = Apt.serviceInstalledRunning "postfix" installed = Apt.serviceInstalledRunning "postfix"
restarted :: Property
restarted = Service.restarted "postfix"
-- | Configures postfix as a satellite system, which -- | Configures postfix as a satellite system, which
-- relats all mail through a relay host, which defaults to smtp.domain. -- relats all mail through a relay host, which defaults to smtp.domain.
-- --
@ -36,6 +40,11 @@ mappedFile :: FilePath -> (FilePath -> Property) -> Property
mappedFile f setup = setup f mappedFile f setup = setup f
`onChange` cmdProperty "postmap" [f] `onChange` cmdProperty "postmap" [f]
-- | Run newaliases command, which should be done after changing
-- /etc/aliases.
newaliases :: Property
newaliases = trivial $ cmdProperty "newaliases" []
-- | Parses main.cf, and removes any initial configuration lines that are -- | Parses main.cf, and removes any initial configuration lines that are
-- overridden to other values later in the file. -- overridden to other values later in the file.
-- --

View File

@ -392,12 +392,15 @@ kiteMailServer = propertyList "kitenet.net mail server"
, Apt.serviceInstalledRunning "spamassassin" , Apt.serviceInstalledRunning "spamassassin"
, "/etc/default/spamassassin" `File.containsLines` , "/etc/default/spamassassin" `File.containsLines`
[ "ENABLED=1" [ "# Propellor deployed"
, "ENABLED=1"
, "CRON=1"
, "OPTIONS=\"--create-prefs --max-children 5 --helper-home-dir\"" , "OPTIONS=\"--create-prefs --max-children 5 --helper-home-dir\""
, "CRON=1" , "CRON=1"
, "NICE=\"--nicelevel 15\"" , "NICE=\"--nicelevel 15\""
] `onChange` Service.restarted "spamassassin" ] `onChange` Service.restarted "spamassassin"
`describe` "spamd enabled" `describe` "spamd enabled"
`requires` Apt.serviceInstalledRunning "cron"
, Apt.serviceInstalledRunning "spamass-milter" , Apt.serviceInstalledRunning "spamass-milter"
-- Add -m to prevent modifying messages Subject or body. -- Add -m to prevent modifying messages Subject or body.
@ -408,7 +411,7 @@ kiteMailServer = propertyList "kitenet.net mail server"
, Apt.installed ["maildrop"] , Apt.installed ["maildrop"]
, "/etc/maildroprc" `File.hasContent` , "/etc/maildroprc" `File.hasContent`
[ "# Global maildrop filter file (deployed with propellor" [ "# Global maildrop filter file (deployed with propellor)"
, "DEFAULT=\"$HOME/Maildir\"" , "DEFAULT=\"$HOME/Maildir\""
, "MAILBOX=\"$DEFAULT/.\"" , "MAILBOX=\"$DEFAULT/.\""
, "# Filter spam to a spam folder, unless .keepspam exists" , "# Filter spam to a spam folder, unless .keepspam exists"
@ -422,22 +425,21 @@ kiteMailServer = propertyList "kitenet.net mail server"
`describe` "maildrop configured" `describe` "maildrop configured"
, "/etc/aliases" `File.hasPrivContentExposed` ctx , "/etc/aliases" `File.hasPrivContentExposed` ctx
`onChange` cmdProperty "newaliases" ["newaliases"] `onChange` Postfix.newaliases
, hasJoeyCAChain , hasJoeyCAChain
, "/etc/ssl/certs/postfix.pem" `File.hasPrivContentExposed` ctx , "/etc/ssl/certs/postfix.pem" `File.hasPrivContentExposed` ctx
, "/etc/ssl/private/postfix.pem" `File.hasPrivContent` ctx , "/etc/ssl/private/postfix.pem" `File.hasPrivContent` ctx
, "/etc/postfix/mydomain" `File.containsLines` , "/etc/postfix/mydomain" `File.containsLines`
[ "/.*\\.kitenet\\.net/\tOK" [ "/.*\\.kitenet\\.net/\tOK"
, "/mooix\\.net/\tOK"
, "/ikiwiki\\.info/\tOK" , "/ikiwiki\\.info/\tOK"
, "/joeyh\\.name/\tOK" , "/joeyh\\.name/\tOK"
] ]
`onChange` Service.restarted "postfix" `onChange` Postfix.restarted
`describe` "postfix mydomain file configured" `describe` "postfix mydomain file configured"
, "/etc/postfix/obscure_client_relay.pcre" `File.containsLine` , "/etc/postfix/obscure_client_relay.pcre" `File.containsLine`
"/^Received: from ([^.]+)\\.kitenet\\.net.*using TLS.*by kitenet\\.net \\(([^)]+)\\) with (E?SMTPS?A?) id ([A-F[:digit:]]+)(.*)/ IGNORE" "/^Received: from ([^.]+)\\.kitenet\\.net.*using TLS.*by kitenet\\.net \\(([^)]+)\\) with (E?SMTPS?A?) id ([A-F[:digit:]]+)(.*)/ IGNORE"
`onChange` Service.restarted "postfix" `onChange` Postfix.restarted
`describe` "postfix obscure_client_relay file configured" `describe` "postfix obscure_client_relay file configured"
, Postfix.mappedFile "/etc/postfix/virtual" , Postfix.mappedFile "/etc/postfix/virtual"
(flip File.containsLines (flip File.containsLines
@ -445,6 +447,7 @@ kiteMailServer = propertyList "kitenet.net mail server"
, "@joeyh.name\tjoey" , "@joeyh.name\tjoey"
] ]
) `describe` "postfix virtual file configured" ) `describe` "postfix virtual file configured"
`onChange` Postfix.restarted
, Postfix.mappedFile "/etc/postfix/relay_clientcerts" $ , Postfix.mappedFile "/etc/postfix/relay_clientcerts" $
flip File.hasPrivContentExposed ctx flip File.hasPrivContentExposed ctx
, Postfix.mainCf `File.containsLines` , Postfix.mainCf `File.containsLines`
@ -489,13 +492,12 @@ kiteMailServer = propertyList "kitenet.net mail server"
, "smtp_tls_session_cache_database = sdbm:/etc/postfix/smtp_scache" , "smtp_tls_session_cache_database = sdbm:/etc/postfix/smtp_scache"
] ]
`onChange` Postfix.dedupMainCf `onChange` Postfix.dedupMainCf
`onChange` Service.restarted "postfix" `onChange` Postfix.restarted
`describe` "postfix configured" `describe` "postfix configured"
, Apt.serviceInstalledRunning "dovecot-imapd" , Apt.serviceInstalledRunning "dovecot-imapd"
, Apt.serviceInstalledRunning "dovecot-pop3d" , Apt.serviceInstalledRunning "dovecot-pop3d"
, Apt.serviceInstalledRunning "cron"
, Apt.installed ["bsd-mailx"] , Apt.installed ["bsd-mailx"]
] ]
where where