mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[enh] Add MUA autoconfig.
This commit is contained in:
parent
933c56bb7e
commit
a7e85dbbba
4 changed files with 39 additions and 0 deletions
|
@ -38,12 +38,19 @@ do_pre_regen() {
|
|||
for domain in $domain_list; do
|
||||
domain_conf_dir="${nginx_conf_dir}/${domain}.d"
|
||||
mkdir -p "$domain_conf_dir"
|
||||
mail_autoconfig_dir="${pending_dir}/var/www/.well-known/${domain}/autoconfig/mail/"
|
||||
mkdir -p "$mail_autoconfig_dir"
|
||||
|
||||
# NGINX server configuration
|
||||
cat server.tpl.conf \
|
||||
| sed "s/{{ domain }}/${domain}/g" \
|
||||
> "${nginx_conf_dir}/${domain}.conf"
|
||||
|
||||
cat autoconfig.tpl.xml \
|
||||
| sed "s/{{ domain }}/${domain}/g" \
|
||||
> "${mail_autoconfig_dir}/config-v1.1.xml"
|
||||
|
||||
|
||||
[[ $main_domain != $domain ]] \
|
||||
&& touch "${domain_conf_dir}/yunohost_local.conf" \
|
||||
|| cp yunohost_local.conf "${domain_conf_dir}/yunohost_local.conf"
|
||||
|
@ -58,6 +65,14 @@ do_pre_regen() {
|
|||
|| touch "${nginx_conf_dir}/${file}"
|
||||
done
|
||||
|
||||
# remove old mail-autoconfig files
|
||||
autoconfig_files=$(ls -1 /var/www/.well-known/*/autoconfig/mail/config-v1.1.xml)
|
||||
for file in $autoconfig_files; do
|
||||
domain=$(basename $(readlink -f $(dirname $file)/../..))
|
||||
[[ $domain_list =~ $domain ]] \
|
||||
|| (mkdir -p "$(dirname ${pending_dir}/${file})" && touch "${pending_dir}/${file}")
|
||||
done
|
||||
|
||||
# disable default site
|
||||
mkdir -p "${nginx_dir}/sites-enabled"
|
||||
touch "${nginx_dir}/sites-enabled/default"
|
||||
|
|
19
data/templates/nginx/autoconfig.tpl.xml
Normal file
19
data/templates/nginx/autoconfig.tpl.xml
Normal file
|
@ -0,0 +1,19 @@
|
|||
<clientConfig version="1.1">
|
||||
<emailProvider id="{{ domain }}">
|
||||
<domain>{{ domain }}</domain>
|
||||
<incomingServer type="imap">
|
||||
<hostname>{{ domain }}</hostname>
|
||||
<port>993</port>
|
||||
<socketType>SSL</socketType>
|
||||
<authentication>password-cleartext</authentication>
|
||||
<username>%EMAILLOCALPART%</username>
|
||||
</incomingServer>
|
||||
<outgoingServer type="smtp">
|
||||
<hostname>{{ domain }}</hostname>
|
||||
<port>587</port>
|
||||
<socketType>STARTTLS</socketType>
|
||||
<authentication>password-cleartext</authentication>
|
||||
<username>%EMAILLOCALPART%</username>
|
||||
</outgoingServer>
|
||||
</emailProvider>
|
||||
</clientConfig>
|
|
@ -11,6 +11,10 @@ server {
|
|||
return 301 https://$http_host$request_uri;
|
||||
}
|
||||
|
||||
location /.well-known/autoconfig/mail {
|
||||
alias /var/www/.well-known/{{ domain }}/autoconfig/mail;
|
||||
}
|
||||
|
||||
access_log /var/log/nginx/{{ domain }}-access.log;
|
||||
error_log /var/log/nginx/{{ domain }}-error.log;
|
||||
}
|
||||
|
|
|
@ -1321,6 +1321,7 @@ def app_ssowatconf(auth):
|
|||
|
||||
# Authorize ACME challenge url
|
||||
skipped_regex.append("^[^/]*/%.well%-known/acme%-challenge/.*$")
|
||||
skipped_regex.append("^[^/]*/%.well%-known/autoconfig/mail/config%-v1%.1%.xml.*$")
|
||||
|
||||
conf_dict = {
|
||||
'portal_domain': main_domain,
|
||||
|
|
Loading…
Add table
Reference in a new issue