WireGuard VPN
WireGuard - result of researches of the author of the project of Jayson Donenfilda (Jason A. Donenfeld), heads of company Edge Security. A product with the built in cryptography, simultaneously idle time in use and in realisation (hardly more than 4000 lines of a code) that essentially allocates it among other decisions. For example, its code is easier to analyse, than everything that is written in frameworks *Swan/IPsec or OpenVPN.
The youngest project of the review. About it have started talking in the middle of summer 2016 ambassador of the publication of the announcement in the mailing list of developers of kernel Linux where the patch to a kernel has been presented. Though the project develops some years and has passed a stage of reviewing of cryptography, that is it can be introduced in the basic kernel.
VPN-connection is initialized (handshake) by an exchange of open keys and reminds the approach applied in SSH. All the rest is transparent is processed WireGuard, there is no necessity to worry about keys, routeing, control of a status and other, it is all care WireGuard.
Use of symmetric enciphering is possible, but it will demand hardly the big options. Routeing is made on enciphering keys, for this purpose to each network interface the closed key becomes attached. For updating of keys handshake happens through certain time or on a signal that keys have become outdated. For the coordination of keys and connection instead of own demon in space of the user mechanism Noise_IK from Noise Protocol Framework, similar to maintenance authorized_keys in SSH, without complications in the form of support x509 and ASN.1 is used.
Stream code number ChaCha20 and algorithm of authentication of messages are applied to enciphering (MAC) Poly1305. For generation of a joint confidential key - the report of Diffi - Hellmana on elliptic curves in realisation Curve25519 offered by Denielom Bernstein. For hashings are used BLAKE2s (RFC 7693) and SipHash-2-4. To avoid replay-attack the label of time TAI64N allows, packages with a smaller label of time are rejected.
Date transmission is carried out at the third level ISO through encapsulation in packages UDP. Are supported IPv4 and IPv6, encapsulation v4 in v6 and v6 in v4. Can work for NAT and a firewall. Change of an IP address of the VPN-server without rupture of connection with automatic change-over of the client is supported.
After installation in system there is a new network interface wg0 which can be adjusted regular tools ipconfig/ip-address and route/ip-route. The special utility wg allows to instal a confidential key of the device and to specify the list of associations for clients (its public key resolved IP).
For installation the distribution kit with kernel Linux> 4.1 is required. The package can be found in repositories of basic distribution kits Linux. For Ubuntu 16.04 is PPA.
Independent assemblage from initial texts also is simple. We lift the interface, we generate pair of keys (for an example it is kept in files privatekey and publickey):
We receive a public key from the client and we create connection.
Use PresharedKey (it is generated by wg genpsk command) which adds one more level of symmetric enciphering to available enciphering with an open key is possible. For a feast it is possible to specify PersistentKeepalive, allowing to support connection because of NAT and a firewall. We lift the interface:
We look options:
For convenience it is better to prepare in advance the configuration file containing section interface and section peer. The format can be seen, having entered wg showconf.
Approaches as for the small built in devices like smart phones, and for the main routers. Tests have shown that WireGuard has approximately four times the best carrying capacity and in 3,8 times is more sympathetic in comparison with OpenVPN (256-bit AES c HMAC-SHA-2-256). Here affects not only realisation in the form of the kernel module whereas OpenVPN works in userspace. Productivity increase is caused by refusal of use CryptoAPI of the kernel working slowly enough. Instead of it in WireGuard own realisations ChaCha20, Poly1305, BLAKE2s and Curve25519 which are positioned as fast and safe analogues AES-256-CTR and HMAC are involved, their program realisation allows to achieve the fixed runtime without hardware support.
Also WireGuard thanks to smaller delays hardly looks in productivity in comparison with IPsec (256-bit ChaCha20 + Poly1305 and AES-256-GCM-128) is better, but here options are much easier. While WireGuard it is accessible only for Linux, after testing it is supposed to instal in other OS. The code extends under licence GNU GPLv2.
Adjustment WireGuard
Configuration WireGuard
Other VPN programs: