Adoptable Cookbooks List

Looking for a cookbook to adopt? You can now see a list of cookbooks available for adoption!
List of Adoptable Cookbooks

Supermarket Belongs to the Community

Supermarket belongs to the community. While Chef has the responsibility to keep it running and be stewards of its functionality, what it does and how it works is driven by the community. The chef/supermarket repository will continue to be where development of the Supermarket application takes place. Come be part of shaping the direction of Supermarket by opening issues and pull requests or by joining us on the Chef Mailing List.

Select Badges

Select Supported Platforms


postfixadmin (16) Versions 1.1.0

Installs and configures PostfixAdmin, a web based interface used to manage mailboxes, virtual domains and aliases.

cookbook 'postfixadmin', '= 1.1.0'
cookbook 'postfixadmin', '= 1.1.0', :supermarket
knife supermarket install postfixadmin
knife supermarket download postfixadmin
Quality 100%


Cookbook Version Dependency Status Code Climate Build Status

Installs and configures PostfixAdmin, a web based interface used to manage mailboxes, virtual domains and aliases.

Also creates the required MySQL or PostgreSQL database and tables.

The first time it runs, automatically generates some passwords if not specified. Generated passwords are:

From the PostfixAdmin Default Recipe

  • postfixadmin/setup_password
  • postfixadmin/setup_password_salt
  • postfixadmin/setup_password_encrypted
  • postfixadmin/database/password

When MySQL Is Used

  • postfixadmin/mysql/server_root_password
  • postfixadmin/mysql/server_debian_password
  • postfixadmin/mysql/server_repl_password

When PostgreSQL Is Used

  • postgresql/password/postgres


Supported Platforms

This cookbook has been tested on the following platforms:

  • Amazon Linux
  • CentOS
  • Debian
  • Fedora
  • Ubuntu

Please, let us know if you use it successfully on any other platform.

Required Cookbooks

Required Applications

  • Ruby 1.9.3 or higher.


