mox/imapserver
Mechiel Lukkien 8804d6b60e
implement tls client certificate authentication
the imap & smtp servers now allow logging in with tls client authentication and
the "external" sasl authentication mechanism. email clients like thunderbird,
fairemail, k9, macos mail implement it. this seems to be the most secure among
the authentication mechanism commonly implemented by clients. a useful property
is that an account can have a separate tls public key for each device/email
client.  with tls client cert auth, authentication is also bound to the tls
connection. a mitm cannot pass the credentials on to another tls connection,
similar to scram-*-plus. though part of scram-*-plus is that clients verify
that the server knows the client credentials.

for tls client auth with imap, we send a "preauth" untagged message by default.
that puts the connection in authenticated state. given the imap connection
state machine, further authentication commands are not allowed. some clients
don't recognize the preauth message, and try to authenticate anyway, which
fails. a tls public key has a config option to disable preauth, keeping new
connections in unauthenticated state, to work with such email clients.

for smtp (submission), we don't require an explicit auth command.

both for imap and smtp, we allow a client to authenticate with another
mechanism than "external". in that case, credentials are verified, and have to
be for the same account as the tls client auth, but the adress can be another
one than the login address configured with the tls public key.

only the public key is used to identify the account that is authenticating. we
ignore the rest of the certificate. expiration dates, names, constraints, etc
are not verified. no certificate authorities are involved.

users can upload their own (minimal) certificate. the account web interface
shows openssl commands you can run to generate a private key, minimal cert, and
a p12 file (the format that email clients seem to like...) containing both
private key and certificate.

the imapclient & smtpclient packages can now also use tls client auth. and so
does "mox sendmail", either with a pem file with private key and certificate,
or with just an ed25519 private key.

there are new subcommands "mox config tlspubkey ..." for
adding/removing/listing tls public keys from the cli, by the admin.
2024-12-06 10:08:17 +01:00
..
append_test.go prevent unicode-confusion in password by applying PRECIS, and username/email address by applying unicode NFC normalization 2024-03-09 09:20:29 +01:00
authenticate_test.go implement tls client certificate authentication 2024-12-06 10:08:17 +01:00
condstore_test.go fix the Status command on imapclient.Conn 2024-03-11 15:22:41 +01:00
copy_test.go prevent unicode-confusion in password by applying PRECIS, and username/email address by applying unicode NFC normalization 2024-03-09 09:20:29 +01:00
create_test.go prevent unicode-confusion in password by applying PRECIS, and username/email address by applying unicode NFC normalization 2024-03-09 09:20:29 +01:00
delete_test.go prevent unicode-confusion in password by applying PRECIS, and username/email address by applying unicode NFC normalization 2024-03-09 09:20:29 +01:00
error.go for imap/smtp syntax errors, only echo the remaining buffer if the connection is authenticated 2023-03-10 11:32:34 +01:00
expunge_test.go prevent unicode-confusion in password by applying PRECIS, and username/email address by applying unicode NFC normalization 2024-03-09 09:20:29 +01:00
fetch.go imapserver: for the "bodystructure" fetch response item, add the content-type parameters for multiparts so clients will get the mime boundary without having to parse the message themselves 2024-11-01 11:28:25 +01:00
fetch_test.go imapserver: for the "bodystructure" fetch response item, add the content-type parameters for multiparts so clients will get the mime boundary without having to parse the message themselves 2024-11-01 11:28:25 +01:00
fuzz_test.go in more tests, after closing accounts, check the last reference is indeed gone 2024-04-16 17:33:54 +02:00
idle_test.go prevent unicode-confusion in password by applying PRECIS, and username/email address by applying unicode NFC normalization 2024-03-09 09:20:29 +01:00
list.go imapserver: allow creating mailboxes with characters &#*%, and encode mailbox names in imap with imaputf7 when needed 2024-01-01 13:27:29 +01:00
list_test.go fix the Status command on imapclient.Conn 2024-03-11 15:22:41 +01:00
lsub_test.go prevent unicode-confusion in password by applying PRECIS, and username/email address by applying unicode NFC normalization 2024-03-09 09:20:29 +01:00
move_test.go prevent unicode-confusion in password by applying PRECIS, and username/email address by applying unicode NFC normalization 2024-03-09 09:20:29 +01:00
pack.go add two new log levels for tracing sensitive auth protocol messages, and bulk data messages 2023-02-03 20:33:19 +01:00
parse.go imapserver: prevent unbounded memory allocations when handling a command 2024-06-10 15:00:18 +02:00
prefixconn.go mox! 2023-01-30 14:27:06 +01:00
protocol.go imapserver: fix interpreting the first "*" in sequence/uid patterns, like "*:123" or plain "*" 2024-01-23 21:21:08 +01:00
protocol_test.go imapserver: fix interpreting the first "*" in sequence/uid patterns, like "*:123" or plain "*" 2024-01-23 21:21:08 +01:00
quota_test.go fix the Status command on imapclient.Conn 2024-03-11 15:22:41 +01:00
rename_test.go prevent unicode-confusion in password by applying PRECIS, and username/email address by applying unicode NFC normalization 2024-03-09 09:20:29 +01:00
search.go replace packages slog and slices from golang.org/x/exp with stdlib 2024-02-08 14:49:01 +01:00
search_test.go imapserver: prevent unbounded memory allocations when handling a command 2024-06-10 15:00:18 +02:00
selectexamine_test.go prevent unicode-confusion in password by applying PRECIS, and username/email address by applying unicode NFC normalization 2024-03-09 09:20:29 +01:00
server.go implement tls client certificate authentication 2024-12-06 10:08:17 +01:00
server_test.go implement tls client certificate authentication 2024-12-06 10:08:17 +01:00
starttls_test.go prevent unicode-confusion in password by applying PRECIS, and username/email address by applying unicode NFC normalization 2024-03-09 09:20:29 +01:00
status_test.go fix the Status command on imapclient.Conn 2024-03-11 15:22:41 +01:00
store_test.go prevent unicode-confusion in password by applying PRECIS, and username/email address by applying unicode NFC normalization 2024-03-09 09:20:29 +01:00
subscribe_test.go prevent unicode-confusion in password by applying PRECIS, and username/email address by applying unicode NFC normalization 2024-03-09 09:20:29 +01:00
unselect_test.go fix the Status command on imapclient.Conn 2024-03-11 15:22:41 +01:00
unsubscribe_test.go prevent unicode-confusion in password by applying PRECIS, and username/email address by applying unicode NFC normalization 2024-03-09 09:20:29 +01:00
utf7.go imapserver: allow creating mailboxes with characters &#*%, and encode mailbox names in imap with imaputf7 when needed 2024-01-01 13:27:29 +01:00
utf7_test.go imapserver: allow creating mailboxes with characters &#*%, and encode mailbox names in imap with imaputf7 when needed 2024-01-01 13:27:29 +01:00