propellor-5.10.1: property-based host configuration management in haskell

Safe Haskell | None
Language | Haskell98

Propellor.Property.Postfix

Synopsis

- installed :: Property DebianLike
- restarted :: Property DebianLike
- reloaded :: Property DebianLike
- satellite :: Property DebianLike
- mappedFile :: Combines (Property x) (Property UnixLike) => FilePath -> (FilePath -> Property x) -> CombinedType (Property x) (Property UnixLike)
- newaliases :: Property UnixLike
- mainCfFile :: FilePath
- mainCf :: (String, String) -> Property UnixLike
- getMainCf :: String -> IO (Maybe String)
- mainCfIsSet :: String -> IO Bool
- dedupMainCf :: Property UnixLike
- dedupCf :: [String] -> [String]
- masterCfFile :: FilePath
- data Service = Service {
  - serviceType :: ServiceType
  - serviceCommand :: String
  - serviceOpts :: ServiceOpts
  }
- data ServiceType
  - = InetService (Maybe HostName) ServicePort
  - | UnixService FilePath PrivateService
  - | FifoService FilePath PrivateService
  - | PassService FilePath PrivateService
- type ServicePort = String
- type PrivateService = Bool
- data ServiceOpts = ServiceOpts {
  - serviceUnprivileged :: Maybe Bool
  - serviceChroot :: Maybe Bool
  - serviceWakeupTime :: Maybe Int
  - serviceProcessLimit :: Maybe Int
  }
- defServiceOpts :: ServiceOpts
- formatServiceLine :: Service -> Line
- parseServiceLine :: Line -> Maybe Service
- service :: Service -> RevertableProperty DebianLike DebianLike
- saslAuthdInstalled :: Property DebianLike
- saslPasswdSet :: Domain -> User -> Property (HasInfo + UnixLike)

# Documentation

installed :: Property DebianLike Source #

restarted :: Property DebianLike Source #

reloaded :: Property DebianLike Source #

satellite :: Property DebianLike Source #

Configures postfix as a satellite system, which relays all mail through a relay host, which defaults to smtp.domain, but can be changed by `mainCf "relayhost"`.

The smarthost may refuse to relay mail on to other domains, without further configuration/keys. But this should be enough to get cron job mail flowing to a place where it will be seen.

mappedFile :: Combines (Property x) (Property UnixLike) => FilePath -> (FilePath -> Property x) -> CombinedType (Property x) (Property UnixLike) Source #

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 file, and postfix will be reloaded.

newaliases :: Property UnixLike Source #

Run newaliases command, which should be done after changing `etcaliases`.

mainCfFile :: FilePath Source #

The main config file for postfix.

mainCf :: (String, String) -> Property UnixLike Source #

Sets a main.cf `name=value` pair. Does not reload postfix immediately.

getMainCf :: String -> IO (Maybe String) Source #

Gets a main.cf setting.

mainCfIsSet :: String -> IO Bool Source #

Checks if a main.cf field is set. A field that is set to the empty string is considered not set.

dedupMainCf :: Property UnixLike Source #

Parses main.cf, and removes any initial configuration lines that are overridden to other values later in the file.

For example, to add some settings, removing any old settings:

     mainCf `File.containsLines`
    	[ "# I like bars."
    	, "foo = bar"
    	] `onChange` dedupMainCf

Note that multiline configurations that continue onto the next line are not currently supported.

dedupCf :: [String] -> [String] Source #

masterCfFile :: FilePath Source #

The master config file for postfix.

data Service Source #

A service that can be present in the master config file.

Constructors

Service |

Fields

- serviceType :: ServiceType
- serviceCommand :: String
- serviceOpts :: ServiceOpts

Instances

Eq Service Source # |
Instance details Defined in Propellor.Property.Postfix Methods (==) :: Service -> Service -> Bool (/=) :: Service -> Service -> Bool
Show Service Source # |
Instance details Defined in Propellor.Property.Postfix Methods showsPrec :: Int -> Service -> ShowS show :: Service -> String showList :: [Service] -> ShowS

data ServiceType Source #

Constructors

InetService (Maybe HostName) ServicePort |
UnixService FilePath PrivateService |
FifoService FilePath PrivateService |
PassService FilePath PrivateService |

Instances

Eq ServiceType Source # |
Instance details Defined in Propellor.Property.Postfix Methods (==) :: ServiceType -> ServiceType -> Bool (/=) :: ServiceType -> ServiceType -> Bool
Show ServiceType Source # |
Instance details Defined in Propellor.Property.Postfix Methods showsPrec :: Int -> ServiceType -> ShowS show :: ServiceType -> String showList :: [ServiceType] -> ShowS

type ServicePort = String Source #

type PrivateService = Bool Source #

data ServiceOpts Source #

Options for a service.

Constructors

ServiceOpts |

Fields

- serviceUnprivileged :: Maybe Bool
- serviceChroot :: Maybe Bool
- serviceWakeupTime :: Maybe Int
- serviceProcessLimit :: Maybe Int

Instances

Eq ServiceOpts Source # |
Instance details Defined in Propellor.Property.Postfix Methods (==) :: ServiceOpts -> ServiceOpts -> Bool (/=) :: ServiceOpts -> ServiceOpts -> Bool
Show ServiceOpts Source # |
Instance details Defined in Propellor.Property.Postfix Methods showsPrec :: Int -> ServiceOpts -> ShowS show :: ServiceOpts -> String showList :: [ServiceOpts] -> ShowS

defServiceOpts :: ServiceOpts Source #

formatServiceLine :: Service -> Line Source #

parseServiceLine :: Line -> Maybe Service Source #

Note that this does not handle multi-line service entries, in which subsequent lines are indented. `serviceLine` does not generate such entries.

service :: Service -> RevertableProperty DebianLike DebianLike Source #

Enables a `Service` in postfix's `masterCfFile`.

saslAuthdInstalled :: Property DebianLike Source #

Installs saslauthd and configures it for postfix, authenticating against PAM.

Does not configure postfix to use it; eg `smtpd_sasl_auth_enable = yes` needs to be set to enable use. See https://wiki.debian.org/PostfixAndSASL.

Password brute force attacks are possible when SASL auth is enabled. It would be wise to enable fail2ban, for example:

    Fail2Ban.jailEnabled "postfix-sasl"

saslPasswdSet :: Domain -> User -> Property (HasInfo + UnixLike) Source #

Uses `saslpasswd2` to set the password for a user in the sasldb2 file.

The password is taken from the privdata.