Chef cookbook for a full posty mail server installation with Postfix, Dovecot, Roundcube, z-push, d-push, Postgrey, Spamhaus, automx, Amavis, ClamAV, SpamAssassin and Posty.
The following external cookbooks are used:
All dependencies are automatically resolved when using Berkshelf
The following platforms are currently supported and tested:
- Ubuntu 14.04
This recipe can be used in multiple ways. The Vagrant method is recommended for inexperienced Chef users.
Warning: This recipe installs a complete mail server with many individual programms, thus changes a lot of system files. Using it on an unconfigured system is recommended.
Just include posty
in your node's run_list
:
{
"name":"my_node",
"run_list": [
"recipe[posty]"
]
}
Then change the Attributes to your needs. The important attributes are:
default["posty"]["company_name"] = "Posty" # set it to your company name it is used in roundcube
default["tz"] = "Europe/Berlin" # set it to your timezone
default["posty"]["certificate_name"] = "ssl-cert-snakeoil" # change cert name and place certificate to /etc/ssl/certs/certificate_name.pem and key to /etc/ssl/private/certificate_name.key
default['mysqld']['root_password'] = "" # set a password for your mysql root user
default["posty"]["mail"]["domain"] = "example.com" # This domain is used to generate the postmaster address for emails from the local root user and other important notifications if the domain is example.com we use [email protected] for postmaster notifications and .forward file
default["posty"]["db"]["dbpass"] = "" # this password is for the database for posty
default["posty"]["roundcube"]["dbpass"] = "" # this password is for the roundcube database
default["posty"]["webui"]["htaccess_user"] = "" # set the htaccess user for the webui
default["posty"]["webui"]["htaccess_pass"] = "" # set the htaccess password for the webui
The IMPORTANT attributes: Please change it before the first chef zero run
default["posty"]["company_name"] = "Posty" # set it to your company name it is used in roundcube
default["tz"] = "Europe/Berlin" # set it to your timezone
default["posty"]["certificate_name"] = "ssl-cert-snakeoil" # change cert name and place certificate to /etc/ssl/certs/certificate_name.pem and key to /etc/ssl/private/certificate_name.key
default['mysqld']['root_password'] = "" # set a password for your mysql root user
default["posty"]["mail"]["domain"] = "example.com" # This domain is used to generate the postmaster address for emails from the local root user and other important notifications if the domain is example.com we use [email protected] for postmaster notifications and .forward file
default["posty"]["db"]["dbpass"] = "" # this password is for the database for posty
default["posty"]["roundcube"]["dbpass"] = "" # this password is for the roundcube database
default["posty"]["webui"]["htaccess_user"] = "" # set the htaccess user for the webui
default["posty"]["webui"]["htaccess_pass"] = "" # set the htaccess password for the webui
First create a chef repo for the box you will create eg. mail.example.com
chef generate repo mail.example.com
This creates a new chef repocd mail.example.com
Go to the new created foldertouch metadata.rb
create the missing metadata.rbberks init
creates the Berksfile- Now edit the Berksfile and add
cookbook "posty", path: 'path_to_the_downloaded_posty_cookbook'
instead of the metadata line berks vendor ./cookbooks
installs all cookbooks in the ./cookbook folder- Create a Role File for your needs and add the posty recipe to your run_list and set the important attributes above
knife zero bootstrap mail.example.com -r 'role[rolename]'
this bootstraps your server and runs chef-client with the role "rolename"
For the development of this cookbook and to allow easy testing of the posty system, an automated process to set up a virtual test/development machine is provided.
- Download the latest Vagrant version from the project page
dpkg -i vagrant*.deb; apt-get install -f
or install the deb via Ubuntu Software Centervagrant plugin install vagrant-omnibus
to install Omnibusvagrant plugin install vagrant-chef-zero
to install Chef Zerovagrant plugin install vagrant-berkshelf --plugin-version '>= 2.0.1'
to install Berkshelf
git clone https://github.com/posty/posty_chef
cd posty_chef
vagrant up
This sets up a virtual machine host posty-chef based on Ubuntu 14.04 providing all services mentioned above.
The IP address assigned to the host is 192.168.254.10 which can be changed by adapting the parameter "config.vm.network" in the Vagrantfile accordingly.
The setup takes a couple of minutes. After the installation has finished
you can login to the machine by running: vagrant ssh
The posty_webui, automx and the roundcube webmailer are reachable via HTTP and HTTPS
under the configured IP. The mail services are
reachable under the same IP.
See LICENSE file.