匿名 IPv6 地址

发布于 2024-11-09 12:26:41 字数 171 浏览 5 评论 0 原文

根据多个国家/地区的法律要求,我们在日志文件中对用户的 IP 地址进行匿名化处理。使用 IPv4,我们通常只是匿名最后两个字节,例如。我们记录的是 255.255.\*.\*,而不是 255.255.255.255

您建议使用什么算法来匿名化 IPv6 地址?

As required by law in several countries we anonymize IP-addresses of our users in our log files. Using IPv4 we regularly just anonymize the two last bytes, eg. instead of 255.255.255.255 we log 255.255.\*.\*

What algorithm would you recommend to anonymize IPv6 addresses?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

灯角 2024-11-16 12:26:41

至少你想剥离 EUI-64 off,即地址的最后 64 位。更现实的是,您希望剥离更多内容以真正实现私有,因为剩余部分仍将仅标识一个子网(即可能是一栋房子)

IPv6 全局寻址是非常分层的,来自 RFC2374

 | 3|  13 | 8 |   24   |   16   |          64 bits               |
 +--+-----+---+--------+--------+--------------------------------+
 |FP| TLA |RES|  NLA   |  SLA   |         Interface ID           |
 |  | ID  |   |  ID    |  ID    |                                |
 +--+-----+---+--------+--------+--------------------------------+
 <--Public Topology--->   Site
                       <-------->
                        Topology
                                 <------Interface Identifier----->

问题是如何私密才足够私密?剥离 64 位后,您就识别出了 LAN 子网,而不是用户。再除去 16 个,您就确定了一个小型组织,即 ISP 的客户,例如具有多个子网的公司/分支机构。去掉接下来的 24 个,您基本上就只能识别出 ISP 或真正的大型组织。

您可以使用与 IPv4 地址完全相同的位掩码来实现这一点,但问题变成了一个法律问题,即“我需要剥离多少内容才能符合特定立法”,而不是技术问题。

At the very least you want to strip the EUI-64 off, i.e the last 64 bits of the address. more realistically you want to strip quite a lot more to really be private, since the remaining part will still identify only one subnet (i.e. one house possibly)

IPv6 global addressing is very hierarchical, from RFC2374:

 | 3|  13 | 8 |   24   |   16   |          64 bits               |
 +--+-----+---+--------+--------+--------------------------------+
 |FP| TLA |RES|  NLA   |  SLA   |         Interface ID           |
 |  | ID  |   |  ID    |  ID    |                                |
 +--+-----+---+--------+--------+--------------------------------+
 <--Public Topology--->   Site
                       <-------->
                        Topology
                                 <------Interface Identifier----->

The question becomes how private is private enough? Strip 64 bits and you've identified a LAN subnet, not a user. Strip another 16 on top of that and you've identified a small organisation, i.e. a customer of an ISP, e.g. company/branch office with several subnets. Strip the next 24 off an you've basically identified an ISP or really big organisation only.

You can implement this with a bitmask exactly like you would for an IPv4 address, the question becomes a legal one though of "how much do I need to strip to comply with the specific legislation", not a technical one at that point though.

软的没边 2024-11-16 12:26:41

要匿名化公共 IPv6 地址,您可以采用前 2 组(32 位)并用 CRC-16 替换剩余部分(96 位)。一些示例(其中 abc1abc2 - 是 CRC-16 值):

  • 2001:0db8:85a3:0000:0000:8a2e:0370:7334 -> 2001:0db8-abc1
  • 2a02:200:7::123 -> 2a02:200-abc2

这种缩短可以轻松地将前 2 组(当然有一定概率)与保留时间较短的完整日志中的非匿名 IPv6 进行匹配。这有利于问题或安全事件调查。

如有必要,可以将 CRC-16 更改为 CRC-12 以提高匿名级别。

To anonymize public IPv6 addresses you could take the first 2 groups (32 bits) and replace the remaining part (96 bits) with CRC-16. Some examples (where abc1 and abc2 - are CRC-16 values):

  • 2001:0db8:85a3:0000:0000:8a2e:0370:7334 -> 2001:0db8-abc1
  • 2a02:200:7::123 -> 2a02:200-abc2

Such shortening allows easy matching of the first 2 groups (of course with some probability) with non-anonymized IPv6 in full logs having shorter retention time. Which is good for problem or security incident investigation.

If necessary the CRC-16 could be changed to CRC-12 to increase anonymization level.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文