2021-03-21 10:12:03 +00:00
|
|
|
from bundlewrap.metadata import atomic
|
|
|
|
|
2020-11-07 21:31:47 +00:00
|
|
|
defaults = {
|
|
|
|
'apt': {
|
|
|
|
'packages': {
|
|
|
|
'dovecot-imapd': {},
|
|
|
|
'dovecot-lmtpd': {},
|
|
|
|
'dovecot-managesieved': {},
|
|
|
|
'dovecot-pgsql': {},
|
|
|
|
'dovecot-sieve': {},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
'icinga2_api': {
|
|
|
|
'dovecot': {
|
|
|
|
'services': {
|
|
|
|
'DOVECOT PROCESS': {
|
|
|
|
'command_on_monitored_host': '/usr/local/share/icinga/plugins/check_systemd_unit dovecot',
|
|
|
|
},
|
|
|
|
'IMAP CONNECT': {
|
|
|
|
'check_command': 'check_imap',
|
|
|
|
'vars.imap_port': 143,
|
2021-01-02 11:26:37 +00:00
|
|
|
'vars.notification.sms': True,
|
2020-11-07 21:31:47 +00:00
|
|
|
},
|
|
|
|
'IMAPS CONNECT': {
|
|
|
|
'check_command': 'check_imap',
|
|
|
|
'vars.imap_port': 993,
|
|
|
|
'vars.imap_ssl': True,
|
2021-01-02 11:26:37 +00:00
|
|
|
'vars.notification.sms': True,
|
2020-11-07 21:31:47 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2020-11-08 09:42:08 +00:00
|
|
|
'letsencrypt': {
|
|
|
|
'reload_after': {
|
|
|
|
'dovecot',
|
|
|
|
},
|
|
|
|
},
|
2020-11-07 21:31:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if node.has_bundle('postfixadmin'):
|
|
|
|
defaults['dovecot'] = {
|
|
|
|
'database': {
|
|
|
|
'dbname': 'postfixadmin',
|
|
|
|
'dbuser': 'postfixadmin',
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2021-04-23 17:31:28 +00:00
|
|
|
if node.has_bundle('telegraf'):
|
|
|
|
defaults['telegraf'] = {
|
|
|
|
'input_plugins': {
|
|
|
|
'builtin': {
|
2021-04-24 09:45:58 +00:00
|
|
|
'dovecot': [{
|
|
|
|
'type': 'global',
|
|
|
|
}],
|
2021-04-23 17:31:28 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2020-11-07 21:31:47 +00:00
|
|
|
|
2021-01-07 17:44:38 +00:00
|
|
|
@metadata_reactor.provides(
|
|
|
|
'dovecot/admin_email',
|
|
|
|
'dovecot/database/dbpass',
|
|
|
|
)
|
2020-11-07 21:31:47 +00:00
|
|
|
def import_database_settings_from_postfixadmin(metadata):
|
|
|
|
if not node.has_bundle('postfixadmin'):
|
|
|
|
raise DoNotRunAgain
|
|
|
|
|
|
|
|
return {
|
|
|
|
'dovecot': {
|
|
|
|
'admin_email': metadata.get('postfixadmin/admin_email'),
|
|
|
|
'database': {
|
2020-11-10 11:37:58 +00:00
|
|
|
'dbpass': metadata.get('postgresql/roles/postfixadmin/password'),
|
2020-11-07 21:31:47 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
2021-03-21 10:12:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
@metadata_reactor.provides(
|
2023-09-24 18:59:58 +00:00
|
|
|
'firewall/port_rules',
|
|
|
|
'firewall/port_rules',
|
|
|
|
'firewall/port_rules',
|
2021-03-21 10:12:03 +00:00
|
|
|
)
|
2021-06-03 11:59:15 +00:00
|
|
|
def firewall(metadata):
|
2021-03-21 10:12:03 +00:00
|
|
|
return {
|
2021-06-03 11:59:15 +00:00
|
|
|
'firewall': {
|
2021-03-21 10:12:03 +00:00
|
|
|
'port_rules': {
|
|
|
|
# imap(s)
|
2023-09-24 18:59:58 +00:00
|
|
|
'143/tcp': atomic(metadata.get('dovecot/restrict-to', {'*'})),
|
|
|
|
'993/tcp': atomic(metadata.get('dovecot/restrict-to', {'*'})),
|
2021-03-21 10:12:03 +00:00
|
|
|
# managesieve
|
2023-09-24 18:59:58 +00:00
|
|
|
'4190/tcp': atomic(metadata.get('dovecot/restrict-to', {'*'})),
|
2021-03-21 10:12:03 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|