<table> <tr> <th>Attribute</th> <th>Description</th> <th>Default</th> </tr> <tr> <td><code>node['postfixadmin']['version']</code></td> <td>PostfixAdmin version</td> <td><code>"2.3.7"</code></td> </tr> <tr> <td><code>node['postfixadmin']['url']</code></td> <td>PostfixAdmin download URL</td> <td><em>calculated</em></td> </tr> <tr> <td><code>node['postfixadmin']['checksum']</code></td> <td>PostfixAdmin download file checksum</td> <td><code>"761074e711ab618deda425dc013133b9d5968e0859bb883f10164061fd87006e"</code></td> </tr> <tr> <td><code>node['postfixadmin']['port']</code></td> <td>PostfixAdmin listen port</td> <td><em>calculated: </em><code>"80"</code><em> or </em><code>"443"</code></td> </tr> <tr> <td><code>node['postfixadmin']['server_name']</code></td> <td>PostfixAdmin server name</td> <td><em>calculated</em></td> </tr> <tr> <td><code>node['postfixadmin']['server_aliases']</code></td> <td>PostfixAdmin server aliases</td> <td><code>[]</code></td> </tr> <tr> <td><code>node['postfixadmin']['headers']</code></td> <td>PostfixAdmin HTTP headers to set as hash</td> <td><code>{}</code></td> </tr> <tr> <td><code>node['postfixadmin']['ssl']</code></td> <td>enables HTTPS (with SSL)</td> <td><code>false</code></td> </tr> <tr> <td><code>node['postfixadmin']['encrypt_attributes']</code></td> <td>Whether to encrypt PostfixAdmin attributes containing credential secrets.</td> <td><code>false</code></td> </tr> <tr> <td><code>node['postfixadmin']['setup_password']</code></td> <td>PostfixAdmin Setup Password (required for chef-solo)</td> <td><em>calculated</em></td> </tr> <tr> <td><code>node['postfixadmin']['setup_password_salt']</code></td> <td>PostfixAdmin password salt (required for chef-solo)</td> <td><em>calculated</em></td> </tr> <tr> <td><code>node['postfixadmin']['web_server']</code></td> <td>Web server to use: <code>"apache"</code> or <code>"false"</code></td> <td><code>"apache"</code></td> </tr> <tr> <td><code>node['postfixadmin']['setup_password_encrypted']</code></td> <td>PostfixAdmin encrypted Password</td> <td><em>calculated</em></td> </tr> <tr> <td><code>node['postfixadmin']['database']['type']</code></td> <td>PostfixAdmin database type. Possible values are: <code>"mysql"</code>, <code>"postgresql" (Please, see <a href="#postgresql-support">below<a/>)</code></td> <td><code>"mysql"</code></td> </tr> <tr> <td><code>node['postfixadmin']['database']['name']</code></td> <td>PostfixAdmin database name</td> <td><code>"postfix"</code></td> </tr> <tr> <td><code>node['postfixadmin']['database']['host']</code></td> <td>PostfixAdmin database hostname or IP address</td> <td><code>"localhost"</code></td> </tr> <tr> <td><code>node['postfixadmin']['database']['user']</code></td> <td>PostfixAdmin database login username</td> <td><code>"postfix"</code></td> </tr> <tr> <td><code>node['postfixadmin']['database']['password']</code></td> <td>PostfixAdmin database login password (requried for chef-solo)</td> <td><em>calculated</em></td> </tr> <tr> <td><code>node['postfixadmin']['conf']['encrypt']</code></td> <td>The way do you want the passwords to be crypted</td> <td><code>"md5crypt"</code></td> </tr> <tr> <td><code>node['postfixadmin']['conf']['domain_path']</code></td> <td>Whether you want to store the mailboxes per domain</td> <td><code>"YES"</code></td> </tr> <tr> <td><code>node['postfixadmin']['conf']['domain_in_mailbox']</code></td> <td>Whether you want to have the domain in your mailbox</td> <td><code>"NO"</code></td> </tr> <tr> <td><code>node['postfixadmin']['conf']['fetchmail']</code></td> <td>Whether you want fetchmail tab</td> <td><code>"NO"</code></td> </tr> <tr> <td><code>node['postfixadmin']['packages']['requirements']</code></td> <td>PostfixAdmin required packages array</td> <td><em>calculated</em></td> </tr> <tr> <td><code>node['postfixadmin']['packages']['mysql']</code></td> <td>PostfixAdmin required packages array for MySQL support</td> <td><em>calculated</em></td> </tr> <tr> <td><code>node['postfixadmin']['packages']['postgresql']</code></td> <td>PostfixAdmin required packages array for PostgreSQL support</td> <td><em>calculated</em></td> </tr> <tr> <td><code>node["boxbilling"]["mysql"]["server_root_password"]</code></td> <td>PostfixAdmin MySQL <em>root</em> password.</td> <td><em>calculated</em></td> </tr> <tr> <td><code>node["boxbilling"]["mysql"]["server_debian_password"]</code></td> <td>PostfixAdmin MySQL <em>debian</em> user password.</td> <td><em>calculated</em></td> </tr> <tr> <td><code>node["boxbilling"]["mysql"]["server_repl_password"]</code></td> <td>PostfixAdmin MySQL <em>repl</em> user password.</td> <td><em>calculated</em></td> </tr> <tr> <td><code>node['postfixadmin']['map_files']['path']</code></td> <td>Path to generate map-files into</td> <td><code>"/etc/postfix/tables"</code></td> </tr> <tr> <td><code>node['postfixadmin']['map_files']['mode']</code></td> <td>Map-files file-mode bits</td> <td><code>00640</code></td> </tr> <tr> <td><code>node['postfixadmin']['map_files']['owner']</code></td> <td>Map-files files owner</td> <td><code>"root"</code></td> </tr> <tr> <td><code>node['postfixadmin']['map_files']['group']</code></td> <td>Map-files files group</td> <td><code>"postfix"</code></td> </tr> <tr> <td><code>node['postfixadmin']['map_files']['list']</code></td> <td>An array with map file names to generate</td> <td><code>[<br/>   "",<br/>   "",<br/>   "",<br/>   "",<br/>   "",<br/>   "",<br/>   ""<br/> ]</code></td> </tr> </table>

The HTTPS Certificate

This cookbook uses the ssl_certificate cookbook to create the HTTPS certificate. The namespace used is node['postfixadmin']. For example:

