From 6284e3f825ddf785f460f62ed4d681ad28ac788e Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 25 Nov 2015 13:57:52 -0400 Subject: unused import --- src/Propellor/Property/User.hs | 1 - 1 file changed, 1 deletion(-) (limited to 'src') 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 -- cgit v1.2.3 From 4e2aa1f39abd3a9c11fd863bf3b100653c7b961a Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 25 Nov 2015 13:59:51 -0400 Subject: Added Postfix.saslPasswdSet. --- debian/changelog | 1 + src/Propellor/Property/Postfix.hs | 16 ++++++++++++++++ src/Propellor/Property/SiteSpecific/JoeySites.hs | 2 ++ 3 files changed, 19 insertions(+) (limited to 'src') diff --git a/debian/changelog b/debian/changelog index 4bcca675..ffd9eb07 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,7 @@ propellor (2.14.1) UNRELEASED; urgency=medium * User.hasDesktopGroups changed to avoid trying to add the user to groups that don't exist. + * Added Postfix.saslPasswdSet. -- Joey Hess Tue, 24 Nov 2015 17:06:12 -0400 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` -- cgit v1.2.3