Commit b5ccfb2e authored by Joanne Hugé's avatar Joanne Hugé

WIP

parent 2be9e8dc
# mail-server
- Local IMAP / SMTP mail server using Dovecot and Postfix
- Runs on port 10143 and 10025
- Designed to be deployed on 4G / 5G base stations such as ORS
...@@ -15,34 +15,25 @@ ...@@ -15,34 +15,25 @@
[template] [template]
filename = instance.cfg.in filename = instance.cfg.in
md5sum = 06e676a14d64c2aa394bab2849aff687 md5sum = 7ab3b606972e1b338d28fc1374617835
[template-default] [template-default]
_update_hash_filename_ = instance-default.cfg.in _update_hash_filename_ = instance-default.cfg.in
md5sum = 21f59e513b2ab8cce8a428dd30a6fe26 md5sum = 123a56ab69723d869bc52169fa5d530b
[dovecot.jinja2.conf] [dovecot.jinja2.conf]
_update_hash_filename_ = dovecot.jinja2.conf _update_hash_filename_ = dovecot.jinja2.conf
md5sum = 9bf03ace9c104b8d566e782a6578561e md5sum = a1f695cb881e9be680b7b8a597a4b0c9
[dovecot-passwd.jinja2]
_update_hash_filename_ = dovecot-passwd.jinja2
md5sum = 9e895c044984534a330328329b8b8462
[dovecot-passdb.jinja2.lua] [dovecot-passdb.jinja2.lua]
_update_hash_filename_ = dovecot-passdb.jinja2.lua _update_hash_filename_ = dovecot-passdb.jinja2.lua
md5sum = 060107ee6ad0eb9092529bc2bd1ee52f md5sum = 060107ee6ad0eb9092529bc2bd1ee52f
[postfix_main.jinja2.cf] [postfix_main.jinja2.cf]
_update_hash_filename_ = postfix_main.jinja2.cf _update_hash_filename_ = postfix_main.jinja2.cf
md5sum = b0e5870eb65fe70e01e6787e825b78eb md5sum = e3b2b86282816ac4020154de70cd5074
[postfix_master.jinja2.cf] [postfix_master.jinja2.cf]
_update_hash_filename_ = postfix_master.jinja2.cf _update_hash_filename_ = postfix_master.jinja2.cf
md5sum = 7752a8b4af5c18dc404e0a862af89272 md5sum = 7752a8b4af5c18dc404e0a862af89272
[postfix_alias.jinja2]
_update_hash_filename_ = postfix_alias.jinja2
md5sum = ea0165b66d7d3da48c4977dc611c044a
[postfix_mailname.jinja2]
_update_hash_filename_ = postfix_mailname.jinja2
md5sum = e7eb11cb4485b0d46f968f612643c1b0
[postfix_vmailbox.jinja2] [postfix_vmailbox.jinja2]
_update_hash_filename_ = postfix_vmailbox.jinja2 _update_hash_filename_ = postfix_vmailbox.jinja2
md5sum = b01eb42fd9cecc1fcc9bad85f463eea6 md5sum = b01eb42fd9cecc1fcc9bad85f463eea6
......
alpha:{PLAIN}ors123
bravo:{PLAIN}ors123
charlie:{PLAIN}ors123
delta:{PLAIN}ors123
...@@ -78,10 +78,6 @@ namespace inbox { ...@@ -78,10 +78,6 @@ namespace inbox {
ssl = no ssl = no
# passdb {
# args = {{ dovecot_passwd }}
# driver = passwd-file
# }
passdb { passdb {
driver = lua driver = lua
args = file={{ dovecot_passdb_lua }} blocking=yes args = file={{ dovecot_passdb_lua }} blocking=yes
......
...@@ -3,10 +3,10 @@ ...@@ -3,10 +3,10 @@
"$schema": "http://json-schema.org/draft-04/schema", "$schema": "http://json-schema.org/draft-04/schema",
"title": "Input Parameters", "title": "Input Parameters",
"properties": { "properties": {
"mail_domain": { "dns_sr_url": {
"default": "ors.rapid.space", "default": "",
"title": "Mail domain", "title": "DNS SR URL",
"description": "Mail domain", "description": "URL of the SR running the DNS server",
"type": "string" "type": "string"
} }
} }
......
...@@ -67,15 +67,10 @@ context = ...@@ -67,15 +67,10 @@ context =
url = {{ dovecot_conf_template }} url = {{ dovecot_conf_template }}
output = ${directory:etc}/dovecot.conf output = ${directory:etc}/dovecot.conf
extra-context = extra-context =
key dovecot_passwd dovecot-passwd:output
key dovecot_passdb_lua dovecot-passdb-lua:output key dovecot_passdb_lua dovecot-passdb-lua:output
raw postfix_auth ${directory:var-spool-postfix-private}/auth raw postfix_auth ${directory:var-spool-postfix-private}/auth
raw postfix_dovecot_lmtp ${directory:var-spool-postfix-private}/dovecot-lmtp raw postfix_dovecot_lmtp ${directory:var-spool-postfix-private}/dovecot-lmtp
[dovecot-passwd]
<= config-base
url = {{ dovecot_passwd_template }}
output = ${directory:etc}/dovecot-passwd
[dovecot-passdb-lua] [dovecot-passdb-lua]
<= config-base <= config-base
url = {{ dovecot_passdb_lua_template }} url = {{ dovecot_passdb_lua_template }}
...@@ -97,16 +92,6 @@ init = ...@@ -97,16 +92,6 @@ init =
except: except:
options['ipv4'] = "0.0.0.0" options['ipv4'] = "0.0.0.0"
[typed-paths]
# Postfix-friendly rendering of file paths, prefixed with database type.
aliases = hash:${postfix-alias:output}
[{{ section('postalias-db') }}]
recipe = plone.recipe.command
stop-on-error = true
command = '${wrapper-postalias:wrapper-path}' '${typed-paths:aliases}'
update-command = ${:command}
[{{ section('postmap-virtual') }}] [{{ section('postmap-virtual') }}]
recipe = plone.recipe.command recipe = plone.recipe.command
stop-on-error = true stop-on-error = true
...@@ -124,8 +109,6 @@ update-command = ${:command} ...@@ -124,8 +109,6 @@ update-command = ${:command}
url = {{ postfix_main_template }} url = {{ postfix_main_template }}
output = ${directory:etc-postfix}/main.cf output = ${directory:etc-postfix}/main.cf
extra-context = extra-context =
key alias_file postfix-alias:output
key mailname_file postfix-mailname:output
key vmailbox_file postfix-vmailbox:output key vmailbox_file postfix-vmailbox:output
key virtual_file postfix-virtual:output key virtual_file postfix-virtual:output
key bin_directory directory:bin key bin_directory directory:bin
...@@ -138,34 +121,26 @@ extra-context = ...@@ -138,34 +121,26 @@ extra-context =
key mail_owner userinfo:pw-name key mail_owner userinfo:pw-name
key setgid_group userinfo:gr-name key setgid_group userinfo:gr-name
key ip_address slap-configuration:ipv6-random key ip_address slap-configuration:ipv6-random
key mail_domain request-dns-entry:connection-domain
raw xz_utils_location {{ xz_utils_location }} raw xz_utils_location {{ xz_utils_location }}
raw postfix_location {{ postfix_location }} raw postfix_location {{ postfix_location }}
raw mail_domain {{ slapparameter_dict.get('mail_domain', 'ors.rapid.space') }}
[postfix-conf-master] [postfix-conf-master]
<= config-base <= config-base
url = {{ postfix_master_template }} url = {{ postfix_master_template }}
output = ${directory:etc-postfix}/master.cf output = ${directory:etc-postfix}/master.cf
[postfix-alias]
<= config-base
url = {{ postfix_alias_template }}
output = ${directory:etc-postfix}/postfix-alias
[postfix-mailname]
<= config-base
url = {{ postfix_mailname_template }}
output = ${directory:etc-postfix}/postfix-mailname
[postfix-vmailbox] [postfix-vmailbox]
<= config-base <= config-base
url = {{ postfix_vmailbox_template }} url = {{ postfix_vmailbox_template }}
output = ${directory:etc-postfix}/postfix-vmailbox output = ${directory:etc-postfix}/postfix-vmailbox
extra-context = extra-context =
raw mail_domain {{ slapparameter_dict.get('mail_domain', 'ors.rapid.space') }} raw mail_domain {{ slapparameter_dict.get('mail_domain', '') }}
[postfix-virtual] [postfix-virtual]
<= config-base <= config-base
url = {{ postfix_virtual_template }} url = {{ postfix_virtual_template }}
output = ${directory:etc-postfix}/postfix-virtual output = ${directory:etc-postfix}/postfix-virtual
extra-context = extra-context =
raw mail_domain {{ slapparameter_dict.get('mail_domain', 'ors.rapid.space') }} raw mail_domain {{ slapparameter_dict.get('mail_domain', '') }}
[dovecot-wrapper] [dovecot-wrapper]
recipe = slapos.recipe.template recipe = slapos.recipe.template
...@@ -209,6 +184,47 @@ hash-files = ...@@ -209,6 +184,47 @@ hash-files =
${postfix-conf-main:output} ${postfix-conf-main:output}
${postfix-wrapper:output} ${postfix-wrapper:output}
[publish-connection-parameters]
recipe = slapos.cookbook:publish
<= monitor-publish
imap-port = 10143
smtp-port = 10025
imap-smtp-ipv6 = ${slap-configuration:ipv6-random}
{% if slapparameter_dict.get('dns_sr_url', '') %}
domain = ${request-dns-entry:connection-domain}
{% endif %}
[imap-listen-promise]
<= monitor-promise-base
promise = check_socket_listening
name = imap_listen.py
config-host = ${slap-configuration:ipv6-random}
config-port = 10143
[smtp-listen-promise]
<= monitor-promise-base
promise = check_socket_listening
name = smtp_listen.py
config-host = ${slap-configuration:ipv6-random}
config-port = 10025
[request-dns-entry]
name = dns-mail-entry
recipe = slapos.cookbook:request.serialised
software-url = {{ slapparameter_dict['dns_sr_url'] }}
software-type = core-network
server-url = {{ slap_connection['server-url'] }}
computer-id = {{ slap_connection['computer-id'] }}
partition-id = {{ slap_connection['partition-id'] }}
key-file = {{ slap_connection['key-file'] }}
cert-file = {{ slap_connection['cert-file'] }}
shared = true
sla-computer_guid = {{ slap_connection['computer-id'] }}
config-name = dns-mail-entry
config-subdomain = mail
config-ip = ${slap-configuration:ipv6-random}
return = domain ip
[base-wrapper] [base-wrapper]
recipe = slapos.cookbook:wrapper recipe = slapos.cookbook:wrapper
environment = environment =
...@@ -238,7 +254,6 @@ path = {{ postfix_location }}/usr/sbin ...@@ -238,7 +254,6 @@ path = {{ postfix_location }}/usr/sbin
( (
'base-sbin-bin-wrapper', 'base-sbin-bin-wrapper',
( (
'postalias',
'postcat', 'postcat',
'postconf', 'postconf',
'postdrop', 'postdrop',
...@@ -267,6 +282,8 @@ command-line = ${directory:usr}/libexec/postfix/master -c ${directory:etc-postfi ...@@ -267,6 +282,8 @@ command-line = ${directory:usr}/libexec/postfix/master -c ${directory:etc-postfi
wrapper-path = ${directory:run}/postfix-master wrapper-path = ${directory:run}/postfix-master
[buildout] [buildout]
extends =
{{ template_monitor }}
parts = parts =
directory directory
dovecot-conf dovecot-conf
...@@ -275,9 +292,15 @@ parts = ...@@ -275,9 +292,15 @@ parts =
postfix-conf-master postfix-conf-master
postfix-service postfix-service
postfix-symlinks-libexec postfix-symlinks-libexec
monitor-base
publish-connection-parameters
imap-listen-promise
smtp-listen-promise
{{ part_list | join('\n ') }} {{ part_list | join('\n ') }}
{% if slapparameter_dict.get('dns_sr_url', '') %}
request-dns-entry
{% endif %}
eggs-directory = {{ eggs_directory }} eggs-directory = {{ eggs_directory }}
develop-eggs-directory = {{ develop_eggs_directory }} develop-eggs-directory = {{ develop_eggs_directory }}
offline= true offline= true
...@@ -22,14 +22,11 @@ context = ...@@ -22,14 +22,11 @@ context =
key slapparameter_dict slap-configuration:configuration key slapparameter_dict slap-configuration:configuration
raw template_monitor ${monitor2-template:output} raw template_monitor ${monitor2-template:output}
raw dovecot_conf_template ${dovecot.jinja2.conf:target} raw dovecot_conf_template ${dovecot.jinja2.conf:target}
raw dovecot_passwd_template ${dovecot-passwd.jinja2:target}
raw dovecot_passdb_lua_template ${dovecot-passdb.jinja2.lua:target} raw dovecot_passdb_lua_template ${dovecot-passdb.jinja2.lua:target}
raw dovecot_binary ${dovecot:location}/sbin/dovecot raw dovecot_binary ${dovecot:location}/sbin/dovecot
raw postfix_main_template ${postfix_main.jinja2.cf:target} raw postfix_main_template ${postfix_main.jinja2.cf:target}
raw postfix_master_template ${postfix_master.jinja2.cf:target} raw postfix_master_template ${postfix_master.jinja2.cf:target}
raw postfix_alias_template ${postfix_alias.jinja2:target}
raw postfix_virtual_template ${postfix_virtual.jinja2:target} raw postfix_virtual_template ${postfix_virtual.jinja2:target}
raw postfix_mailname_template ${postfix_mailname.jinja2:target}
raw postfix_vmailbox_template ${postfix_vmailbox.jinja2:target} raw postfix_vmailbox_template ${postfix_vmailbox.jinja2:target}
raw postfix_location ${postfix:location} raw postfix_location ${postfix:location}
raw xz_utils_location ${xz-utils:location} raw xz_utils_location ${xz-utils:location}
......
postmaster: alpha
postmaster: bravo
postmaster: charlie
...@@ -18,9 +18,6 @@ smtputf8_enable = no ...@@ -18,9 +18,6 @@ smtputf8_enable = no
mail_owner = {{ mail_owner }} mail_owner = {{ mail_owner }}
setgid_group = {{ setgid_group }} setgid_group = {{ setgid_group }}
alias_maps = hash:{{ alias_file }}
alias_database = hash:{{ alias_file }}
virtual_mailbox_domains = {{ mail_domain }} virtual_mailbox_domains = {{ mail_domain }}
virtual_mailbox_base = {{ vhosts_directory }} virtual_mailbox_base = {{ vhosts_directory }}
virtual_mailbox_maps = hash:{{ vmailbox_file }} virtual_mailbox_maps = hash:{{ vmailbox_file }}
...@@ -43,11 +40,6 @@ smtpd_sasl_type = dovecot ...@@ -43,11 +40,6 @@ smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes smtpd_sasl_auth_enable = yes
# smtpd_recipient_restrictions =
# reject_non_fqdn_recipient
# reject_unknown_recipient_domain
# permit_sasl_authenticated
# reject
smtpd_recipient_restrictions = smtpd_recipient_restrictions =
permit_sasl_authenticated permit_sasl_authenticated
smtpd_relay_restrictions = smtpd_relay_restrictions =
......
...@@ -32,8 +32,6 @@ filename = ${:_buildout_section_name_} ...@@ -32,8 +32,6 @@ filename = ${:_buildout_section_name_}
[dovecot.jinja2.conf] [dovecot.jinja2.conf]
< = copy-to-instance < = copy-to-instance
[dovecot-passwd.jinja2]
< = copy-to-instance
[dovecot-passdb.jinja2.lua] [dovecot-passdb.jinja2.lua]
< = copy-to-instance < = copy-to-instance
...@@ -41,10 +39,6 @@ filename = ${:_buildout_section_name_} ...@@ -41,10 +39,6 @@ filename = ${:_buildout_section_name_}
< = copy-to-instance < = copy-to-instance
[postfix_master.jinja2.cf] [postfix_master.jinja2.cf]
< = copy-to-instance < = copy-to-instance
[postfix_alias.jinja2]
< = copy-to-instance
[postfix_mailname.jinja2]
< = copy-to-instance
[postfix_vmailbox.jinja2] [postfix_vmailbox.jinja2]
< = copy-to-instance < = copy-to-instance
[postfix_virtual.jinja2] [postfix_virtual.jinja2]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment