- Overview
- Module Description - What the module does and why it is useful
- Setup - The basics of getting started with postfixadmin
- Usage - Configuration options and additional functionality
- Reference - An under-the-hood peek at what the module is doing and how
- Limitations - OS compatibility, etc.
- Development - Guide for contributing to the module
- Todo
Downloads, installs and configures Postfix Admin.
Postfix Admin provides a web interface to manage mailboxes, virtual domains and more. It requires PHP, Postfix and MySQL or PostgreSQL.
Besides a web interface, Postfix Admin also ships with a command line interface, postfixadmin-cli.
The parameter config_file_template has been renamed to custom_config_file in version 0.2.0, and is now a file-based resource, instead of template-based.
The parameter config_file_template has been renamed to custom_config_file in version 0.2.0, and is now a file-based resource, instead of template-based.
- Downloads, extracts and configures (but in a disabled state) Postfix Admin, version 3.1.
- Creates a postfixadmin user and group on Red Hat based distributions.
- Creates the parent directories for postfixadmin archive and extracted files.
This module expect either camptocamp-archive or puppet-archive to be installed. Neither are specified as dependency, but camptocamp-archive is the default.
By default, Postfix Admin will be extracted to /var/cache/puppet/archive and installed in /opt/postfixadmin-3.1, based on the specified version. Both parent directories should exist (and can be managed by setting manage_dirs to true).
To simply install postfixadmin without any configuration, (don't really) use:
class { '::postfixadmin':
manage_dirs => true,
configured => true,
}
By default, postfixadmins' config.inc.php file loads config.local.php, which is the file this module manages. The bare minimum is provided, but can be easily expanded by passing a hash to options_hash.
class { '::postfixadmin':
manage_dirs => true,
configured => true,
db_type => 'mysqli',
db_host => 'localhost',
db_user => 'postfix',
db_pass => 'postfix',
db_name => 'postfix',
encrypt => 'dovecot:SHA512-CRYPT',
options_hash => {
'admin_email' => 'admin@example.com',
'password_validation' => [
"/.{5}/' => 'password_too_short 5",
"/([a-zA-Z].*){3}/' => 'password_no_characters 3",
],
}
}
When this class is declared with the default options, Puppet:
- Downloads a postfixadmin archive, version, and extracts it to install_dir/version.
- Creates a new configuration file,
config.local.php. - Removes the installer directory from install_dir/version.
- Changes the owner and group of install_dir/version
/{logs,temp,config.local.php}towww-dataon Debian based distributions, and topostfixadminon RedHat and its derivatives. - Creates a system owner and group on RedHat based distributions, based on manage_user and process.
If you would just declare the default postfixadmin class, Postfix Admin will
be installed in a disabled state, since configured is set to
false by default.
Parameters within postfixadmin:
Sets the version of Postfix Admin. Default: 3.1.
class { '::postfixadmin':
version => '3.1',
}
Sets the checksum type, required for validating the Postfix Admin tarfile. Default: 36eaed433c673382fb5d513bc3b0d2685bf3169ead6065293d3a0f8f6d262aa4.
class { '::postfixadmin':
checksum_type => '36eaed433c673382fb5d513bc3b0d2685bf3169ead6065293d3a0f8f6d262aa4',
}
Sets the checksum method, required for validating the Postfix Admin tarfile. Default: sha256.
class { '::postfixadmin':
checksum => 'sha256',
}
Sets the archive_provider, required for downloading and extracting the Postfix Admin tarfile. Default: camptocamp.
class { '::postfixadmin':
archive_provider => 'camptocamp',
}
Creates the parent directories for install_dir and puppet_cache. Default: false.
class { '::postfixadmin':
manage_dirs => false,
}
Creates a system user and group, for ownership of install_dir/{logs,temp,config.local.php}. Default: true if facts[:os]['family'] == 'RedHat'.
class { '::postfixadmin':
manage_user => false,
}
Sets the parent directory for the files downloaded by the archive_provider. Default: /var/cache/puppet.
class { '::postfixadmin':
puppet_cache => '/var/cache/puppet',
}
Sets the directory which contains the files downloaded by the archive_provider. Default: /var/cache/puppet/archive.
class { '::postfixadmin':
archive_dir => '/var/cache/puppet/archive',
}
Sets the parent directory for the Postfix Admin installation. Default: /opt.
class { '::postfixadmin':
install_dir => '/opt',
}
Sets the user and group of the Postfix Admin web application. Default: Depends on your operating system.
- Debian:
www-data - Red Hat:
postfixadmin
class { '::postfixadmin':
process => 'www-data',
}
Enables the use of the Postfix Admin web application. Default: false.
class { '::postfixadmin':
configured => 'false',
}
Sets the type of the Postfix Admin database. Default: mysqli.
class { '::postfixadmin':
db_type => 'mysqli',
}
Sets the host of the Postfix Admin database. Default: localhost.
class { '::postfixadmin':
db_host => 'localhost',
}
Sets the user of the Postfix Admin database. Default: postfix.
class { '::postfixadmin':
db_user => 'postfix',
}
Sets the pass of the Postfix Admin database. Default: postfix.
class { '::postfixadmin':
db_pass => 'postfix',
}
Sets the name of the Postfix Admin database. Default: postfix.
class { '::postfixadmin':
db_name => 'postfix',
}
Sets the way passwords are encrypted. Default: dovecot:SHA512-CRYPT.
class { '::postfixadmin':
encrypt => 'dovecot:SHA512-CRYPT',
}
You can configure other parameters by passing a hash to options_hash.
Default: {}.
See config.inc.php from the Postfix Admin github repository for a full reference.
class { '::postfixadmin':
options_hash => {
'admin_email' => 'admin@example.com',
'smtp_server' => 'mail.example.com',
'domain_path' => 'NO',
'domain_in_mailbox' => 'NO',
'password_validation' => [
"/.{5}/' => 'password_too_short 5",
"/([a-zA-Z].*){3}/' => 'password_no_characters 3",
],
}
}
You can use a file for creating the config.local.php file: Default: undef.
class { '::postfixadmin':
custom_config_file => 'postfixadmin/my_custom_template.txt',
}
postfixadmin/files/my_custom_template.txt:
// Change the text between EOM.
$CONF['welcome_text'] = <<<EOM
Hi,
Welcome to your new account.
EOM;
You can use a file for adding custom functions to config.local.php file: Default: undef.
class { '::postfixadmin':
custom_functions_file => 'postfixadmin/my_custom_function.txt',
}
postfixadmin/files/my_custom_function.txt:
function language_hook($PALANG, $language) {
switch ($language) {
case "de":
$PALANG['x_whatever'] = 'foo';
break;
case "fr":
$PALANG['x_whatever'] = 'bar';
break;
default:
$PALANG['x_whatever'] = 'foobar';
}
return $PALANG;
}
- Requires manual seeding of database, ie
$ curl -v https://postfixadmin.example.com/setup.php - Does not manage a webserver.
- Does not manage a database.
- Does not manage PHP.
- Does not manage SELinux.
This project uses rspec-puppet and beaker to ensure the module works as expected and to prevent regressions.
- Fork it
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create new Pull Request
- Refactor for Puppet 4.
- Revisit
manage_dirs. - Automate seeding of database.