bundles/postfixadmin: introduce

This commit is contained in:
Franzi 2020-11-07 22:31:29 +01:00
parent 5550d2cc56
commit f42dda5961
Signed by: kunsi
GPG key ID: 12E3D2136B818350
7 changed files with 136 additions and 0 deletions

View file

@ -0,0 +1,32 @@
<?php
$CONF['configured'] = true;
$CONF['setup_password'] = '${setup_password}';
$CONF['database_type'] = 'pgsql';
$CONF['database_host'] = 'localhost';
$CONF['database_user'] = 'postfixadmin';
$CONF['database_password'] = '${database_password}';
$CONF['database_name'] = 'postfixadmin';
$CONF['admin_email'] = '${admin_email}';
$CONF['admin_name'] = 'root';
$CONF['generate_password'] = 'YES';
$CONF['page_size'] = '100';
$CONF['default_aliases'] = array (
'abuse' => '${admin_email}',
'hostmaster' => '${admin_email}',
'postmaster' => '${admin_email}',
);
$CONF['domain_quota'] = 'NO';
$CONF['aliases'] = '0';
$CONF['mailboxes'] = '0';
$CONF['maxquota'] = '0';
$CONF['domain_quota_default'] = '0';
$CONF['special_alias_control'] = 'YES';
$CONF['fetchmail'] = 'NO';
$CONF['show_footer_text'] = 'NO';

View file

@ -0,0 +1,5 @@
user = postfixadmin
password = ${node.metadata['postgresql']['users']['postfixadmin']['password']}
hosts = localhost
dbname = postfixadmin
query = SELECT domain FROM domain WHERE domain='%s' and backupmx = true

View file

@ -0,0 +1,5 @@
user = postfixadmin
password = ${node.metadata['postgresql']['users']['postfixadmin']['password']}
hosts = localhost
dbname = postfixadmin
query = SELECT goto FROM alias WHERE address='%s' AND active = true

View file

@ -0,0 +1,5 @@
user = postfixadmin
password = ${node.metadata['postgresql']['users']['postfixadmin']['password']}
hosts = localhost
dbname = postfixadmin
query = SELECT domain FROM domain WHERE domain='%s' AND backupmx = false AND active = true

View file

@ -0,0 +1,5 @@
user = postfixadmin
password = ${node.metadata['postgresql']['users']['postfixadmin']['password']}
hosts = localhost
dbname = postfixadmin
query = SELECT maildir FROM mailbox WHERE username='%s' AND active = true

View file

@ -0,0 +1,62 @@
assert node.has_bundle('php')
assert node.has_bundle('postfix')
directories = {
'/opt/postfixadmin': {},
'/opt/postfixadmin/templates_c': {
'owner': 'www-data',
'group': 'www-data',
'needs': {
'git_deploy:/opt/postfixadmin',
},
},
'/var/mail/vmail': {
'owner': 'nobody',
'group': 'nogroup',
},
}
git_deploy = {
'/opt/postfixadmin': {
'repo': 'https://github.com/postfixadmin/postfixadmin.git',
'rev': 'master',
},
}
files = {
'/opt/postfixadmin/config.local.php': {
'content_type': 'mako',
'context': {
'setup_password': node.metadata['postfixadmin']['setup_password'],
'admin_email': node.metadata['postfixadmin']['admin_email'],
'database_password': node.metadata['postgresql']['users']['postfixadmin']['password'],
},
'needs': {
'git_deploy:/opt/postfixadmin',
},
},
'/etc/postfix/pgsql/relay_domains.cf': {
'content_type': 'mako',
'triggers': {
'svc_systemd:postfix:restart',
},
},
'/etc/postfix/pgsql/virtual_alias_maps.cf': {
'content_type': 'mako',
'triggers': {
'svc_systemd:postfix:restart',
},
},
'/etc/postfix/pgsql/virtual_domains_maps.cf': {
'content_type': 'mako',
'triggers': {
'svc_systemd:postfix:restart',
},
},
'/etc/postfix/pgsql/virtual_mailbox_maps.cf': {
'content_type': 'mako',
'triggers': {
'svc_systemd:postfix:restart',
},
},
}

View file

@ -0,0 +1,22 @@
defaults = {
'apt': {
'packages': {
'postfix-pgsql',
},
},
'postfixadmin': {
'admin_email': 'hostmaster@kunbox.net',
},
'postgresql': {
'databases': {
'postfixadmin': {
'owner': 'postfixadmin',
},
},
'users': {
'postfixadmin': {
'password': repo.vault.password_for(node.name + ' postgresql postfixadmin'),
},
},
},
}