| 1 | = How to use Mailman as a source of authentication = |
| 2 | |
| 3 | Kudos to Christopher Gabriel for his original idea: |
| 4 | http://www.cgabriel.org/2009/09/21/ldap-e-la-disperazione/ |
| 5 | |
| 6 | Mailman can be used as a source of authentication for Trac. This is super handy, as it allows to have a single signon between the two. |
| 7 | |
| 8 | Here is how it works: |
| 9 | |
| 10 | * an Apache macro (please install mod_macro and mod_python, and add `www-data` to the group `list`) |
| 11 | |
| 12 | {{{#!bash |
| 13 | /etc/apache2/macros |
| 14 | |
| 15 | <Macro PrivateProjectMailman $name $list> |
| 16 | <Location /svn/$name> |
| 17 | AuthName "$name" |
| 18 | AuthType Basic |
| 19 | PythonPath "sys.path+['/etc/apache2/']" |
| 20 | PythonAuthenHandler mailauth |
| 21 | PythonOption MailmanList $list |
| 22 | AuthUserFile /dev/null |
| 23 | AuthBasicAuthoritative Off |
| 24 | require valid-user |
| 25 | </Location> |
| 26 | |
| 27 | <Location "/$name"> |
| 28 | AuthName "$name" |
| 29 | AuthType Basic |
| 30 | PythonPath "sys.path+['/etc/apache2/']" |
| 31 | PythonAuthenHandler mailauth |
| 32 | PythonOption MailmanList $list |
| 33 | AuthUserFile /dev/null |
| 34 | AuthBasicAuthoritative Off |
| 35 | require valid-user |
| 36 | </Location> |
| 37 | |
| 38 | </Macro> |
| 39 | |
| 40 | |
| 41 | <Macro PublicProjectMailman $name $list> |
| 42 | <Location /svn/$name> |
| 43 | <LimitExcept GET PROPFIND OPTIONS REPORT> |
| 44 | AuthName "$name" |
| 45 | AuthType Basic |
| 46 | PythonPath "sys.path+['/etc/apache2/']" |
| 47 | PythonAuthenHandler mailauth |
| 48 | PythonOption MailmanList $list |
| 49 | AuthUserFile /dev/null |
| 50 | AuthBasicAuthoritative Off |
| 51 | require valid-user |
| 52 | </LimitExcept> |
| 53 | </Location> |
| 54 | |
| 55 | <Location "/$name/login"> |
| 56 | AuthName "$name" |
| 57 | AuthType Basic |
| 58 | PythonPath "sys.path+['/etc/apache2/']" |
| 59 | PythonAuthenHandler mailauth |
| 60 | PythonOption MailmanList $list |
| 61 | AuthUserFile /dev/null |
| 62 | AuthBasicAuthoritative Off |
| 63 | require valid-user |
| 64 | </Location> |
| 65 | |
| 66 | </Macro> |
| 67 | }}} |
| 68 | |
| 69 | * then, in the relative !VirtualHost |
| 70 | |
| 71 | {{{#!bash |
| 72 | Use PrivateProjectMailman progetto-x lista-progetto-x |
| 73 | }}} |
| 74 | |
| 75 | or |
| 76 | |
| 77 | {{{#!bash |
| 78 | Use PublicProjectMailman progetto-x lista-progetto-x |
| 79 | }}} |
| 80 | |
| 81 | And you are done. |