Skip to content

proposal: crypto/tls: add Config.AdditionalServerNames #61483

@andrewhodel

Description

@andrewhodel

tls.Config.ServerName should be []string instead of string.

https://cs.opensource.google/go/go/+/refs/tags/go1.20.6:src/crypto/tls/common.go;l=521

Some SMTP servers allow you to provide a unique domain TLS key and use their domain name instead of you creating a subdomain.

For example, look up the domain yourpc.ie:

dig yourpc.ie MX 

; <<>> DiG 9.10.6 <<>> yourpc.ie MX
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 60768
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;yourpc.ie.			IN	MX

;; ANSWER SECTION:
yourpc.ie.		1800	IN	MX	30 yourpc-ie.mail.protection.outlook.com.
yourpc.ie.		1800	IN	MX	1 spamfilter.yourpc.ie.

;; Query time: 204 msec
;; SERVER: 2001:1998:f00:1::1#53(2001:1998:f00:1::1)
;; WHEN: Thu Jul 20 10:47:01 CDT 2023
;; MSG SIZE  rcvd: 118

Read that there are two MX servers, the first being yourpc-ie.mail.protection.outlook.com.

If you connect to yourpc-ie.mail.protection.outlook.com with this TLS config:

tlsconfig = &tls.Config {
      ServerName: "yourpc-ie.mail.protection.outlook.com",
      ClientAuth: tls.RequireAndVerifyClientCert,
}

This error is returned, x509: certificate is not valid for any names, but wanted to match spamfilter.yourpc.ie.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ProposalProposal-CryptoProposal related to crypto packages or other security issues

    Type

    No type

    Projects

    Status

    Incoming

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions