From f979aa993d21ac19f8ac006738d8e12632a74b97 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Sun, 20 Mar 2022 21:15:45 +0100 Subject: [PATCH] email from external network --- .../dovecot/dictionaries/22_dovecot.xml | 62 ++++++++++++++----- .../2022.03.08/dovecot/templates/10-ssl.conf | 10 +++ .../dovecot/templates/ca_IMAPServer.crt | 2 +- .../dovecot/templates/ca_MailServer.crt | 2 +- .../dovecot/templates/external_imap.crt | 2 + .../dovecot/templates/external_imap.key | 1 + .../2022.03.08/dovecot/templates/main.cf | 9 ++- .../2022.03.08/dovecot/templates/postfix.pem | 2 + .../dovecot/templates/postfix.service | 1 + .../dovecot/templates/postfix_sni.pem | 3 + .../2022.03.08/dovecot/templates/sni | 4 ++ .../dictionaries/20-letsencrypt.xml | 5 +- .../letsencrypt/funcs/letsencrypt.py | 4 +- .../2022.03.08/mailman/DEBUG.md | 1 + .../nextcloud/dictionaries/31_nextcloud.xml | 36 +++++++++++ .../nextcloud/templates/nextcloud.init | 3 +- .../templates/certificate.crt | 2 +- .../templates/private.key | 2 +- .../2022.03.08/postfix-relay/DEBUG.md | 4 ++ .../postfix-relay/dictionaries/30_postfix.xml | 4 +- .../2022.03.08/postfix-relay/funcs/postfix.py | 12 ++++ .../funcs/revprox_client.py | 6 +- 22 files changed, 144 insertions(+), 33 deletions(-) create mode 100644 seed/applicationservice/2022.03.08/dovecot/templates/external_imap.crt create mode 100644 seed/applicationservice/2022.03.08/dovecot/templates/external_imap.key create mode 100644 seed/applicationservice/2022.03.08/dovecot/templates/postfix.pem create mode 100644 seed/applicationservice/2022.03.08/dovecot/templates/postfix_sni.pem create mode 100644 seed/applicationservice/2022.03.08/dovecot/templates/sni create mode 100644 seed/applicationservice/2022.03.08/postfix-relay/funcs/postfix.py diff --git a/seed/applicationservice/2022.03.08/dovecot/dictionaries/22_dovecot.xml b/seed/applicationservice/2022.03.08/dovecot/dictionaries/22_dovecot.xml index e82fbafc..229fcd63 100644 --- a/seed/applicationservice/2022.03.08/dovecot/dictionaries/22_dovecot.xml +++ b/seed/applicationservice/2022.03.08/dovecot/dictionaries/22_dovecot.xml @@ -12,6 +12,9 @@ /etc/pki/ca-trust/source/anchors/ca_MailServer.crt /etc/pki/tls/certs/postfix.crt /etc/pki/tls/private/postfix.key + /etc/postfix/sni + postfix_pem_files + /etc/postfix/certs/postfix.pem @@ -24,7 +27,7 @@ /etc/dovecot/conf.d/10-auth.conf /etc/dovecot/conf.d/10-mail.conf /etc/dovecot/conf.d/10-master.conf - /etc/dovecot/conf.d/10-ssl.conf + /etc/dovecot/conf.d/10-ssl.conf /etc/dovecot/conf.d/15-ldap.conf /etc/dovecot/conf.d/30-service-stats.conf @@ -41,9 +44,15 @@ /etc/pki/ca-trust/source/anchors/ca_IMAPServer.crt /etc/pki/tls/certs/dovecot.crt /etc/pki/tls/private/dovecot.key + external_imap_crt + external_imap_key + + 587 + 993 + dovecot @@ -52,12 +61,17 @@ postfix - - - - - domain_name_eth0 - MailServer - postfix_ca_chain - - - domain_name_eth0 - IMAPServer - dovecot_ca_chain - domain_name_eth0 @@ -89,13 +93,13 @@ smtp_relay_address lmtp_server domain_name_eth0 - postfix_my_domains + mail_domains smtp_relay_address lmtp_criteria domain_name_eth0 - postfix_my_domains + mail_domains tls_ca_directory @@ -103,5 +107,29 @@ / revprox_ca_file + + /etc/pki/tls/certs/imap_ + imap_domainname + .crt + + True + external_imap_crt + + + /etc/pki/tls/private/imap_ + imap_domainname + .key + + True + external_imap_key + + + /etc/postfix/certs/ + submission_domainname + .pem + + True + postfix_pem_files + diff --git a/seed/applicationservice/2022.03.08/dovecot/templates/10-ssl.conf b/seed/applicationservice/2022.03.08/dovecot/templates/10-ssl.conf index 2c9459b2..6adcf9f7 100644 --- a/seed/applicationservice/2022.03.08/dovecot/templates/10-ssl.conf +++ b/seed/applicationservice/2022.03.08/dovecot/templates/10-ssl.conf @@ -16,6 +16,16 @@ ssl = required #>GNUNUX ssl_cert = GNUNUX +tls_server_sni_maps = hash:/etc/postfix/sni +# - - @@ -12,8 +10,7 @@ - authority_cn - authority_name + domain_name_eth0 plugin_name credential_filename email diff --git a/seed/applicationservice/2022.03.08/letsencrypt/funcs/letsencrypt.py b/seed/applicationservice/2022.03.08/letsencrypt/funcs/letsencrypt.py index 2270e43a..b5a39745 100644 --- a/seed/applicationservice/2022.03.08/letsencrypt/funcs/letsencrypt.py +++ b/seed/applicationservice/2022.03.08/letsencrypt/funcs/letsencrypt.py @@ -14,13 +14,13 @@ _X509_DIR = _join(_HERE, 'pki', 'x509') def letsencrypt_certif(domain: str, authority_cn: str, - authority_name: str, plugin_name: str, credential_filename: str, email: str, ) -> None: - if None in (domain, authority_cn, authority_name, plugin_name, credential_filename, email): + if None in (domain, authority_cn, plugin_name, credential_filename, email): return + authority_name = 'External' date_file = _join(_LE_DIR, f'{domain}.date') date = _datetime.now() today = str(date.date()) diff --git a/seed/applicationservice/2022.03.08/mailman/DEBUG.md b/seed/applicationservice/2022.03.08/mailman/DEBUG.md index 871c9ed0..c9713d23 100644 --- a/seed/applicationservice/2022.03.08/mailman/DEBUG.md +++ b/seed/applicationservice/2022.03.08/mailman/DEBUG.md @@ -42,3 +42,4 @@ export MAILMAN_WEB_CONFIG=/usr/share/postorius/m_postorius/settings.py echo "DEBUG=True" >> /etc/mailman3.d/postorius.py systemctl restart postorius + diff --git a/seed/applicationservice/2022.03.08/nextcloud/dictionaries/31_nextcloud.xml b/seed/applicationservice/2022.03.08/nextcloud/dictionaries/31_nextcloud.xml index 4bff5373..6aa37d18 100644 --- a/seed/applicationservice/2022.03.08/nextcloud/dictionaries/31_nextcloud.xml +++ b/seed/applicationservice/2022.03.08/nextcloud/dictionaries/31_nextcloud.xml @@ -17,6 +17,8 @@ @@ -55,5 +57,39 @@ True nextcloud_instance_id + + revprox_clients + revprox_client_external_domainname + revprox_location + /.well-known/caldav + revprox_is_websocket + False + revprox_url + nexcloud_well_known_caldav + revprox_client_server_domainname + + + domain_name_eth0 + revprox_client_port + /.well-known/caldav + nexcloud_well_known_caldav + + + revprox_clients + revprox_client_external_domainname + revprox_location + /.well-known/carddav + revprox_is_websocket + False + revprox_url + nexcloud_well_known_carddav + revprox_client_server_domainname + + + domain_name_eth0 + revprox_client_port + /.well-known/carddav + nexcloud_well_known_carddav + diff --git a/seed/applicationservice/2022.03.08/nextcloud/templates/nextcloud.init b/seed/applicationservice/2022.03.08/nextcloud/templates/nextcloud.init index db827d6d..5d6e74f5 100644 --- a/seed/applicationservice/2022.03.08/nextcloud/templates/nextcloud.init +++ b/seed/applicationservice/2022.03.08/nextcloud/templates/nextcloud.init @@ -14,6 +14,8 @@ else sed -i "s/'installed' => false,/'installed' => true,/g" /etc/nextcloud/config.php /usr/bin/php /usr/share/nextcloud/occ app:enable user_ldap -q fi +# Upgrade +/usr/bin/php /usr/share/nextcloud/occ upgrade || true # SSO /usr/bin/php /usr/share/nextcloud/occ app:enable oidc_login # Feature @@ -49,7 +51,6 @@ fi # Need network /usr/bin/php /usr/share/nextcloud/occ app:disable weather_status # Maintenance -/usr/bin/php /usr/share/nextcloud/occ upgrade /usr/bin/php /usr/share/nextcloud/occ files:scan --all -q /usr/bin/php /usr/share/nextcloud/occ maintenance:repair -q diff --git a/seed/applicationservice/2022.03.08/nginx-reverse-proxy-server/templates/certificate.crt b/seed/applicationservice/2022.03.08/nginx-reverse-proxy-server/templates/certificate.crt index 9e4b28f5..45a1426c 100644 --- a/seed/applicationservice/2022.03.08/nginx-reverse-proxy-server/templates/certificate.crt +++ b/seed/applicationservice/2022.03.08/nginx-reverse-proxy-server/templates/certificate.crt @@ -1 +1 @@ -%%get_certificate(cn=%%rougail_variable, authority_cn=%%domain_name_eth0, authority_name='ReverseProxy') +%%get_certificate(cn=%%rougail_variable, authority_cn=%%domain_name_eth0, authority_name='External') diff --git a/seed/applicationservice/2022.03.08/nginx-reverse-proxy-server/templates/private.key b/seed/applicationservice/2022.03.08/nginx-reverse-proxy-server/templates/private.key index 9e2828c8..1662468a 100644 --- a/seed/applicationservice/2022.03.08/nginx-reverse-proxy-server/templates/private.key +++ b/seed/applicationservice/2022.03.08/nginx-reverse-proxy-server/templates/private.key @@ -1 +1 @@ -%%get_private_key(cn=%%rougail_variable, authority_cn=%%domain_name_eth0, authority_name='ReverseProxy') +%%get_private_key(cn=%%rougail_variable, authority_cn=%%domain_name_eth0, authority_name='External') diff --git a/seed/applicationservice/2022.03.08/postfix-relay/DEBUG.md b/seed/applicationservice/2022.03.08/postfix-relay/DEBUG.md index be1cb65d..324683b4 100644 --- a/seed/applicationservice/2022.03.08/postfix-relay/DEBUG.md +++ b/seed/applicationservice/2022.03.08/postfix-relay/DEBUG.md @@ -45,3 +45,7 @@ postconf maillog_file postconf maillog_file=/dev/stdout +# Test mail en ligne + +https://www.mail-tester.com/ +https://dkimvalidator.com/ diff --git a/seed/applicationservice/2022.03.08/postfix-relay/dictionaries/30_postfix.xml b/seed/applicationservice/2022.03.08/postfix-relay/dictionaries/30_postfix.xml index 72c6201e..7926827a 100644 --- a/seed/applicationservice/2022.03.08/postfix-relay/dictionaries/30_postfix.xml +++ b/seed/applicationservice/2022.03.08/postfix-relay/dictionaries/30_postfix.xml @@ -37,14 +37,14 @@ - +