Bookmarks

SASL — SASL authentication

Simple Authentication and Security Layer

A framework that lets protocols such as SMTP and IMAP plug in different ways of signing in, with a username and password or otherwise.

Also: SMTP AUTH, SASL authentication

checked 9 Nov

All terms

SASL separates the protocol from the way a user is verified. SMTP, IMAP, LDAP and other protocols only describe how to exchange sign-in data, while the mechanisms (PLAIN, SCRAM-SHA-256, OAUTHBEARER) are attached as interchangeable modules.

Mechanisms

MechanismWhat it doesTLS required
PLAINsends the username and password in clear text (RFC 4616)yes
LOGINa non-standard variant of PLAIN, needed by some clients, for example Outlookyes
SCRAM-SHA-256exchanges verification data without sending the password (RFC 7677)not required
OAUTHBEARERsign-in with an OAuth token (RFC 7628)yes

RFC 4616 advises not offering PLAIN by default and not using it without a reliably protected channel, usually TLS. In practice, almost everyone therefore uses PLAIN over TLS, and Dovecot enables only that by default and refuses unencrypted clear text.

How it works in SMTP

The client sends AUTH PLAIN with its credentials, and the server replies 235 if the sign-in succeeded or 535 if not. Postfix does not need to check passwords itself: it asks Dovecot through a socket.

inimain.cf: checking passwords through Dovecot, over TLS only
smtpd_sasl_type = dovecotsmtpd_sasl_path = private/authsmtpd_sasl_auth_enable = yessmtpd_tls_auth_only = yes

A user who has signed in with SASL may send mail to other domains, while the server refuses strangers, otherwise it would be an open relay. The framework is described in RFC 4422 (2006), and the SMTP sign-in extension in RFC 4954.

Sources

the term is written from these pages

Verified 9 Nov

Not to be confused with

what it is mixed up with and how it differs

  • STARTTLS command

    STARTTLS encrypts the channel, while SASL confirms who has connected: they are usually used together.

In depth in the references

where the topic is covered in detail