libesmtp/libESMTP

Support for OAUTH2

swordfish22 opened this issue · 6 comments

Support for OAUTH2 would be desirable.

A search for OAUTH clients on GitHub finds a number of implementations in various languages, including a Python implementation from Google. I'm slightly surprised there are none in C++ however.

A viable approach should be an auth module that embeds the Python interpreter and provides an interface to libESMTP via Python's C API as this avoids issues like finding a suitable library to handle https, used as an out-of-band mechansim in OAUTH.

There is a C Plugin for Postfix, with a bunch of Python scripts to handle updating of the tokens. It's not the best documented code ever.

http://mmogilvi.users.sourceforge.net/software/oauthbearer.html
https://github.com/moriyoshi/cyrus-sasl-xoauth2

RFC 5849 and RFC 6749 describe the OAUTH v1 and 2 protocols. RFC 7628 describes integration with SASL.

One way to add OAUTH2 support (and in particular XOAUTH2, as used by Google) would be to replace the experimental GNU SASL support with Cyrus SASL, as there is a Cyrus SASL plugin for XOAUTH2.

Is there any suggestion on how to enable mail bot operation? How could the credentials provided automatically on client-auth?

I am not quite sure how to deal with python stuff in a C-world as mentioned above.

I also don't understand, whether OAUTH is for providing credentials. A short lookup told me it is for auth delegation, meaning signing in into an application by another one.