node.default['postfixadmin']['common_name'] = ''
include_recipe 'postfixadmin'

See the ssl_certificate namespace documentation for more information.

Encrypted Attributes

This cookbook can use the encrypted_attributes cookbook to encrypt the secrets generated during the Chef Run. This feature is disabled by default, but can be enabled setting the node["postfixadmin"]["encrypt_attributes"] attribute to true. For example:

include_recipe 'encrypted_attributes::users_data_bag'
node.default['postfixadmin']['encrypt_attributes'] = true
inclure_recipe 'postfixadmin'

This will create the following encrypted attributes:

  • node['postfixadmin']['setup_password']: PostfixAdmin setup.php setup password.
  • node['postfixadmin']['setup_password_encrypted']: PostfixAdmin setup.php setup password encrypted with a salt.
  • node['postfixadmin']['mysql']['server_root_password']: MySQL root user password.
  • node['postfixadmin']['mysql']['server_debian_password']: MySQL debian user password.
  • node['postfixadmin']['mysql']['server_repl_password']: MySQL repl user password.
  • node['postfixadmin']['database']['password']: MySQL PostfixAdmin user password.

Read the chef-encrypted-attributes gem documentation to learn how to read them.

Warning: When PostgreSQL is used, the database root password will still remain unencrypted in the node['postgresql']['password']['postgres'] attribute due to limitations of the postgresql cookbook.



Installs and configures PostfixAdmin.


Installs PostfixAdmin SQL map files to be used by Postfix.


Installs MySQL server for PostfixAdmin.


Installs PostgreSQL server for PostfixAdmin.



Create or remove a PostfixAdmin admin user. This kind of user is used to create the domains and mailboxes.

postfixadmin_admin Actions

  • create: Create a PostfixAdmin admin user (default).
  • remove: Remove a PostfixAdmin admin user.

postfixadmin_admin Attributes

<table> <tr> <th>Attribute</th> <th>Description</th> <th>Default</th> </tr> <tr> <td>user</td> <td>Username</td> <td><em>name attribute</em></td> </tr> <tr> <td>password</td> <td>Password</td> <td><code>"p@ssw0rd1"</code></td> </tr> <tr> <td>setup_password</td> <td>PostfixAdmin Setup Password</td> <td><code>node['postfixadmin']['setup_password']</code></td> </tr> <tr> <td>db_user</td> <td>Database username</td> <td><code>node['postfixadmin']['database']['user']</code></td> </tr> <tr> <td>db_password</td> <td>Database password</td> <td><code>node['postfixadmin']['database']['password']</code></td> </tr> <tr> <td>db_name</td> <td>Database name</td> <td><code>node['postfixadmin']['database']['name']</code></td> </tr> <tr> <td>db_host</td> <td>Database hostname</td> <td><code>node['postfixadmin']['database']['host']</code></td> </tr> <tr> <td>ssl</td> <td>Whether to use SSL on HTTP requests</td> <td><code>node['postfixadmin']['ssl']</code></td> </tr> </table>

postfixadmin_admin Example

postfixadmin_admin '' do
  password 'sup3r-s3cr3t-p4ss'
  action :create


Create domains.

postfixadmin_domain Actions

  • create

postfixadmin_domain Attributes

<table> <tr> <th>Attribute</th> <th>Description</th> <th>Default</th> </tr> <tr> <td>domain</td> <td>Domain name</td> <td><em>name attribute</em></td> </tr> <tr> <td>description</td> <td>Domain description</td> <td><code>""</code></td> </tr> <tr> <td>aliases</td> <td>Maximum number of aliases</td> <td><code>10</code></td> </tr> <tr> <td>mailboxes</td> <td>Maximum number of mailboxes</td> <td><code>10</code></td> </tr> <tr> <td>login_username</td> <td>Admin user to use</td> <td><em>required</em></td> </tr> <tr> <td>login_password</td> <td>Admin password </td> <td><em>required</em></td> </tr> <tr> <td>db_user</td> <td>Database username</td> <td><code>node['postfixadmin']['database']['user']</code></td> </tr> <tr> <td>db_password</td> <td>Database password</td> <td><code>node['postfixadmin']['database']['password']</code></td> </tr> <tr> <td>db_name</td> <td>Database name</td> <td><code>node['postfixadmin']['database']['name']</code></td> </tr> <tr> <td>db_host</td> <td>Database hostname</td> <td><code>node['postfixadmin']['database']['host']</code></td> </tr> <tr> <td>ssl</td> <td>Whether to use SSL on HTTP requests</td> <td><code>node['postfixadmin']['ssl']</code></td> </tr> </table>

