WireGuard

使用加密路由的安全隧道

 

 Wireguard 快速、现代、安全的隧道,来自 pfsense+

Wireguard 快速、现代、安全的隧道,来自 pfsense+)

WireGuard® 是一个极其简单、快速和现代的 VPN,利用了最先进的加密技术。它的目标是比 IPsec 更快、更简单、更精简、更有用,同时避免大规模的麻烦。它的性能要比 OpenVPN 好得多。WireGuard 被设计成一个通用 VPN,可以在嵌入式接口和超级计算机上运行,适合许多不同的环境。它最初发布于 Linux 内核,现在是跨平台的 (Windows, macOS, BSD, iOS, Android) 和广泛部署。它目前正在大量开发中,但它可能已经被认为是行业中最安全、最容易使用、最简单的 VPN 解决方案。

WireGuard 白皮书

 

WireGuard 概述

如果你想了解 WireGuard 的总体概念,请继续阅读。然后您可以安装,并阅读关于如何使用它的快速入门说明。如果您对内部的工作原理感兴趣,您可能会对协议的简要摘要感兴趣,或者通过阅读技术白皮书来深入了解,该白皮书更详细地介绍了协议、密码学和基础知识。如果你想在一个新的平台上实现 WireGuard,请阅读跨平台说明。WireGuard 通过 UDP 安全地封装 IP 数据包。您添加一个 WireGuard 接口,用您的私钥和对等的公钥配置它,然后通过它发送数据包。所有密钥分发和推送配置的问题都超出了 WireGuard 的范围;这些问题最好留给其他层处理,以免我们最终导致 IKE 或 OpenVPN 的臃肿。相比之下,它更像 SSH 和 Mosh 的模型;双方都有对方的公钥,然后就可以通过接口开始交换数据包。

简单和易于使用

WireGuard 的目标是像 SSH 一样易于配置和部署。VPN 连接只需交换非常简单的公钥(就像交换 SSH 密钥一样),其余的都由 WireGuard 透明地处理。它甚至能够在 IP 地址之间漫游,就像 Mosh。不需要管理连接、关心状态、管理守护进程或担心隐藏在底层的内容。WireGuard 提供了一个非常基本但功能强大的界面。

加密技术

WireGuard使用最先进的加密技术,如 噪声协议框架, Curve25519, ChaCha20, Poly1305, BLAKE2, SipHash24, HKDF, 安全可信结构。它做出了保守和合理的选择,并已被密码学家审查。

最小的攻击界面

WireGuard 在设计时考虑到了易于实现和简单性。这意味着只需很少的几行代码就可以轻松实现,并且容易对安全漏洞进行审计。与 *Swan / IPsec 或 OpenVPN / OpenSSL 这样的庞然大物相比,即使对大型安全专家团队来说,审核庞大的代码库也是一项艰巨的任务,而 WireGuard 的目的是让单个个人全面审查。

高性能

集成于 Linux 内核中的 WireGuard 意味着安全的网络可以非常高速。它既适用于小型嵌入式设备,如智能手机和全负载骨干路由器。

定义明确,考虑周全

WireGuard 是一个漫长的、经过充分考虑的学术过程的结果,从而产生了 技术白皮书, 这是一篇明确定义协议和每个决定的学术研究论文。

 

简单的网络接口

WireGuard works by adding a network interface (or multiple), like eth0 or wlan0, called wg0 (or wg1, wg2, wg3, etc). This network interface can then be configured normally using ifconfig(8) or ip-address(8), with routes for it added and removed using route(8) or ip-route(8), and so on with all the ordinary networking utilities. The specific WireGuard aspects of the interface are configured using the wg(8) tool. This interface acts as a tunnel interface.

WireGuard associates tunnel IP addresses with public keys and remote endpoints. When the interface sends a packet to a peer, it does the following:

  1. This packet is meant for 192.168.30.8. Which peer is that? Let me look... Okay, it's for peer ABCDEFGH. (Or if it's not for any configured peer, drop the packet.)
  2. Encrypt entire IP packet using peer ABCDEFGH's public key.
  3. What is the remote endpoint of peer ABCDEFGH? Let me look... Okay, the endpoint is UDP port 53133 on host 216.58.211.110.
  4. Send encrypted bytes from step 2 over the Internet to 216.58.211.110:53133 using UDP.

When the interface receives a packet, this happens:

  1. I just got a packet from UDP port 7361 on host 98.139.183.24. Let's decrypt it!
  2. It decrypted and authenticated properly for peer LMNOPQRS. Okay, let's remember that peer LMNOPQRS's most recent Internet endpoint is 98.139.183.24:7361 using UDP.
  3. Once decrypted, the plain-text packet is from 192.168.43.89. Is peer LMNOPQRS allowed to be sending us packets as 192.168.43.89?
  4. If so, accept the packet on the interface. If not, drop it.

Behind the scenes there is much happening to provide proper privacy, authenticity, and perfect forward secrecy, using state-of-the-art cryptography.

加密密钥路由

WireGuard 的核心是一个称为加密密钥路由的概念,它的工作原理是将公钥与隧道内允许的隧道 IP 地址列表关联起来。每个网络接口都有一个私钥和一个对等体列表。每个对等点都有一个公钥。公钥简短而简单,对等体使用公钥进行彼此身份验证。它们可以通过任何带外方法传递,以便在配置文件中使用,类似于将 SSH 公钥发送给访问 shell 服务器的朋友。

内置的漫游

客户端配置包含其单个对等端(服务器)的初始端点,以便在接收加密数据之前知道将加密数据发送到哪里。服务器配置没有其对等端(客户机)的任何初始端点。这是因为服务器通过检查经过正确身份验证的数据的来源来发现对等节点的端点。如果服务器本身更改了自己的端点,并向客户机发送数据,客户机将发现新的服务器端点,并同样更新配置。客户机和服务器都将加密的数据发送到最新的IP端点,并对其进行真实解密。因此,在两端都有全IP漫游。

容器准备就绪

WireGuard 使用最初创建 WireGuard 接口的网络名称空间发送和接收加密包。. 这意味着你可以在你的主网络命名空间(可以访问 Internet )中创建 WireGuard 接口,然后将它移动到一个属于 Docker 容器的网络命名空间中,作为该容器的唯一接口。这确保了 container 访问网络的唯一可能方式是通过一个安全加密的 WireGuard 隧道。

 

追踪 IP 地址...

Netgate pfsense Global Support 24x7

From Mass Storage NAS, firewall, IDS, IPS, Autosense/autodefense setup to mission-critical HA implementation.

HK office: +852 2312-0878  China office: +86 0755 2590-4562 or email: sales_team @ topscoms . com   sales_team @ topscoms . cn