diff options
| author | Joey Hess <joeyh@joeyh.name> | 2015-11-25 14:05:54 -0400 |
|---|---|---|
| committer | Joey Hess <joeyh@joeyh.name> | 2015-11-25 14:05:54 -0400 |
| commit | 6a608d530ff2397ca3c28ba8e726c166b10a6ca0 (patch) | |
| tree | c90fd8d645629df5cde615333f92eb3cfe3e0fcf /src/Propellor | |
| parent | df91695d31d5c4d527af0532bebf36e8580c89e9 (diff) | |
| parent | 1d1cee078438844ddda4e214c8354fddd81d4cc9 (diff) | |
Merge branch 'joeyconfig'
Diffstat (limited to 'src/Propellor')
| -rw-r--r-- | src/Propellor/Property/Postfix.hs | 16 | ||||
| -rw-r--r-- | src/Propellor/Property/SiteSpecific/JoeySites.hs | 2 | ||||
| -rw-r--r-- | src/Propellor/Property/User.hs | 1 |
3 files changed, 18 insertions, 1 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` diff --git a/src/Propellor/Property/User.hs b/src/Propellor/Property/User.hs index 5bb4e1a7..564be82d 100644 --- a/src/Propellor/Property/User.hs +++ b/src/Propellor/Property/User.hs @@ -1,7 +1,6 @@ module Propellor.Property.User where import System.Posix -import Data.List import Propellor.Base import qualified Propellor.Property.File as File |
