From: Progfou Date: Fri, 18 Jul 2014 01:22:23 +0000 (+0200) Subject: Mise en place autoconfig Thunderbird pour auf.org. X-Git-Url: https://git.auf.org/?p=progfou.git;a=commitdiff_plain;h=3deec61930935691ac744aa43cd270b15fc989fc;hp=6f1330b0151105b1a8d249f3ae4fec9b1c8d6304 Mise en place autoconfig Thunderbird pour auf.org. --- diff --git a/thunderbird/autoconfig/ThunderbirdAutoconfiguration-ConfigFileFormat.pdf b/thunderbird/autoconfig/ThunderbirdAutoconfiguration-ConfigFileFormat.pdf new file mode 100644 index 0000000..4c314aa Binary files /dev/null and b/thunderbird/autoconfig/ThunderbirdAutoconfiguration-ConfigFileFormat.pdf differ diff --git a/thunderbird/autoconfig/ThunderbirdAutoconfiguration-ConfigFileHowTo.pdf b/thunderbird/autoconfig/ThunderbirdAutoconfiguration-ConfigFileHowTo.pdf new file mode 100644 index 0000000..c420f40 Binary files /dev/null and b/thunderbird/autoconfig/ThunderbirdAutoconfiguration-ConfigFileHowTo.pdf differ diff --git a/thunderbird/autoconfig/ThunderbirdAutoconfiguration.pdf b/thunderbird/autoconfig/ThunderbirdAutoconfiguration.pdf new file mode 100644 index 0000000..cd6d26c Binary files /dev/null and b/thunderbird/autoconfig/ThunderbirdAutoconfiguration.pdf differ diff --git a/thunderbird/autoconfig/apache.conf b/thunderbird/autoconfig/apache.conf new file mode 100644 index 0000000..f03d702 --- /dev/null +++ b/thunderbird/autoconfig/apache.conf @@ -0,0 +1,17 @@ + + ServerName autoconfig.auf.org + ServerAdmin technique@ca.auf.org + ErrorLog ${APACHE_LOG_DIR}/autoconfig.auf.org_error.log + CustomLog ${APACHE_LOG_DIR}/autoconfig.auf.org_access.log combined + #DocumentRoot /srv/www/autoconfig.auf.org + # + # Options FollowSymLinks + # AllowOverride None + # + ScriptAlias /mail/config-v1.1.xml /usr/local/lib/autoconfig-mail + + Order allow,deny + Allow from All + + RedirectMatch ^$ http://www.auf.org/ + diff --git a/thunderbird/autoconfig/autoconfig-example.xml b/thunderbird/autoconfig/autoconfig-example.xml new file mode 100644 index 0000000..50dc3b8 --- /dev/null +++ b/thunderbird/autoconfig/autoconfig-example.xml @@ -0,0 +1,59 @@ + + + + + freenet.de + Freenet Mail + Freenet + + imap.freenet.de + 993 + SSL + password-encrypted + %EMAILADDRESS% + + + imap.freenet.de + 143 + STARTTLS + password-encrypted + %EMAILADDRESS% + + + pop.freenet.de + 995 + SSL + password-cleartext + %EMAILADDRESS% + + + pop.freenet.de + 110 + STARTTLS + password-cleartext + %EMAILADDRESS% + + + smtp.freenet.de + 465 + SSL + password-encrypted + %EMAILADDRESS% + + + smtp.freenet.de + 587 + STARTTLS + password-encrypted + %EMAILADDRESS% + + + Allgemeine Beschreibung der Einstellungen + Generic settings page + + + TB 2.0 IMAP-Einstellungen + TB 2.0 IMAP settings + + + diff --git a/thunderbird/autoconfig/autoconfig-mail b/thunderbird/autoconfig/autoconfig-mail new file mode 100755 index 0000000..0def22f --- /dev/null +++ b/thunderbird/autoconfig/autoconfig-mail @@ -0,0 +1,74 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# https://developer.mozilla.org/fr/docs/Mozilla/Thunderbird/Autoconfiguration +from sys import stdout +import psycopg2 +import psycopg2.extras +import cgi +import cgitb +cgitb.enable(display=0, logdir="/tmp") + +DSN = 'host=db-srv.auf user=XXX password=XXX dbname=AUF' + +info = { + 'login_local': '%EMAILADDRESS%', + 'serveur_bal': "imap.refer.org", + 'domaine': "refer.org", + 'shortname': 'REFER', + 'name': 'REFER', +} + +form = cgi.FieldStorage() +if form: + email = form.getvalue('emailaddress') + cnx = psycopg2.connect(DSN) + cur = cnx.cursor(cursor_factory=psycopg2.extras.DictCursor) + cur.execute("""SELECT login_local,serveur_bal,pays """ + """FROM "Authentification".annuaire WHERE courriel=%s""", (email,)) + res = cur.fetchall() + if res: + row = res[0] + if row['login_local']: + info['login_local'] = row['login_local'] + else: + info['login_local'] = '%EMAILADDRESS%' + info['serveur_bal'] = row['serveur_bal'] + #info['domaine'] = row['pays'] + ".auf.org" + info['domaine'] = "auf.org" + info['shortname'] = 'AUF' + info['name'] = 'Agence universitaire de la Francophonie' + +data = """ + + + %(domaine)s + %(name)s + %(shortname)s + + %(serveur_bal)s + 993 + SSL + password-cleartext + %(login_local)s + + + %(serveur_bal)s + 587 + STARTTLS + password-cleartext + %(login_local)s + + +""" % info + +headers = dict() +headers['Content-Type'] = 'text/xml; charset=utf-8' +headers['Vary'] = 'Content-Encoding' +headers['Content-Length'] = len(data) + +# envoi de la réponse +headers = ''.join(map(lambda x: "%s: %s\r\n" % (x, headers[x]), headers)) +stdout.write(headers + "\r\n") +if data: + stdout.write(data) + diff --git a/thunderbird/autoconfig/notes.txt b/thunderbird/autoconfig/notes.txt new file mode 100644 index 0000000..9169a0e --- /dev/null +++ b/thunderbird/autoconfig/notes.txt @@ -0,0 +1,29 @@ +Source : + https://developer.mozilla.org/fr/docs/Mozilla/Thunderbird/Autoconfiguration + +TB fera une requête sur : + http://autoconfig.example.com/mail/config-v1.1.xml?emailaddress=fred@example.com +(et à terme : http://example.com/.well-known/autoconfig/mail/config-v1.1.xml) + +Exemple config' Apache : + + #Must be the first and only virtual host with this ip! + DocumentRoot /var/www/autoconfig/ + ServerName autoconfig.hoster.com + + Order allow,deny + allow from all + + + +Place the configuration file at the URL /mail/config-v1.1.xml on that host. + +All config files must be served as Content-Type: text/xml (or application/xml), +otherwise the file will be ignored. Also, they must use charset UTF-8 (esp. if +there are any non-ASCII-characters). + +Doc pour faire le fichier de config' : + https://developer.mozilla.org/en-US/docs/Mozilla/Thunderbird/Autoconfiguration/FileFormat/HowTo + +Format du fichier de config' : + https://wiki.mozilla.org/Thunderbird:Autoconfiguration:ConfigFileFormat