Skip to content

Fix ra-tls certificate SAN generation for IP-only endpoints#673

Merged
kvinwang merged 1 commit into
Dstack-TEE:masterfrom
flashbots:fix-ra-tls-ip-sans
May 11, 2026
Merged

Fix ra-tls certificate SAN generation for IP-only endpoints#673
kvinwang merged 1 commit into
Dstack-TEE:masterfrom
flashbots:fix-ra-tls-ip-sans

Conversation

@ameba23
Copy link
Copy Markdown
Contributor

@ameba23 ameba23 commented May 11, 2026

ra_tls::cert::CertRequest::into_cert_params converts every configured subject alternative name into SanType::DnsName, so an IP literal like 203.0.113.10 is encoded as a DNS SAN.

dstack/ra-tls/src/cert.rs

Lines 372 to 378 in 4b7372d

if let Some(alt_names) = self.alt_names {
for alt_name in alt_names {
params
.subject_alt_names
.push(SanType::DnsName(alt_name.clone().try_into()?));
}
}

rustls/webpki requires IP endpoints to be represented as actual IP SANs, so name verification fails when clients connect by IP address. This makes it difficult to use ra_tls for IP-only hosts. See related issue in our attested-tls implementation which depends on ra-tls: flashbots/attested-tls#30

This PR delegates SAN parsing to rcgen::CertificateParams::new(...), which internally converts IP literals into SanType::IpAddress and leaves hostnames as DNS SANs.

So this is a behavioral change, but it only effects names which successfully parse as IP addresses.

A test covering mixed SANs is included which checks that:

  • 203.0.113.10 is encoded as SanType::IpAddress
  • test.example.com remains SanType::DnsName

Copy link
Copy Markdown
Collaborator

@kvinwang kvinwang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for the fix!

@kvinwang kvinwang enabled auto-merge May 11, 2026 14:29
@kvinwang kvinwang merged commit 8288491 into Dstack-TEE:master May 11, 2026
8 of 12 checks passed
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.

2 participants