postfixadmin_domain Example

# admin user copied from the previous example
postfixadmin_domain '' do
  login_username ''
  login_password 'sup3r-s3cr3t-p4ss'


Create a mailbox.

postfixadmin_mailbox Actions

  • create

postfixadmin_mailbox Attributes

<table> <tr> <th>Attribute</th> <th>Description</th> <th>Default</th> </tr> <tr> <td>mailbox</td> <td>Mailbox address to create</td> <td><em>name attribute</em></td> </tr> <tr> <td>password</td> <td>Mailbox password</td> <td><em>required</em></td> </tr> <tr> <td>name</td> <td>The name of the mailbox owner</td> <td><code>""</code></td> </tr> <tr> <td>active</td> <td>Active status</td> <td><code>true</code></td> </tr> <tr> <td>mail</td> <td>Whether to send a welcome email</td> <td><code>false</code></td> </tr> <tr> <td>login_username</td> <td>Admin user to use</td> <td><em>required</em></td> </tr> <tr> <td>login_password</td> <td>Admin password </td> <td><em>required</em></td> </tr> <tr> <td>db_user</td> <td>Database username</td> <td><code>node['postfixadmin']['database']['user']</code></td> </tr> <tr> <td>db_password</td> <td>Database password</td> <td><code>node['postfixadmin']['database']['password']</code></td> </tr> <tr> <td>db_name</td> <td>Database name</td> <td><code>node['postfixadmin']['database']['name']</code></td> </tr> <tr> <td>db_host</td> <td>Database hostname</td> <td><code>node['postfixadmin']['database']['host']</code></td> </tr> <tr> <td>ssl</td> <td>Whether to use SSL on HTTP requests</td> <td><code>node['postfixadmin']['ssl']</code></td> </tr> </table>

postfixadmin_mailbox Example

# admin user copied from the previous example
postfixadmin_mailbox '' do
  password 'alice'
  login_username ''
  login_password 'sup3r-s3cr3t-p4ss'


Create mailbox aliases.

postfixadmin_alias Actions

  • create

postfixadmin_alias Attributes

<table> <tr> <th>Attribute</th> <th>Description</th> <th>Default</th> </tr> <tr> <td>address</td> <td>Alias address</td> <td><em>name attribute</em></td> </tr> <tr> <td>goto</td> <td>Destination mailbox address</td> <td><em>required</em></td> </tr> <tr> <td>active</td> <td>Active status</td> <td><code>true</code></td> </tr> <tr> <td>login_username</td> <td>Admin user to use</td> <td><em>required</em></td> </tr> <tr> <td>login_password</td> <td>Admin password </td> <td><em>required</em></td> </tr> <tr> <td>db_user</td> <td>Database username</td> <td><code>node['postfixadmin']['database']['user']</code></td> </tr> <tr> <td>db_password</td> <td>Database password</td> <td><code>node['postfixadmin']['database']['password']</code></td> </tr> <tr> <td>db_name</td> <td>Database name</td> <td><code>node['postfixadmin']['database']['name']</code></td> </tr> <tr> <td>db_host</td> <td>Database hostname</td> <td><code>node['postfixadmin']['database']['host']</code></td> </tr> <tr> <td>ssl</td> <td>Whether to use SSL on HTTP requests</td> <td><code>node['postfixadmin']['ssl']</code></td> </tr> </table>

postfixadmin_alias Example

# admin user copied from the previous example
postfixadmin_alias '' do
  goto ''
  login_username ''
  login_password 'sup3r-s3cr3t-p4ss'


Create domain aliases. The alias_domain must already exist.

postfixadmin_alias_domain Actions

  • create

postfixadmin_alias_domain Attributes

