mirror of
https://github.com/SoftEtherVPN/SoftEtherVPN.git
synced 2024-11-22 01:19:52 +03:00
Compare commits
21 Commits
1fafd78fb1
...
a66cf64155
Author | SHA1 | Date | |
---|---|---|---|
|
a66cf64155 | ||
|
4e8f797036 | ||
|
b1bdc03cd7 | ||
|
c76f11a523 | ||
|
25585a1e3d | ||
|
4370efcc90 | ||
|
b8fbb3e3d8 | ||
|
98a8d5249d | ||
|
dd2a53e049 | ||
|
7ce9c088ff | ||
|
c2a7aa5481 | ||
|
6f57449164 | ||
|
48f6bc57cc | ||
|
bc31a5cfd3 | ||
|
68964ab0d7 | ||
|
bf3c50fde4 | ||
|
b06486b37d | ||
|
63ffab9ee4 | ||
|
2fe4ca0f8c | ||
|
a50d8910ba | ||
|
a366bdbf02 |
3
.github/workflows/fedora-rawhide.yml
vendored
3
.github/workflows/fedora-rawhide.yml
vendored
@ -4,6 +4,7 @@ on:
|
||||
schedule:
|
||||
- cron: "0 0 25 * *"
|
||||
push:
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
@ -24,7 +25,7 @@ jobs:
|
||||
submodules: true
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
dnf -y install git cmake ncurses-devel openssl-devel libsodium-devel readline-devel zlib-devel gcc-c++ clang
|
||||
dnf -y install git cmake ncurses-devel openssl-devel-engine libsodium-devel readline-devel zlib-devel gcc-c++ clang
|
||||
- name: Compile with ${{ matrix.cc }}
|
||||
run: |
|
||||
export CC=${{ matrix.cc }}
|
||||
|
@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.10)
|
||||
set(BUILD_NUMBER CACHE STRING "The number of the current build.")
|
||||
|
||||
if ("${BUILD_NUMBER}" STREQUAL "")
|
||||
set(BUILD_NUMBER "5185")
|
||||
set(BUILD_NUMBER "5186")
|
||||
endif()
|
||||
|
||||
if (BUILD_NUMBER LESS 5180)
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"environments": [ { "BuildNumber": "5185" } ],
|
||||
"environments": [ { "BuildNumber": "5186" } ],
|
||||
"configurations": [
|
||||
{
|
||||
"name": "x64-native",
|
||||
|
@ -201,7 +201,9 @@ Also SoftEther VPN [Stable Edition](https://www.freshports.org/security/softethe
|
||||
|
||||
## For Windows
|
||||
|
||||
[Nightly builds](https://dev.azure.com/SoftEther-VPN/SoftEther%20VPN/_build?definitionId=6)
|
||||
[Releases](https://github.com/SoftEtherVPN/SoftEtherVPN/releases)
|
||||
|
||||
[Nightly builds](https://github.com/SoftEtherVPN/SoftEtherVPN/actions/workflows/windows.yml)
|
||||
(choose appropriate platform, then find binaries or installers as artifacts)
|
||||
|
||||
## From binary installers (stable channel)
|
||||
|
@ -30,6 +30,7 @@
|
||||
<ul>
|
||||
<li>Older versions of SoftEther VPN before June 2019 don't support JSON-RPC APIs.</li>
|
||||
<li>If you want to completely disable the JSON-RPC on your VPN Server, set the <code>DisableJsonRpcWebApi</code> variable to <code>true</code> on the <code>vpn_server.config</code>.</li>
|
||||
<li>You may also restrict access to JSON-RPC API to a specific subnet, e.g. your internal network, by setting the <code>JsonRpcWebApiAllowedSubnet</code> variable to, for example, <code>192.168.0.0/16</code>.</li>
|
||||
</ul>
|
||||
<h3 id="json-rpc-specification">JSON-RPC specification</h3>
|
||||
<p>You must use HTTPS 1.1 <code>POST</code> method to call each of JSON-RPC APIs.<br />
|
||||
|
@ -25,6 +25,7 @@ https://<vpn_server_hostname>:<port>/api/
|
||||
|
||||
- Older versions of SoftEther VPN before June 2019 don't support JSON-RPC APIs.
|
||||
- If you want to completely disable the JSON-RPC on your VPN Server, set the `DisableJsonRpcWebApi` variable to `true` on the `vpn_server.config`.
|
||||
- You may also restrict access to JSON-RPC API to a specific subnet, e.g. your internal network, by setting the `JsonRpcWebApiAllowedSubnet` variable to, for example, `192.168.0.0/16`.
|
||||
|
||||
|
||||
### JSON-RPC specification
|
||||
|
@ -25,6 +25,7 @@ https://<vpn_server_hostname>:<port>/api/
|
||||
|
||||
- Older versions of SoftEther VPN before June 2019 don't support JSON-RPC APIs.
|
||||
- If you want to completely disable the JSON-RPC on your VPN Server, set the `DisableJsonRpcWebApi` variable to `true` on the `vpn_server.config`.
|
||||
- You may also restrict access to JSON-RPC API to a specific subnet, e.g. your internal network, by setting the `JsonRpcWebApiAllowedSubnet` variable to, for example, `192.168.0.0/16`.
|
||||
|
||||
|
||||
### JSON-RPC specification
|
||||
|
@ -463,39 +463,13 @@ void ProcIPsecEspPacketRecv(IKE_SERVER *ike, UDPPACKET *p)
|
||||
seq = READ_UINT(src + sizeof(UINT));
|
||||
|
||||
// Search and retrieve the IPsec SA from SPI
|
||||
|
||||
// thank to @phillibert report, responding to bad SA might lead to amplification
|
||||
// according to RFC4303 we should drop such packets
|
||||
|
||||
ipsec_sa = SearchClientToServerIPsecSaBySpi(ike, spi);
|
||||
if (ipsec_sa == NULL)
|
||||
{
|
||||
// Invalid SPI
|
||||
UINT64 init_cookie = Rand64();
|
||||
UINT64 resp_cookie = 0;
|
||||
IKE_CLIENT *c = NULL;
|
||||
IKE_CLIENT t;
|
||||
|
||||
|
||||
Copy(&t.ClientIP, &p->SrcIP, sizeof(IP));
|
||||
t.ClientPort = p->SrcPort;
|
||||
Copy(&t.ServerIP, &p->DstIP, sizeof(IP));
|
||||
t.ServerPort = p->DestPort;
|
||||
t.CurrentIkeSa = NULL;
|
||||
|
||||
if (p->DestPort == IPSEC_PORT_IPSEC_ESP_RAW)
|
||||
{
|
||||
t.ClientPort = t.ServerPort = IPSEC_PORT_IPSEC_ISAKMP;
|
||||
}
|
||||
|
||||
c = Search(ike->ClientList, &t);
|
||||
|
||||
if (c != NULL && c->CurrentIkeSa != NULL)
|
||||
{
|
||||
init_cookie = c->CurrentIkeSa->InitiatorCookie;
|
||||
resp_cookie = c->CurrentIkeSa->ResponderCookie;
|
||||
}
|
||||
|
||||
SendInformationalExchangePacketEx(ike, (c == NULL ? &t : c), IkeNewNoticeErrorInvalidSpiPayload(spi), false,
|
||||
init_cookie, resp_cookie);
|
||||
|
||||
SendDeleteIPsecSaPacket(ike, (c == NULL ? &t : c), spi);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -5740,6 +5740,7 @@ bool ServerDownloadSignature(CONNECTION *c, char **error_detail_str)
|
||||
UINT num = 0, max = 19;
|
||||
SERVER *server;
|
||||
char *vpn_http_target = HTTP_VPN_TARGET2;
|
||||
bool disableJsonRpcWebApi;
|
||||
// Validate arguments
|
||||
if (c == NULL)
|
||||
{
|
||||
@ -5750,6 +5751,15 @@ bool ServerDownloadSignature(CONNECTION *c, char **error_detail_str)
|
||||
|
||||
s = c->FirstSock;
|
||||
|
||||
disableJsonRpcWebApi = server->DisableJsonRpcWebApi;
|
||||
if (!disableJsonRpcWebApi && !IsZeroIP(&server->JsonRpcWebApiAllowedSubnetAddr)
|
||||
&& !IsZeroIP(&server->JsonRpcWebApiAllowedSubnetMask)) {
|
||||
// restrict JSON-RPC Web API to specified subnet only
|
||||
if (!IsInSameNetwork(&s->RemoteIP, &server->JsonRpcWebApiAllowedSubnetAddr, &server->JsonRpcWebApiAllowedSubnetMask)) {
|
||||
disableJsonRpcWebApi = true;
|
||||
}
|
||||
}
|
||||
|
||||
while (true)
|
||||
{
|
||||
bool not_found_error = false;
|
||||
@ -5782,7 +5792,7 @@ bool ServerDownloadSignature(CONNECTION *c, char **error_detail_str)
|
||||
// Receive the data since it's POST
|
||||
data_size = GetContentLength(h);
|
||||
|
||||
if (server->DisableJsonRpcWebApi == false)
|
||||
if (disableJsonRpcWebApi == false)
|
||||
{
|
||||
if (StrCmpi(h->Target, "/api") == 0 || StrCmpi(h->Target, "/api/") == 0)
|
||||
{
|
||||
@ -5868,7 +5878,7 @@ bool ServerDownloadSignature(CONNECTION *c, char **error_detail_str)
|
||||
}
|
||||
else if (StrCmpi(h->Method, "OPTIONS") == 0)
|
||||
{
|
||||
if (server->DisableJsonRpcWebApi == false)
|
||||
if (disableJsonRpcWebApi == false)
|
||||
{
|
||||
if (StrCmpi(h->Target, "/api") == 0 || StrCmpi(h->Target, "/api/") == 0 || StartWith(h->Target, "/admin"))
|
||||
{
|
||||
@ -5939,7 +5949,7 @@ bool ServerDownloadSignature(CONNECTION *c, char **error_detail_str)
|
||||
BUF *b = NULL;
|
||||
*error_detail_str = "HTTP_ROOT";
|
||||
|
||||
if (server->DisableJsonRpcWebApi == false)
|
||||
if (disableJsonRpcWebApi == false)
|
||||
{
|
||||
b = ReadDump("|wwwroot/index.html");
|
||||
}
|
||||
@ -6019,7 +6029,7 @@ bool ServerDownloadSignature(CONNECTION *c, char **error_detail_str)
|
||||
|
||||
if (b == false)
|
||||
{
|
||||
if (server->DisableJsonRpcWebApi == false)
|
||||
if (disableJsonRpcWebApi == false)
|
||||
{
|
||||
if (StartWith(h->Target, "/api?") || StartWith(h->Target, "/api/") || StrCmpi(h->Target, "/api") == 0)
|
||||
{
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "Mayaqua/Internat.h"
|
||||
#include "Mayaqua/Memory.h"
|
||||
#include "Mayaqua/Microsoft.h"
|
||||
#include "Mayaqua/Network.h"
|
||||
#include "Mayaqua/Object.h"
|
||||
#include "Mayaqua/OS.h"
|
||||
#include "Mayaqua/Pack.h"
|
||||
@ -6032,6 +6033,15 @@ void SiLoadServerCfg(SERVER *s, FOLDER *f)
|
||||
// Disable JSON-RPC Web API
|
||||
s->DisableJsonRpcWebApi = CfgGetBool(f, "DisableJsonRpcWebApi");
|
||||
|
||||
char tmpaddr[MAX_PATH];
|
||||
if (CfgGetStr(f, "JsonRpcWebApiAllowedSubnet", tmpaddr, sizeof(tmpaddr))) {
|
||||
IP _subnet, _mask;
|
||||
if (ParseIpAndMask46(tmpaddr, &_subnet, &_mask)) {
|
||||
s->JsonRpcWebApiAllowedSubnetAddr = _subnet;
|
||||
s->JsonRpcWebApiAllowedSubnetMask = _mask;
|
||||
}
|
||||
}
|
||||
|
||||
// Bits of Diffie-Hellman parameters
|
||||
c->DhParamBits = CfgGetInt(f, "DhParamBits");
|
||||
if (c->DhParamBits == 0)
|
||||
@ -6365,6 +6375,11 @@ void SiWriteServerCfg(FOLDER *f, SERVER *s)
|
||||
|
||||
// Disable JSON-RPC Web API
|
||||
CfgAddBool(f, "DisableJsonRpcWebApi", s->DisableJsonRpcWebApi);
|
||||
|
||||
char tmpaddr[MAX_PATH];
|
||||
IPAndMaskToStr(tmpaddr, sizeof(tmpaddr),
|
||||
&s->JsonRpcWebApiAllowedSubnetAddr, &s->JsonRpcWebApiAllowedSubnetMask);
|
||||
CfgAddStr(f, "JsonRpcWebApiAllowedSubnet", tmpaddr);
|
||||
}
|
||||
Unlock(c->lock);
|
||||
}
|
||||
|
@ -276,6 +276,9 @@ struct SERVER
|
||||
IP ListenIP; // Listen IP
|
||||
bool StrictSyslogDatetimeFormat; // Make syslog datetime format strict RFC3164
|
||||
bool DisableJsonRpcWebApi; // Disable JSON-RPC Web API
|
||||
|
||||
IP JsonRpcWebApiAllowedSubnetAddr; // If set, allow access to JSON-RPC Web API from
|
||||
IP JsonRpcWebApiAllowedSubnetMask; // this subnet only
|
||||
};
|
||||
|
||||
|
||||
|
@ -20,7 +20,9 @@
|
||||
#include <openssl/ssl.h>
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/rand.h>
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
#include <openssl/engine.h>
|
||||
#endif
|
||||
#include <openssl/bio.h>
|
||||
#include <openssl/x509.h>
|
||||
#include <openssl/pkcs7.h>
|
||||
@ -88,6 +90,7 @@ int ssl_clientcert_index = 0;
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
|
||||
static OSSL_PROVIDER *ossl_provider_legacy = NULL;
|
||||
static OSSL_PROVIDER *ossl_provider_default = NULL;
|
||||
static OSSL_PROVIDER *ossl_provider_oqsprovider = NULL;
|
||||
#endif
|
||||
|
||||
LOCK **ssl_lock_obj = NULL;
|
||||
@ -3974,6 +3977,12 @@ void FreeCryptLibrary()
|
||||
OSSL_PROVIDER_unload(ossl_provider_legacy);
|
||||
ossl_provider_legacy = NULL;
|
||||
}
|
||||
|
||||
if (ossl_provider_oqsprovider != NULL)
|
||||
{
|
||||
OSSL_PROVIDER_unload(ossl_provider_oqsprovider);
|
||||
ossl_provider_oqsprovider = NULL;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -3996,6 +4005,7 @@ void InitCryptLibrary()
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
|
||||
ossl_provider_default = OSSL_PROVIDER_load(NULL, "legacy");
|
||||
ossl_provider_legacy = OSSL_PROVIDER_load(NULL, "default");
|
||||
ossl_provider_oqsprovider = OSSL_PROVIDER_load(NULL, "oqsprovider");
|
||||
#endif
|
||||
|
||||
ssl_clientcert_index = SSL_get_ex_new_index(0, "struct SslClientCertInfo *", NULL, NULL, NULL);
|
||||
|
@ -6993,6 +6993,18 @@ void IPToStr6Inner(char *str, IP *ip)
|
||||
}
|
||||
}
|
||||
|
||||
// Format IP and subnet mask as "<ip>/<masksize>"
|
||||
void IPAndMaskToStr(char *str, UINT size, IP *ip, IP *subnet)
|
||||
{
|
||||
int iplen;
|
||||
UINT masksize;
|
||||
|
||||
IPToStr(str, size, ip);
|
||||
iplen = StrLen(str);
|
||||
masksize = SubnetMaskToInt(subnet);
|
||||
Format(str + iplen, size - iplen, "/%d", masksize);
|
||||
}
|
||||
|
||||
// Convert the string to an IP address
|
||||
bool StrToIP6(IP *ip, char *str)
|
||||
{
|
||||
@ -11905,6 +11917,10 @@ bool StartSSLEx3(SOCK *sock, X *x, K *priv, LIST *chain, UINT ssl_timeout, char
|
||||
Unlock(openssl_lock);
|
||||
}
|
||||
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
|
||||
SSL_set1_groups_list(sock->ssl, PQ_GROUP_LIST);
|
||||
#endif
|
||||
|
||||
if (sock->ServerMode)
|
||||
{
|
||||
// Lock(ssl_connect_lock);
|
||||
@ -11984,7 +12000,7 @@ bool StartSSLEx3(SOCK *sock, X *x, K *priv, LIST *chain, UINT ssl_timeout, char
|
||||
// Unlock(ssl_connect_lock);
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
prev_timeout = GetTimeout(sock);
|
||||
SetTimeout(sock, ssl_timeout);
|
||||
// Client mode
|
||||
|
@ -59,6 +59,10 @@ struct DYN_VALUE
|
||||
|
||||
#define DEFAULT_CIPHER_LIST "ECDHE+AESGCM:ECDHE+CHACHA20:DHE+AESGCM:DHE+CHACHA20:ECDHE+AES256:DHE+AES256:RSA+AES"
|
||||
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
|
||||
#define PQ_GROUP_LIST "p521_kyber1024:x25519_kyber768:P-521:X25519:P-256"
|
||||
#endif
|
||||
|
||||
// SSL logging function
|
||||
//#define ENABLE_SSL_LOGGING
|
||||
#define SSL_LOGGING_DIRNAME "@ssl_log"
|
||||
@ -1289,6 +1293,7 @@ void IPToStr6(char *str, UINT size, IP *ip);
|
||||
void IP6AddrToStr(char *str, UINT size, IPV6_ADDR *addr);
|
||||
void IPToStr6Array(char *str, UINT size, UCHAR *bytes);
|
||||
void IPToStr6Inner(char *str, IP *ip);
|
||||
void IPAndMaskToStr(char *str, UINT size, IP *ip, IP *subnet);
|
||||
void IntToSubnetMask6(IP *ip, UINT i);
|
||||
void IPAnd6(IP *dst, IP *a, IP *b);
|
||||
void GetAllRouterMulticastAddress6(IP *ip);
|
||||
|
Loading…
Reference in New Issue
Block a user