1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2024-11-23 01:49:53 +03:00
SoftEtherVPN/src/Cedar
Davide Beatrici dd1eebdbed Cedar: Implement support for WireGuard
Please note that the implementation is not 100% conformant to the protocol whitepaper (https://www.wireguard.com/papers/wireguard.pdf).
More specifically: all peers are expected to send a handshake initiation once the current keypair is about to expire or is expired.
I decided not to do that because our implementation is meant to act as a server only. A true WireGuard peer acts, instead, as both a client and a server.
Once the keypair is expired, we immediately delete the session.

The cookie mechanism can be implemented in future.

As for authentication: unfortunately using the already existing methods is not possible due to the protocol not providing a way to send strings to a peer.
That's because WireGuard doesn't have a concept of "users": it identifies a peer through the public key, which is determined using the source address.
As a solution, this commit adds a special authentication method: once we receive the handshake initiation message and decrypt the peer's public key, we check whether it's in the allowed key list.
If it is, we retrieve the associated Virtual Hub and user; if the hub exists and the user is in it, the authentication is successful.

The allowed key list is stored in the configuration file like this:

declare WireGuardKeyList
{
	declare 96oA7iMvjn7oXiG3ghBDPaSUytT75uXceLV+Fx3XMlM=
	{
		string Hub DEFAULT
		string User user
	}
}
2021-03-01 02:49:59 +01:00
..
winpcap Correct Spelling (#458) 2018-05-16 23:47:10 +02:00
Account.c Cedar: DHCP server now assigns static IPv4 address, if present in user note 2020-10-12 04:56:33 +02:00
Account.h Cedar: DHCP server now assigns static IPv4 address, if present in user note 2020-10-12 04:56:33 +02:00
Admin.c Cedar: Add "DefaultGateway" and "DefaultSubnet" virtual hub options 2021-03-01 02:49:59 +01:00
Admin.h Cedar: Add "DefaultGateway" and "DefaultSubnet" virtual hub options 2021-03-01 02:49:59 +01:00
AzureClient.c Merge pull request #832 from dnobori/181202_switch_to_apache_license 2019-01-21 09:36:19 +09:00
AzureClient.h Merge pull request #832 from dnobori/181202_switch_to_apache_license 2019-01-21 09:36:19 +09:00
AzureServer.c Compacting headers, updating trivial texts to fit to the license change from GPLv2 to Apache License 2.0. 2019-01-14 12:25:53 +09:00
AzureServer.h Compacting headers, updating trivial texts to fit to the license change from GPLv2 to Apache License 2.0. 2019-01-14 12:25:53 +09:00
Bridge.c Compacting headers, updating trivial texts to fit to the license change from GPLv2 to Apache License 2.0. 2019-01-14 12:25:53 +09:00
Bridge.h Compacting headers, updating trivial texts to fit to the license change from GPLv2 to Apache License 2.0. 2019-01-14 12:25:53 +09:00
BridgeUnix.c Preliminary implementation of IPv6CP and IPv6 for PPP (untested) 2020-05-12 18:05:18 +03:00
BridgeUnix.h Compacting headers, updating trivial texts to fit to the license change from GPLv2 to Apache License 2.0. 2019-01-14 12:25:53 +09:00
BridgeWin32.c Compacting headers, updating trivial texts to fit to the license change from GPLv2 to Apache License 2.0. 2019-01-14 12:25:53 +09:00
BridgeWin32.h Compacting headers, updating trivial texts to fit to the license change from GPLv2 to Apache License 2.0. 2019-01-14 12:25:53 +09:00
Cedar.c Cedar: Implement support for WireGuard 2021-03-01 02:49:59 +01:00
Cedar.h Cedar: Implement support for WireGuard 2021-03-01 02:49:59 +01:00
CedarPch.c Compacting headers, updating trivial texts to fit to the license change from GPLv2 to Apache License 2.0. 2019-01-14 12:25:53 +09:00
CedarPch.h Compacting headers, updating trivial texts to fit to the license change from GPLv2 to Apache License 2.0. 2019-01-14 12:25:53 +09:00
CedarType.h Cedar: Implement support for WireGuard 2021-03-01 02:49:59 +01:00
Client.c Openssl engine certificate authentication 2020-10-09 02:56:51 +02:00
Client.h Openssl engine certificate authentication 2020-10-09 02:56:51 +02:00
CM.c Cedar: remove all references to binaries with "_x64" and "_ia64" suffix 2020-07-27 20:59:40 +02:00
CM.h Compacting headers, updating trivial texts to fit to the license change from GPLv2 to Apache License 2.0. 2019-01-14 12:25:53 +09:00
CMakeLists.txt Cedar: Implement support for WireGuard 2021-03-01 02:49:59 +01:00
CMInner.h Merge pull request #832 from dnobori/181202_switch_to_apache_license 2019-01-21 09:36:19 +09:00
Command.c Cedar: Add "DefaultGateway" and "DefaultSubnet" virtual hub options 2021-03-01 02:49:59 +01:00
Command.h Cedar: Add "DefaultGateway" and "DefaultSubnet" virtual hub options 2021-03-01 02:49:59 +01:00
Connection.c Fixed setting change trigger of keepalive function 2020-11-17 12:23:14 +09:00
Connection.h Openssl engine certificate authentication 2020-10-09 02:56:51 +02:00
Console.c Compacting headers, updating trivial texts to fit to the license change from GPLv2 to Apache License 2.0. 2019-01-14 12:25:53 +09:00
Console.h Compacting headers, updating trivial texts to fit to the license change from GPLv2 to Apache License 2.0. 2019-01-14 12:25:53 +09:00
Database.c Compacting headers, updating trivial texts to fit to the license change from GPLv2 to Apache License 2.0. 2019-01-14 12:25:53 +09:00
Database.h Compacting headers, updating trivial texts to fit to the license change from GPLv2 to Apache License 2.0. 2019-01-14 12:25:53 +09:00
DDNS.c Implementation of the JSON-RPC API and the Web Admin interface. (dnobori's internal note: 7579 - 7682) 2019-05-28 12:51:51 +09:00
DDNS.h Implementation of the JSON-RPC API and the Web Admin interface. (dnobori's internal note: 7579 - 7682) 2019-05-28 12:51:51 +09:00
EM.c Compacting headers, updating trivial texts to fit to the license change from GPLv2 to Apache License 2.0. 2019-01-14 12:25:53 +09:00
EM.h Compacting headers, updating trivial texts to fit to the license change from GPLv2 to Apache License 2.0. 2019-01-14 12:25:53 +09:00
EMInner.h Compacting headers, updating trivial texts to fit to the license change from GPLv2 to Apache License 2.0. 2019-01-14 12:25:53 +09:00
EtherLog.c Implementation of the JSON-RPC API and the Web Admin interface. (dnobori's internal note: 7579 - 7682) 2019-05-28 12:51:51 +09:00
EtherLog.h Compacting headers, updating trivial texts to fit to the license change from GPLv2 to Apache License 2.0. 2019-01-14 12:25:53 +09:00
Hub.c Bugfix: Imperfect Virtual Hub FDB lock may cause process crush. 2020-01-01 15:52:47 +09:00
Hub.h Cedar: Add "DefaultGateway" and "DefaultSubnet" virtual hub options 2021-03-01 02:49:59 +01:00
IPC.c Cedar: Implement support for WireGuard 2021-03-01 02:49:59 +01:00
IPC.h Cedar: Implement support for WireGuard 2021-03-01 02:49:59 +01:00
Layer3.c Compacting headers, updating trivial texts to fit to the license change from GPLv2 to Apache License 2.0. 2019-01-14 12:25:53 +09:00
Layer3.h Compacting headers, updating trivial texts to fit to the license change from GPLv2 to Apache License 2.0. 2019-01-14 12:25:53 +09:00
Link.c Openssl engine certificate authentication 2020-10-09 02:56:51 +02:00
Link.h Compacting headers, updating trivial texts to fit to the license change from GPLv2 to Apache License 2.0. 2019-01-14 12:25:53 +09:00
Listener.c Implementation of the JSON-RPC API and the Web Admin interface. (dnobori's internal note: 7579 - 7682) 2019-05-28 12:51:51 +09:00
Listener.h Compacting headers, updating trivial texts to fit to the license change from GPLv2 to Apache License 2.0. 2019-01-14 12:25:53 +09:00
Logging.c Fixing most errors, the link on Windows is working and is stable 2020-05-12 18:10:06 +03:00
Logging.h Compacting headers, updating trivial texts to fit to the license change from GPLv2 to Apache License 2.0. 2019-01-14 12:25:53 +09:00
Nat.c Implementation of the JSON-RPC API and the Web Admin interface. (dnobori's internal note: 7579 - 7682) 2019-05-28 12:51:51 +09:00
Nat.h separte log directory and database(config) directory 2019-12-04 23:59:09 +09:00
NativeStack.c Compacting headers, updating trivial texts to fit to the license change from GPLv2 to Apache License 2.0. 2019-01-14 12:25:53 +09:00
NativeStack.h Compacting headers, updating trivial texts to fit to the license change from GPLv2 to Apache License 2.0. 2019-01-14 12:25:53 +09:00
netcfgn.h v4.03-9408-rtm 2014-01-04 22:00:08 +09:00
netcfgx.h v4.03-9408-rtm 2014-01-04 22:00:08 +09:00
NM.c Compacting headers, updating trivial texts to fit to the license change from GPLv2 to Apache License 2.0. 2019-01-14 12:25:53 +09:00
NM.h Compacting headers, updating trivial texts to fit to the license change from GPLv2 to Apache License 2.0. 2019-01-14 12:25:53 +09:00
NMInner.h Compacting headers, updating trivial texts to fit to the license change from GPLv2 to Apache License 2.0. 2019-01-14 12:25:53 +09:00
NullLan.c Compacting headers, updating trivial texts to fit to the license change from GPLv2 to Apache License 2.0. 2019-01-14 12:25:53 +09:00
NullLan.h Compacting headers, updating trivial texts to fit to the license change from GPLv2 to Apache License 2.0. 2019-01-14 12:25:53 +09:00
Proto_EtherIP.c Cedar: Implement support for WireGuard 2021-03-01 02:49:59 +01:00
Proto_EtherIP.h Compacting headers, updating trivial texts to fit to the license change from GPLv2 to Apache License 2.0. 2019-01-14 12:25:53 +09:00
Proto_IKE.c Cedar: various fixes 2019-11-23 04:23:51 +01:00
Proto_IKE.h Compacting headers, updating trivial texts to fit to the license change from GPLv2 to Apache License 2.0. 2019-01-14 12:25:53 +09:00
Proto_IkePacket.c Compacting headers, updating trivial texts to fit to the license change from GPLv2 to Apache License 2.0. 2019-01-14 12:25:53 +09:00
Proto_IkePacket.h Compacting headers, updating trivial texts to fit to the license change from GPLv2 to Apache License 2.0. 2019-01-14 12:25:53 +09:00
Proto_IPsec.c Merge pull request #832 from dnobori/181202_switch_to_apache_license 2019-01-21 09:36:19 +09:00
Proto_IPsec.h Merge pull request #832 from dnobori/181202_switch_to_apache_license 2019-01-21 09:36:19 +09:00
Proto_L2TP.c Remove "BOOL", "TRUE" and "FALSE", use lowercase everywhere for consistency 2020-08-15 09:18:27 +02:00
Proto_L2TP.h Adding timeout propagation from user policy in PPP sessions (including L2TP and SSTP). 2020-05-02 19:52:45 +03:00
Proto_OpenVPN.c Cedar: Add ProtoOptionString() in PROTO_IMPL, to generate default option values 2021-03-01 02:49:59 +01:00
Proto_OpenVPN.h Cedar: Improve IsPacketForMe()'s "data" argumment in PROTO_IMPL 2021-03-01 02:49:59 +01:00
Proto_PPP.c Cedar: Implement support for WireGuard 2021-03-01 02:49:59 +01:00
Proto_PPP.h Remove "UINT32" and "DWORD", use "UINT" everywhere for consistency 2020-08-15 09:18:27 +02:00
Proto_SSTP.c Cedar: Add ProtoOptionString() in PROTO_IMPL, to generate default option values 2021-03-01 02:49:59 +01:00
Proto_SSTP.h Cedar: use Proto API for protocol options 2020-07-28 00:57:36 +02:00
Proto_Win7.c Compacting headers, updating trivial texts to fit to the license change from GPLv2 to Apache License 2.0. 2019-01-14 12:25:53 +09:00
Proto_Win7.h Compacting headers, updating trivial texts to fit to the license change from GPLv2 to Apache License 2.0. 2019-01-14 12:25:53 +09:00
Proto_Win7Inner.h Compacting headers, updating trivial texts to fit to the license change from GPLv2 to Apache License 2.0. 2019-01-14 12:25:53 +09:00
Proto_WireGuard.c Cedar: Implement support for WireGuard 2021-03-01 02:49:59 +01:00
Proto_WireGuard.h Cedar: Implement support for WireGuard 2021-03-01 02:49:59 +01:00
Proto.c Cedar: Implement support for WireGuard 2021-03-01 02:49:59 +01:00
Proto.h Cedar: Add ProtoOptionString() in PROTO_IMPL, to generate default option values 2021-03-01 02:49:59 +01:00
Protocol.c Cedar: Implement support for WireGuard 2021-03-01 02:49:59 +01:00
Protocol.h Cedar: Implement support for WireGuard 2021-03-01 02:49:59 +01:00
Radius.c Remove "BOOL", "TRUE" and "FALSE", use lowercase everywhere for consistency 2020-08-15 09:18:27 +02:00
Radius.h Increase Radius timeout 2020-05-11 23:06:01 +02:00
Remote.c Implementation of the JSON-RPC API and the Web Admin interface. (dnobori's internal note: 7579 - 7682) 2019-05-28 12:51:51 +09:00
Remote.h Implementation of the JSON-RPC API and the Web Admin interface. (dnobori's internal note: 7579 - 7682) 2019-05-28 12:51:51 +09:00
Sam.c sam: fix using pointer to local variable that is out of scope 2020-03-27 07:28:43 +03:00
Sam.h Compacting headers, updating trivial texts to fit to the license change from GPLv2 to Apache License 2.0. 2019-01-14 12:25:53 +09:00
SecureInfo.c Compacting headers, updating trivial texts to fit to the license change from GPLv2 to Apache License 2.0. 2019-01-14 12:25:53 +09:00
SecureInfo.h Compacting headers, updating trivial texts to fit to the license change from GPLv2 to Apache License 2.0. 2019-01-14 12:25:53 +09:00
SecureNAT.c Compacting headers, updating trivial texts to fit to the license change from GPLv2 to Apache License 2.0. 2019-01-14 12:25:53 +09:00
SecureNAT.h Compacting headers, updating trivial texts to fit to the license change from GPLv2 to Apache License 2.0. 2019-01-14 12:25:53 +09:00
SeLowUser.c Compacting headers, updating trivial texts to fit to the license change from GPLv2 to Apache License 2.0. 2019-01-14 12:25:53 +09:00
SeLowUser.h Compacting headers, updating trivial texts to fit to the license change from GPLv2 to Apache License 2.0. 2019-01-14 12:25:53 +09:00
Server.c Cedar: Implement support for WireGuard 2021-03-01 02:49:59 +01:00
Server.h Cedar: Implement support for WireGuard 2021-03-01 02:49:59 +01:00
Session.c Cedar/Session.c: fix "use after free" in CleanupSession() 2020-10-31 20:03:22 +01:00
Session.h Cedar: DHCP server now assigns static IPv4 address, if present in user note 2020-10-12 04:56:33 +02:00
SM.c Bug fix: Proxy button not enabled for SOCKS5 2020-12-08 14:12:21 +08:00
SM.h Compacting headers, updating trivial texts to fit to the license change from GPLv2 to Apache License 2.0. 2019-01-14 12:25:53 +09:00
SMInner.h Cedar/SM: replace SmStrToPortList() with StrToPortList() 2020-05-20 20:18:51 +02:00
SW.c Cedar/SW.c: disable "vpninstall" and "vpnweb" tasks 2020-07-27 20:59:40 +02:00
SW.h Compacting headers, updating trivial texts to fit to the license change from GPLv2 to Apache License 2.0. 2019-01-14 12:25:53 +09:00
SWInner.h Compacting headers, updating trivial texts to fit to the license change from GPLv2 to Apache License 2.0. 2019-01-14 12:25:53 +09:00
UdpAccel.c Cedar: implement UDP acceleration version 2, powered by ChaCha20-Poly1305 2019-11-23 04:23:56 +01:00
UdpAccel.h Cedar: implement UDP acceleration version 2, powered by ChaCha20-Poly1305 2019-11-23 04:23:56 +01:00
UT.c Merge pull request #832 from dnobori/181202_switch_to_apache_license 2019-01-21 09:36:19 +09:00
UT.h Merge pull request #832 from dnobori/181202_switch_to_apache_license 2019-01-21 09:36:19 +09:00
VG.c Compacting headers, updating trivial texts to fit to the license change from GPLv2 to Apache License 2.0. 2019-01-14 12:25:53 +09:00
VG.h Compacting headers, updating trivial texts to fit to the license change from GPLv2 to Apache License 2.0. 2019-01-14 12:25:53 +09:00
Virtual.c Cedar: DHCP server now assigns static IPv4 address, if present in user note 2020-10-12 04:56:33 +02:00
Virtual.h Cedar: DHCP server now assigns static IPv4 address, if present in user note 2020-10-12 04:56:33 +02:00
VLan.c Compacting headers, updating trivial texts to fit to the license change from GPLv2 to Apache License 2.0. 2019-01-14 12:25:53 +09:00
VLan.h Compacting headers, updating trivial texts to fit to the license change from GPLv2 to Apache License 2.0. 2019-01-14 12:25:53 +09:00
VLanUnix.c Compacting headers, updating trivial texts to fit to the license change from GPLv2 to Apache License 2.0. 2019-01-14 12:25:53 +09:00
VLanUnix.h Compacting headers, updating trivial texts to fit to the license change from GPLv2 to Apache License 2.0. 2019-01-14 12:25:53 +09:00
VLanWin32.c Compacting headers, updating trivial texts to fit to the license change from GPLv2 to Apache License 2.0. 2019-01-14 12:25:53 +09:00
VLanWin32.h Compacting headers, updating trivial texts to fit to the license change from GPLv2 to Apache License 2.0. 2019-01-14 12:25:53 +09:00
WaterMark.c Compacting headers, updating trivial texts to fit to the license change from GPLv2 to Apache License 2.0. 2019-01-14 12:25:53 +09:00
WaterMark.h Compacting headers, updating trivial texts to fit to the license change from GPLv2 to Apache License 2.0. 2019-01-14 12:25:53 +09:00
WebUI.c Compacting headers, updating trivial texts to fit to the license change from GPLv2 to Apache License 2.0. 2019-01-14 12:25:53 +09:00
WebUI.h Compacting headers, updating trivial texts to fit to the license change from GPLv2 to Apache License 2.0. 2019-01-14 12:25:53 +09:00
Win32Com.cpp Cedar/Win32Com.cpp: fix non-const wchar_t array literal initialization error 2020-08-16 00:58:18 +02:00
Win32Com.h Link to Windows libraries in CMake project, remove related #pragma directives 2021-02-28 20:35:25 +01:00
WinJumpList.cpp Link to Windows libraries in CMake project, remove related #pragma directives 2021-02-28 20:35:25 +01:00
WinUi.c Mayaqua: remove all references to binaries with "_x64" and "_ia64" suffix 2020-07-27 20:59:40 +02:00
WinUi.h Remove "UINT_PTR" and "LONG_PTR", use original type everywhere 2020-08-15 09:18:21 +02:00
Wpc.c Wpc.c: adapt WpcSockConnectEx() for new proxy functions 2019-10-30 01:39:11 +01:00
Wpc.h Compacting headers, updating trivial texts to fit to the license change from GPLv2 to Apache License 2.0. 2019-01-14 12:25:53 +09:00