diff options
| author | Joey Hess <joeyh@joeyh.name> | 2015-11-25 13:59:51 -0400 |
|---|---|---|
| committer | Joey Hess <joeyh@joeyh.name> | 2015-11-25 14:02:32 -0400 |
| commit | 4e2aa1f39abd3a9c11fd863bf3b100653c7b961a (patch) | |
| tree | 440ecf8c13fd2493dedde0de2026663ca7d7a0ec /src | |
| parent | 6284e3f825ddf785f460f62ed4d681ad28ac788e (diff) | |
Added Postfix.saslPasswdSet.
Diffstat (limited to 'src')
| -rw-r--r-- | src/Propellor/Property/Postfix.hs | 16 | ||||
| -rw-r--r-- | src/Propellor/Property/SiteSpecific/JoeySites.hs | 2 |
2 files changed, 18 insertions, 0 deletions
diff --git a/src/Propellor/Property/Postfix.hs b/src/Propellor/Property/Postfix.hs index 562444da..5e265e6f 100644 --- a/src/Propellor/Property/Postfix.hs +++ b/src/Propellor/Property/Postfix.hs @@ -157,3 +157,19 @@ saslAuthdInstalled = setupdaemon postfixgroup = (User "postfix") `User.hasGroup` (Group "sasl") `onChange` restarted dir = "/var/spool/postfix/var/run/saslauthd" + +-- | Uses `saslpasswd2` to set the password for a user in the sasldb2 file. +-- +-- The password is taken from the privdata. +saslPasswdSet :: Domain -> User -> Property HasInfo +saslPasswdSet domain (User user) = withPrivData src ctx $ \getpw -> + property ("sasl password for " ++ uatd) $ getpw $ \pw -> makeChange $ + withHandle StdinHandle createProcessSuccess p $ \h -> do + hPutStrLn h (privDataVal pw) + hClose h + where + uatd = user ++ "@" ++ domain + ps = ["-p", "-c", "-u", domain, user] + p = proc "saslpasswd2" ps + ctx = Context "sasl" + src = PrivDataSource (Password uatd) "enter password" diff --git a/src/Propellor/Property/SiteSpecific/JoeySites.hs b/src/Propellor/Property/SiteSpecific/JoeySites.hs index d22eb615..2e34d75f 100644 --- a/src/Propellor/Property/SiteSpecific/JoeySites.hs +++ b/src/Propellor/Property/SiteSpecific/JoeySites.hs @@ -541,6 +541,8 @@ kiteMailServer = propertyList "kitenet.net mail server" $ props & dkimInstalled & Postfix.saslAuthdInstalled + & "/etc/default/saslauthd" `File.containsLine` "MECHANISMS=sasldb" + & Postfix.saslPasswdSet "kitenet.net" (User "errol") & Apt.installed ["maildrop"] & "/etc/maildroprc" `File.hasContent` |
