Mise en place autoconfig Thunderbird pour auf.org.
authorProgfou <jean-christophe.andre@auf.org>
Fri, 18 Jul 2014 01:22:23 +0000 (03:22 +0200)
committerProgfou <jean-christophe.andre@auf.org>
Fri, 18 Jul 2014 01:22:23 +0000 (03:22 +0200)
thunderbird/autoconfig/ThunderbirdAutoconfiguration-ConfigFileFormat.pdf [new file with mode: 0644]
thunderbird/autoconfig/ThunderbirdAutoconfiguration-ConfigFileHowTo.pdf [new file with mode: 0644]
thunderbird/autoconfig/ThunderbirdAutoconfiguration.pdf [new file with mode: 0644]
thunderbird/autoconfig/apache.conf [new file with mode: 0644]
thunderbird/autoconfig/autoconfig-example.xml [new file with mode: 0644]
thunderbird/autoconfig/autoconfig-mail [new file with mode: 0755]
thunderbird/autoconfig/notes.txt [new file with mode: 0644]

diff --git a/thunderbird/autoconfig/ThunderbirdAutoconfiguration-ConfigFileFormat.pdf b/thunderbird/autoconfig/ThunderbirdAutoconfiguration-ConfigFileFormat.pdf
new file mode 100644 (file)
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 (file)
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 (file)
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 (file)
index 0000000..f03d702
--- /dev/null
@@ -0,0 +1,17 @@
+<VirtualHost *:80>
+       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
+       #<Directory /srv/www/autoconfig.auf.org>
+       #       Options FollowSymLinks
+       #       AllowOverride None
+       #</Directory>
+       ScriptAlias /mail/config-v1.1.xml /usr/local/lib/autoconfig-mail
+       <Location /mail/config-v1.1.xml>
+               Order allow,deny
+               Allow from All
+       </Location>
+       RedirectMatch ^$ http://www.auf.org/
+</VirtualHost>
diff --git a/thunderbird/autoconfig/autoconfig-example.xml b/thunderbird/autoconfig/autoconfig-example.xml
new file mode 100644 (file)
index 0000000..50dc3b8
--- /dev/null
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<clientConfig version="1.1">
+  <emailProvider id="freenet.de">
+    <domain>freenet.de</domain>
+    <displayName>Freenet Mail</displayName>
+    <displayShortName>Freenet</displayShortName>
+    <incomingServer type="imap">
+      <hostname>imap.freenet.de</hostname>
+      <port>993</port>
+      <socketType>SSL</socketType>
+      <authentication>password-encrypted</authentication>
+      <username>%EMAILADDRESS%</username>
+    </incomingServer>
+    <incomingServer type="imap">
+      <hostname>imap.freenet.de</hostname>
+      <port>143</port>
+      <socketType>STARTTLS</socketType>
+      <authentication>password-encrypted</authentication>
+      <username>%EMAILADDRESS%</username>
+    </incomingServer>
+    <incomingServer type="pop3">
+      <hostname>pop.freenet.de</hostname>
+      <port>995</port>
+      <socketType>SSL</socketType>
+      <authentication>password-cleartext</authentication>
+      <username>%EMAILADDRESS%</username>
+    </incomingServer>
+    <incomingServer type="pop3">
+      <hostname>pop.freenet.de</hostname>
+      <port>110</port>
+      <socketType>STARTTLS</socketType>
+      <authentication>password-cleartext</authentication>
+      <username>%EMAILADDRESS%</username>
+    </incomingServer>
+    <outgoingServer type="smtp">
+      <hostname>smtp.freenet.de</hostname>
+      <port>465</port>
+      <socketType>SSL</socketType>
+      <authentication>password-encrypted</authentication>
+      <username>%EMAILADDRESS%</username>
+    </outgoingServer>
+    <outgoingServer type="smtp">
+      <hostname>smtp.freenet.de</hostname>
+      <port>587</port>
+      <socketType>STARTTLS</socketType>
+      <authentication>password-encrypted</authentication>
+      <username>%EMAILADDRESS%</username>
+    </outgoingServer>
+    <documentation url="http://kundenservice.freenet.de/hilfe/email/programme/config/index.html">
+      <descr lang="de">Allgemeine Beschreibung der Einstellungen</descr>
+      <descr lang="en">Generic settings page</descr>
+    </documentation>
+    <documentation url="http://kundenservice.freenet.de/hilfe/email/programme/config/thunderbird/imap-thunderbird/imap/index.html">
+      <descr lang="de">TB 2.0 IMAP-Einstellungen</descr>
+      <descr lang="en">TB 2.0 IMAP settings</descr>
+    </documentation>
+  </emailProvider>
+</clientConfig>
diff --git a/thunderbird/autoconfig/autoconfig-mail b/thunderbird/autoconfig/autoconfig-mail
new file mode 100755 (executable)
index 0000000..0def22f
--- /dev/null
@@ -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 = """<?xml version="1.0" encoding="utf-8"?>
+<clientConfig version="1.1"> 
+  <emailProvider id="auf.org">
+    <domain>%(domaine)s</domain>
+    <displayName>%(name)s</displayName>
+    <displayShortName>%(shortname)s</displayShortName>
+    <incomingServer type="imap">
+      <hostname>%(serveur_bal)s</hostname>
+      <port>993</port>
+      <socketType>SSL</socketType>
+      <authentication>password-cleartext</authentication>
+      <username>%(login_local)s</username>
+    </incomingServer>
+    <outgoingServer type="smtp">
+      <hostname>%(serveur_bal)s</hostname>
+      <port>587</port>
+      <socketType>STARTTLS</socketType>
+      <authentication>password-cleartext</authentication>
+      <username>%(login_local)s</username>
+    </outgoingServer>
+  </emailProvider>
+</clientConfig>""" % 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 (file)
index 0000000..9169a0e
--- /dev/null
@@ -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 :
+
+<VirtualHost 10.2.3.4:80> #Must be the first and only virtual host with this ip!
+    DocumentRoot /var/www/autoconfig/
+    ServerName autoconfig.hoster.com
+    <Directory /var/www/autoconfig>
+       Order allow,deny
+       allow from all
+    </Directory>
+</VirtualHost>
+
+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