Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define "private" and "local" in terms of properties of the relevant IANA registry #30

Closed
sleevi opened this issue Nov 12, 2020 · 9 comments

Comments

@sleevi
Copy link
Contributor

sleevi commented Nov 12, 2020

This is a subset of issue #28 , and addresses the Carrier Grade NAT / Special Use address.

Presently, the spec states:

An IPv4 address is a private address if it matches the private address space defined in Section 3 of [RFC1918], a local address if it matches the "loopback" space (127.0.0.0/8) defined in section 3.2.1.3 of [RFC1122] or the "link-local" space (169.254.0.0/16) defined in [RFC3927], and a public address otherwise.

However, the "source of truth" for these reservations is the relevant IANA registry, which captures all of the relevant reservations (such as what @thejh raised with RFC6598)

With this approach, the following rules should give equivalent results, but support the full spectrum of reserved allocations

  • An address is a local address if Source, Destination, and Globally Reachable are False
  • An address is a private address if Globally Reachable is False
  • Otherwise, an address is a public address

This isn't perfect, as there are still reserved address spaces that would be treated as public.

However, this also matches Chrome's current implementation, and would cover the situation raised in Issue #28 regarding VMs

@letitz
Copy link
Collaborator

letitz commented Nov 13, 2020

That sounds like a great idea. I'll amend the spec.

@letitz letitz mentioned this issue Nov 16, 2020
Closed
@letitz
Copy link
Collaborator

letitz commented Nov 16, 2020

I went through the IPv4 registry to see how the above proposal would play out concretely.

Here are the special-use registrations classified by address space:

I'll want to dig into a few of these a bit more to understand whether the classifications make sense, but on a surface level they look good :)

@thejh
Copy link

thejh commented Nov 17, 2020

I think it's noteworthy that this will classify things like TEST-NET-1 as local; so if a private network uses these (in violation of the RFC?), that would allow the network to gain access to 127.0.0.1?

If addresses of the same type are allowed to interact freely, then local must be restricted to addresses that operating systems won't route onto the network (independent of what the router tells the local machine about the private network).

@letitz
Copy link
Collaborator

letitz commented Nov 17, 2020

That's fair, and simple enough to fix. How about this alternate definition?

  • An address is local if:
    • it is an IPv4 address in the 127.0.0.0/8 subnet
    • it is an IPv6 address equal to ::1
  • Otherwise an address is private if Globally Reachable is False
  • Otherwise, an address is public

It hardcodes the IPv4 and IPv6 loopback addresses, but otherwise defers to the registry for private vs public distinctions?

@thejh
Copy link

thejh commented Nov 17, 2020

I think that sounds reasonable.

@letitz
Copy link
Collaborator

letitz commented Nov 17, 2020

It just happens to match the current implementation in Chromium too! 🎉

I'll see how it plays out with the IPv6 special-use registry.

@letitz
Copy link
Collaborator

letitz commented Nov 17, 2020

Here's the classification of the IPv6 special-use registry assignments according to the rules laid out in comment #30 (comment).

private:

  • ::/128: Unspecified Address - RFC4291
  • ::ffff:0:0/96: IPv4-mapped Address - RFC4291
  • 64:ff9b:1::/48: IPv4-IPv6 Translat. - RFC8215
  • 100::/64: Discard-Only Address Block - RFC6666
  • 2001:2::/48: Benchmarking - RFC5180, RFC Errata 1752
  • 2001:db8::/32: Documentation - RFC3849
  • fe80::/10: Link-Local Unicast - RFC4291
  • 2001::/23: IETF Protocol Assignments - RFC2928 - unless otherwise overridden
  • fc00::/7: Unique-Local - RFC4193 RFC8190

The following assignments have a Globally Reachable value of N/A... Not sure what to do with those.

public:

  • 64:ff9b::/96: IPv4-IPv6 Translat. - RFC6052
  • 2001:1::1/128: Port Control Protocol Anycast - RFC7723
  • 2001:1::2/128: Traversal Using Relays around NAT Anycast - RFC8155
  • 2001:3::/32: AMT - RFC7450
  • 2001:4:112::/48: AS112-v6 - RFC7535
  • 2001:20::/28: ORCHIDv2 - RFC7343
  • 2620:4f:8000::/48: Direct Delegation AS112 Service - RFC7534

We might want to make an exception for IPv4-mapped addresses, and instead consider the address space of the embedded IPv4 address?

@letitz
Copy link
Collaborator

letitz commented Nov 23, 2020

A strict reading of #30 (comment) yields that both TEREDO an 6to4 should be considered public, as their Globally Reachable bit is not explicitly False. I think this makes sense as a default stance, since it gives less privileges to such IP addresses.

I'll amend the algorithm to handle the IPv4-IPv6 mapped addresses: in that case, apply the algorithm to the encapsulated IPv4 address.

Will send a PR to fix the spec.

@letitz
Copy link
Collaborator

letitz commented Dec 7, 2020

Fixed by #31.

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

No branches or pull requests

3 participants