<table> <tr> <th>Attribute</th> <th>Description</th> <th>Default</th> </tr> <tr> <td>alias_domain</td> <td>Alias domain</td> <td><em>name attribute</em></td> </tr> <tr> <td>target_domain</td> <td>Target domain</td> <td><em>required</em></td> </tr> <tr> <td>active</td> <td>Active status</td> <td><code>true</code></td> </tr> <tr> <td>login_username</td> <td>Admin user to use</td> <td><em>required</em></td> </tr> <tr> <td>login_password</td> <td>Admin password </td> <td><em>required</em></td> </tr> <tr> <td>db_user</td> <td>Database username</td> <td><code>node['postfixadmin']['database']['user']</code></td> </tr> <tr> <td>db_password</td> <td>Database password</td> <td><code>node['postfixadmin']['database']['password']</code></td> </tr> <tr> <td>db_name</td> <td>Database name</td> <td><code>node['postfixadmin']['database']['name']</code></td> </tr> <tr> <td>db_host</td> <td>Database hostname</td> <td><code>node['postfixadmin']['database']['host']</code></td> </tr> <tr> <td>ssl</td> <td>Whether to use SSL on HTTP requests</td> <td><code>node['postfixadmin']['ssl']</code></td> </tr> </table>

postfixadmin_alias_domain Example

# admin user copied from the previous example
postfixadmin_alias_domain '' do
  target_domain ''
  login_username ''
  login_password 'sup3r-s3cr3t-p4ss'

Usage Example

Including in a Cookbook Recipe

A complete example:

include_recipe 'postfixadmin::default'
include_recipe 'postfixadmin::map_files'
# or include them in your run-list

postfixadmin_admin '' do
  password 'sup3r-s3cr3t-p4ss'
  action :create

postfixadmin_domain '' do
  login_username ''
  login_password 'sup3r-s3cr3t-p4ss'

postfixadmin_mailbox '' do
  password 'alice'
  login_username ''
  login_password 'sup3r-s3cr3t-p4ss'

postfixadmin_alias '' do
  goto ''
  login_username ''
  login_password 'sup3r-s3cr3t-p4ss'

postfixadmin_alias_domain '' do
  target_domain ''
  login_username ''
  login_password 'sup3r-s3cr3t-p4ss'

Don't forget to include the postfixadmin cookbook as a dependency in the metadata.

# metadata.rb

depends 'postfixadmin'

Including in the Run List

Another alternative is to include the recipes in your Run List.

  "name": "",
  "run_list": [

PostgreSQL Support

PostgreSQL support should be considered experimental at the moment. Use at your own risk.

Any feedback you can provide regarding the PostgreSQL support will be greatly appreciated.

PostgreSQL Support on Debian and Ubuntu

Due to postgresql cookbook issue #108, you should configure your system locale correctly for PostgreSQL to work. You can use the locale cookbook to fix this. For example:

ENV['LANGUAGE'] = ENV['LANG'] = node['locale']['lang']
ENV['LC_ALL'] = node['locale']['lang']
include_recipe 'locale'
# ...
node.default['postfixadmin']['database']['type'] = 'postgresql'
include_recipe 'postfixadmin'

PostgreSQL Versions < 9.3

If you are using PostgreSQL version < 9.3, you may need to adjust the shmmax and shmall kernel parameters to configure the shared memory. You can see [the example used for the integration tests](test/cookbooks/postfixadmin_test/recipes/postgresql_memory.rb).




Please do not hesitate to open an issue with any questions or problems.




License and Author

Author: Xabier de Zuazo (
Contributor: chrludwig
Contributor: MATSUI Shinsuke (poppen)
Contributor: Brian Racer
Copyright: Copyright (c) 2013-2014 Onddo Labs, SL. (
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

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
See the License for the specific language governing permissions and
limitations under the License.

CHANGELOG for postfixadmin

This file is used to list changes made in each version of postfixadmin.

1.1.0 (2014-10-03)

  • Added depends mysql cookbook ~> 5.0.
  • Include PHP recipe to fix Fedora support.
  • Added LICENSE file.
  • travis.yml: exclude some groups from bundle install.
  • Gemfile:
    • Replaced vagrant git by vagrant-wrapper.
    • Berkshelf updated to 3.1.
  • Rakefile: require kitchen inside integration task.
  • Guardfile added.
  • Vagrantfile updated to work properly and documented in TESTING.
  • PostgreSQL support improved and documented.
  • Added Serverspec tests.
  • Set PATH for bats integration tests to avoid $LSOF monkey-patch.
  • Some integration tests improved.

1.0.1 (2014-09-14)

  • Do not include mysql::server recipe.
  • Added MySQL attributes documentation.
  • PostgreSQL password generation moved to recipe::postgresql.
  • README: generated password documentation fixed.
  • Added Fedora and Amazon Linux support.

1.0.0 (2014-09-14)

  • Fixed Apache 2.4 support.
  • FC001: Use strings in preference to symbols to access node attributes.
  • FC023: Prefer conditional attributes.
  • kitchen.yml: updated, some syntax improvements, added apt to the run list.
  • kitchen.yml: added hostname and forwarded ports.
  • Added file.
  • test/kitchen/cookbooks directory moved to test/cookbooks.
  • Gemfile updated and improved.
  • Added a TODO file.
  • Integrated with ssl_certificate cookbook and some related improvements:
    • Update Warning: This update will cause the self-signed certificate to be regenerated.
    • Added server_aliases attribute.
    • Added headers attribute.
    • Fixed SSL support in CentOS.
    • Both 80 and 443 ports remain enabled with SSL.
    • Update Warning: Log files path changed from postfix_access.log and postfix_ssl_access.log to postfix-access.log and postfix-ssl-access.log (the same applies applies to error logs).
    • Replaced returns in providers by nexts.
    • Fixed apache restart for LWRPs.
  • web_app-postfixadmin-reload resource for LWRPs after VirtualHost creation.
  • All RuboCop offenses fixed, Rakefile added.
    • Library methods changed from camelCase to snake_case.
    • exists? library methods renamed to exist?.
    • Replaced Chef::Application.fatal by exceptions: avoids daemon exit.
    • Fixed map-files integration tests.
  • PostfixAdmin::MySQL refactored: removed code duplication and logger configured.
  • PostfixAdmin::PHP code duplication removed.
  • Added PostgreSQL support (based on @anveo's work, thanks!), including:
    • PostfixAdmin::MySQL library renamed to PostfixAdmin::DB.
    • PostfixAdmin HTML error parsing improved.
    • Required packages installation refactored using attributes.
    • Fixed config.local.php group value without apache.
  • All integration tests fixed to pass.
  • Added listening port attribute:
    • Update Warning: Only one port will be enabled by default at the same time (no more non-SSL + SSL combo).
  • Added ChefSpec matchers.
  • Added ChefSpec tests.
  • Added travis.yml and multiple badges.
  • README: updated a paragraph about database support.
  • README: separated into multiple files and some titles fixed.
  • recipes::apache: fixed disabling web_app[postfixadmin-ssl].
  • Integrated with encrypted_attributes cookbook:
    • FC007: Ensure recipe dependencies are reflected in cookbook metadata.
    • attributes: disable encrypt_attributes by default.
  • Create MySQL database only for localhost.

0.2.0 (2014-05-24)

  • Default PostfixAdmin version updated to 2.3.7.
  • server_name attribute calculated.
  • README: Added requirements links.
  • README: Added Cookbook Badge.
  • README: some alias_domain titles fixed.
  • Added postfixadmin_alias_domain LWRP.
  • Added serverspec tests (issue #4, thanks MATSUI Shinsuke (poppen)).
  • Separate recipe for apache (issue #4, thanks MATSUI Shinsuke (poppen)).
  • Gemfile: switch to using the new version of vagrant (issue #4, thanks MATSUI Shinsuke (poppen)).
  • kitchen.yml: updated to latest format.

0.1.3 (2014-03-16)

  • Avoid nil package resource name for pkg_php_mbstring (issues #2 and #3, thanks chrludwig).

0.1.2 (2013-11-17)

  • Fixed compatibility issues with Chef 11.8 (issue #1, thanks mikelococo for reporting).
  • LWRPs fixed to notify only when an action is executed.

0.1.1 (2013-10-28)

  • metadata: provides without square brackets to avoid CHEF-3976

0.1.0 (2013-06-11)

  • Initial release of postfixadmin

Foodcritic Metric

1.1.0 passed this metric