TLS client certificates and auth external

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

TLS client certificates and auth external

Bastian Schmidt
Hello,

I have an email client (K-9 on Android), which, when using TLS client
certificates insists on sending an auth external. However, postfix/SASL
does not advertise external auth, which causes the client to not being
able to use client certificates with postfix.

As I see it, postfix is missing the external mechanism as specified in
RFC 2222 (SASL) completely. Thus, I have implemented this feature (for
TLS CA client certs) and I am currently successfully running this on a
local installation using cyrus sasl.

I would be willing to provide a patch and would really like to see this
integrated in future versions of postfix.

I hope this is the right postfix mailing list for this request.

Bastian




Reply | Threaded
Open this post in threaded view
|

Re: TLS client certificates and auth external

Viktor Dukhovni
> On Jan 8, 2019, at 5:17 PM, Bastian Schmidt <[hidden email]> wrote:
>
> I have an email client (K-9 on Android), which, when using TLS client certificates insists on sending an auth external. However, postfix/SASL does not advertise external auth, which causes the client to not being able to use client certificates with postfix.
>
> As I see it, postfix is missing the external mechanism as specified in RFC 2222 (SASL) completely. Thus, I have implemented this feature (for TLS CA client certs) and I am currently successfully running this on a local installation using cyrus sasl.
>
> I would be willing to provide a patch and would really like to see this integrated in future versions of postfix.
>
> I hope this is the right postfix mailing list for this request.

Well perhaps postfix-devel is equally or more appropriate.

There is a key design issue here:

 * In typical Postfix configurations we see relay restrictions of
   the form:

        smtpd_relay_restrictions =
                permit_mynetworks,
                permit_sasl_authenticated,
                reject_unauth_destination

   which is fine, when the user has enrolled for a login account
   on the receiving system.  But with client certs, anyone can get
   a client certificate from some CA, or even mint their own.

   So what does "SASL authenticated" mean with client certs?  Is
   there a particular issuing CA that's the only one trusted to
   issue client certs?  Or does the client certificate fingerprint
   need to match a lookup table for it to be considered authenticated?

   My advice is that a trusted CA, and likely often accidentally every
   CA on the planet from one of the usual CA bundles, is much too risky
   in this context, and would drag in revocation lists, OCSP, and that
   whole dumpster-fire of PKI issues.

   Therefore, the meaning of SASL authenticated for EXTERNAL should be
   that the client certificate fingerprint matches a lookup table that
   maps the client certificate to something resembling a SASL user name.

   You would then either "permit_sasl_authenticated" without distinguishing
   between one user and another, or else use "check_sasl_access" based on
   username obtained from the fingerprint->username map.  You could also
   then use the "sender login mismatch" features by matching the username
   with valid sender addresses, ...

Otherwise, "EXTERNAL" should be fairly straight-forward.  Feel free to
move the discussion to postfix-devel, or continue here to the extent
the discussion stays high level, rather than dives into the implementation.

--
        Viktor.

Reply | Threaded
Open this post in threaded view
|

Re: TLS client certificates and auth external

Matthew Horan
 > On Jan 8, 2019, at 5:17 PM, Bastian Schmidt <[hidden email]> wrote:

>
> I have an email client (K-9 on Android), which, when using TLS client
> certificates insists on sending an auth external. However, postfix/SASL
> does not advertise external auth, which causes the client to not being
> able to use client certificates with postfix.
>
> As I see it, postfix is missing the external mechanism as specified in RFC
> 2222 (SASL) completely. Thus, I have implemented this feature (for TLS CA
> client certs) and I am currently successfully running this on a local
> installation using cyrus sasl.
>
> I would be willing to provide a patch and would really like to see this
> integrated in future versions of postfix.

I'm quite excited about seeing this feature added to Postfix. I have a
similar configuration, and have been putting off making the proposed changes
myself. I had previously posted on the Dovecot mailing list [1] to no avail.
I'm happy to know that there are at least two of us out there who would
benefit from this feature!

Thanks,
Matt

[1] https://www.dovecot.org/list/dovecot/2017-February/106884.html



--
Sent from: http://postfix.1071664.n5.nabble.com/Postfix-Users-f2.html
Reply | Threaded
Open this post in threaded view
|

Re: TLS client certificates and auth external

Bastian Schmidt
In the meantime I have completed a patch and sent it to Wietse and
Victor, which adds an option smtpd_sasl_tls_ccert_username.
As the patch is rather small, I also attached it to this message.

This smtpd_sasl_tls_ccert_username option can be used in the following way:

Using smtpd_sasl_tls_ccert_username = commonName
After providing a verified client certificate, postfix advertises auth
external and the user can authenticate with the username being the
commonName of the certificate. This is for users having control over the
CA issuing the certificates and resembles the way cyrus imap handles the
situation.

Using smtpd_sasl_tls_ccert_username = relay_clientcerts
When a client presents a certificate, where the fingerprint matches in
relay_clientcerts, the lookup value (previously unused) is used to get
the username for sasl. The client can then perform an auth external with
this username successfully. This is a solution for users, which cannot
control the CAs or do not want to trust them or cope with crls, ... It
fits in the way postfix currently handles client certificates.

Both solutions then cause permit_sasl_authenticated to succeed and the
sasl username to be set correctly.

The default for smtpd_sasl_tls_ccert_username (the empty value) or any
other value cause auth external to not be advertised and neither
succeed; the same situation as without the patch.

I have the first version running successfully in a small local
installation using cyrus sasl, where K-9 and Thunderbird are both able
to use client certificates (and simple username/password login). With
cyrus sasl the setup is more or less straight forward.
I also setup a virtual machine to test a dovecot sasl setup. Here the
setup is more complicated, as dovecot has to be setup to allow an empty
password, when using external auth (and only, when using external auth).
This is only possible since version dovecot version 2.2.28. Here I have
tested my patch using the s_client only.

Best regards,
Bastian


On 11.03.19 03:47, Matthew Horan wrote:

>   > On Jan 8, 2019, at 5:17 PM, Bastian Schmidt <[hidden email]> wrote:
>> I have an email client (K-9 on Android), which, when using TLS client
>> certificates insists on sending an auth external. However, postfix/SASL
>> does not advertise external auth, which causes the client to not being
>> able to use client certificates with postfix.
>>
>> As I see it, postfix is missing the external mechanism as specified in RFC
>> 2222 (SASL) completely. Thus, I have implemented this feature (for TLS CA
>> client certs) and I am currently successfully running this on a local
>> installation using cyrus sasl.
>>
>> I would be willing to provide a patch and would really like to see this
>> integrated in future versions of postfix.
> I'm quite excited about seeing this feature added to Postfix. I have a
> similar configuration, and have been putting off making the proposed changes
> myself. I had previously posted on the Dovecot mailing list [1] to no avail.
> I'm happy to know that there are at least two of us out there who would
> benefit from this feature!
>
> Thanks,
> Matt
>
> [1] https://www.dovecot.org/list/dovecot/2017-February/106884.html
>
>
>
> --
> Sent from: http://postfix.1071664.n5.nabble.com/Postfix-Users-f2.html


sasl_auth_external.patch (10K) Download Attachment
smime.p7s (5K) Download Attachment