Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
/ corefx Public archive

Unix SslStream: Implement RFC2812 IP Address matching for HTTP over TLS. #3829

Merged
merged 1 commit into from
Oct 14, 2015

Conversation

bartonjs
Copy link
Member

If the hostname looks like an IP Address then do exact matches against GEN_IPADDR Subject Alternative Name entries. Unlike the GEN_DNS matching of text hostnames, the IP Address form always falls back to the CN text comparison if no other match has been found.

Fixes #3445.

cc: @vijaykota @stephentoub @rajansingh10 @shrutigarg @CIPop @davidsh

If the hostname looks like an IP Address then do exact matches against GEN_IPADDR Subject Alternative Name entries.  Unlike the GEN_DNS matching of text hostnames, the IP Address form always falls back to the CN text comparison if no other match has been found.
@bartonjs bartonjs force-pushed the unix_sslstream_ipaddress branch from b00dbfb to b8ad721 Compare October 14, 2015 04:43
continue;
}

if (!memcmp(addressBytes, ipAddr->data, (size_t)addressBytesLen))
Copy link
Member

Choose a reason for hiding this comment

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

I assume we don't have to worry about byte order?

Copy link
Member Author

Choose a reason for hiding this comment

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

RFC 3280 defines that iPAddress values within the subjectAltName extension are in network-byte-order. And while the MSDN documentation is a bit sparse for IPAddress.GetAddressBytes(), it seems to be returning things in network-byte-order.

Copy link
Member

Choose a reason for hiding this comment

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

Sounds good.

@stephentoub
Copy link
Member

LGTM

stephentoub added a commit that referenced this pull request Oct 14, 2015
Unix SslStream: Implement RFC2812 IP Address matching for HTTP over TLS.
@stephentoub stephentoub merged commit 127809a into dotnet:master Oct 14, 2015
@bartonjs bartonjs deleted the unix_sslstream_ipaddress branch October 14, 2015 14:19
@vijaykota
Copy link
Contributor

LGTM. Sorry about the delay

@karelz karelz modified the milestone: 1.0.0-rtm Dec 3, 2016
@karelz karelz added the os-linux Linux OS (any supported distro) label Mar 8, 2017
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
…address

Unix SslStream: Implement RFC2812 IP Address matching for HTTP over TLS.

Commit migrated from dotnet/corefx@127809a
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Net os-linux Linux OS (any supported distro)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants