Installs and configures a mail server using Postfix, Dovecot, PostfixAdmin and SpamAssassin, including Amazon SES support.
This cookbook has been tested on the following platforms:
- Amazon Linux
- CentOS >= 6.0
- Debian >= 7.0
- Fedora >= 17.0
- Ubuntu >= 12.04
Let me know if you use it successfully on any other platform.
- Dovecot >= 2: requires this version of dovecot to be available by the distribution's package manager.
| Attribute | Description | Default |
|---|---|---|
node['postfix-dovecot']['postmaster_address'] |
Postmaster mail address. | "[email protected]" |
node['postfix-dovecot']['hostname'] |
Hostname. | node["fqdn"] |
node['postfix-dovecot']['sieve']['enabled'] |
Whether to enable sieve. | true |
node['postfix-dovecot']['sieve']['global_path'] |
Sieve global path. | "#{default["dovecot"]["conf_path"]}/sieve/default.sieve" |
node['postfix-dovecot']['spamc']['enabled'] |
Whether to enable SpamAssassin | true |
node['postfix-dovecot']['spamc']['recipe'] |
Spamc recipe name to use. | "onddo-spamassassin" |
node['postfix-dovecot']['vmail']['user'] |
Virtual mail system user name. | "vmail" |
node['postfix-dovecot']['vmail']['group'] |
Virtual mail system group name. | node["postfix-dovecot"]["vmail"]["user"] |
node['postfix-dovecot']['vmail']['uid'] |
Virtual mail system user id. | 5000 |
node['postfix-dovecot']['vmail']['gid'] |
Virtual mail system group id. | node["postfix-dovecot"]["vmail"]["uid"] |
node['postfix-dovecot']['vmail']['home'] |
Virtual mail user home path. | "/var/vmail" |
node['postfix-dovecot']['ses']['enabled'] |
Whether to enable Amazon SES. | false |
node['postfix-dovecot']['ses']['username'] |
Amazon SES SMTP username. See the Obtaining Your Amazon SES SMTP Credentials documentation. | "USERNAME" |
node['postfix-dovecot']['ses']['password'] |
Amazon SES SMTP password. | "PASSWORD" |
node['postfix-dovecot']['ses']['servers'] |
Amazon SES SMTP servers. | [ |
Installs and configures everything.
Creates vmail user.
Installs and configures SpamAssassin.
Installs and configures Postfix.
Installs and configures PostfixAdmin.
Installs and configures Dovecot 2.
Running it from a recipe:
node['postfix-dovecot']['postmaster_address'] = '[email protected]'
node['postfix-dovecot']['hostname'] = 'mail.foobar.com'
include_recipe 'postfix-dovecot::default'
postfixadmin_admin '[email protected]' do
password 'sup3r-s3cr3t-p4ss'
action :create
end
postfixadmin_domain 'foobar.com' do
login_username '[email protected]'
login_password 'sup3r-s3cr3t-p4ss'
end
postfixadmin_mailbox '[email protected]' do
password 'alice'
login_username '[email protected]'
login_password 'sup3r-s3cr3t-p4ss'
end
postfixadmin_alias '[email protected]' do
goto '[email protected]'
login_username '[email protected]'
login_password 'sup3r-s3cr3t-p4ss'
endDon't forget to include the postfix-dovecot cookbook as a dependency in the metadata.
# metadata.rb
[...]
depends 'postfix-dovecot'Another alternative is to include the default recipe in your Run List.
{
"name": "mail.onddo.com",
[...]
"run_list": [
[...]
"recipe[postfix-dovecot]"
]
}vagrantberkshelf>=1.4.0test-kitchen>=1.0.0.alphakitchen-vagrant>=0.10.0
$ kitchen test
$ kitchen verify
[...]kitchen-vagrant>=0.10kitchen-digitalocean>=0.5kitchen-ec2>=0.8
You can run the tests in the cloud instead of using vagrant. First, you must set the following environment variables:
AWS_ACCESS_KEY_IDAWS_SECRET_ACCESS_KEYAWS_KEYPAIR_NAME: EC2 SSH public key name. This is the name used in Amazon EC2 Console's Key Pars section.EC2_SSH_KEY_PATH: EC2 SSH private key local full path. Only when you are not using an SSH Agent.DIGITAL_OCEAN_CLIENT_IDDIGITAL_OCEAN_API_KEYDIGITAL_OCEAN_SSH_KEY_IDS: DigitalOcean SSH numeric key IDs.DIGITAL_OCEAN_SSH_KEY_PATH: DigitalOcean SSH private key local full path. Only when you are not using an SSH Agent.
Then, you must configure test-kitchen to use .kitchen.cloud.yml configuration file:
$ export KITCHEN_LOCAL_YAML=".kitchen.cloud.yml"
$ kitchen list
[...]
You need to set the following environment variables:
AMAZON_SES_EMAIL_FROM: SES valid from address, only used in testsAMAZON_SES_SMTP_USERNAME: See Obtaining Your Amazon SES SMTP Credentials documentation.AMAZON_SES_SMTP_PASSWORD
Then, you must configure test-kitchen to use .kitchen.ses.yml configuration file:
$ export AMAZON_SES_EMAIL_FROM="[email protected]"
$ export AMAZON_SES_SMTP_USERNAME="..."
$ export AMAZON_SES_SMTP_PASSWORD="..."
$ export KITCHEN_LOCAL_YAML=".kitchen.ses.yml"
$ kitchen list
[...]
- Fork the repository on Github
- Create a named feature branch (like
add_component_x) - Write you change
- Write tests for your change (if applicable)
- Run the tests, ensuring they all pass
- Submit a Pull Request using Github
| Author: | Xabier de Zuazo ([email protected]) |
| Copyright: | Copyright (c) 2013-2014 Onddo Labs, SL. (www.onddo.com) |
| License: | Apache License, Version 2.0 |
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.