Help to setup a Unix socket based authentication server for dovecot in Python
Hi,
I am building a custom server platform in which dovecot is used for imap/pop . But the default authentication mechanism is not suitable for me becuase each domain will have different system users and different location for mail storage . So I need to create a custom authentication mechanism using python . There is an option to use Key-value authentication (dict) database via socket as per
https://doc.dovecot.org/configuration_manual/authentication/dict/#complete-e...
The above documentation link have a sample perl script too to send authentication to
uri = proxy:/var/run/auth_proxy_dovecot/socket:somewhere
So my question is how the inputs are send to the socket file ? in which format ?
How the result return ? and in which format ?
Let us say I can create a python socket program that can listen to /var/run/auth_proxy_dovecot/socket for getting the inputs from dovecot , but what is the format
Is it like the following
AUTH PLAIN
USER test@myemail.com
PASS mypassword
I looked into the documentation and developer documentation, I am unable to see how dovecot send the data , I can see a sample perl for answering dict lookups. Any one have a python alternative for it. ?
-- *Sherin Abdulkhareem* Chairman & Managing Director
email Email sherin@sherin.in mailto:sherin@sherin.in
mobile Mobile (+91)9496533234
office Office (+91)4716007799
*Syslint Technologies India Private Limited* First Floor,Asiatic Business Center Kazhakkootam, Trivandrum PIN-695582 India
Facebook https://facebook.com/sherin.co.in LinkedIn https://linkedin.com/in/sherina Google+ https://plus.google.com/+sherinAbdulkhareem
sherin.in http://sherin.in
On 13/08/2021 15:12 Sherin A sherinmon@gmail.com wrote:
Hi, I am building a custom server platform in which dovecot is used for imap/pop . But the default authentication mechanism is not suitable for me becuase each domain will have different system users and different location for mail storage . So I need to create a custom authentication mechanism using python . There is an option to use Key-value authentication (dict) database via socket as per
https://doc.dovecot.org/configuration_manual/authentication/dict/#complete-e...
The above documentation link have a sample perl script too to send authentication to
uri = proxy:/var/run/auth_proxy_dovecot/socket:somewhere
So my question is how the inputs are send to the socket file ? in which format ? How the result return ? and in which format ? Let us say I can create a python socket program that can listen to /var/run/auth_proxy_dovecot/socket for getting the inputs from dovecot , but what is the format
Is it like the following
AUTH PLAIN USER test@myemail.com PASS mypassword
I looked into the documentation and developer documentation, I am unable to see how dovecot send the data , I can see a sample perl for answering dict lookups. Any one have a python alternative for it. ?
--
Sherin Abdulkhareem Chairman & Managing Director
It should work just by reading from socket and writing to the socket. You are sent tab separated lines, which start with L or H followed by first parameter that, as in
Hhandshake-data (you can ignore H)
and actual lookups as
Lnamespace/type/arg
and then you respond with
O{"json":"blob"}
You could also consider using Lua authentication. See https://doc.dovecot.org/configuration_manual/authentication/lua_based_authen... (please note version requirements).
which can be lot easier to do.
Regards, Aki
participants (2)
-
Aki Tuomi
-
Sherin A