As I noted in Debian bug #810727, I need to use the proper hostname to
connect to my SMTP server; otherwise Kerberos authentication will fail.
But this wasn't easy to figure out, as the message returned by msmtp is
kind of useless (it seems to just print whatever text is returned by GNU
SASL):
msmtp: GNU SASL: GSSAPI error in client while negotiating security
context in gss_init_sec_context() in SASL library. This is most
likely due insufficient credentials or malicious interactions.
This makes it seem like I used a bad password or the SMTP server didn't
like the ticket. In fact, the Kerberos server didn't recognise the
hostname, and according to a Wireshark dump returned a perfectly clear
error message:
krb-error
pvno: 5
msg-type: krb-error (30)
stime: 2016-01-11 16:08:01 (UTC)
susec: 299239
error-code: eRR-S-PRINCIPAL-UNKNOWN (7)
realm: EXAMPLE.COM
sname
name-type: kRB5-NT-SRV-HST (3)
name-string: 2 items
KerberosString: smtp
KerberosString: smtp-server.EXAMPLE.COM
I suggest a message like the following, based on the libkrb5 text:
"Server not found in Kerberos database:
smtp/smtp-server.example.com@EXAMPLE.COM"
- Michael