Skip to content

Conversation

@arp242
Copy link
Collaborator

@arp242 arp242 commented Jan 6, 2026

This fixes sslmode=verify-ca. The DNSName field is documented as:

// DNSName, if set, is checked against the leaf certificate with
// Certificate.VerifyHostname or the platform verifier.

So the fix is to just remove that field.

Took me a while to reproduce; turns out it validates only if DNSNAme is set to a hostname, and not an IP address (which makes sense, as it's not a DNS name). So the tests would pass on account of that. To fix that, also add "postgres-invalid" to /etc/hosts and test that too.

Also rewrite the SSL tests to table-driven tests while I'm here.

Fixes #1106

@arp242 arp242 force-pushed the verify-ca branch 2 times, most recently from a69e154 to 3bd9714 Compare January 6, 2026 16:48
This fixes sslmode=verify-ca. The DNSName field is documented as:

	// DNSName, if set, is checked against the leaf certificate with
	// Certificate.VerifyHostname or the platform verifier.

So the fix is to just remove that field.

Took me a while to reproduce; turns out it validates only if DNSNAme is
set to a hostname, and not an IP address (which makes sense, as it's not
a DNS name). So the tests would pass on account of that. To fix that,
also add "postgres-invalid" to /etc/hosts and test that too.

Also rewrite the SSL tests to table-driven tests while I'm here.

Fixes #1106
Fixes #1164
@arp242 arp242 merged commit 74106ae into master Jan 6, 2026
25 of 26 checks passed
@arp242 arp242 deleted the verify-ca branch January 6, 2026 16:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sslsni default support in 1.10.7 breaks verify-ca option

2 participants