1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2026-04-23 23:39:27 +03:00

Compare commits

...

415 Commits

Author SHA1 Message Date
tickerguy 96926591b4 Merge 0643ae70f5 into dc2b11918a 2024-01-16 23:22:43 +05:00
Ilya Shipitsin dc2b11918a Merge pull request #1933 from chipitsine/master
CI: use OPENSSL_ROOT_DIR for cirrus-ci builds
2023-12-03 14:08:34 +01:00
Ilya Shipitsin 7398bf2724 CI: use OPENSSL_ROOT_DIR for cirrus-ci builds 2023-12-02 22:30:26 +01:00
Ilya Shipitsin ff4b74afda Merge pull request #1929 from chipitsine/pr_1921_followup
fix nullptr deref
2023-12-01 17:18:40 +01:00
Ilya Shipitsin e6792d8893 fix nullptr deref
Co-authored-by: icy17 <1061499390@qq.com>
2023-11-19 10:57:28 +01:00
Ilya Shipitsin 8cde812157 Merge pull request #1924 from hiura2023/master
Fix azure pipelines: Publish separate artifacts for both x64 and x86.
2023-11-10 13:49:45 +01:00
hiura 3574f8aa98 Fix azure pipelines: Publish separate artifacts for both x64 and x86. 2023-11-02 18:42:12 +09:00
Ilya Shipitsin 9429243dbe Merge pull request #1906 from hiura2023/master
Fix access violation: correct typing mistake in calling Debug().
2023-11-01 10:26:37 +01:00
Yihong Wu 895c16e3e8 Revert "README.md: Add me to members"
This reverts commit 1f40de2dda.
2023-10-15 06:13:59 +00:00
Davide Beatrici 6a170ac691 Merge PR #1911: Fix 7 vulnerabilities, add softether.net after-2038 year certificate hash, add vpncmd message about Developer Edition 2023-10-09 18:01:47 +02:00
Daiyuu Nobori 6dbf7e9ae2 Showing an explanation of the purpose of the Developer Edition and the difference from the Stable Editon by Daiyuu Nobori 2023-10-09 17:14:32 +02:00
Daiyuu Nobori 54ae7f725b Add four new certificate hashes to the DDNS_CERT_HASH list by Daiyuu Nobori. These certificates will be used to University of Tsukuba's built-in "softether.net" DDNS server after year 2038. 2023-10-09 17:14:32 +02:00
Daiyuu Nobori 35077deaf1 Fix Vulnerability: CVE-2023-25774 TALOS-2023-1743
SoftEther VPN vpnserver ConnectionAccept () denial of service vulnerability
2023-10-09 17:13:57 +02:00
Daiyuu Nobori 3b932f5fee Fix Vulnerability: CVE-2023-27516 TALOS-2023-1754 and CVE-2023-32634 TALOS-2023-1755
SoftEther VPN CiRpcAccepted () authentication bypass vulnerability
and SoftEther VPN CiRpcServerThread () MitM authentication bypass vulnerability
https://www.softether.org/9-about/News/904-SEVPN202301
https://jvn.jp/en/jp/JVN64316789/
2023-10-07 04:42:41 +02:00
Daiyuu Nobori f4bbe476be Fix Vulnerability: CVE-2023-32275 TALOS-2023-1753
SoftEther VPN CtEnumCa () information disclosure vulnerability
https://www.softether.org/9-about/News/904-SEVPN202301
https://jvn.jp/en/jp/JVN64316789/
2023-10-07 04:42:41 +02:00
Daiyuu Nobori 2dec52b875 Heap area protection of memory has been enhanced.
When memory is released and reallocated, a random security value called a canary is written to the before/after area of memory, and if the value has been modified, the process is terminated (restarted) for safety, assuming it is a buffer overflow of the memory area. This feature may effectively prevent confidentiality or integrity violations in the event that some heap area overflow vulnerability is discovered in this system in the future.
2023-10-07 04:42:34 +02:00
Daiyuu Nobori c49e462ed1 Fix Vulnerability: CVE-2023-22325 TALOS-2023-1736
SoftEther VPN DCRegister DDNS_RPC_MAX_RECV_SIZE denial of service vulnerability
https://www.softether.org/9-about/News/904-SEVPN202301
https://jvn.jp/en/jp/JVN64316789/
2023-09-28 18:26:17 +09:00
Daiyuu Nobori b8e542105f Fix Vulnerability: CVE-2023-27395 TALOS-2023-1735
SoftEther VPN vpnserver WpcParsePacket () heap-based buffer overflow vulnerability
https://www.softether.org/9-about/News/904-SEVPN202301
https://jvn.jp/en/jp/JVN64316789/
2023-09-28 18:24:12 +09:00
Ilya Shipitsin 18dc2621ec Merge pull request #1905 from chipitsine/master
fix windows build
2023-09-17 21:02:58 +02:00
hiura f57f05a599 Bind outgoing connection to a specific IP address (fix a bug) 2023-09-17 16:36:57 +09:00
Ilya Shipitsin f736d18267 temporarily suppress clang warnings on "-Wincompatible-function-pointer-types" 2023-09-16 00:03:03 +02:00
Ilya Shipitsin 1be55ebb94 src/vpndrvinst/main.c: add missing header file 2023-09-16 00:02:29 +02:00
Ilya Shipitsin d8dec75bc5 Merge pull request #1903 from puripuri2100/fix-missing-arg-name
Fix missing argument name in strtable file
2023-09-15 14:27:22 +02:00
puripuri2100 fc2a33d1f3 fix missing arg 2023-09-15 09:39:11 +09:00
Ilya Shipitsin 68615fe64e Merge pull request #1902 from chipitsine/master
add missing localization
2023-09-13 12:21:02 +02:00
Ilya Shipitsin 2fd6c0b76a add missing localization
this is a follow up of
https://github.com/SoftEtherVPN/SoftEtherVPN/pull/1867

English localization is added for now
2023-09-12 22:43:01 +02:00
Ilya Shipitsin 6833a7a11d Merge pull request #1901 from hiura2023/master
Bind outgoing connection to a specific IP address (avoid illegal access)
2023-09-12 09:39:18 +02:00
hiura 643cbbbf88 Bind outgoing connection to a specific IP address (avoid illegal access) 2023-09-12 10:20:51 +09:00
Ilya Shipitsin 205a94cda2 Merge pull request #1867 from hiura2023/master
Bind outgoing connection to a specific IP address
2023-09-10 17:18:31 +02:00
Ilya Shipitsin 2868ff1ef6 Merge pull request #1897 from puripuri2100/fix_strtable_VpnAzureSetStatus
fixed comments in strtable file
2023-09-01 22:43:29 +02:00
puripuri2100 a9a93a2824 fixed VpnAzureSetStatus to VpnAzureSetEnable 2023-08-31 01:30:15 +09:00
Ilya Shipitsin 979eb803a6 Merge pull request #1894 from chipitsine/master
CI: move stb check from travis-ci to GHA
2023-08-27 21:23:50 +02:00
Ilya Shipitsin 68e704097d fix another stb complaints 2023-08-27 21:11:53 +02:00
Ilya Shipitsin 8162ca3d12 Merge branch 'SoftEtherVPN:master' into master 2023-08-27 21:01:22 +02:00
Ilya Shipitsin d9686df302 Merge pull request #1895 from djony/master
Update file strtable_ru.stb
2023-08-27 21:00:43 +02:00
djony 8345deebe4 Add files via upload 2023-08-27 19:21:13 +03:00
Ilya Shipitsin 63595f79c5 fix some missing localization 2023-08-25 22:24:53 +02:00
Ilya Shipitsin 7fe3e6a800 CI: travis: cleanup stb check 2023-08-25 22:07:07 +02:00
Ilya Shipitsin 107c4ba362 CI: add stb check 2023-08-25 22:06:09 +02:00
Ilya Shipitsin aa65e11fc8 stbchecker: retarget against net7.0 2023-08-25 22:05:08 +02:00
Ilya Shipitsin 519d94f925 Merge pull request #1893 from djony/master
Big Russian language update
2023-08-24 22:53:55 +02:00
djony 950ecc186c Update strtable_ru.stb 2023-08-24 00:39:17 +03:00
djony 2abd9de923 Update strtable_ru.stb 2023-08-24 00:37:55 +03:00
Ilya Shipitsin 5d8ff7ed4f Merge pull request #1887 from chipitsine/master
additional error handling if SSL_CTX_new failed
2023-08-16 22:47:14 +02:00
Ilya Shipitsin 8f8677f164 set PPPSetStatus(p, PPP_STATUS_FAIL); in case of failure 2023-08-16 22:32:00 +02:00
Ilya Shipitsin 088b5c2df3 additional error handling if SSL_CTX_new failed
this is a folloup to https://github.com/SoftEtherVPN/SoftEtherVPN/pull/1873
2023-08-16 19:17:18 +02:00
Ilya Shipitsin acb6a53b31 Merge pull request #1884 from chipitsine/master
CI: enable GHA macos builds
2023-08-15 10:00:06 +02:00
Ilya Shipitsin e122e964f3 CI: cleanup osx travis-ci due to migration to GHA 2023-08-14 22:10:03 +02:00
Ilya Shipitsin df108b559d CI: enable macos builds 2023-08-14 22:03:38 +02:00
Ilya Shipitsin efac849ed7 Merge pull request #1883 from barracuda156/darwin
Fix macOS build: add missing headers
2023-08-14 19:58:06 +02:00
barracuda156 a80d3f2032 TunTap.h: fix for undefined u_char, u_short on MacOS 2023-08-14 15:54:56 +08:00
barracuda156 1cf2e7a8ea Network.h: include forgotten pthread.h for MacOS too 2023-08-14 15:40:53 +08:00
Ilya Shipitsin 137b8ef67a Merge pull request #1877 from chipitsine/master
CI: get rid of travis-ci coverity wrapper
2023-08-09 07:41:20 +02:00
hiura c2fe874865 Bind outgoing connection to a specific IP address No.2 2023-08-08 18:14:22 +09:00
Ilya Shipitsin 14fea1f4a2 CI: get rid of travis-ci coverity wrapper 2023-08-08 07:53:58 +02:00
Ilya Shipitsin f6f2660060 Merge pull request #1869 from metalefty/bsdunixvlan-group
Cedar/VLanUnix: assign virtual interface to softether group
2023-08-07 08:16:17 +02:00
Ilya Shipitsin 5d667e4261 Merge pull request #1876 from chipitsine/fedora_rawhide
CI: introduce monthly Fedora Rawhide builds
2023-08-06 23:29:32 +02:00
Yihong Wu adccc6b7d4 Merge pull request #1775 from domosekai/radius2
Support more EAP methods for RADIUS auth
2023-08-07 02:50:13 +09:00
Ilya Shipitsin a2aa254f11 CI: introduce monthly Fedora Rawhide builds
Fedora Rawhide includes latest compilers
2023-08-06 15:43:53 +02:00
Ilya Shipitsin c0440031e9 Merge pull request #1873 from icy17/master
fix potential crash.
2023-08-05 23:09:56 +02:00
icy17 07733b29cb fix potential crash. 2023-07-30 11:01:09 +00:00
Davide Beatrici eb785e08fe Merge PR #1866: Translate GenX25519/GetPublicX25519 command 2023-07-05 09:55:53 +02:00
Davide Beatrici 1493ccb44d Merge PR #1865: Fix build when NO_VLAN 2023-07-05 09:55:35 +02:00
Koichiro IWAO 49f8112d83 Cedar/VLanUnix: assign virtual interface to softether group
Interface grouping is available on FreeBSD and OpenBSD. This will allow
you to enumerate only SoftEther virtual interfaces or exclude SoftEther
virtual interfaces, and be helpful when making custom scripts to start
DHCP client when virtual interface become up (=VPN connection
established) for example.

Usage examples as follows.

List all interfaces' names available on the system:
```
$ ifconfig -l
vtnet0 lo0 vpn_client0 vpn_client1 vpn_client2
```

Display a list of SoftEther virtual interfaces:
```
$ ifconfig -g softether
vpn_client0
vpn_client1
vpn_client2
```

Display details about SoftEther virtual interfaces that are up:
```
$ ifconfig -a -u -g softether
vpn_client0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        description: SoftEther Virtual Network Adapter
        options=80000<LINKSTATE>
        ether 5e:71:fa:f8:91:4a
        hwaddr 58:9c:fc:10:34:2a
        groups: tap softether
        media: Ethernet autoselect
        status: active
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
        Opened by PID 1445
```

Display details about interfaces except for SoftEther virtual interfaces:
```
$ ifconfig -a -G softether
vtnet0: flags=8863<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=80028<VLAN_MTU,JUMBO_MTU,LINKSTATE>
        ether 58:9c:fc:00:f0:23
        inet6 fe80::5a9c:fcff:fe00:f023%vtnet0 prefixlen 64 scopeid 0x1
        inet 192.168.96.7 netmask 0xffffff00 broadcast 192.168.96.255
        media: Ethernet autoselect (10Gbase-T <full-duplex>)
        status: active
        nd6 options=23<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL>
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
        options=680003<RXCSUM,TXCSUM,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6>
        inet6 ::1 prefixlen 128
        inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2
        inet 127.0.0.1 netmask 0xff000000
        groups: lo
        nd6 options=23<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL>
```
2023-07-04 14:38:36 +09:00
Davide Beatrici 5633314981 Merge PR #1868: Fix build on __FreeBSD_version >= 140091 (LLVM 16) 2023-07-04 06:08:21 +02:00
Koichiro Iwao dcdbce63d5 Fix build on __FreeBSD_version >= 140091 (LLVM 16)
Fails to build after:
https://cgit.freebsd.org/src/commit/?id=a681cba16d8967651a2146385ce44a2bfeb1c4c3

As the commit title is "Bump __FreeBSD_version for llvm 16.0.6 merge",
I suppose LLVM 16 is stricter than LLVM 15. It was building successfully
at least the previous week.

Build log: https://pkg-status.freebsd.org/beefy18/data/main-amd64-default/p4785b313b958_se8efee297c/logs/softether5-5.02.5180.335,2.log

```
[ 32%] Building C object src/Mayaqua/CMakeFiles/mayaqua.dir/Unix.c.o
cd /wrkdirs/usr/ports/security/softether5/work/.build/src/Mayaqua && /usr/bin/cc -DBRIDGE_BPF -DCPU_64 -DHAVE_SSL_CTX_SET_NUM_TICKETS -DNDEBUG -DOS_UNIX -DREENTRANT -DSE_DBDIR=\"/var/db/softether\" -DSE_LOGDIR=\"/var/log/softether\" -DSE_PIDDIR=\"/var/run/softether\" -DSE_TAGNAME=\"5.02.5180-335-g1c0bdb0c/freebsd\" -DTHREADSAFE -DTHREAD_SAFE -DUNIX -DUNIX_BSD -DVPN_SPEED -D_FILE_OFFSET_BITS=64 -D_REENTRANT -D_THREADSAFE -D_THREAD_SAFE -Dmayaqua_EXPORTS -I/wrkdirs/usr/ports/security/softether5/work/SoftEtherVPN-5.02.5180-335-g1c0bdb0c/src/. -I/wrkdirs/usr/ports/security/softether5/work/SoftEtherVPN-5.02.5180-335-g1c0bdb0c/src/Mayaqua/. -I/wrkdirs/usr/ports/security/softether5/work/SoftEtherVPN-5.02.5180-335-g1c0bdb0c/src/libhamcore/include -O2 -pipe  -I/usr/local/include/cpu_features -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing -fsigned-char -O2 -pipe  -I/usr/local/include/cpu_features -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing  -DNDEBUG -O2 -std=gnu99 -fPIC -pthread -MD -MT src/Mayaqua/CMakeFiles/mayaqua.dir/Unix.c.o -MF CMakeFiles/mayaqua.dir/Unix.c.o.d -o CMakeFiles/mayaqua.dir/Unix.c.o -c /wrkdirs/usr/ports/security/softether5/work/SoftEtherVPN-5.02.5180-335-g1c0bdb0c/src/Mayaqua/Unix.c
/wrkdirs/usr/ports/security/softether5/work/SoftEtherVPN-5.02.5180-335-g1c0bdb0c/src/Mayaqua/Unix.c:259:18: error: incompatible function pointer types assigning to 'void (*)(int, struct __siginfo *, void *)' from 'void *(int, siginfo_t *, void *)' (aka 'void *(int, struct __siginfo *, void *)') [-Wincompatible-function-pointer-types]
        sa.sa_sigaction = signal_received_for_ignore;
                        ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
```
2023-07-04 08:50:53 +09:00
Ilya Shipitsin 8ac021a38c Merge pull request #1863 from metalefty/bsdunixvlan-bridge
FreeBSD: Make sure to destroy tap device for bridge
2023-07-03 22:45:37 +02:00
hiura e4330ca71a bind outgoing connection 2023-06-28 23:18:09 +09:00
Koichiro Iwao 35b5d0640f Translate GenX25519/GetPublicX25519 command 2023-06-21 15:16:47 +09:00
Koichiro Iwao f88341ce40 Fix case of WireGuard 2023-06-21 15:11:38 +09:00
Koichiro IWAO 0ab5199272 Fix build when NO_VLAN
Occurred at:	 #670
Closes:		#1864

Tested build on FreeBSD with NO_VLAN by modifying CMakeLists.txt like this:

```diff
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index c49a3c78..1dad3691 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -93,6 +93,7 @@ if(UNIX)
if(${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
     add_definitions(-DUNIX_BSD -DBRIDGE_BPF)
+    add_definitions(-DNO_VLAN)
     include_directories(SYSTEM /usr/local/include)
     link_directories(SYSTEM /usr/local/lib)
   endif()
```
2023-06-17 02:18:04 +09:00
Koichiro IWAO 41be858df0 Collect garbage at development 2023-06-17 01:54:36 +09:00
Koichiro IWAO 6665efb822 Remove unnecessary quotation to fix build 2023-06-15 10:17:33 +09:00
Koichiro IWAO 8826484245 Rename macro BRDEST -> BRIDGE for simplicity
UNIX_VLAN_BRDEST_IFACE_PREFIX -> UNIX_VLAN_BRIDGE_IFACE_PREFIX
2023-06-15 00:15:17 +09:00
Koichiro IWAO 09708bc8cb Cedar/BridgeUnix: make sure to destroy tap device for bridge on FreeBSD
Also, rename NewTap/FreeTap to NewBridgeTap/FreeBridgeTap because these
functions are used to create/destroy tap device used for bridge
destination.
2023-06-15 00:15:17 +09:00
Koichiro IWAO 696a9bc0a1 Cedar: Don't hardcode prefix for virtual brige destination 2023-06-15 00:15:17 +09:00
Davide Beatrici 1c0bdb0c30 Merge PR #1860: Cedar/VLanUnix: add description to FreeBSD tap device 2023-06-08 19:09:02 +02:00
Koichiro IWAO 96e4fc040f Cedar/VLanUnix: add description to FreeBSD tap device
$ ifconfig vpn_client
vpn_client: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        description: SoftEther Virtual Network Adapter
        options=80000<LINKSTATE>
        ether 5e:51:5e:48:ea:ef
        hwaddr 58:9c:fc:10:34:2a
        groups: tap
        media: Ethernet autoselect
        status: active
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
        Opened by PID 35981
2023-06-01 16:50:30 +09:00
Davide Beatrici 0f689d9dfc Merge PR #1859: FreeBSD: Improve client's virtual network interface handling 2023-06-01 09:38:26 +02:00
Koichiro IWAO 867c992111 Cedar/VLanUnix: use space after #ifdef 2023-06-01 15:18:13 +09:00
Koichiro IWAO 96b1961d78 Cedar/VLanUnix: add UnixDestroyTapDevice prototype declaration 2023-06-01 11:57:50 +09:00
Koichiro IWAO 939eb3130e Cedar/Client: Enable CtVLans{Up,Down} on FreeBSD
The same trick also works on FreeBSD. There's no reason to limit it to
Linux.
2023-05-31 17:48:31 +09:00
Koichiro IWAO 0ba7ad392e Cedar/VLanUnix: Enable UnixVLanSetState on FreeBSD 2023-05-31 17:48:31 +09:00
Koichiro IWAO 8482a52522 Cedar/VLanUnix: Make NicDelete work on FreeBSD
In contrast to Linux, FreeBSD's tap devices are still plumbed after fd
closed. The tap device must be destroyed in addition to closing fd
to delete virtual network interfaces used for VPN connection.

NicDelete command now works properly and virtual network interfaces used
by vpnclient are cleaned up when shutting down vpnclient.
2023-05-31 17:48:31 +09:00
Koichiro IWAO 9c33605f5e Cedar: Don't hardcode prefix for UNIX virtual network interface 2023-05-31 17:48:06 +09:00
Ilya Shipitsin 3c70698c35 Merge pull request #1845 from chipitsine/master
introduce security policy, add security reporting link to README.md
2023-05-21 19:16:44 +02:00
Ilya Shipitsin 56b4ebfa65 add github security reporting to README.md 2023-05-14 21:21:03 +02:00
Ilya Shipitsin c68d93c2e9 introduce security policy 2023-05-14 21:13:42 +02:00
Ilya Shipitsin 2fdd9ec4dc Merge pull request #1832 from chipitsine/master
src/Cedar/Server.c: fix race condition
2023-05-13 20:42:38 +02:00
Ilya Shipitsin 6ae786d542 Merge pull request #1833 from chipitsine/coverity_fix
several potential null pointer dereferences fix
2023-05-01 09:14:17 +02:00
Ilya Shipitsin c59df82666 src/Mayaqua/Secure.c: fix potential null pointer dereference
found by coverity

   CID 343528 (#1 of 1): Dereference before null check (REVERSE_INULL)
   check_after_deref: Null-checking name suggests that it may be null,
   but it has already been dereferenced on all paths leading to the
   check.
   438        if (name == NULL || k == NULL || k->private_key == false)
   439        {
   440                sec->Error = SEC_ERROR_BAD_PARAMETER;
   441                return false;
   442        }
2023-05-01 06:18:39 +02:00
Ilya Shipitsin db7d6c83d5 src/Mayaqua/Secure.c: fix potential null pointer dereference
found by coverity

   CID 343537 (#1 of 1): Dereference before null check (REVERSE_INULL)
   check_after_deref: Null-checking name suggests that it may be null
   but it has already been dereferenced on all paths leading to the
   check.
   664        if (name == NULL)
   665        {
   666                sec->Error = SEC_ERROR_BAD_PARAMETER;
   667                return false;
   668        }
2023-05-01 06:09:38 +02:00
Ilya Shipitsin a89adaebc3 src/Mayaqua/Secure.c: fix potential null pointer dereference
found by coverity

 CID 343536 (#1 of 1): Dereference before null check (REVERSE_INULL)
 check_after_deref: Null-checking name suggests that it may be null, but
 it has already been dereferenced on all paths leading to the check.
 1339        if (name == NULL || data == NULL || size == 0)
 1340        {
 1341                sec->Error = SEC_ERROR_BAD_PARAMETER;
 1342                return false;
 1343        }
2023-05-01 06:07:19 +02:00
Ilya Shipitsin c46871688b src/Cedar/Server.c: fix race condition
=================================================================
==1505093==ERROR: AddressSanitizer: heap-use-after-free on address 0x607000366b88 at pc 0x7f72afadc34a bp 0x7f72990fa390 sp 0x7f72990fa388
READ of size 4 at 0x607000366b88 thread T22
    #0 0x7f72afadc349 in GetCaps /home/ilia/SoftEtherVPN/src/Cedar/Server.c:1861
    #1 0x7f72afadc382 in GetCapsInt /home/ilia/SoftEtherVPN/src/Cedar/Server.c:1802
    #2 0x7f72afaf72a5 in GetServerCapsInt /home/ilia/SoftEtherVPN/src/Cedar/Server.c:1098
    #3 0x7f72afaf7318 in GetServerCapsBool /home/ilia/SoftEtherVPN/src/Cedar/Server.c:1104
    #4 0x7f72afaf771e in SiWriteHubCfg /home/ilia/SoftEtherVPN/src/Cedar/Server.c:4887
    #5 0x7f72afaf771e in SiWriteHubCfg /home/ilia/SoftEtherVPN/src/Cedar/Server.c:4824
    #6 0x7f72afaf7c0b in SiWriteHubs /home/ilia/SoftEtherVPN/src/Cedar/Server.c:5548
    #7 0x7f72afaf7c0b in SiWriteHubs /home/ilia/SoftEtherVPN/src/Cedar/Server.c:5515
    #8 0x7f72afaf81d6 in SiWriteConfigurationToCfg /home/ilia/SoftEtherVPN/src/Cedar/Server.c:3166
    #9 0x7f72afaf86bc in SiWriteConfigurationFile /home/ilia/SoftEtherVPN/src/Cedar/Server.c:6593
    #10 0x7f72afaf86bc in SiWriteConfigurationFile /home/ilia/SoftEtherVPN/src/Cedar/Server.c:6569
    #11 0x7f72afaf8914 in SiSaverThread /home/ilia/SoftEtherVPN/src/Cedar/Server.c:6561
    #12 0x7f72afaf8914 in SiSaverThread /home/ilia/SoftEtherVPN/src/Cedar/Server.c:6547
    #13 0x7f72af6e0cfa in ThreadPoolProc /home/ilia/SoftEtherVPN/src/Mayaqua/Kernel.c:872
    #14 0x7f72af6e0cfa in ThreadPoolProc /home/ilia/SoftEtherVPN/src/Mayaqua/Kernel.c:827
    #15 0x7f72af76eeb4 in UnixDefaultThreadProc /home/ilia/SoftEtherVPN/src/Mayaqua/Unix.c:1604
    #16 0x7f72af4ffc56 in start_thread (/lib64/libc.so.6+0x8cc56) (BuildId: 6107835fa7d4725691b2b7f6aaee7abe09f493b2)
    #17 0x7f72af585a6f in __clone3 (/lib64/libc.so.6+0x112a6f) (BuildId: 6107835fa7d4725691b2b7f6aaee7abe09f493b2)

0x607000366b88 is located 24 bytes inside of 72-byte region [0x607000366b70,0x607000366bb8)
freed by thread T0 here:
    #0 0x7f72afed7fc8 in __interceptor_free.part.0 (/lib64/libasan.so.8+0xd7fc8) (BuildId: 9501248886f79bf1482f3e153f794be742818172)
    #1 0x7f72af76ed6f in UnixMemoryFree /home/ilia/SoftEtherVPN/src/Mayaqua/Unix.c:2072

previously allocated by thread T22 here:
    #0 0x7f72afed92ff in malloc (/lib64/libasan.so.8+0xd92ff) (BuildId: 9501248886f79bf1482f3e153f794be742818172)
    #1 0x7f72af76f35d in UnixMemoryAlloc /home/ilia/SoftEtherVPN/src/Mayaqua/Unix.c:2053

Thread T22 created by T0 here:
    #0 0x7f72afe48966 in pthread_create (/lib64/libasan.so.8+0x48966) (BuildId: 9501248886f79bf1482f3e153f794be742818172)
    #1 0x7f72af76f713 in UnixInitThread /home/ilia/SoftEtherVPN/src/Mayaqua/Unix.c:1683

SUMMARY: AddressSanitizer: heap-use-after-free /home/ilia/SoftEtherVPN/src/Cedar/Server.c:1861 in GetCaps
Shadow bytes around the buggy address:
  0x607000366900: 00 00 00 fa fa fa fa fa 00 00 00 00 00 00 00 00
  0x607000366980: 00 fa fa fa fa fa 00 00 00 00 00 00 00 00 00 fa
  0x607000366a00: fa fa fa fa 00 00 00 00 00 00 00 00 00 fa fa fa
  0x607000366a80: fa fa 00 00 00 00 00 00 00 00 00 fa fa fa fa fa
  0x607000366b00: 00 00 00 00 00 00 00 00 00 fa fa fa fa fa fd fd
=>0x607000366b80: fd[fd]fd fd fd fd fd fa fa fa fa fa fd fd fd fd
  0x607000366c00: fd fd fd fd fd fa fa fa fa fa fd fd fd fd fd fd
  0x607000366c80: fd fd fd fa fa fa fa fa fd fd fd fd fd fd fd fd
  0x607000366d00: fd fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x607000366d80: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x607000366e00: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
2023-05-01 05:53:36 +02:00
Ilya Shipitsin aadc068964 Merge pull request #1831 from chipitsine/master
src/Mayaqua/Unix.c: fix guarding
2023-04-29 23:47:35 +02:00
Ilya Shipitsin 46e73e944f src/Mayaqua/Unix.c: fix guarding
SoftEtherVPN/src/Mayaqua/Unix.c:51:25: warning: missing
terminating ' character
   51 | #include <sys/statvfs.h>'
2023-04-29 22:31:55 +02:00
Ilya Shipitsin 8fc27da780 Merge pull request #1829 from chipitsine/master
src/Mayaqua/Str.c: fix denial of service reported by Cisco Talos
2023-04-22 08:26:47 +02:00
Ilya Shipitsin c983ebffc1 Merge pull request #1828 from chipitsine/cleanup_source_release_pipeline
Cleanup source release pipeline
2023-04-21 23:22:02 +02:00
Ilya Shipitsin df6df007a3 src/Mayaqua/Str.c: fix denial of service reported by Cisco Talos
TALOS-2023-1741
CVE-2023-23581

SoftEther VPN vpnserver EnSafeHttpHeaderValueStr denial of service
vulnerability

A denial of service vulnerability exists in the vpnserver
EnSafeHttpHeaderValueStr functionality of SoftEther VPN 5.01.9674 and
5.02. A specially-crafted network packet can lead to denial of service.
2023-04-21 22:38:22 +02:00
Ilya Shipitsin f7a2cc5a7d CI: modernize GH release creation
details:
https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
2023-04-21 22:27:47 +02:00
Ilya Shipitsin 544f03ec8b CI: drop AppVeyor source release creation in favour of GH Actions 2023-04-21 22:26:30 +02:00
Ilya Shipitsin 82ce34fccb Merge pull request #1824 from chipitsine/master
src/Cedar/Proto_OpenVPN.c: fix denial of service found by Cisco Talos
2023-04-17 00:22:03 +02:00
Ilya Shipitsin 6ff0ce7076 Merge pull request #1823 from chipitsine/bump_cirrus_ci
CI: cirrus-ci: switch to freebsd-13.2
2023-04-17 00:21:39 +02:00
Ilya Shipitsin d2e673a47d src/Cedar/Proto_OpenVPN.c: fix denial of service found by Cisco Talos
specially crafted network packet lead to buffer overrun and process
crash. working exploit was provided by Cisco Talos team.

An integer underflow vulnerability exists in the vpnserver
OvsProcessData functionality of SoftEther VPN 5.01.9674 and 5.02. A
specially-crafted network packet can lead to denial of service. An
attacker can send a malicious packet to trigger this vulnerability.

The versions below were either tested or verified to be vulnerable by
Talos or confirmed to be vulnerable by the vendor.

SoftEther VPN 5.01.9674
SoftEther VPN 5.02
While 5.01.9674 is a development version, it is distributed at the time
of writing by Ubuntu and other Debian-based distributions.
2023-04-16 23:06:30 +02:00
Ilya Shipitsin b3df7a0b90 CI: cirrus-ci: switch to freebsd-13.2
openssl-devel has been renamed to openssl3{0,1}.
2023-04-16 22:58:03 +02:00
Ilya Shipitsin 22c602f630 Merge pull request #1801 from chipitsine/master
Windows: link MSVC runtime static
2023-04-03 09:43:13 +02:00
Yihong Wu b4e26dec05 Merge pull request #1815 from domosekai/b64
Mayaqua/Memory: Fix memory corruption in base64
2023-04-01 13:16:39 +09:00
Yihong Wu df7ea3c54a Mayaqua/Memory: Fix memory corruption in base64 2023-03-31 09:14:39 +00:00
Ilya Shipitsin 423631100f Merge pull request #1802 from SoftEtherVPN/dependabot/npm_and_yarn/src/bin/hamcore/wwwroot/admin/default/webpack-5.76.0
Bump webpack from 5.75.0 to 5.76.0 in /src/bin/hamcore/wwwroot/admin/default
2023-03-15 13:32:01 +01:00
dependabot[bot] fb83ac08f2 Bump webpack in /src/bin/hamcore/wwwroot/admin/default
Bumps [webpack](https://github.com/webpack/webpack) from 5.75.0 to 5.76.0.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.75.0...v5.76.0)

---
updated-dependencies:
- dependency-name: webpack
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-15 09:35:00 +00:00
Ilya Shipitsin e6123d36a0 Merge pull request #1782 from metalefty/adjust-version-string
Cedar: Trim contiguous whitespaces in version string
2023-03-12 08:32:55 +01:00
Ilya Shipitsin 0ff9d1a455 CI: Windows: use static link for MSVC runtime 2023-03-11 23:08:59 +01:00
Ilya Shipitsin 96ab969152 build: windows: link MSVC runtime statically 2023-03-11 21:52:11 +01:00
Ilya Shipitsin 1f3a730d0a .gitignore: do not count Visual Studio user settings 2023-03-11 21:48:31 +01:00
Ilya Shipitsin 21963c6c68 Merge pull request #1796 from SoftEtherVPN/dependabot/npm_and_yarn/src/bin/hamcore/wwwroot/admin/default/minimist-and-mkdirp-1.2.8
Bump minimist and mkdirp in /src/bin/hamcore/wwwroot/admin/default
2023-03-03 09:44:10 +06:00
dependabot[bot] 91053622ab Bump minimist and mkdirp in /src/bin/hamcore/wwwroot/admin/default
Bumps [minimist](https://github.com/minimistjs/minimist) and [mkdirp](https://github.com/isaacs/node-mkdirp). These dependencies needed to be updated together.

Updates `minimist` from 0.0.8 to 1.2.8
- [Release notes](https://github.com/minimistjs/minimist/releases)
- [Changelog](https://github.com/minimistjs/minimist/blob/main/CHANGELOG.md)
- [Commits](https://github.com/minimistjs/minimist/compare/v0.0.8...v1.2.8)

Updates `mkdirp` from 0.5.1 to 0.5.6
- [Release notes](https://github.com/isaacs/node-mkdirp/releases)
- [Changelog](https://github.com/isaacs/node-mkdirp/blob/main/CHANGELOG.md)
- [Commits](https://github.com/isaacs/node-mkdirp/compare/0.5.1...v0.5.6)

---
updated-dependencies:
- dependency-name: minimist
  dependency-type: indirect
- dependency-name: mkdirp
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-03 01:26:17 +00:00
Ilya Shipitsin 1519e23b3e Merge pull request #1795 from metalefty/se-vs-de
README: SEvsDE: document AES-NI hardware acceleration support
2023-03-02 16:28:35 +06:00
Koichiro IWAO f7d33568f3 README: SEvsDE: document AES-NI hardware acceleration support
Stable Edition requires intel_aes_lib to enable AES-NI [1]. Developer
Edition depends on OpeSSL to use AES-NI. It is enabled by default as
long as processor supports it.

[1] https://github.com/SoftEtherVPN/SoftEtherVPN_Stable/blob/bf23fe0/src/Mayaqua/Encrypt.c#L145-L147
2023-03-02 18:44:02 +09:00
Koichiro IWAO 1fe26ccb6c Cedar: Trim contiguous whitespaces in version string
Before change, contiguous whitespaces appeared in version string.
This room is for beta string (such as Alpha, Beta) and beta number but
it looks a bit odd if the build is not alpha/beta/RC.

> Version 5.02 Build 5180 Alpha 3 (Japanese)
> Version 5.02 Build 5180 Beta 3 (Japanese)
> Version 5.02 Build 5180 Release Candidate 3 (Japanese)
> Version 5.02 Build 5180   (Japanese)
>                        ^^^

Now version string looks neat like this:

> Version 5.02 Build 5180 (Japanese)
> Version 5.02 Build 5180 Release Candidate 3 (Japanese)
2023-03-01 16:14:04 +09:00
Ilya Shipitsin 8c64dc0cd7 Merge pull request #1781 from metalefty/vm-detection/freebsd-on-vm
Mayaqua/Unix: Make VM detection work on FreeBSD
2023-02-28 20:32:26 +06:00
Koichiro IWAO bedf1cd7e9 Mayaqua/Unix: Make VM detection work on FreeBSD
This is just a cosmetic problem in the result of "Caps" command which
gets the list of server functions/capability.  There's no behavioural
change in SoftEtherVPN whether running on VM so far.
2023-02-28 20:08:04 +09:00
Ilya Shipitsin d7c487619a Merge pull request #1780 from chipitsine/master
CI: bump Ubuntu to newer version, install missing DCO dependencies
2023-02-28 08:31:52 +06:00
Ilya Shipitsin 2b7b728077 CI: bump Ubuntu to newer version, install missing DCO dependencies 2023-02-27 20:51:23 +06:00
Yihong Wu cd2838795b Radius: Make sure MS-CHAP response matches the original username 2023-02-27 08:37:23 +00:00
Yihong Wu 4ff9c6393a Support all EAP methods for PPP sessions with RADIUS 2023-02-27 08:37:23 +00:00
Yihong Wu e81ecbb0ec Support EAP auth with RADIUS server for SEVPN 2023-02-24 13:05:34 +00:00
Yihong Wu e20fa9ec2e Merge pull request #1773 from domosekai/radius
Cedar/Proto_PPP: Fix radius authentication
2023-02-24 11:36:42 +08:00
Yihong Wu 1741dfdccc Cedar/Proto_PPP: Fix radius authentication 2023-02-23 13:03:10 +00:00
Yihong Wu d045d1eeb7 Merge pull request #1771 from ChurchillSD/master
Fix Incorrect password hash on documentation
2023-02-21 10:16:34 +08:00
Yihong Wu cc61b5b3c3 Merge pull request #1772 from domosekai/udp
Mayaqua/Network: Fix empty packet being treated as error
2023-02-21 10:14:36 +08:00
Yihong Wu eea1de3d25 Mayaqua/Network: Fix empty packet being treated as error 2023-02-19 05:41:55 +00:00
Hector 7e19bbc421 Fix Incorrect password hash on documentation 2023-02-17 11:30:55 +00:00
Yihong Wu d49b9f108b Merge pull request #1762 from Evengard/ppp-coverity-fixes
Fixing up coverity report flags from #1760 and #1761
2023-02-05 00:15:51 +09:00
Evengard c67d9ee201 Fixing up coverity report flags from #1760 and #1761 2023-02-04 17:47:20 +03:00
Yihong Wu 1062692d08 Merge pull request #1759 from domosekai/fixtls
Fix thread safety after #1751
2023-02-02 17:40:23 +09:00
Yihong Wu 025ebec4cc Fix thread safety after #1751 2023-02-02 06:53:30 +00:00
Ilya Shipitsin 11828be9e6 Merge pull request #1751 from Evengard/eap-tls-fixups
TLS 1.3 for EAP-TLS, user search by certificate CN
2023-02-01 09:47:38 +06:00
Evengard edcdc923ad Reworked EAP-TLS 1.3 to account for RFC9190, implemented searching by certificate instead of certificate CN 2023-01-31 20:33:18 +03:00
Yihong Wu 7c642c7d55 Merge pull request #1758 from domosekai/ipv6rs
Cedar/IPC: Change IPv6 router lookup to non-blocking
2023-01-31 19:52:10 +09:00
Yihong Wu 6ce91e9c81 Cedar/IPC: Change IPv6 router lookup to non-blocking
Fix #1755
2023-01-31 05:20:40 +00:00
Ilya Shipitsin 064d211fab Merge pull request #1757 from domosekai/domosekai-patch-1
Cedar/Proto_PPP: Fix memory leak
2023-01-31 01:52:07 +06:00
Yihong Wu 43aaca509d Cedar/Proto_PPP: Fix memory leak 2023-01-30 20:24:45 +09:00
Yihong Wu f4934abc9a Merge pull request #1755 from domosekai/ipv6cp
Cedar/IPC: Improve IPv6CP configuration
2023-01-29 03:34:56 +09:00
Yihong Wu 0cdf0eacbf Cedar/IPC: Improve IPv6CP configuration 2023-01-28 09:05:28 +00:00
Ilya Shipitsin 0e8174c6cf Merge pull request #1754 from libnumafly/patch-1
add requirements package on Debian/Ubuntu
2023-01-25 22:56:56 +06:00
Kensei Sakai 54593e8cac add requirements package on Debian/Ubuntu
On Ubuntu Server 22.04 LTS (and newer?), the ./configure command fails because the 'pkgconf' package is not installed by default. Suggest that the 'pkgconf' package be installed in this command line.
2023-01-26 01:35:37 +09:00
Evengard 26403c70e3 Reworking the EAP CN matching option from admin options to extended options 2023-01-24 12:18:20 +03:00
Evengard 0a60cdf141 Hiding the EAP-TLS match user by certificate behind an admin option, disabled by default 2023-01-24 11:48:49 +03:00
Evengard 149096e13c * Implementing user search by certificate common name.
* Reworking EAP-TLS flow
* Implementing iterative TLS downgrade supporting PPPD TLS 1.3+Tickets, Windows TLS 1.3 w/o Tickets, VPN Client Pro TLS 1.2.
2023-01-23 23:57:19 +03:00
Ilya Shipitsin 8362637353 Merge pull request #1749 from chipitsine/master
src/Mayaqua/Unix.c: improve memory allocation handling according to Coverity
2023-01-15 22:09:00 +06:00
Ilya Shipitsin c7766d072b src/Mayaqua/Unix.c: improve memory allocation handling according to Coverity
1875        if (mutex == NULL)
1876        {
    CID 367204 (#1 of 1): Resource leak (RESOURCE_LEAK)4. leaked_storage: Variable lock going out of scope leaks the storage it points to.
1877                return NULL;
1878        }
2023-01-15 13:30:37 +06:00
Ilya Shipitsin 8215de91f9 Merge pull request #1747 from chipitsine/master
src/Cedar/Virtual.c: mute Coverity warning
2023-01-14 23:46:27 +06:00
Ilya Shipitsin 6a5f4b0dfd src/Cedar/Virtual.c: mute Coverity warning
4272                FreeBlock(block);
    CID 375153 (#1 of 1): Uninitialized scalar variable (UNINIT)44. uninit_use: Using uninitialized value send_size.
4273                if (send_size == 0)
2023-01-14 21:38:28 +06:00
Yihong Wu 58c0e1ded4 Merge pull request #1740 from domosekai/cmake
Mayaqua/CMakeLists: Fix win32 build without vcpkg
2023-01-07 09:52:12 +08:00
Yihong Wu 6e48227d93 Update CMakeLists.txt 2023-01-07 10:27:47 +09:00
Yihong Wu 1b79df7954 Mayaqua/CMakeLists: Fix win32 build without vcpkg 2023-01-06 22:32:28 +09:00
Ilya Shipitsin cbb90c5f23 Merge pull request #1738 from SoftEtherVPN/dependabot/npm_and_yarn/src/bin/hamcore/wwwroot/admin/default/json5-and-ts-loader-and-webpack-and-webpack-cli--removed
Bump json5, ts-loader, webpack and webpack-cli in /src/bin/hamcore/wwwroot/admin/default
2023-01-01 19:40:00 +06:00
dependabot[bot] 2e8723b967 Bump json5, ts-loader, webpack and webpack-cli
Removes [json5](https://github.com/json5/json5). It's no longer used after updating ancestor dependencies [json5](https://github.com/json5/json5), [ts-loader](https://github.com/TypeStrong/ts-loader), [webpack](https://github.com/webpack/webpack) and [webpack-cli](https://github.com/webpack/webpack-cli). These dependencies need to be updated together.


Removes `json5`

Updates `ts-loader` from 6.0.1 to 9.4.2
- [Release notes](https://github.com/TypeStrong/ts-loader/releases)
- [Changelog](https://github.com/TypeStrong/ts-loader/blob/main/CHANGELOG.md)
- [Commits](https://github.com/TypeStrong/ts-loader/compare/v6.0.1...v9.4.2)

Updates `webpack` from 4.32.2 to 5.75.0
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v4.32.2...v5.75.0)

Updates `webpack-cli` from 3.3.12 to 5.0.1
- [Release notes](https://github.com/webpack/webpack-cli/releases)
- [Changelog](https://github.com/webpack/webpack-cli/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack/webpack-cli/compare/v3.3.12...webpack-cli@5.0.1)

---
updated-dependencies:
- dependency-name: json5
  dependency-type: indirect
- dependency-name: ts-loader
  dependency-type: direct:development
- dependency-name: webpack
  dependency-type: direct:development
- dependency-name: webpack-cli
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-01 08:28:23 +00:00
Ilya Shipitsin 64396e2c05 Merge pull request #1737 from SoftEtherVPN/dependabot/npm_and_yarn/developer_tools/vpnserver-jsonrpc-clients/vpnserver-jsonrpc-client-nodejs-package/json5-and-ts-loader--removed
Bump json5 and ts-loader in /developer_tools/vpnserver-jsonrpc-clients/vpnserver-jsonrpc-client-nodejs-package
2023-01-01 14:27:25 +06:00
dependabot[bot] 89cc6ae717 Bump json5 and ts-loader
Removes [json5](https://github.com/json5/json5). It's no longer used after updating ancestor dependency [ts-loader](https://github.com/TypeStrong/ts-loader). These dependencies need to be updated together.


Removes `json5`

Updates `ts-loader` from 6.0.1 to 9.4.2
- [Release notes](https://github.com/TypeStrong/ts-loader/releases)
- [Changelog](https://github.com/TypeStrong/ts-loader/blob/main/CHANGELOG.md)
- [Commits](https://github.com/TypeStrong/ts-loader/compare/v6.0.1...v9.4.2)

---
updated-dependencies:
- dependency-name: json5
  dependency-type: indirect
- dependency-name: ts-loader
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-01 08:00:19 +00:00
Ilya Shipitsin ec3769ba32 Merge pull request #1731 from chipitsine/master
LibreSSL-3.7.0 compatibility
2022-12-26 07:08:28 +06:00
Ilya Shipitsin 86e44e8d7b LibreSSL-3.7.0 compatibility 2022-12-25 11:35:29 +06:00
Ilya Shipitsin 260413d242 Merge pull request #1718 from SoftEtherVPN/dependabot/npm_and_yarn/src/bin/hamcore/wwwroot/admin/default/decode-uri-component-0.2.2
Bump decode-uri-component from 0.2.0 to 0.2.2 in /src/bin/hamcore/wwwroot/admin/default
2022-12-03 19:11:03 +05:00
dependabot[bot] 99374ba446 Bump decode-uri-component in /src/bin/hamcore/wwwroot/admin/default
Bumps [decode-uri-component](https://github.com/SamVerschueren/decode-uri-component) from 0.2.0 to 0.2.2.
- [Release notes](https://github.com/SamVerschueren/decode-uri-component/releases)
- [Commits](https://github.com/SamVerschueren/decode-uri-component/compare/v0.2.0...v0.2.2)

---
updated-dependencies:
- dependency-name: decode-uri-component
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-03 13:51:53 +00:00
Davide Beatrici 23c3e1d9e5 README.md: Update OneDev URL
https://code.onedev.io/onedev/server/~issues/458
2022-11-29 02:08:17 +01:00
Yihong Wu 68283fca80 Merge pull request #1715 from domosekai/domosekai-patch-1
Add build instruction for dynamic linking OpenSSL
2022-11-27 19:52:10 +09:00
Yihong Wu d8e56f9dbc Add build instruction for dynamic linking OpenSSL
Co-authored-by: Davide Beatrici <github@davidebeatrici.dev>
2022-11-27 19:33:52 +09:00
Davide Beatrici dca2eaa370 Merge PR #1707: FreeBSD CI: Add test with OpenSSL 3.0.x 2022-11-22 19:33:27 +01:00
Koichiro IWAO c223fbe8a3 FreeBSD CI: Add test with OpenSSL 3.0.x
As the stable version uses OpenSSL 3.0.x, it is nice to perform test
with OpenSSL 3.0.x as well.

Also, update FreeBSD to 13.1.
2022-11-23 00:27:39 +09:00
Yihong Wu 334e8be915 Merge pull request #1703 from metalefty/shortcut_key_fix
Cedar/CM.c: Fix wrong shortcut key assignment in the menu
2022-11-17 16:18:42 +09:00
Koichiro IWAO e2ad7d5e8f Fix wrong shortcut key assignment
Fixes #1702.
2022-11-17 16:11:30 +09:00
Ilya Shipitsin 9eb9d57c27 Merge pull request #1700 from SoftEtherVPN/dependabot/npm_and_yarn/src/bin/hamcore/wwwroot/admin/default/kind-of-6.0.3
Bump kind-of from 6.0.2 to 6.0.3 in /src/bin/hamcore/wwwroot/admin/default
2022-11-12 21:00:03 +05:00
Ilya Shipitsin 28ec0d54b8 Merge pull request #1697 from SoftEtherVPN/dependabot/npm_and_yarn/src/bin/hamcore/wwwroot/admin/default/yargs-parser-13.1.2
Bump yargs-parser from 11.1.1 to 13.1.2 in /src/bin/hamcore/wwwroot/admin/default
2022-11-12 20:56:54 +05:00
dependabot[bot] 506677bf60 Bump kind-of in /src/bin/hamcore/wwwroot/admin/default
Bumps [kind-of](https://github.com/jonschlinkert/kind-of) from 6.0.2 to 6.0.3.
- [Release notes](https://github.com/jonschlinkert/kind-of/releases)
- [Changelog](https://github.com/jonschlinkert/kind-of/blob/master/CHANGELOG.md)
- [Commits](https://github.com/jonschlinkert/kind-of/compare/6.0.2...6.0.3)

---
updated-dependencies:
- dependency-name: kind-of
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-12 15:42:01 +00:00
dependabot[bot] 6a1b55293c Bump yargs-parser in /src/bin/hamcore/wwwroot/admin/default
Bumps [yargs-parser](https://github.com/yargs/yargs-parser) from 11.1.1 to 13.1.2.
- [Release notes](https://github.com/yargs/yargs-parser/releases)
- [Changelog](https://github.com/yargs/yargs-parser/blob/main/docs/CHANGELOG-full.md)
- [Commits](https://github.com/yargs/yargs-parser/commits)

---
updated-dependencies:
- dependency-name: yargs-parser
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-12 15:39:28 +00:00
Ilya Shipitsin 49c1a84752 Merge pull request #1699 from SoftEtherVPN/dependabot/npm_and_yarn/src/bin/hamcore/wwwroot/admin/default/serialize-javascript-and-terser-webpack-plugin-4.0.0
Bump serialize-javascript and terser-webpack-plugin in /src/bin/hamcore/wwwroot/admin/default
2022-11-12 20:35:18 +05:00
Ilya Shipitsin 34a9a7bc46 Merge pull request #1698 from SoftEtherVPN/dependabot/npm_and_yarn/src/bin/hamcore/wwwroot/admin/default/set-value-and-union-value-2.0.1
Bump set-value and union-value in /src/bin/hamcore/wwwroot/admin/default
2022-11-12 20:22:47 +05:00
Ilya Shipitsin bf9ebe21ff Merge pull request #1701 from chipitsine/master
CI: install libcap-ng-dev as OpenVPN dependency
2022-11-12 20:22:19 +05:00
dependabot[bot] e7980ae9b1 Bump serialize-javascript and terser-webpack-plugin
Bumps [serialize-javascript](https://github.com/yahoo/serialize-javascript) and [terser-webpack-plugin](https://github.com/webpack-contrib/terser-webpack-plugin). These dependencies needed to be updated together.

Updates `serialize-javascript` from 1.7.0 to 4.0.0
- [Release notes](https://github.com/yahoo/serialize-javascript/releases)
- [Commits](https://github.com/yahoo/serialize-javascript/compare/v1.7.0...v4.0.0)

Updates `terser-webpack-plugin` from 1.3.0 to 1.4.5
- [Release notes](https://github.com/webpack-contrib/terser-webpack-plugin/releases)
- [Changelog](https://github.com/webpack-contrib/terser-webpack-plugin/blob/v1.4.5/CHANGELOG.md)
- [Commits](https://github.com/webpack-contrib/terser-webpack-plugin/compare/v1.3.0...v1.4.5)

---
updated-dependencies:
- dependency-name: serialize-javascript
  dependency-type: indirect
- dependency-name: terser-webpack-plugin
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-12 14:44:52 +00:00
dependabot[bot] 9f53cf5bdb Bump set-value and union-value in /src/bin/hamcore/wwwroot/admin/default
Bumps [set-value](https://github.com/jonschlinkert/set-value) and [union-value](https://github.com/jonschlinkert/union-value). These dependencies needed to be updated together.

Updates `set-value` from 2.0.0 to 2.0.1
- [Release notes](https://github.com/jonschlinkert/set-value/releases)
- [Commits](https://github.com/jonschlinkert/set-value/compare/2.0.0...2.0.1)

Updates `union-value` from 1.0.0 to 1.0.1
- [Release notes](https://github.com/jonschlinkert/union-value/releases)
- [Commits](https://github.com/jonschlinkert/union-value/compare/1.0.0...1.0.1)

---
updated-dependencies:
- dependency-name: set-value
  dependency-type: indirect
- dependency-name: union-value
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-12 14:43:12 +00:00
Ilya Shipitsin 1027dbf385 CI: install libcap-ng-dev as OpenVPN dependency 2022-11-12 19:42:37 +05:00
Ilya Shipitsin 675b78e502 Merge pull request #1696 from SoftEtherVPN/dependabot/npm_and_yarn/developer_tools/vpnserver-jsonrpc-clients/vpnserver-jsonrpc-client-nodejs-package/minimatch-3.1.2
Bump minimatch from 3.0.4 to 3.1.2 in /developer_tools/vpnserver-jsonrpc-clients/vpnserver-jsonrpc-client-nodejs-package
2022-11-12 19:36:27 +05:00
Ilya Shipitsin c492276a94 Merge pull request #1695 from SoftEtherVPN/dependabot/npm_and_yarn/src/bin/hamcore/wwwroot/admin/default/glob-parent-and-watchpack-5.1.2
Bump glob-parent and watchpack in /src/bin/hamcore/wwwroot/admin/default
2022-11-12 19:36:00 +05:00
Ilya Shipitsin 661e61538e Merge pull request #1694 from SoftEtherVPN/dependabot/npm_and_yarn/src/bin/hamcore/wwwroot/admin/default/ansi-regex-3.0.1
Bump ansi-regex from 3.0.0 to 3.0.1 in /src/bin/hamcore/wwwroot/admin/default
2022-11-12 19:34:56 +05:00
Ilya Shipitsin b5a83cc208 Merge pull request #1691 from SoftEtherVPN/dependabot/npm_and_yarn/src/bin/hamcore/wwwroot/admin/default/loader-utils-1.4.2
Bump loader-utils from 1.2.3 to 1.4.2 in /src/bin/hamcore/wwwroot/admin/default
2022-11-12 19:34:07 +05:00
dependabot[bot] 7f65bae400 Bump minimatch
Bumps [minimatch](https://github.com/isaacs/minimatch) from 3.0.4 to 3.1.2.
- [Release notes](https://github.com/isaacs/minimatch/releases)
- [Commits](https://github.com/isaacs/minimatch/compare/v3.0.4...v3.1.2)

---
updated-dependencies:
- dependency-name: minimatch
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-12 14:27:01 +00:00
Ilya Shipitsin 3781d0f91c Merge pull request #1690 from SoftEtherVPN/dependabot/npm_and_yarn/src/bin/hamcore/wwwroot/admin/default/minimatch-3.1.2
Bump minimatch from 3.0.4 to 3.1.2 in /src/bin/hamcore/wwwroot/admin/default
2022-11-12 19:26:36 +05:00
Ilya Shipitsin d76888434b Merge pull request #1692 from SoftEtherVPN/dependabot/npm_and_yarn/developer_tools/vpnserver-jsonrpc-clients/vpnserver-jsonrpc-client-nodejs-package/minimist-and-mkdirp-1.2.7
Bump minimist and mkdirp in /developer_tools/vpnserver-jsonrpc-clients/vpnserver-jsonrpc-client-nodejs-package
2022-11-12 19:26:00 +05:00
dependabot[bot] b6d2ec3b76 Bump glob-parent and watchpack in /src/bin/hamcore/wwwroot/admin/default
Bumps [glob-parent](https://github.com/gulpjs/glob-parent) and [watchpack](https://github.com/webpack/watchpack). These dependencies needed to be updated together.

Updates `glob-parent` from 3.1.0 to 5.1.2
- [Release notes](https://github.com/gulpjs/glob-parent/releases)
- [Changelog](https://github.com/gulpjs/glob-parent/blob/main/CHANGELOG.md)
- [Commits](https://github.com/gulpjs/glob-parent/compare/v3.1.0...v5.1.2)

Updates `watchpack` from 1.6.0 to 1.7.5
- [Release notes](https://github.com/webpack/watchpack/releases)
- [Commits](https://github.com/webpack/watchpack/compare/v1.6.0...v1.7.5)

---
updated-dependencies:
- dependency-name: glob-parent
  dependency-type: indirect
- dependency-name: watchpack
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-12 09:32:44 +00:00
dependabot[bot] 4ebf713911 Bump ansi-regex in /src/bin/hamcore/wwwroot/admin/default
Bumps [ansi-regex](https://github.com/chalk/ansi-regex) from 3.0.0 to 3.0.1.
- [Release notes](https://github.com/chalk/ansi-regex/releases)
- [Commits](https://github.com/chalk/ansi-regex/compare/v3.0.0...v3.0.1)

---
updated-dependencies:
- dependency-name: ansi-regex
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-12 09:31:04 +00:00
dependabot[bot] 4981008534 Bump minimist and mkdirp
Bumps [minimist](https://github.com/minimistjs/minimist) and [mkdirp](https://github.com/isaacs/node-mkdirp). These dependencies needed to be updated together.

Updates `minimist` from 1.2.0 to 1.2.7
- [Release notes](https://github.com/minimistjs/minimist/releases)
- [Changelog](https://github.com/minimistjs/minimist/blob/main/CHANGELOG.md)
- [Commits](https://github.com/minimistjs/minimist/compare/v1.2.0...v1.2.7)

Updates `mkdirp` from 0.5.1 to 0.5.6
- [Release notes](https://github.com/isaacs/node-mkdirp/releases)
- [Changelog](https://github.com/isaacs/node-mkdirp/blob/main/CHANGELOG.md)
- [Commits](https://github.com/isaacs/node-mkdirp/compare/0.5.1...v0.5.6)

---
updated-dependencies:
- dependency-name: minimist
  dependency-type: indirect
- dependency-name: mkdirp
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-12 09:15:56 +00:00
dependabot[bot] b5727b3525 Bump loader-utils in /src/bin/hamcore/wwwroot/admin/default
Bumps [loader-utils](https://github.com/webpack/loader-utils) from 1.2.3 to 1.4.2.
- [Release notes](https://github.com/webpack/loader-utils/releases)
- [Changelog](https://github.com/webpack/loader-utils/blob/v1.4.2/CHANGELOG.md)
- [Commits](https://github.com/webpack/loader-utils/compare/v1.2.3...v1.4.2)

---
updated-dependencies:
- dependency-name: loader-utils
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-12 09:14:27 +00:00
dependabot[bot] 372759d2ad Bump minimatch in /src/bin/hamcore/wwwroot/admin/default
Bumps [minimatch](https://github.com/isaacs/minimatch) from 3.0.4 to 3.1.2.
- [Release notes](https://github.com/isaacs/minimatch/releases)
- [Commits](https://github.com/isaacs/minimatch/compare/v3.0.4...v3.1.2)

---
updated-dependencies:
- dependency-name: minimatch
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-12 09:14:23 +00:00
Ilya Shipitsin 86e28db3d7 Merge pull request #1689 from SoftEtherVPN/dependabot/npm_and_yarn/developer_tools/vpnserver-jsonrpc-clients/vpnserver-jsonrpc-client-nodejs-package/loader-utils-1.4.2
Bump loader-utils from 1.2.3 to 1.4.2 in /developer_tools/vpnserver-jsonrpc-clients/vpnserver-jsonrpc-client-nodejs-package
2022-11-12 14:13:34 +05:00
dependabot[bot] 797696a9f4 Bump loader-utils
Bumps [loader-utils](https://github.com/webpack/loader-utils) from 1.2.3 to 1.4.2.
- [Release notes](https://github.com/webpack/loader-utils/releases)
- [Changelog](https://github.com/webpack/loader-utils/blob/v1.4.2/CHANGELOG.md)
- [Commits](https://github.com/webpack/loader-utils/compare/v1.2.3...v1.4.2)

---
updated-dependencies:
- dependency-name: loader-utils
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-12 03:11:42 +00:00
tickerguy 0643ae70f5 Update BridgeUnix.c
On FreeBSD the stock code will attempt to expand the interface MTU any time a packet is to be sent that exceeds the current MTU.  This results in a down/up on the interface that is wildly disruptive to existing services on that adapter and, eventually, is likely to run into MTU limits and start logging failures, even with jumbo-frame capable adapters.  Thus if compiling on a FreeBSD machine disable this capability.  Tested against 12.3-STABLE and 13.1-STABLE on v4.38-9760 from the FreeBSD ports tree but likely applies here as well; see bug report https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=267178
2022-10-19 12:39:32 -04:00
Yihong Wu 8ae0a932da Merge pull request #1666 from domosekai/domosekai-patch-1
Add edition comparison to README.md
2022-09-27 11:41:53 +09:00
Yihong Wu bfee06d144 Add comparison with Stable Edition 2022-09-27 11:37:34 +09:00
Yihong Wu e4f9abba1c Merge pull request #1659 from domosekai/route6 2022-09-16 20:01:55 +09:00
Yihong Wu 05fa675d5a Exclude inactive routes in Windows routing management 2022-09-16 17:25:11 +09:00
Yihong Wu ac04c469c7 Merge pull request #1657 from domosekai/detail 2022-09-14 10:06:46 +09:00
Yihong Wu dc5da0c6a9 Zero out protocol strings when reconnecting 2022-09-13 19:14:33 +09:00
Davide Beatrici e85fc4435e README.md: Replace Codeberg with OneDev, update GitLab URL 2022-08-07 23:23:57 +02:00
Davide Beatrici cf38a3b6c2 Merge PR #1641: fix typo of disclaimers 2022-08-03 19:39:41 +02:00
Guest126 04569c81c7 fix typo 2022-08-03 23:30:05 +09:00
Ilya Shipitsin 6adc996bf9 Merge pull request #1627 from SoftEtherVPN/dependabot/npm_and_yarn/src/bin/hamcore/wwwroot/admin/default/terser-4.8.1
Bump terser from 4.0.0 to 4.8.1 in /src/bin/hamcore/wwwroot/admin/default
2022-07-22 15:22:21 +05:00
dependabot[bot] fa99fde893 Bump terser in /src/bin/hamcore/wwwroot/admin/default
Bumps [terser](https://github.com/terser/terser) from 4.0.0 to 4.8.1.
- [Release notes](https://github.com/terser/terser/releases)
- [Changelog](https://github.com/terser/terser/blob/master/CHANGELOG.md)
- [Commits](https://github.com/terser/terser/commits)

---
updated-dependencies:
- dependency-name: terser
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-20 08:39:28 +00:00
Ilya Shipitsin d854fd6baf Merge pull request #1618 from SoftEtherVPN/dependabot/nuget/developer_tools/vpnserver-jsonrpc-clients/vpnserver-jsonrpc-client-csharp/Newtonsoft.Json-13.0.1
Bump Newtonsoft.Json from 11.0.2 to 13.0.1 in /developer_tools/vpnserver-jsonrpc-clients/vpnserver-jsonrpc-client-csharp
2022-06-24 10:45:25 +05:00
Ilya Shipitsin ee1ecf8b42 Merge pull request #1617 from SoftEtherVPN/dependabot/nuget/developer_tools/vpnserver-jsonrpc-codegen/Newtonsoft.Json-13.0.1
Bump Newtonsoft.Json from 11.0.2 to 13.0.1 in /developer_tools/vpnserver-jsonrpc-codegen
2022-06-24 10:44:47 +05:00
dependabot[bot] 1ba86c0dc1 Bump Newtonsoft.Json
Bumps [Newtonsoft.Json](https://github.com/JamesNK/Newtonsoft.Json) from 11.0.2 to 13.0.1.
- [Release notes](https://github.com/JamesNK/Newtonsoft.Json/releases)
- [Commits](https://github.com/JamesNK/Newtonsoft.Json/compare/11.0.2...13.0.1)

---
updated-dependencies:
- dependency-name: Newtonsoft.Json
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-22 21:07:32 +00:00
dependabot[bot] d8768367b9 Bump Newtonsoft.Json in /developer_tools/vpnserver-jsonrpc-codegen
Bumps [Newtonsoft.Json](https://github.com/JamesNK/Newtonsoft.Json) from 11.0.2 to 13.0.1.
- [Release notes](https://github.com/JamesNK/Newtonsoft.Json/releases)
- [Commits](https://github.com/JamesNK/Newtonsoft.Json/compare/11.0.2...13.0.1)

---
updated-dependencies:
- dependency-name: Newtonsoft.Json
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-22 21:07:27 +00:00
Davide Beatrici a14d812dcb Merge PR #1610: Proto_OpenVPN: Set max allowed ACKs to 8 for P_ACK_V1 2022-06-14 04:53:56 +02:00
Yihong Wu 49ea58dd58 Merge pull request #1611 from domosekai/mss
Adjust TCP MSS if UDP acceleration is enabled (even if inactive)
2022-06-14 11:26:26 +09:00
Arne Schwabe 37aa1ba534 Proto_OpenVPN: Set max allowed ACKs to 8 for P_ACK_V1
OpenVPN always allowed 8 ACKs in P_ACK_V1 packets but only used
up to 4 in other control packets. Since Softether drops all packets with
more than 4 ACKs it also drops legimate P_ACK_V1.

See also this issue: https://github.com/schwabe/ics-openvpn/issues/1486
2022-06-14 00:06:02 +02:00
Yihong Wu 3ed7f7cbce Adjust TCP MSS if UDP acceleration is enabled (even if inactive) 2022-06-13 22:15:44 +09:00
Yihong Wu 209f60f079 Merge pull request #1604 from domosekai/docs 2022-05-29 10:47:59 +09:00
Yihong Wu 333cbb3f29 Update Windows build instructions
Co-authored-by: Davide Beatrici <github@davidebeatrici.dev>
2022-05-28 15:26:23 +09:00
Yihong Wu 5146bbbadc Remove vcpkg baseline as openssl build has been fixed upstream 2022-05-28 15:26:23 +09:00
Yihong Wu e74d9dec25 Merge pull request #1593 from domosekai/cm 2022-05-26 12:54:09 +09:00
Yihong Wu ad4ce138e9 Merge pull request #1594 from domosekai/tray
Show connection names in tray tips
2022-05-16 15:23:36 +09:00
Yihong Wu 34d443648b Merge pull request #1596 from domosekai/route
Fix route tracking on x86 Windows
2022-05-16 10:55:37 +09:00
Yihong Wu 27d7f4cfbe Fix route tracking on x86 Windows 2022-05-15 19:42:57 +09:00
Yihong Wu 4a3b4589c6 Show connection names in icon tips 2022-05-15 15:22:46 +08:00
Yihong Wu 53d8b10de2 Remove CM timer event to fix taskbar behavior on Win 11 2022-05-14 14:05:31 +08:00
Yihong Wu ca996ed89a Merge pull request #1522 from domosekai/tls
Implement complete server certificate verification
2022-05-12 23:38:38 +08:00
Davide Beatrici 0d075f0b42 Merge PR #1592: Fix invalid systemd TasksMax 2022-05-11 20:21:58 +02:00
Yihong Wu 8f3915417f Fix invalid systemd TasksMax 2022-05-11 18:23:48 +08:00
Davide Beatrici bf206bd7ad Merge PR #1589: Fix static route pushing to OpenVPN clients 2022-05-10 21:09:19 +02:00
Daehun Hyun cb6d9531b5 Fixed an issue where routing was not added when receiving DHCP static routing options. 2022-05-10 17:35:01 +09:00
Davide Beatrici 2f1bff96b2 Merge PR #1587: Implement additional option for PrivacyFilter Mode settings 2022-05-09 20:21:23 +02:00
sfreet 5a0227ba1d Allow packets if the both source and destination session users are the same, even in PrivacyFilter mode 2022-05-09 15:45:55 +09:00
Yihong Wu 4f9c75a3a7 Merge pull request #1582 from domosekai/vcpkg
Add vcpkg manifest, VS presets and update build instruction for Windows
2022-04-30 15:38:05 +08:00
Yihong Wu 0735af9fdf Warn user if vcpkg is not integrated with VS 2022-04-30 15:03:32 +08:00
Yihong Wu ca226cdc9d Add CMakeSettings.json to facilitate VS configuration
Update build instructions for Windows
2022-04-30 15:03:05 +08:00
Yihong Wu 900947bd08 Use vcpkg manifest and pin to OpenSSL 1.1.1 2022-04-30 15:03:05 +08:00
Yihong Wu 817ecf2348 Merge pull request #1583 from domosekai/domosekai-patch-1
Fix Azure x86 environment inconsistency
2022-04-29 16:07:45 +08:00
Yihong Wu a8be4c38e1 Fix inconsistent Azure environment and compiler 2022-04-29 13:43:22 +08:00
Yihong Wu c8dca265b4 Merge pull request #1576 from domosekai/ipv6
Fix IPv6 ND for Windows 11 PPP clients
2022-04-27 20:37:25 +08:00
Yihong Wu 4c2e0867e4 Merge pull request #1581 from domosekai/pkcs12
Fix PKCS12 import under OpenSSL 3.0
2022-04-27 09:59:10 +08:00
Yihong Wu b3afbe37e9 Load legacy provider under OpenSSL 3.0 2022-04-26 22:00:15 +08:00
Yihong Wu 3a91490b7f Merge pull request #1580 from updatede/patch-2
Fix udp acceleration unusable on big endian system
2022-04-26 10:18:04 +08:00
updatede b4bb90ec5b Fix udp acceleration unusable on big endian system
On big endian system, while store 32 bits and 16bits number in memory of  UINT64 variable "tmp", first 4 bytes of it always be zero makes "cookie" and "size" always be zero, lead to udpaccel unusable.
2022-04-25 18:16:50 +08:00
Yihong Wu 192d4938da Merge pull request #1578 from SoftEtherVPN/domosekai-vs2022
Upgrade CI template for Visual Studio 2022
2022-04-21 10:02:00 +08:00
Yihong Wu 43f0d3b4fa Upgrade CI template for Visual Studio 2022 2022-04-21 00:09:18 +08:00
Yihong Wu a742e2d193 Fix IPv6 ND for Windows 11 PPP clients 2022-04-08 00:37:38 +08:00
Yihong Wu fade8672c2 Merge pull request #1574 from domosekai/str 2022-04-02 11:21:47 +08:00
Yihong Wu 992a998a34 Add missing translation for protocol details 2022-04-01 22:18:54 +08:00
Yihong Wu 3c0e3fa49c Merge pull request #1564 from domosekai/bulk 2022-03-21 10:13:56 +08:00
Davide Beatrici c6334a44f9 Merge PR #1561: Bump tar from 4.4.8 to 4.4.19 2022-03-20 20:10:43 +01:00
Yihong Wu d86cf181bf Fix UDP bulk v2 and protocol display 2022-03-20 16:48:15 +08:00
dependabot[bot] e8b88fd225 Bump tar from 4.4.8 to 4.4.19 in /src/bin/hamcore/wwwroot/admin/default
Bumps [tar](https://github.com/npm/node-tar) from 4.4.8 to 4.4.19.
- [Release notes](https://github.com/npm/node-tar/releases)
- [Changelog](https://github.com/npm/node-tar/blob/main/CHANGELOG.md)
- [Commits](https://github.com/npm/node-tar/compare/v4.4.8...v4.4.19)

---
updated-dependencies:
- dependency-name: tar
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-19 19:17:31 +00:00
Davide Beatrici 9764485774 Merge PR #1551: Bump ajv from 6.10.0 to 6.12.6 2022-03-19 20:16:53 +01:00
Davide Beatrici a52a3928db Merge PR #1556: Fix wrong endianness in InRpcNodeInfo() and OutRpcNodeInfo() 2022-02-22 19:47:09 +01:00
Daiyuu Nobori 32a970f976 Admin.c: Fix wrong endianness in InRpcNodeInfo() and OutRpcNodeInfo() 2022-02-22 19:38:34 +01:00
Daiyuu Nobori 56aedd6817 Memory: Add LittleEndian16(), LittleEndian32() and LittleEndian64() 2022-02-22 19:38:03 +01:00
dependabot[bot] b603d2658a Bump ajv from 6.10.0 to 6.12.6 in /src/bin/hamcore/wwwroot/admin/default
Bumps [ajv](https://github.com/ajv-validator/ajv) from 6.10.0 to 6.12.6.
- [Release notes](https://github.com/ajv-validator/ajv/releases)
- [Commits](https://github.com/ajv-validator/ajv/compare/v6.10.0...v6.12.6)

---
updated-dependencies:
- dependency-name: ajv
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-12 02:08:14 +00:00
Yihong Wu 1e604407af Merge pull request #1533 from tew42/patch-2
Readme - add info for Windows & macOS nightlies
2022-02-03 16:45:26 +08:00
Yihong Wu 24926bcc17 Remove reference to macOS and Ubuntu 2022-02-01 12:39:32 +08:00
Ilya Shipitsin a4334753ad Merge pull request #1538 from hww3/hww3/illumos-headers
Merge pull request #1538: Add missing headers required for solaris/illumos
2022-01-07 11:13:16 +03:00
H William Welliver fd92c754fc Add missing headers required for solaris/illumos 2022-01-06 23:06:36 -05:00
Davide Beatrici 10b5034f0d FUNDING.yml: Remove Bountysource link 2022-01-03 03:17:56 +01:00
Yihong Wu 0a4455ac40 Add more TLS negotiation info in logging and UI 2021-12-29 17:41:29 +08:00
Yihong Wu f94ac6351e Implement complete server certificate verification 2021-12-29 17:41:29 +08:00
Ilya Shipitsin 034aae5a70 Merge pull request #1534 from weidi/master
Merge pull request #1534: Fix build error on alpine
2021-12-27 09:53:58 +03:00
weidi 879bd34af4 trigger alpine build action also on pull request 2021-12-27 07:26:34 +01:00
weidi a4d414891f Merge branch 'musl-workflow' 2021-12-26 21:35:56 +01:00
weidi 09dd8a8b07 endif UNIX_LINUX before BSD 2021-12-26 16:13:53 +01:00
weidi 3c7d78a1bf Merge branch 'SoftEtherVPN:master' into master 2021-12-26 11:51:55 +01:00
Yihong Wu adbbe94675 Merge pull request #1528 from updatede/patch-1
Mayaqua/Network.h: Fix UDP acceleration under NAT-T connections
2021-12-26 12:32:48 +08:00
Yihong Wu 1c1560f6ca Apply security level override in azure client mode 2021-12-26 12:12:00 +08:00
Yihong Wu 68dc4e23d8 Improve NAT-T hint string handling 2021-12-26 12:11:51 +08:00
Yihong Wu f6edb5e165 Fix a typo that causes CascadeList to show blank hub name 2021-12-26 12:03:59 +08:00
Yihong Wu a5565fce4b Fix cascade links may start before configuration is loaded 2021-12-26 12:03:59 +08:00
Yihong Wu d95d8ddefa Fix account name in wrong case after editing 2021-12-26 12:03:59 +08:00
Yihong Wu 5ecade7950 Merge pull request #1536 from domosekai/compat 2021-12-26 09:24:51 +08:00
weidi f3905cc421 Merge branch 'musl-workflow' of https://github.com/weidi/SoftEtherVPN into musl-workflow 2021-12-25 22:45:02 +01:00
Johannes Weidacher 3cdad95ee1 Add Musl build github workflow 2021-12-25 22:44:31 +01:00
weidi 1c3dc59892 fiexed configure step 2021-12-25 22:40:03 +01:00
weidi 529d2c232f use checkout@v1 to make submodules work 2021-12-25 22:37:34 +01:00
Johannes Weidacher 7f7d72cca9 Add Musl build github workflow 2021-12-25 22:26:43 +01:00
Johannes Weidacher e65cacdf96 Merge branch 'master' of https://github.com/weidi/SoftEtherVPN 2021-12-25 21:22:20 +01:00
Johannes Weidacher f1b464e84d fix alpine compile issue. 2021-12-25 21:22:06 +01:00
Johannes Weidacher 18598b5d96 Change ifdef for UNIX_LINUX Only 2021-12-25 15:36:52 +01:00
Yihong Wu 51585e63e3 Fix server manager setting compatibility since build 9658 2021-12-25 13:25:34 +08:00
weidi c72d4fddb8 Merge branch 'SoftEtherVPN:master' into master 2021-12-24 08:47:45 +01:00
Yihong Wu 82b6422821 Merge pull request #1532 from domosekai/init 2021-12-24 09:52:50 +08:00
Johannes Weidacher fc15d1ebd5 fix alpine compile issue. 2021-12-23 21:06:19 +01:00
Johannes Weidacher 73ffa10f50 Fix build error on alpine 2021-12-23 20:59:48 +01:00
tew42 a0f831c071 Readme - add info for Windows & macOS nightlies
This would be a very useful link/info to include I think, or is there some reason not to?

Also a small update to clarify what can be found at softether-download.com
2021-12-23 13:17:08 +01:00
Yihong Wu 77ee848caa Cedar/SM.c: Fix pointer usage before initialization 2021-12-23 17:23:15 +08:00
updatede 0b74a8e4ce Update Network.h
Missing argument check lead to wrong value of IsIPv6 of struct UDP_ACCEL in NewUdpAccel(),  eventually lead to UdpAccelInitClient() fail.
2021-12-22 13:19:50 +08:00
Yihong Wu 918fedb9d4 Merge pull request #1519 from domosekai/dns
Fix DNS thread safety and other
2021-12-13 13:51:04 +08:00
Yihong Wu fc94843579 Fix the creation of a zero IPv6 address
Fix #1517
2021-12-12 20:05:36 +08:00
Yihong Wu b91d9af5e3 Mayaqua/DNS: Fix memory safety in DNS operation threads
Fix #1329
2021-12-12 20:05:36 +08:00
Yihong Wu 2a40d21ef9 Merge pull request #1512 from domosekai/he
Perform TCP connection via IPv6 and IPv4 in parallel threads
2021-12-11 17:20:12 +08:00
Yihong Wu 02ee7b45d7 Save the correct server IP for route management 2021-12-10 16:53:28 +08:00
Yihong Wu 384ab07996 Perform TCP connection attempts via IPv6 and IPv4 in parallel 2021-12-10 16:18:45 +08:00
Yihong Wu e6bf956806 Return and cache all addresses from DNS resolver 2021-12-10 16:18:45 +08:00
Yihong Wu 528f313dbe Merge pull request #1511 from domosekai/ipstr
Fix IPv6 address display in session info dialog
2021-12-09 12:55:10 +08:00
Yihong Wu 5cac4481f0 Merge pull request #1513 from domosekai/rudp
Restore R-UDP listener when ListenIP is ::
2021-12-09 12:54:05 +08:00
Yihong Wu b4aad09f21 Restore R-UDP listener when ListenIP is :: 2021-12-07 21:55:41 +08:00
Yihong Wu 14f5854ecf Fix IPv6 address display in session info dialog 2021-12-07 15:48:32 +08:00
Yihong Wu a9239a6aab Merge pull request #1510 from domosekai/dns6
Fix DNS resolution when no IPv6 address is configured on any interface
2021-12-04 20:03:44 +08:00
Yihong Wu b178f26e52 Reduce redundant loop
Co-authored-by: Davide Beatrici <github@davidebeatrici.dev>
2021-12-04 16:16:22 +08:00
Yihong Wu 9692a8d961 Fix DNS resolution when no IPv6 address is configured 2021-12-03 14:18:43 +08:00
Yihong Wu 2d1c8765aa Merge pull request #1433 from domosekai/chain
Support user-specified server trust chain
2021-11-25 17:15:53 +08:00
Yihong Wu 8392ccd1fa Merge pull request #1391 from domosekai/master 2021-11-25 11:09:12 +08:00
Davide Beatrici 2955dc5580 Merge PR #1507: Change default hub option to allow default router in IPv6 RA 2021-11-24 00:22:04 +01:00
Davide Beatrici 235d5d1d0d Merge PR #1506: Cedar/Proto_PPP: Fix IPC DHCP renewal 2021-11-24 00:20:37 +01:00
Yihong Wu e095283641 Change default hub option to allow default router in IPv6 RA 2021-11-23 23:54:42 +08:00
Yihong Wu fb004345b4 Cedar/Proto_PPP: Fix IPC DHCP renewal 2021-11-23 19:48:46 +08:00
Ilya Shipitsin 9d4970841f Merge pull request #1491 from chipitsine/master
Merge PR #1491: add "data-ciphers" to generated OpenVPN configs
2021-10-03 12:47:25 +05:00
Ilya Shipitsin 4d594e00f8 add "data-ciphers" to generated OpenVPN configs 2021-10-02 15:00:20 +05:00
Davide Beatrici d7be057ae0 Merge PR #1489: Fix policy dialog and memory overrun 2021-09-30 21:23:17 +02:00
Yihong Wu 2990b5ae93 Fix memory overrun in policy copy 2021-09-30 19:36:36 +08:00
Yihong Wu 462ebfb960 Fix policy dialog 2021-09-30 16:59:22 +08:00
Davide Beatrici 6e7eba8e71 Merge PR #1486: Fix auto refreshing of client manager 2021-09-28 22:01:19 +02:00
Yihong Wu 8e292138b1 Update AUTHORS.TXT 2021-09-28 22:24:48 +08:00
Yihong Wu 582a739179 Fix auto refreshing of client manager 2021-09-28 20:15:41 +08:00
Yihong Wu 3a2d588722 Merge pull request #1483 from domosekai/ecc
Support ECDSA certificates on server side and show parameters in dialog
2021-09-25 20:58:18 +08:00
Yihong Wu 9c2a573cf2 Display key algorithm and parameters in cert dialog 2021-09-24 17:12:51 +08:00
Davide Beatrici 4657d7ee49 Merge PR #1484: Password change from client increments config file revision 2021-09-22 00:28:32 +02:00
Tetsuo Sugiyama c9508b7fb7 Password change from client increments config file revision
Fixed an issue where changing the password from the client did not increment the revision of the server config file and the changes were not saved
2021-09-21 18:28:17 +09:00
Yihong Wu 2853337b81 Allow ECDSA certificates on server side 2021-09-20 08:18:36 +00:00
Yihong Wu 03859eb515 Merge pull request #1443 from domosekai/win32
Add IPv6 route management for Windows client
2021-09-18 22:12:27 +08:00
Davide Beatrici a56cfac947 Merge PR #1482: Cedar/Protocol.c: Fix connection to server clusters 2021-09-18 10:34:20 +02:00
Yihong Wu 82af38c482 Cedar/Protocol.c: Fix connection to server clusters 2021-09-18 08:06:10 +00:00
Davide Beatrici f74c53b449 Merge PR #1480: CI: gitlab: remove broken tasks, leave only Illumos 2021-09-08 23:03:16 +02:00
Ilya Shipitsin f85dff25dc CI: gitlab: remove broken tasks, leave only Illumos 2021-09-08 21:15:13 +05:00
Ilya Shipitsin f301ba1e60 Merge pull request #1478 from chipitsine/master
Merge PR #1478: BUILD: use rpath for locating dynamic libraries
2021-09-08 10:53:49 +05:00
Ilya Shipitsin dcb1023999 BUILD: use rpath for locating dynamic libraries 2021-09-08 10:41:15 +05:00
Davide Beatrici 26c8fbe538 Merge PR #1476: openvpn live tests: change "remote" inplace 2021-08-30 08:16:50 +02:00
Ilya Shipitsin 115b8aab82 openvpn live tests: change "remote" inplace
command line override is not very stable
2021-08-30 09:46:45 +05:00
Davide Beatrici 3cc85c1d51 Merge PR #1474: enable Control-flow Enforcement Technology (CET) Shadow Stack mitigation 2021-08-27 21:06:08 +02:00
Ilya Shipitsin fc9286b11b enable Control-flow Enforcement Technology (CET) Shadow Stack mitigation
for Windows binaries

found by BinSkim
2021-08-27 12:43:42 +05:00
Davide Beatrici 224abd99b8 Merge PR #1472: Enable Control flow guard and Qspectre protection for windows binaries 2021-08-27 06:45:51 +02:00
Ilya Shipitsin 5adeeb75ea Enable Control flow guard and Qspectre protection for windows binaries
found by BinSkim
2021-08-26 23:09:13 +05:00
Davide Beatrici d0fe38384c Merge PR #1471: CI: Azure Pipelines: enable submodules checkout 2021-08-26 19:40:40 +02:00
Ilya Shipitsin 84bc94b232 CI: Azure Pipelines: enable submodules checkout
it is better to have this enabled in yml, cause it allows to build
from forks easier
2021-08-26 14:34:09 +05:00
Ilya Shipitsin 78e89eb3c7 Merge pull request #1460 from stevemuskiewicz/sm/rpm-fix-1457
Merge PR #1460: Redo of PR #1402 with proper fix for #1457
2021-08-19 19:11:47 +05:00
Steve Muskiewicz fcd00547aa Revert "reapply other RPM fixes from prior PR (service file updates and systemd path exclusions)"
This reverts commit 0eb0152437.
2021-08-19 09:50:30 -04:00
Steve Muskiewicz 0eb0152437 reapply other RPM fixes from prior PR (service file updates and systemd path exclusions) 2021-08-19 09:10:26 -04:00
Steve Muskiewicz 472dde05de apply permission fix suggested by @hornos (for #1457) 2021-08-19 08:14:50 -04:00
Ilya Shipitsin 1e6806bee7 Merge pull request #1456 from SoftEtherVPN/revert-1402-sm/rpm-pkg-fixes
Merge PR #1456: Revert "RPM package and systemd service file fixes (for CentOS 8)"
2021-08-16 16:09:39 +05:00
Ilya Shipitsin c01d8e6058 Revert "RPM package and systemd service file fixes (for CentOS 8)" 2021-08-16 16:06:34 +05:00
Ilya Shipitsin d061abae8f Merge PR #1454: Merge pull request #1454 from SoftEtherVPN/dependabot/npm_and_yarn/developer_tools/vpnserver-jsonrpc-clients/vpnserver-jsonrpc-client-nodejs-package/path-parse-1.0.7
Bump path-parse from 1.0.6 to 1.0.7 in /developer_tools/vpnserver-jsonrpc-clients/vpnserver-jsonrpc-client-nodejs-package
2021-08-16 11:33:54 +05:00
dependabot[bot] 888cf188bb Bump path-parse
Bumps [path-parse](https://github.com/jbgutierrez/path-parse) from 1.0.6 to 1.0.7.
- [Release notes](https://github.com/jbgutierrez/path-parse/releases)
- [Commits](https://github.com/jbgutierrez/path-parse/commits/v1.0.7)

---
updated-dependencies:
- dependency-name: path-parse
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-16 06:32:50 +00:00
Ilya Shipitsin fbdd6f1f3c Merge pull request #1453 from SoftEtherVPN/dependabot/npm_and_yarn/src/bin/hamcore/wwwroot/admin/default/path-parse-1.0.7
Merge PR #1453: Bump path-parse from 1.0.6 to 1.0.7 in /src/bin/hamcore/wwwroot/admin/default
2021-08-16 11:32:13 +05:00
Ilya Shipitsin 024b68120d Merge pull request #1402 from stevemuskiewicz/sm/rpm-pkg-fixes
Merge PR #1402: RPM package and systemd service file fixes (for CentOS 8)
2021-08-16 11:31:13 +05:00
dependabot[bot] 2d00ab7dcc Bump path-parse in /src/bin/hamcore/wwwroot/admin/default
Bumps [path-parse](https://github.com/jbgutierrez/path-parse) from 1.0.6 to 1.0.7.
- [Release notes](https://github.com/jbgutierrez/path-parse/releases)
- [Commits](https://github.com/jbgutierrez/path-parse/commits/v1.0.7)

---
updated-dependencies:
- dependency-name: path-parse
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-11 02:56:38 +00:00
Ilya Shipitsin 51a3346f70 Merge pull request #1451 from davidebeatrici/blake2-have-sse2-manual-definition
CMake: Fix BLAKE2 build failure with MSVC due to it not defining __SSE2__
2021-08-11 07:51:12 +05:00
Davide Beatrici 7f8e527883 CMake: Fix BLAKE2 build failure with MSVC due to it not defining __SSE2__ 2021-08-10 22:58:28 +02:00
Davide Beatrici 832c69add2 Merge PR #1449: CMake: Add build time check for EVP_PKEY_get_raw_public_key() availability 2021-08-09 04:41:54 +02:00
Davide Beatrici ffc095f95a CMake: Add build time check for EVP_PKEY_get_raw_public_key() availability
We need the function since 9dbbfcd388, but unfortunately it's not provided by LibreSSL.

By introducing a build time check we inform the user about the issue explicitly instead of just letting compilation fail.
2021-08-08 19:29:32 +02:00
Ilya Shipitsin b6d31af188 Merge pull request #1448 from neheb/eng
fix compilation without OpenSSL engines
2021-08-08 08:38:02 +05:00
Rosen Penev ee3bf7f507 fix compilation without OpenSSL engines
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-08-07 20:05:04 -07:00
domosekai 9b3077d955 Store interface metric separately as it mau change 2021-08-02 16:18:37 +08:00
domosekai dd9c3546f7 Prevent IPv6 leak if only IPv4 default route is added 2021-08-02 16:18:37 +08:00
domosekai 4ddf39e760 Remove obsolete Win32 functions 2021-08-02 16:18:37 +08:00
domosekai ce0591d924 Add IPv6 route management for Windows client 2021-08-02 16:18:36 +08:00
Ilya Shipitsin 5a05e7a249 Merge pull request #1447 from chipitsine/drop_libressl_ci
CI: cirrus: drop LibreSSL builds
2021-08-01 21:39:17 +05:00
Ilya Shipitcin c3573561ed CI: cirrus: drop LibreSSL builds
starting with 9dbbfcd388 we only support
OpenSSL-1.1.1, no LibreSSL for now. Let us drop LibreSSL builds for the
sake of simplicity
2021-08-01 21:08:34 +05:00
Davide Beatrici 97a04888b7 Merge PR #1445: src/Cedar/SW.c: treat "0" build as legitimate 2021-08-01 12:42:43 +02:00
Ilya Shipitcin 37b5644291 src/Cedar/SW.c: treat "0" build as legitimate
installers built for PR have "0" build. let us treat them as legitimate
2021-08-01 12:26:51 +05:00
Davide Beatrici 101d79d7c3 Merge PR #1441: Mayaqua/Network.c: Fix race condition in TUBE operation 2021-07-23 19:42:13 +02:00
domosekai 9182a9b4e9 Mayaqua/Network.c: Fix race condition in TUBE operation 2021-07-22 11:59:15 +00:00
Davide Beatrici bf14817f1f Merge PR #1434: Cedar/Proto_PPP.c: Fix memory leak in EAP-MSCHAPv2 2021-07-21 23:54:59 +02:00
domosekai 8b87c9d4ef Cedar/Proto_PPP.c: Fix memory leak in EAP-MSCHAPv2
Fixes: #1420 (Implement EAP-MSCHAPv2)
2021-07-21 11:16:35 +00:00
domosekai 2761c1ca42 Support user-specified server trust chain 2021-07-21 07:02:42 +00:00
Yihong Wu 1f40de2dda README.md: Add me to members 2021-07-16 15:46:53 +08:00
Ilya Shipitsin ddf9e48c10 Merge pull request #1432 from domosekai/route
Mayaqua/TcpIp.c: Fix building DHCP static routes in new format
2021-07-14 17:41:01 +05:00
domosekai 1bb01e55e5 Mayaqua/TcpIp.c: Fix building DHCP static routes in new format
Fixes: 1708998 (Change IP structure so that IPv4 addresses are stored in RFC3493 format)
2021-07-14 08:11:05 +00:00
Ilya Shipitsin b531d8e234 Merge pull request #1429 from metalefty/typo
Fix typo, fix case, and trivial translations
2021-07-13 14:57:34 +05:00
Koichiro IWAO fce3592917 hamcore(ja,tw,cn): translate "Authentication"
appeared in "OpenSSL Engine Authorization"
2021-07-13 18:44:42 +09:00
Koichiro IWAO 410b7a959d Fix case of OpenSSL 2021-07-13 18:41:41 +09:00
Koichiro IWAO 1590e6afb3 Fix typo s/has beens/has been/g 2021-07-13 18:15:09 +09:00
Davide Beatrici 996f2f2aa0 Merge PR #1427: Cedar/IPC.c: Add hub release in NewIPC() 2021-07-12 23:20:53 +02:00
domosekai 7863ce8a8e Cedar/IPC.c: Add hub release in NewIPC() 2021-07-12 08:37:12 +00:00
Davide Beatrici 26a27553b2 Merge PR #1426: Mayaqua/Network.c: Create UDP listener for every interface if ListenIP is wildcard 2021-07-11 21:35:01 +02:00
domosekai a1dff0f594 Mayaqua/Network.c: Create UDP listener for every interface if ListenIP is wildcard 2021-07-11 16:15:29 +00:00
Ilya Shipitsin 7881f8657a Merge pull request #1420 from domosekai/eap
Implement EAP-MSCHAPv2
2021-07-10 23:27:10 +05:00
Ilya Shipitsin bd501ba9bf Merge pull request #1422 from domosekai/timeout
Fix use-after-free timeout issue for L2TP and SSTP
2021-07-10 22:34:57 +05:00
domosekai dfb105c2d7 Fix use-after-free timeout issue for L2TP and SSTP 2021-07-10 16:07:09 +00:00
domosekai 66dc5ee581 Cedar/Radius.c: Fix EAP Message buffer overflow 2021-07-10 08:15:03 +00:00
domosekai 56bd9733d6 Cedar/Proto_PPP.c: Use unified format for negative condition 2021-07-10 05:30:06 +00:00
domosekai eff784b624 Improve EAP behavior with RADIUS 2021-07-10 05:29:23 +00:00
domosekai 22a9231c33 Implement EAP-MSCHAPv2 2021-07-08 14:26:31 +00:00
Davide Beatrici a2f30c8aad Merge PR #1417: Mayaqua/Network.c: Fix L2TP/IPsec over IPv6 when listening on :: 2021-07-07 20:31:49 +02:00
domosekai 41b9973c24 Mayaqua/Network.c: Fix L2TP/IPsec over IPv6 when listening on :: 2021-07-07 17:37:06 +00:00
Ilya Shipitsin 60db1962f9 Merge pull request #1416 from domosekai/listener
Fix TCP and UDP listener behavior
2021-07-07 16:08:05 +05:00
domosekai 6e400c19af Fix TCP and UDP listener behavior 2021-07-07 10:50:23 +00:00
Ilya Shipitsin f2466eb919 Merge pull request #1415 from davidebeatrici/vpncmd-wireguard-keys
Cedar/Command: Add GenX25519 and GetPublicX25519 commands
2021-07-07 13:04:13 +05:00
Davide Beatrici c310163244 Cedar/Command: Add GenX25519 and GetPublicX25519 commands
GenX25519 command - Create new X25519 keypair
Help for command "GenX25519"

Purpose:
  Create new X25519 keypair

Description:
  Use this to create a new X25519 keypair, which can be used for WireGuard.
  Both the private and public key will be shown.
  The public key can be shared and is used to identify a peer.
  Also, it can always be retrieved from the private key using the GetPublicX25519 command.
  The private key should be kept in a secure place and never be shared.
  It cannot be recovered once lost.

Usage:
  GenX25519

==========================================================================================

GetPublicX25519 command - Retrieve public X25519 key from a private one
Help for command "GetPublicX25519"

Purpose:
  Retrieve public X25519 key from a private one

Description:
  Use this if you have a private X25519 key and want to get its corresponding public key.

Usage:
  GetPublicX25519 [private]

Parameters:
  private - The private X25519 key you want to get the corresponding public key of.
2021-07-07 08:43:41 +02:00
Davide Beatrici 9dbbfcd388 Mayaqua: Add new cryptographic functions for X25519/X448 keys management
The files are created in a new folder to keep the source tree tidier.

Please note that only X25519/X448 keys are supported due to an OpenSSL limitation:
https://www.openssl.org/docs/manmaster/man3/EVP_PKEY_new.html

We have functions that handle AES keys in Encrypt.c/.h.
Ideally we should move them into the new files.
2021-07-07 08:11:08 +02:00
Davide Beatrici 4328e6e5ab CMake: Link Cedar to Mayaqua directly
It's Cedar itself that depends on Mayaqua, not the executables.
2021-07-07 08:08:12 +02:00
Davide Beatrici 505c854303 Merge PR #1414: Mayaqua/Network.c: Use int as boolean flags for socket options 2021-07-07 06:35:50 +02:00
domosekai 4efed994dc Mayaqua/Network.c: Use int as boolean flags for socket options 2021-07-07 03:07:06 +00:00
Davide Beatrici 513ad6e792 Merge PR #1410: Mayaqua/DNS.c: Fix DNS resolution in dual stack environment 2021-07-05 20:23:09 +02:00
Davide Beatrici 0d5b05ef02 Merge PR #1411: Cedar/Protocol.c: Use real server IP in creating node info under direct mode 2021-07-05 20:15:29 +02:00
domosekai bcba88ca73 Cedar/Protocol.c: Use real server IP in creating node info under direct mode 2021-07-05 12:17:57 +00:00
domosekai 883d4d4cd7 Mayaqua/DNS.c: Fix DNS resolution in dual stack environment 2021-07-05 11:10:03 +00:00
Davide Beatrici 4eae5820f6 Merge PR #1407: Cedar/Connection.c: Fix buffer overflow when inserting NAT-T information 2021-07-04 08:45:27 +02:00
domosekai f6adcd6bfc Cedar/Connection.c: Fix buffer overflow when inserting NAT-T information 2021-07-04 05:53:24 +00:00
Davide Beatrici dc296f1eff Merge PR #1406: Add WireGuard mention to README.md 2021-07-03 23:16:31 +02:00
David Refoua 43f8b5fc56 mention WireGuard on the README.md
Now that SoftEther officially support WireGuard, it can also be mentioned on the README page.
2021-07-04 01:07:55 +04:30
Ilya Shipitsin 08905e57a6 Merge pull request #1404 from davidebeatrici/base64-revamp
Refactor Base64 functions, encode/decode using OpenSSL's EVP interface
2021-07-02 13:23:10 +05:00
Davide Beatrici 233e28f38c Refactor Base64 functions, encode/decode using OpenSSL's EVP interface
Our own implementation works fine, however we should use OpenSSL's one since we already link to the library.

Base64Decode() and Base64Encode() return the required buffer size when "dst" is NULL.

This allows to efficiently allocate a buffer, without wasting memory or risking an overflow.

Base64FromBin() and Base64ToBin() perform all steps, returning a heap-allocated buffer with the data in it.
2021-07-02 09:24:41 +02:00
Steve Muskiewicz 8798978951 move CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION list appends inside RPM generator if block 2021-06-30 15:00:05 -04:00
Steve Muskiewicz af84a30adc Update softether-vpnserver.service files:
* change `ReadOnlyDirectories` -> `ReadOnlyPaths` and `ReadWriteDirectories` -> `ReadWritePaths`

 * add `ReadWritePaths` for other necessary directories (this should address #1111)
2021-06-30 11:48:45 -04:00
Steve Muskiewicz b64c15b097 Fixes for RPM packaging issues (on CentOS 8):
* add "common" package provides for `libcedar.so()(64bit)` to allow `softether-vpnserver` package to install properly

* exclude `/lib/systemd/system` paths from RPM package file listing to prevent file conflicts when installing RPM (these paths already are "owned" by the systemd RPM)
2021-06-30 11:43:58 -04:00
Ilya Shipitsin 03d67fd5b1 Merge pull request #1401 from davidebeatrici/admin-proto-alog-fix
Use "%S" instead of "%s" for LA_SET_PORTS_UDP and LA_SET_PROTO_OPTIONS
2021-06-27 22:24:42 +03:00
Davide Beatrici 46ca5f7b98 Use "%S" instead of "%s" for LA_SET_PORTS_UDP and LA_SET_PROTO_OPTIONS
Turns out %S refers to ANSI/UTF-8 and %s to UTF-16.

This commit fixes a buffer overflow reported by AddressSanitizer and removes an unnecessary conversion to UTF-16.
2021-06-27 21:08:26 +02:00
Ilya Shipitsin ce6ea9f781 Merge pull request #1400 from davidebeatrici/remove-hardcoded-build-number-checks
Remove obsolete hardcoded build number checks
2021-06-27 13:42:57 +03:00
Davide Beatrici 4221579e95 Remove obsolete hardcoded build number checks
The open-source project began with version 1.00, build 9022.

With the exception of an informative message fallback for builds older than 9428 (2014), all checks were for closed-source builds.
2021-06-27 07:21:06 +02:00
domosekai 65bcbc8db3 Mayaqua/Network.c: Fix EAP-TLS chain certificate verification 2021-06-21 14:41:22 +00:00
144 changed files with 15762 additions and 14093 deletions
+3 -10
View File
@@ -1,6 +1,6 @@
version: '{build}' version: '{build}'
image: Ubuntu1804 image: Ubuntu2004
configuration: Release configuration: Release
@@ -18,9 +18,8 @@ init:
- ps: Update-AppveyorBuild -Version "build-$env:APPVEYOR_BUILD_NUMBER-$($env:APPVEYOR_REPO_COMMIT.substring(0,7))" - ps: Update-AppveyorBuild -Version "build-$env:APPVEYOR_BUILD_NUMBER-$($env:APPVEYOR_REPO_COMMIT.substring(0,7))"
install: install:
- sudo apt-get -y install libsodium-dev - sudo apt-get -y install libsodium-dev libcap-ng-dev
before_build: before_build:
- sh: "if [ ${APPVEYOR_REPO_TAG} == \"true\" ]; then .ci/appveyor-create-release-tarball.sh\nfi"
- git submodule update --init --recursive - git submodule update --init --recursive
- ./configure - ./configure
build_script: build_script:
@@ -28,13 +27,7 @@ build_script:
- .ci/memory-leak-test.sh - .ci/memory-leak-test.sh
test_script: test_script:
- .ci/appveyor-deb-install-test.sh - .ci/appveyor-deb-install-test.sh
- sudo apt-get update && sudo apt-get -y install autoconf libtool liblzo2-dev libpam-dev fping unzip liblz4-dev # openvpn build deps - sudo apt-get update && sudo apt-get -y install autoconf libtool liblzo2-dev libpam-dev fping unzip liblz4-dev libnl-genl-3-dev # openvpn build deps
- sudo .ci/start-se-openvpn.sh - sudo .ci/start-se-openvpn.sh
- sudo .ci/run-openvpn-tests.sh - sudo .ci/run-openvpn-tests.sh
deploy:
description: 'automatic release'
provider: GitHub
auth_token: $(github_token)
on:
APPVEYOR_REPO_TAG: true
-7
View File
@@ -1,7 +0,0 @@
#!/bin/bash
set -eux
tar --exclude=.git --transform "s//SoftEtherVPN-${APPVEYOR_REPO_TAG_NAME}\//" -czf /tmp/softether-vpn-src-${APPVEYOR_REPO_TAG_NAME}.tar.gz .
appveyor PushArtifact /tmp/softether-vpn-src-${APPVEYOR_REPO_TAG_NAME}.tar.gz
+6 -3
View File
@@ -1,9 +1,12 @@
jobs: jobs:
- job: Ubuntu_x64 - job: Ubuntu_x64
pool: pool:
vmImage: ubuntu-18.04 vmImage: ubuntu-22.04
steps: steps:
- script: sudo apt update && sudo apt-get -y install cmake gcc g++ ninja-build libncurses5-dev libreadline-dev libsodium-dev libssl-dev make zlib1g-dev liblz4-dev - checkout: self
submodules: true
persistCredentials: true
- script: sudo apt update && sudo apt-get -y install cmake gcc g++ ninja-build libncurses5-dev libreadline-dev libsodium-dev libssl-dev make zlib1g-dev liblz4-dev libnl-genl-3-dev
displayName: 'Prepare environment' displayName: 'Prepare environment'
- script: "$(Build.SourcesDirectory)/.ci/azure-pipelines/linux_build.sh" - script: "$(Build.SourcesDirectory)/.ci/azure-pipelines/linux_build.sh"
env: env:
@@ -11,7 +14,7 @@ jobs:
displayName: 'Build' displayName: 'Build'
- script: | - script: |
.ci/appveyor-deb-install-test.sh .ci/appveyor-deb-install-test.sh
sudo apt-get -y install autoconf libtool liblzo2-dev libpam-dev fping unzip # To build OpenVPN sudo apt-get -y install autoconf libtool liblzo2-dev libpam-dev fping unzip libcap-ng-dev # To build OpenVPN
sudo BUILD_BINARIESDIRECTORY=$BUILD_BINARIESDIRECTORY .ci/start-se-openvpn.sh sudo BUILD_BINARIESDIRECTORY=$BUILD_BINARIESDIRECTORY .ci/start-se-openvpn.sh
sudo BUILD_BINARIESDIRECTORY=$BUILD_BINARIESDIRECTORY .ci/run-openvpn-tests.sh sudo BUILD_BINARIESDIRECTORY=$BUILD_BINARIESDIRECTORY .ci/run-openvpn-tests.sh
displayName: 'Test' displayName: 'Test'
+3
View File
@@ -3,6 +3,9 @@ jobs:
pool: pool:
vmImage: macOS-latest vmImage: macOS-latest
steps: steps:
- checkout: self
submodules: true
persistCredentials: true
- script: brew install pkg-config cmake ninja ncurses readline libsodium openssl zlib - script: brew install pkg-config cmake ninja ncurses readline libsodium openssl zlib
displayName: 'Prepare environment' displayName: 'Prepare environment'
- script: '$(Build.SourcesDirectory)/.ci/azure-pipelines/macos_build.sh' - script: '$(Build.SourcesDirectory)/.ci/azure-pipelines/macos_build.sh'
+5 -9
View File
@@ -11,13 +11,9 @@ parameters:
steps: steps:
- task: Cache@2 - task: Cache@2
inputs: inputs:
key: '"vcpkg-installed-windows-${{parameters.architecture}}"' key: '"vcpkg-manifest" | "$(Agent.OS)" | "${{parameters.vcpkgTriplet}}" | C:/vcpkg/.git/refs/heads/master'
path: 'C:/vcpkg/installed' path: '$(Build.BinariesDirectory)/vcpkg_installed'
displayName: 'Environment storage' displayName: 'Environment storage'
- script: |
vcpkg install libsodium openssl zlib --triplet ${{parameters.vcpkgTriplet}}
workingDirectory: C:/vcpkg
displayName: 'Prepare environment'
- script: '$(Build.SourcesDirectory)/.ci/azure-pipelines/windows_build.bat' - script: '$(Build.SourcesDirectory)/.ci/azure-pipelines/windows_build.bat'
env: env:
ARCHITECTURE: ${{parameters.architecture}} ARCHITECTURE: ${{parameters.architecture}}
@@ -33,12 +29,12 @@ steps:
inputs: inputs:
sourceFolder: '$(Build.BinariesDirectory)' sourceFolder: '$(Build.BinariesDirectory)'
contents: '?(*.exe|*.se2|*.pdb)' contents: '?(*.exe|*.se2|*.pdb)'
TargetFolder: '$(Build.StagingDirectory)/binaries' TargetFolder: '$(Build.StagingDirectory)/binaries/${{parameters.architecture}}'
flattenFolders: true flattenFolders: true
- task: PublishBuildArtifacts@1 - task: PublishBuildArtifacts@1
inputs: inputs:
pathtoPublish: '$(Build.StagingDirectory)/binaries' pathtoPublish: '$(Build.StagingDirectory)/binaries/${{parameters.architecture}}'
artifactName: 'Binaries' artifactName: 'Binaries_${{parameters.architecture}}'
- task: PublishBuildArtifacts@1 - task: PublishBuildArtifacts@1
inputs: inputs:
pathtoPublish: '$(Build.StagingDirectory)/installers' pathtoPublish: '$(Build.StagingDirectory)/installers'
+12 -6
View File
@@ -3,19 +3,25 @@ jobs:
pool: pool:
vmImage: windows-latest vmImage: windows-latest
steps: steps:
- checkout: self
submodules: true
persistCredentials: true
- template: "windows-steps.yml" - template: "windows-steps.yml"
parameters: parameters:
architecture: "x64" architecture: "x64"
compilerPath: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/Llvm/x64/bin/clang-cl.exe" compilerPath: "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/Llvm/x64/bin/clang-cl.exe"
vcpkgTriplet: "x64-windows-static-md" vcpkgTriplet: "x64-windows-static"
vcvarsPath: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat" vcvarsPath: "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvars64.bat"
- job: Windows_x86 - job: Windows_x86
pool: pool:
vmImage: windows-latest vmImage: windows-latest
steps: steps:
- checkout: self
submodules: true
persistCredentials: true
- template: "windows-steps.yml" - template: "windows-steps.yml"
parameters: parameters:
architecture: "x86" architecture: "x86"
compilerPath: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/Llvm/bin/clang-cl.exe" compilerPath: "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/Llvm/bin/clang-cl.exe"
vcpkgTriplet: "x86-windows-static-md" vcpkgTriplet: "x86-windows-static"
vcvarsPath: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvarsamd64_x86.bat" vcvarsPath: "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvars32.bat"
+3 -1
View File
@@ -21,7 +21,7 @@ cat << EOF > tests/t_client.rc
CA_CERT=fake CA_CERT=fake
TEST_RUN_LIST="1 2" TEST_RUN_LIST="1 2"
OPENVPN_BASE="--remote 127.0.0.1 --config $CONFIG --auth-user-pass /tmp/auth.txt" OPENVPN_BASE="--config $CONFIG --auth-user-pass /tmp/auth.txt"
RUN_TITLE_1="testing udp/ipv4" RUN_TITLE_1="testing udp/ipv4"
OPENVPN_CONF_1="--dev null --proto udp --port 1194 \$OPENVPN_BASE" OPENVPN_CONF_1="--dev null --proto udp --port 1194 \$OPENVPN_BASE"
@@ -30,4 +30,6 @@ RUN_TITLE_2="testing tcp/ipv4"
OPENVPN_CONF_2="--dev null --proto tcp --port 1194 \$OPENVPN_BASE" OPENVPN_CONF_2="--dev null --proto tcp --port 1194 \$OPENVPN_BASE"
EOF EOF
sed -i 's/^remote.*$/remote 127.0.0.1 1194/g' /tmp/*l3*ovpn
make test_scripts=t_client.sh check make test_scripts=t_client.sh check
+4 -4
View File
@@ -2,16 +2,16 @@ FreeBSD_task:
matrix: matrix:
env: env:
SSL: openssl SSL: openssl
OPENSSL_ROOT_DIR: /usr/local
env: env:
SSL: libressl SSL: openssl32
env: OPENSSL_ROOT_DIR: /usr/local
SSL: libressl-devel
env: env:
# base openssl # base openssl
SSL: SSL:
matrix: matrix:
freebsd_instance: freebsd_instance:
image_family: freebsd-12-1 image_family: freebsd-13-2
prepare_script: prepare_script:
- pkg install -y pkgconf cmake git libsodium $SSL - pkg install -y pkgconf cmake git libsodium $SSL
- git submodule update --init --recursive - git submodule update --init --recursive
+4
View File
@@ -2,6 +2,10 @@ Hi, there!
Thank you for using SoftEther. Thank you for using SoftEther.
If you are running SoftEther VPN 4.x (i.e. Stable Edition), please read the comparison with Developer Edition at:
https://github.com/SoftEtherVPN/SoftEtherVPN#comparison-with-stable-edition
Before you submit an issue, please read the following: Before you submit an issue, please read the following:
Is this a question? Is this a question?
+1 -1
View File
@@ -26,7 +26,7 @@ jobs:
mv /tmp/$PKGNAME . mv /tmp/$PKGNAME .
TARBALL=$PKGNAME.tar.xz TARBALL=$PKGNAME.tar.xz
tar cJf $TARBALL $PKGNAME tar cJf $TARBALL $PKGNAME
echo "::set-output name=tarball::$TARBALL" echo "tarball=$TARBALL" >> $GITHUB_OUTPUT
- name: upload tarball - name: upload tarball
uses: actions/upload-release-asset@v1 uses: actions/upload-release-asset@v1
+23 -10
View File
@@ -5,16 +5,13 @@ on:
schedule: schedule:
- cron: "0 0 * * *" - cron: "0 0 * * *"
permissions:
contents: read
jobs: jobs:
scan: scan:
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: ${{ github.repository_owner == 'SoftEtherVPN' }} if: ${{ github.repository_owner == 'SoftEtherVPN' }}
env:
COVERITY_SCAN_PROJECT_NAME: 'SoftEtherVPN/SoftEtherVPN'
COVERITY_SCAN_BRANCH_PATTERN: '*'
COVERITY_SCAN_NOTIFICATION_EMAIL: 'chipitsine@gmail.com'
COVERITY_SCAN_BUILD_COMMAND_PREPEND: "./configure"
COVERITY_SCAN_BUILD_COMMAND: "make -C build"
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
with: with:
@@ -23,8 +20,24 @@ jobs:
run: | run: |
sudo apt-get update sudo apt-get update
sudo apt-get install -y cmake gcc g++ libncurses5-dev libreadline-dev libssl-dev make zlib1g-dev libsodium-dev sudo apt-get install -y cmake gcc g++ libncurses5-dev libreadline-dev libssl-dev make zlib1g-dev libsodium-dev
- name: Run Coverity Scan - name: Download Coverity build tool
env:
COVERITY_SCAN_TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
run: | run: |
curl -fsSL "https://scan.coverity.com/scripts/travisci_build_coverity_scan.sh" | bash || true wget -c -N https://scan.coverity.com/download/linux64 --post-data "token=${{ secrets.COVERITY_SCAN_TOKEN }}&project=SoftEtherVPN%2FSoftEtherVPN" -O coverity_tool.tar.gz
mkdir coverity_tool
tar xzf coverity_tool.tar.gz --strip 1 -C coverity_tool
- name: Configure
run: |
./configure
- name: Build with Coverity build tool
run: |
export PATH=`pwd`/coverity_tool/bin:$PATH
cov-build --dir cov-int make -C build
- name: Submit build result to Coverity Scan
run: |
tar czvf cov.tar.gz cov-int
curl --form token=${{ secrets.COVERITY_SCAN_TOKEN }} \
--form email=chipitsine@gmail.com \
--form file=@cov.tar.gz \
--form version="Commit $GITHUB_SHA" \
--form description="Build submitted via CI" \
https://scan.coverity.com/builds?project=SoftEtherVPN%2FSoftEtherVPN
+33
View File
@@ -0,0 +1,33 @@
name: Fedora/Rawhide
on:
schedule:
- cron: "0 0 25 * *"
push:
workflow_dispatch:
permissions:
contents: read
jobs:
build_and_test:
strategy:
matrix:
cc: [ gcc, clang ]
name: ${{ matrix.cc }}
runs-on: ubuntu-latest
container:
image: fedora:rawhide
steps:
- uses: actions/checkout@v1
with:
submodules: true
- name: Install dependencies
run: |
dnf -y install git cmake ncurses-devel openssl-devel libsodium-devel readline-devel zlib-devel gcc-c++ clang
- name: Compile with ${{ matrix.cc }}
run: |
export CC=${{ matrix.cc }}
./configure
make -C build
+28
View File
@@ -0,0 +1,28 @@
on: [push, pull_request, workflow_dispatch]
permissions:
contents: read
jobs:
build_and_test:
strategy:
matrix:
os: [macos-13, macos-12, macos-11]
name: ${{ matrix.os }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v1
with:
submodules: true
- name: Install dependencies
run: |
brew install libsodium
- name: Compile
run: |
./configure
make -C build
- name: Test
run: |
otool -L build/vpnserver
.ci/memory-leak-test.sh
+23
View File
@@ -0,0 +1,23 @@
name: alpine/musl
on: [push, pull_request]
permissions:
contents: read
jobs:
musl:
name: gcc
runs-on: ubuntu-latest
container:
image: alpine:latest
steps:
- uses: actions/checkout@v1
with:
submodules: true
- name: Install dependencies
run: apk add binutils --no-cache build-base readline-dev openssl-dev ncurses-dev git cmake zlib-dev libsodium-dev gnu-libiconv
- name: Configure
run: ./configure
- name: make
run: make -C build
+16
View File
@@ -0,0 +1,16 @@
on: [push, pull_request]
permissions:
contents: read
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
with:
submodules: true
- name: Check
run: |
cd developer_tools/stbchecker
dotnet run ../../src/bin/hamcore
+1
View File
@@ -2,6 +2,7 @@
.cproject .cproject
.project .project
.settings/ .settings/
.vs/
Makefile Makefile
/src/bin/* /src/bin/*
!/src/bin/hamcore/ !/src/bin/hamcore/
-49
View File
@@ -1,32 +1,3 @@
.ubuntu: &ubuntu_def
variables:
CMAKE_VERSION: 3.9.6
except:
changes:
- .appveyor.yml
- .travis.yml
- .azure-pipelines.yml
- .cirrus.yml
before_script:
- REPOSITORY="$PWD" && cd ..
- apt-get update && apt-get install -y dpkg-dev wget g++ gcc libncurses5-dev libreadline-dev libsodium-dev libssl-dev make zlib1g-dev git file
- wget https://cmake.org/files/v${CMAKE_VERSION%.*}/cmake-${CMAKE_VERSION}.tar.gz && tar -xzf cmake-${CMAKE_VERSION}.tar.gz
- cd cmake-${CMAKE_VERSION} && ./bootstrap && make install
- cd "$REPOSITORY" && git submodule update --init --recursive
script:
- ./configure
- make package -C build
- dpkg -i build/softether-vpn*.deb
- .ci/memory-leak-test.sh
trusty:
<<: *ubuntu_def
image: ubuntu:trusty
precise:
<<: *ubuntu_def
image: ubuntu:precise
# illumos gitlab-runner maintained by @hww3 # illumos gitlab-runner maintained by @hww3
build_illumos: build_illumos:
only: only:
@@ -38,23 +9,3 @@ build_illumos:
- CMAKE_FLAGS="-DCMAKE_PREFIX_PATH=/opt/local -DCMAKE_CXX_FLAGS=-m64 -DCMAKE_C_FLAGS=-m64" ./configure - CMAKE_FLAGS="-DCMAKE_PREFIX_PATH=/opt/local -DCMAKE_CXX_FLAGS=-m64 -DCMAKE_C_FLAGS=-m64" ./configure
- gmake -C build - gmake -C build
#
# flawfinder
# see https://docs.gitlab.com/ee/user/project/merge_requests/sast.html
#
sast:
image: docker:stable
variables:
DOCKER_DRIVER: overlay2
allow_failure: true
services:
- docker:stable-dind
script:
- export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')
- docker run
--env SAST_CONFIDENCE_LEVEL="${SAST_CONFIDENCE_LEVEL:-3}"
--volume "$PWD:/code"
--volume /var/run/docker.sock:/var/run/docker.sock
"registry.gitlab.com/gitlab-org/security-products/sast:$SP_VERSION" /app/bin/run /code
artifacts:
paths: [gl-sast-report.json]
-19
View File
@@ -38,25 +38,6 @@ matrix:
before_install: before_install:
- sudo apt-get -y install libsodium-dev - sudo apt-get -y install libsodium-dev
- bash .ci/build-libressl.sh > build-deps.log 2>&1 || (cat build-deps.log && exit 1) - bash .ci/build-libressl.sh > build-deps.log 2>&1 || (cat build-deps.log && exit 1)
- env: LABEL="check stb files"
os: linux
language: csharp
mono: none
dotnet: 2.2.203
before_install:
- true
script:
- cd developer_tools/stbchecker
- dotnet run ../../src/bin/hamcore
- os: osx
compiler: clang
before_install:
- brew install libsodium
script:
- ./configure
- make -C build
- otool -L build/vpnserver
- .ci/memory-leak-test.sh
cache: cache:
directories: directories:
+2
View File
@@ -52,6 +52,8 @@ DEVELOPMENT BOARD MEMBERS:
- Ilya Shipitsin - Ilya Shipitsin
https://github.com/chipitsine https://github.com/chipitsine
- Yihong Wu
https://github.com/domosekai
SPECIAL CONTRIBUTORS: SPECIAL CONTRIBUTORS:
+17
View File
@@ -13,6 +13,13 @@ if (BUILD_NUMBER LESS 5180)
"For detailed info: https://github.com/SoftEtherVPN/SoftEtherVPN/issues/1392#issuecomment-867348281") "For detailed info: https://github.com/SoftEtherVPN/SoftEtherVPN/issues/1392#issuecomment-867348281")
endif() endif()
#
# Link MSVC runtime statically
# this should be revisited after installer migration to MSI
#
cmake_policy(SET CMP0091 NEW)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
project("SoftEther VPN" project("SoftEther VPN"
VERSION "5.02.${BUILD_NUMBER}" VERSION "5.02.${BUILD_NUMBER}"
LANGUAGES C LANGUAGES C
@@ -36,9 +43,19 @@ if(EXISTS "${TOP_DIRECTORY}/.git" AND NOT EXISTS "${TOP_DIRECTORY}/src/libhamcor
message (FATAL_ERROR "Submodules are not initialized. Run\n\tgit submodule update --init --recursive") message (FATAL_ERROR "Submodules are not initialized. Run\n\tgit submodule update --init --recursive")
endif() endif()
if(WIN32 AND VCPKG_TARGET_TRIPLET AND NOT DEFINED CMAKE_TOOLCHAIN_FILE)
message (FATAL_ERROR "vcpkg not installed or integrated with Visual Studio. Install it and run\n\tvcpkg integrate install")
endif()
if(UNIX) if(UNIX)
include(GNUInstallDirs) include(GNUInstallDirs)
#
# use rpath for locating installed libraries
#
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
include(CheckIncludeFile) include(CheckIncludeFile)
Check_Include_File(sys/auxv.h HAVE_SYS_AUXV) Check_Include_File(sys/auxv.h HAVE_SYS_AUXV)
if(EXISTS "/lib/systemd/system") if(EXISTS "/lib/systemd/system")
+141
View File
@@ -0,0 +1,141 @@
{
"environments": [ { "BuildNumber": "5180" } ],
"configurations": [
{
"name": "x64-native",
"description": "Target x64 with 64-bit compiler",
"generator": "Ninja",
"configurationType": "RelWithDebInfo",
"inheritEnvironments": [ "clang_cl_x64_x64" ],
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": "",
"variables": [
{
"name": "BUILD_NUMBER",
"value": "${env.BuildNumber}",
"type": "STRING"
},
{
"name": "CMAKE_C_COMPILER",
"value": "${env.VCINSTALLDIR}Tools/Llvm/x64/bin/clang-cl.exe",
"type": "FILEPATH"
},
{
"name": "CMAKE_CXX_COMPILER",
"value": "${env.VCINSTALLDIR}Tools/Llvm/x64/bin/clang-cl.exe",
"type": "FILEPATH"
},
{
"name": "VCPKG_TARGET_TRIPLET",
"value": "x64-windows-static",
"type": "STRING"
}
]
},
{
"name": "x86-on-x64",
"description": "Target x86 with 64-bit compiler",
"generator": "Ninja",
"configurationType": "RelWithDebInfo",
"inheritEnvironments": [ "clang_cl_x86_x64" ],
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": "",
"variables": [
{
"name": "BUILD_NUMBER",
"value": "${env.BuildNumber}",
"type": "STRING"
},
{
"name": "CMAKE_C_COMPILER",
"value": "${env.VCINSTALLDIR}Tools/Llvm/x64/bin/clang-cl.exe",
"type": "FILEPATH"
},
{
"name": "CMAKE_CXX_COMPILER",
"value": "${env.VCINSTALLDIR}Tools/Llvm/x64/bin/clang-cl.exe",
"type": "FILEPATH"
},
{
"name": "VCPKG_TARGET_TRIPLET",
"value": "x86-windows-static",
"type": "STRING"
}
]
},
{
"name": "x64-on-x86",
"description": "Target x64 with 32-bit compiler",
"generator": "Ninja",
"configurationType": "RelWithDebInfo",
"inheritEnvironments": [ "clang_cl_x64" ],
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": "",
"variables": [
{
"name": "BUILD_NUMBER",
"value": "${env.BuildNumber}",
"type": "STRING"
},
{
"name": "CMAKE_C_COMPILER",
"value": "${env.VCINSTALLDIR}Tools/Llvm/bin/clang-cl.exe",
"type": "FILEPATH"
},
{
"name": "CMAKE_CXX_COMPILER",
"value": "${env.VCINSTALLDIR}Tools/Llvm/bin/clang-cl.exe",
"type": "FILEPATH"
},
{
"name": "VCPKG_TARGET_TRIPLET",
"value": "x64-windows-static",
"type": "STRING"
}
]
},
{
"name": "x86-native",
"description": "Target x86 with 32-bit compiler",
"generator": "Ninja",
"configurationType": "RelWithDebInfo",
"inheritEnvironments": [ "clang_cl_x86" ],
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": "",
"variables": [
{
"name": "BUILD_NUMBER",
"value": "${env.BuildNumber}",
"type": "STRING"
},
{
"name": "CMAKE_C_COMPILER",
"value": "${env.VCINSTALLDIR}Tools/Llvm/bin/clang-cl.exe",
"type": "FILEPATH"
},
{
"name": "CMAKE_CXX_COMPILER",
"value": "${env.VCINSTALLDIR}Tools/Llvm/bin/clang-cl.exe",
"type": "FILEPATH"
},
{
"name": "VCPKG_TARGET_TRIPLET",
"value": "x86-windows-static",
"type": "STRING"
}
]
}
]
}
-1
View File
@@ -1,2 +1 @@
liberapay: softether liberapay: softether
custom: https://salt.bountysource.com/teams/softether-vpn
+47 -19
View File
@@ -12,9 +12,9 @@
- [BOARD MEMBERS OF THIS REPOSITORY](#board-members-of-this-repository) - [BOARD MEMBERS OF THIS REPOSITORY](#board-members-of-this-repository)
- [SOFTETHER VPN ADVANTAGES](#softether-vpn-advantages) - [SOFTETHER VPN ADVANTAGES](#softether-vpn-advantages)
- [Installation](#installation) - [Installation](#installation)
* [For Ubuntu](#for-ubuntu)
* [For FreeBSD](#for-freebsd) * [For FreeBSD](#for-freebsd)
* [From binary installers:](#from-binary-installers) * [For Windows](#for-windows)
* [From binary installers (stable channel)](#from-binary-installers-stable-channel)
* [Build from Source code](#build-from-source-code) * [Build from Source code](#build-from-source-code)
- [About HTML5-based Modern Admin Console and JSON-RPC API Suite](#about-html5-based-modern-admin-console-and-json-rpc-api-suite) - [About HTML5-based Modern Admin Console and JSON-RPC API Suite](#about-html5-based-modern-admin-console-and-json-rpc-api-suite)
* [Built-in SoftEther VPN Server HTML5 Ajax-based Web Administration Console](#built-in-softether-vpn-server-html5-ajax-based-web-administration-console) * [Built-in SoftEther VPN Server HTML5 Ajax-based Web Administration Console](#built-in-softether-vpn-server-html5-ajax-based-web-administration-console)
@@ -34,6 +34,8 @@ Stable Edition is available on
https://github.com/SoftEtherVPN/SoftEtherVPN_Stable https://github.com/SoftEtherVPN/SoftEtherVPN_Stable
which the non-developer user can stable use. which the non-developer user can stable use.
Please note that [some features](#comparison-with-stable-edition) are not available in Stable Edition.
Source code packages (.zip and .tar.gz) and binary files of Stable Edition are also available: Source code packages (.zip and .tar.gz) and binary files of Stable Edition are also available:
https://www.softether-download.com/ https://www.softether-download.com/
@@ -72,7 +74,7 @@ world's most powerful and easy-to-use multi-protocol VPN software.
SoftEther VPN runs on Windows, Linux, Mac, FreeBSD and Solaris. SoftEther VPN runs on Windows, Linux, Mac, FreeBSD and Solaris.
SoftEther VPN supports most of widely-used VPN protocols SoftEther VPN supports most of widely-used VPN protocols
including SSL-VPN, OpenVPN, IPsec, L2TP, MS-SSTP, L2TPv3 and EtherIP including SSL-VPN, WireGuard, OpenVPN, IPsec, L2TP, MS-SSTP, L2TPv3 and EtherIP
by the single SoftEther VPN Server program. by the single SoftEther VPN Server program.
More details on https://www.softether.org/. More details on https://www.softether.org/.
@@ -105,6 +107,7 @@ https://github.com/chipitsine
- Supporting all popular VPN protocols by the single VPN server: - Supporting all popular VPN protocols by the single VPN server:
SSL-VPN (HTTPS) SSL-VPN (HTTPS)
WireGuard
OpenVPN OpenVPN
IPsec IPsec
L2TP L2TP
@@ -139,17 +142,37 @@ https://github.com/chipitsine
releasing the build. releasing the build.
- More details at https://www.softether.org/. - More details at https://www.softether.org/.
# Comparison with Stable Edition
| Protocol | Stable Edition (SE) | Developer Edition (DE) | Comment |
| --- | --- | --- | --- |
| SSL-VPN | ✅ | ✅ | |
| OpenVPN | ✅ | ✅ | AEAD mode is supported in DE only. |
| IPsec | ✅ | ✅ | |
| L2TP | ✅ | ✅ | |
| MS-SSTP | ✅ | ✅ | |
| L2TPv3 | ✅ | ✅ | |
| EtherIP | ✅ | ✅ | |
| WireGuard | ❌ | ✅ | |
| IKEv2 | ❌ | ❌ | |
| Feature | Stable Edition (SE) | Developer Edition (DE) | Comment |
| --- | --- | --- | --- |
| Password Authentication | ✅ | ✅ | |
| RADIUS / NT Authentication | ✅ | ✅ | |
| Certificate Authentication | ⚠️ | ✅ | SE supports the feature in SSL-VPN only. |
| IPv6-capable VPN Tunnel | ⚠️ | ✅ | SE supports IPv6 in L2 VPN tunnels only. |
| IPv4 Route Management | ✅ | ✅ | Windows clients only |
| IPv6 Route Management | ❌ | ✅ | Windows clients only |
| TLS Server Verification | ⚠️ | ✅ | In SE you need to specify the exact certificate or CA to verify. DE can perform standard TLS verification and use the system CA store. |
| Dual-stack Name Resolution | ⚠️ | ✅ | SE attempts in IPv6 only after IPv4 has failed. |
| ECDSA Certificates Import | ❌ | ✅ | |
| Runs on Windows XP and Earlier | ✅ | ❌ | |
| Compatible with SoftEther VPN 1.0 | ✅ | ❌ | |
| AES-NI Hardware Acceleration | ⚠️ | ✅ | SE requires [intel_aes_lib](https://software.intel.com/sites/default/files/article/181731/intel-aesni-sample-library-v1.2.zip) to enable AES-NI, so x86 only. In DE, enabled by default as long as processor supports it (at least x86 and ARM). |
# Installation # Installation
## For Ubuntu
Launchpad PPA maintained by [Dmitry Verkhoturov](https://github.com/paskal):
[Daily builds](https://code.launchpad.net/~paskal-07/+archive/ubuntu/softethervpn) (latest released tag)
[Nightly builds](https://code.launchpad.net/~paskal-07/+archive/ubuntu/softethervpn-nightly)
## For FreeBSD ## For FreeBSD
SoftEther VPN in FreeBSD Ports Collection is maintained by SoftEther VPN in FreeBSD Ports Collection is maintained by
@@ -178,7 +201,12 @@ sysrc softether_server_enable=yes
Also SoftEther VPN [Stable Edition](https://www.freshports.org/security/softether-devel/) and Also SoftEther VPN [Stable Edition](https://www.freshports.org/security/softether-devel/) and
[RTM version](https://www.freshports.org/security/softether/) are available on FreeBSD. [RTM version](https://www.freshports.org/security/softether/) are available on FreeBSD.
## From binary installers: ## For Windows
[Nightly builds](https://dev.azure.com/SoftEther-VPN/SoftEther%20VPN/_build?definitionId=6)
(choose appropriate platform, then find binaries or installers as artifacts)
## From binary installers (stable channel)
Those can be found under https://www.softether-download.com/ Those can be found under https://www.softether-download.com/
There you can also find SoftEtherVPN source code in zip and tar formats. There you can also find SoftEtherVPN source code in zip and tar formats.
@@ -236,19 +264,19 @@ SoftEther VPN Project distributes the up-to-date source code
on all the following open-source repositories: on all the following open-source repositories:
- GitHub - GitHub
https://github.com/SoftEtherVPN/SoftEtherVPN/ https://github.com/SoftEtherVPN/SoftEtherVPN
$ git clone https://github.com/SoftEtherVPN/SoftEtherVPN.git $ git clone https://github.com/SoftEtherVPN/SoftEtherVPN.git
- GitLab (mirrored from GitHub) - GitLab (mirrored from GitHub)
https://gitlab.com/SoftEther/SoftEtherVPN/ https://gitlab.com/SoftEther/VPN
$ git clone https://gitlab.com/SoftEther/SoftEtherVPN.git $ git clone https://gitlab.com/SoftEther/VPN.git
- Codeberg (mirrored from GitHub) - OneDev (mirrored from GitHub)
https://codeberg.org/softether/vpn https://code.onedev.io/SoftEther/VPN
$ git clone https://codeberg.org/softether/vpn.git $ git clone https://code.onedev.io/SoftEther/VPN.git
We hope that you can reach one of the above URLs at least! We hope that you can reach one of the above URLs at least!
@@ -261,7 +289,7 @@ Please send patches to us through GitHub.
# DEAR SECURITY EXPERTS # DEAR SECURITY EXPERTS
If you find a bug or a security vulnerability please kindly inform us If you find a bug or a security vulnerability please [kindly inform](https://github.com/SoftEtherVPN/SoftEtherVPN/security/advisories/new) us
about the problem immediately so that we can fix the security problem about the problem immediately so that we can fix the security problem
to protect a lot of users around the world as soon as possible. to protect a lot of users around the world as soon as possible.
+15
View File
@@ -0,0 +1,15 @@
# Security Policy
## Supported Versions
Use this section to tell people about which versions of your project are
currently being supported with security updates.
| Version | Supported |
| ------- | ------------------ |
| 5.x | :white_check_mark: |
## Reporting a Vulnerability
Please use [github security reporting](https://github.com/SoftEtherVPN/SoftEtherVPN/security/advisories/new)
+1 -1
View File
@@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework> <TargetFramework>net7.0</TargetFramework>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
@@ -2210,7 +2210,7 @@ Name | Type | Description
`NoUdpAcceleration_bool` | `boolean` | Client Option Parameters: Do not use UDP acceleration mode if the value is true `NoUdpAcceleration_bool` | `boolean` | Client Option Parameters: Do not use UDP acceleration mode if the value is true
`AuthType_u32` | `number` (enum) | Authentication type<BR>Values:<BR>`0`: Anonymous authentication<BR>`1`: SHA-0 hashed password authentication<BR>`2`: Plain password authentication<BR>`3`: Certificate authentication `AuthType_u32` | `number` (enum) | Authentication type<BR>Values:<BR>`0`: Anonymous authentication<BR>`1`: SHA-0 hashed password authentication<BR>`2`: Plain password authentication<BR>`3`: Certificate authentication
`Username_str` | `string` (ASCII) | User name `Username_str` | `string` (ASCII) | User name
`HashedPassword_bin` | `string` (Base64 binary) | SHA-0 Hashed password. Valid only if ClientAuth_AuthType_u32 == SHA0_Hashed_Password (1). The SHA-0 hashed password must be caluclated by the SHA0(UpperCase(username_ascii_string) + password_ascii_string). `HashedPassword_bin` | `string` (Base64 binary) | SHA-0 Hashed password. Valid only if ClientAuth_AuthType_u32 == SHA0_Hashed_Password (1). The SHA-0 hashed password must be caluclated by the SHA0(password_ascii_string + UpperCase(username_ascii_string)).
`PlainPassword_str` | `string` (ASCII) | Plaintext Password. Valid only if ClientAuth_AuthType_u32 == PlainPassword (2). `PlainPassword_str` | `string` (ASCII) | Plaintext Password. Valid only if ClientAuth_AuthType_u32 == PlainPassword (2).
`ClientX_bin` | `string` (Base64 binary) | Client certificate. Valid only if ClientAuth_AuthType_u32 == Cert (3). `ClientX_bin` | `string` (Base64 binary) | Client certificate. Valid only if ClientAuth_AuthType_u32 == Cert (3).
`ClientK_bin` | `string` (Base64 binary) | Client private key of the certificate. Valid only if ClientAuth_AuthType_u32 == Cert (3). `ClientK_bin` | `string` (Base64 binary) | Client private key of the certificate. Valid only if ClientAuth_AuthType_u32 == Cert (3).
@@ -2352,7 +2352,7 @@ Name | Type | Description
`NoUdpAcceleration_bool` | `boolean` | Client Option Parameters: Do not use UDP acceleration mode if the value is true `NoUdpAcceleration_bool` | `boolean` | Client Option Parameters: Do not use UDP acceleration mode if the value is true
`AuthType_u32` | `number` (enum) | Authentication type<BR>Values:<BR>`0`: Anonymous authentication<BR>`1`: SHA-0 hashed password authentication<BR>`2`: Plain password authentication<BR>`3`: Certificate authentication `AuthType_u32` | `number` (enum) | Authentication type<BR>Values:<BR>`0`: Anonymous authentication<BR>`1`: SHA-0 hashed password authentication<BR>`2`: Plain password authentication<BR>`3`: Certificate authentication
`Username_str` | `string` (ASCII) | User name `Username_str` | `string` (ASCII) | User name
`HashedPassword_bin` | `string` (Base64 binary) | SHA-0 Hashed password. Valid only if ClientAuth_AuthType_u32 == SHA0_Hashed_Password (1). The SHA-0 hashed password must be caluclated by the SHA0(UpperCase(username_ascii_string) + password_ascii_string). `HashedPassword_bin` | `string` (Base64 binary) | SHA-0 Hashed password. Valid only if ClientAuth_AuthType_u32 == SHA0_Hashed_Password (1). The SHA-0 hashed password must be caluclated by the SHA0(password_ascii_string + UpperCase(username_ascii_string)).
`PlainPassword_str` | `string` (ASCII) | Plaintext Password. Valid only if ClientAuth_AuthType_u32 == PlainPassword (2). `PlainPassword_str` | `string` (ASCII) | Plaintext Password. Valid only if ClientAuth_AuthType_u32 == PlainPassword (2).
`ClientX_bin` | `string` (Base64 binary) | Client certificate. Valid only if ClientAuth_AuthType_u32 == Cert (3). `ClientX_bin` | `string` (Base64 binary) | Client certificate. Valid only if ClientAuth_AuthType_u32 == Cert (3).
`ClientK_bin` | `string` (Base64 binary) | Client private key of the certificate. Valid only if ClientAuth_AuthType_u32 == Cert (3). `ClientK_bin` | `string` (Base64 binary) | Client private key of the certificate. Valid only if ClientAuth_AuthType_u32 == Cert (3).
@@ -2537,7 +2537,7 @@ Name | Type | Description
`NoUdpAcceleration_bool` | `boolean` | Client Option Parameters: Do not use UDP acceleration mode if the value is true `NoUdpAcceleration_bool` | `boolean` | Client Option Parameters: Do not use UDP acceleration mode if the value is true
`AuthType_u32` | `number` (enum) | Authentication type<BR>Values:<BR>`0`: Anonymous authentication<BR>`1`: SHA-0 hashed password authentication<BR>`2`: Plain password authentication<BR>`3`: Certificate authentication `AuthType_u32` | `number` (enum) | Authentication type<BR>Values:<BR>`0`: Anonymous authentication<BR>`1`: SHA-0 hashed password authentication<BR>`2`: Plain password authentication<BR>`3`: Certificate authentication
`Username_str` | `string` (ASCII) | User name `Username_str` | `string` (ASCII) | User name
`HashedPassword_bin` | `string` (Base64 binary) | SHA-0 Hashed password. Valid only if ClientAuth_AuthType_u32 == SHA0_Hashed_Password (1). The SHA-0 hashed password must be caluclated by the SHA0(UpperCase(username_ascii_string) + password_ascii_string). `HashedPassword_bin` | `string` (Base64 binary) | SHA-0 Hashed password. Valid only if ClientAuth_AuthType_u32 == SHA0_Hashed_Password (1). The SHA-0 hashed password must be caluclated by the SHA0(password_ascii_string + UpperCase(username_ascii_string)).
`PlainPassword_str` | `string` (ASCII) | Plaintext Password. Valid only if ClientAuth_AuthType_u32 == PlainPassword (2). `PlainPassword_str` | `string` (ASCII) | Plaintext Password. Valid only if ClientAuth_AuthType_u32 == PlainPassword (2).
`ClientX_bin` | `string` (Base64 binary) | Client certificate. Valid only if ClientAuth_AuthType_u32 == Cert (3). `ClientX_bin` | `string` (Base64 binary) | Client certificate. Valid only if ClientAuth_AuthType_u32 == Cert (3).
`ClientK_bin` | `string` (Base64 binary) | Client private key of the certificate. Valid only if ClientAuth_AuthType_u32 == Cert (3). `ClientK_bin` | `string` (Base64 binary) | Client private key of the certificate. Valid only if ClientAuth_AuthType_u32 == Cert (3).
@@ -8,7 +8,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="2.10.0" /> <PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="2.10.0" />
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup> </ItemGroup>
</Project> </Project>
@@ -1,6 +1,6 @@
{ {
"name": "vpnrpc", "name": "vpnrpc",
"version": "1.0.0", "version": "1.0.1",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
@@ -54,12 +54,6 @@
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
"dev": true "dev": true
}, },
"big.js": {
"version": "5.2.2",
"resolved": "https://registry.npmjs.org/big.js/-/big.js-5.2.2.tgz",
"integrity": "sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==",
"dev": true
},
"brace-expansion": { "brace-expansion": {
"version": "1.1.11", "version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
@@ -123,42 +117,20 @@
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
"dev": true "dev": true
}, },
"core-util-is": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
"integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=",
"dev": true
},
"diff": { "diff": {
"version": "3.5.0", "version": "3.5.0",
"resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz",
"integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==",
"dev": true "dev": true
}, },
"emojis-list": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-2.1.0.tgz",
"integrity": "sha1-TapNnbAPmBmIDHn6RXrlsJof04k=",
"dev": true
},
"enhanced-resolve": { "enhanced-resolve": {
"version": "4.1.0", "version": "5.12.0",
"resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-4.1.0.tgz", "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.12.0.tgz",
"integrity": "sha512-F/7vkyTtyc/llOIn8oWclcB25KdRaiPBpZYDgJHgh/UHtpgT2p2eldQgtQnLtUvfMKPKxbRaQM/hHkvLHt1Vng==", "integrity": "sha512-QHTXI/sZQmko1cbDoNAa3mJ5qhWUUNAq3vR0/YiD379fWQrcfuoX1+HW2S0MTt7XmoPLapdaDKUtelUSPic7hQ==",
"dev": true, "dev": true,
"requires": { "requires": {
"graceful-fs": "^4.1.2", "graceful-fs": "^4.2.4",
"memory-fs": "^0.4.0", "tapable": "^2.2.0"
"tapable": "^1.0.0"
}
},
"errno": {
"version": "0.1.7",
"resolved": "https://registry.npmjs.org/errno/-/errno-0.1.7.tgz",
"integrity": "sha512-MfrRBDWzIWifgq6tJj60gkAwtLNb6sQPlcFrSOflcP1aFmmruKQ2wRnze/8V6kgyz7H3FF8Npzv78mZ7XLLflg==",
"dev": true,
"requires": {
"prr": "~1.0.1"
} }
}, },
"escape-string-regexp": { "escape-string-regexp": {
@@ -209,9 +181,9 @@
} }
}, },
"graceful-fs": { "graceful-fs": {
"version": "4.1.15", "version": "4.2.10",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.15.tgz", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz",
"integrity": "sha512-6uHUhOPEBgQ24HM+r6b/QwWfZq+yiFcipKFrOFiBEnWdy5sdzYoi+pJeQaPI5qOLRFqWmAXUPQNsielzdLoecA==", "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==",
"dev": true "dev": true
}, },
"has-flag": { "has-flag": {
@@ -242,12 +214,6 @@
"integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
"dev": true "dev": true
}, },
"isarray": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
"integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=",
"dev": true
},
"js-tokens": { "js-tokens": {
"version": "4.0.0", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
@@ -264,76 +230,47 @@
"esprima": "^4.0.0" "esprima": "^4.0.0"
} }
}, },
"json5": { "lru-cache": {
"version": "1.0.1", "version": "6.0.0",
"resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
"integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==", "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
"dev": true, "dev": true,
"requires": { "requires": {
"minimist": "^1.2.0" "yallist": "^4.0.0"
}
},
"loader-utils": {
"version": "1.2.3",
"resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-1.2.3.tgz",
"integrity": "sha512-fkpz8ejdnEMG3s37wGL07iSBDg99O9D5yflE9RGNH3hRdx9SOwYfnGYdZOUIZitN8E+E2vkq3MUMYMvPYl5ZZA==",
"dev": true,
"requires": {
"big.js": "^5.2.2",
"emojis-list": "^2.0.0",
"json5": "^1.0.1"
}
},
"memory-fs": {
"version": "0.4.1",
"resolved": "https://registry.npmjs.org/memory-fs/-/memory-fs-0.4.1.tgz",
"integrity": "sha1-OpoguEYlI+RHz7x+i7gO1me/xVI=",
"dev": true,
"requires": {
"errno": "^0.1.3",
"readable-stream": "^2.0.1"
} }
}, },
"micromatch": { "micromatch": {
"version": "4.0.2", "version": "4.0.5",
"resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz",
"integrity": "sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==", "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==",
"dev": true, "dev": true,
"requires": { "requires": {
"braces": "^3.0.1", "braces": "^3.0.2",
"picomatch": "^2.0.5" "picomatch": "^2.3.1"
} }
}, },
"minimatch": { "minimatch": {
"version": "3.0.4", "version": "3.1.2",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
"dev": true, "dev": true,
"requires": { "requires": {
"brace-expansion": "^1.1.7" "brace-expansion": "^1.1.7"
} }
}, },
"minimist": { "minimist": {
"version": "1.2.0", "version": "1.2.7",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.7.tgz",
"integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", "integrity": "sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==",
"dev": true "dev": true
}, },
"mkdirp": { "mkdirp": {
"version": "0.5.1", "version": "0.5.6",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz",
"integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==",
"dev": true, "dev": true,
"requires": { "requires": {
"minimist": "0.0.8" "minimist": "^1.2.6"
},
"dependencies": {
"minimist": {
"version": "0.0.8",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
"integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=",
"dev": true
}
} }
}, },
"once": { "once": {
@@ -352,44 +289,17 @@
"dev": true "dev": true
}, },
"path-parse": { "path-parse": {
"version": "1.0.6", "version": "1.0.7",
"resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz",
"integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==",
"dev": true "dev": true
}, },
"picomatch": { "picomatch": {
"version": "2.0.7", "version": "2.3.1",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.0.7.tgz", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz",
"integrity": "sha512-oLHIdio3tZ0qH76NybpeneBhYVj0QFTfXEFTc/B3zKQspYfYYkWYgFsmzo+4kvId/bQRcNkVeguI3y+CD22BtA==", "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==",
"dev": true "dev": true
}, },
"process-nextick-args": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz",
"integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==",
"dev": true
},
"prr": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz",
"integrity": "sha1-0/wRS6BplaRexok/SEzrHXj19HY=",
"dev": true
},
"readable-stream": {
"version": "2.3.6",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz",
"integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==",
"dev": true,
"requires": {
"core-util-is": "~1.0.0",
"inherits": "~2.0.3",
"isarray": "~1.0.0",
"process-nextick-args": "~2.0.0",
"safe-buffer": "~5.1.1",
"string_decoder": "~1.1.1",
"util-deprecate": "~1.0.1"
}
},
"resolve": { "resolve": {
"version": "1.11.0", "version": "1.11.0",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.11.0.tgz", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.11.0.tgz",
@@ -399,17 +309,14 @@
"path-parse": "^1.0.6" "path-parse": "^1.0.6"
} }
}, },
"safe-buffer": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
"dev": true
},
"semver": { "semver": {
"version": "6.1.0", "version": "7.3.8",
"resolved": "https://registry.npmjs.org/semver/-/semver-6.1.0.tgz", "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz",
"integrity": "sha512-kCqEOOHoBcFs/2Ccuk4Xarm/KiWRSLEX9CAZF8xkJ6ZPlIoTZ8V5f7J16vYLJqDbR7KrxTJpR2lqjIEm2Qx9cQ==", "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==",
"dev": true "dev": true,
"requires": {
"lru-cache": "^6.0.0"
}
}, },
"sprintf-js": { "sprintf-js": {
"version": "1.0.3", "version": "1.0.3",
@@ -417,15 +324,6 @@
"integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=",
"dev": true "dev": true
}, },
"string_decoder": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
"integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
"dev": true,
"requires": {
"safe-buffer": "~5.1.0"
}
},
"supports-color": { "supports-color": {
"version": "5.5.0", "version": "5.5.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
@@ -436,9 +334,9 @@
} }
}, },
"tapable": { "tapable": {
"version": "1.1.3", "version": "2.2.1",
"resolved": "https://registry.npmjs.org/tapable/-/tapable-1.1.3.tgz", "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.1.tgz",
"integrity": "sha512-4WK/bYZmj8xLr+HUCODHGF1ZFzsYffasLUgEiMBY4fgtltdO6B4WJtlSbPaDTLpYTcGVwM2qLnFTICEcNxs3kA==", "integrity": "sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==",
"dev": true "dev": true
}, },
"to-regex-range": { "to-regex-range": {
@@ -451,16 +349,66 @@
} }
}, },
"ts-loader": { "ts-loader": {
"version": "6.0.1", "version": "9.4.2",
"resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-6.0.1.tgz", "resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-9.4.2.tgz",
"integrity": "sha512-9H5ErTIw5t73sdSoFE0hX0RO45B7cdDA4pW1VIQ2wNFAhxSpZcAlv2fwMcfv6SAYLoI7uGwHuzC5dECzmzqtzA==", "integrity": "sha512-OmlC4WVmFv5I0PpaxYb+qGeGOdm5giHU7HwDDUjw59emP2UYMHy9fFSDcYgSNoH8sXcj4hGCSEhlDZ9ULeDraA==",
"dev": true, "dev": true,
"requires": { "requires": {
"chalk": "^2.3.0", "chalk": "^4.1.0",
"enhanced-resolve": "^4.0.0", "enhanced-resolve": "^5.0.0",
"loader-utils": "^1.0.2",
"micromatch": "^4.0.0", "micromatch": "^4.0.0",
"semver": "^6.0.0" "semver": "^7.3.4"
},
"dependencies": {
"ansi-styles": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
"dev": true,
"requires": {
"color-convert": "^2.0.1"
}
},
"chalk": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
"integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
"dev": true,
"requires": {
"ansi-styles": "^4.1.0",
"supports-color": "^7.1.0"
}
},
"color-convert": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
"dev": true,
"requires": {
"color-name": "~1.1.4"
}
},
"color-name": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
"dev": true
},
"has-flag": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
"dev": true
},
"supports-color": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
"dev": true,
"requires": {
"has-flag": "^4.0.0"
}
}
} }
}, },
"tslib": { "tslib": {
@@ -513,17 +461,17 @@
"integrity": "sha512-YycBxUb49UUhdNMU5aJ7z5Ej2XGmaIBL0x34vZ82fn3hGvD+bgrMrVDpatgz2f7YxUMJxMkbWxJZeAvDxVe7Vw==", "integrity": "sha512-YycBxUb49UUhdNMU5aJ7z5Ej2XGmaIBL0x34vZ82fn3hGvD+bgrMrVDpatgz2f7YxUMJxMkbWxJZeAvDxVe7Vw==",
"dev": true "dev": true
}, },
"util-deprecate": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
"integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=",
"dev": true
},
"wrappy": { "wrappy": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
"dev": true "dev": true
},
"yallist": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
"dev": true
} }
} }
} }
@@ -23,7 +23,7 @@
"homepage": "https://github.com/SoftEtherVPN/SoftEtherVPN/tree/master/developer_tools/vpnserver-jsonrpc-clients/#readme", "homepage": "https://github.com/SoftEtherVPN/SoftEtherVPN/tree/master/developer_tools/vpnserver-jsonrpc-clients/#readme",
"devDependencies": { "devDependencies": {
"@types/node": "^12.0.2", "@types/node": "^12.0.2",
"ts-loader": "^6.0.1", "ts-loader": "^9.4.2",
"tslint": "^5.16.0", "tslint": "^5.16.0",
"typescript": "^3.4.5" "typescript": "^3.4.5"
} }
@@ -29,7 +29,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Markdig" Version="0.15.4" /> <PackageReference Include="Markdig" Version="0.15.4" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="2.10.0" /> <PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="2.10.0" />
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup> </ItemGroup>
</Project> </Project>
+1 -1
View File
@@ -38,7 +38,7 @@ sudo yum -y install cmake ncurses-devel openssl-devel libsodium-devel readline-d
## Install requirements on Debian/Ubuntu ## Install requirements on Debian/Ubuntu
```bash ```bash
sudo apt -y install cmake gcc g++ make libncurses5-dev libssl-dev libsodium-dev libreadline-dev zlib1g-dev sudo apt -y install cmake gcc g++ make pkgconf libncurses5-dev libssl-dev libsodium-dev libreadline-dev zlib1g-dev
``` ```
## Install requirements on macOS ## Install requirements on macOS
+143 -19
View File
@@ -1,31 +1,155 @@
How to build SoftEther VPN for Windows How to build SoftEther VPN for Windows
====================================== ======================================
Full Build Instructions There are several methods for using CMake but the easiest by far is through Visual Studio by importing the CMake project directly
-----------------------
There are several methods for using CMake but the easiest by far is through Visual Studio 2019 by importing the CMake project directly
into it. So that is what will be described below. into it. So that is what will be described below.
Requirements: ## Requirements
1. Download Visual Studio 2019 (Community Edition is fine). - Visual Studio 2019 or 2022 (Community Edition is fine)
2. During install, make sure to check "Desktop development with C++" under "Workloads".
3. Click on individual components and scroll until you see "Visual C++ tools for CMake" under the compilers section. Make sure this is checked.
4. Proceed with and finish Visual Studio 2019 installation.
5. Install the needed submodules to build the project, avoiding CMake telling you to do so with: `git submodule update --init --recursive`
Building: https://visualstudio.microsoft.com/downloads
Once both installs have finished, launch Visual Studio. Once its started go to the File menu click `Open --> CMake`. Then navigate to where you - Git for Windows (or other git tool)
cloned the project and open the `CMakeLists.txt` file in the projects root directory.
Visual Studio will proceed to start the CMake configuration process and once its finished, you can simply go to toolbar and click `CMake -> Build All`. https://gitforwindows.org/
Once it has finished, hopefully with no errors, look in the newly created `/build` directory in the project's folder. Inside are the development versions - vcpkg
of all the SoftEtherVPN components.
Congrats, you now have a complete CMake development environment for SoftEtherVPN on Windows, enjoy and happy contributing! https://github.com/microsoft/vcpkg
Download Links: ## Installation
- Visual Studio 2019 from Microsoft: https://visualstudio.microsoft.com/downloads
- Visual Studio
Download from the official site and run the installer.
Make sure to check **Desktop development with C++** under *Workloads* and **Clang C++ Tools for Windows** in *Optional* components.
- Git
Nothing special. Just follow the installer.
- vcpkg
Let's say you will install it to `C:\vcpkg`.
Open your preferred terminal and go to `C:\`. Then run these commands.
```
C:\> git clone https://github.com/microsoft/vcpkg
C:\> cd vcpkg
C:\vcpkg> bootstrap-vcpkg.bat
C:\vcpkg> vcpkg integrate install
```
## Update
- vcpkg
You are recommended to update vcpkg from time to time, so that the latest libraries are used in the build.
Go to the installation path, pull the latest repo and the binary:
```
C:\vcpkg> git pull
C:\vcpkg> bootstrap-vcpkg.bat
```
## Building
1. Launch Visual Studio
Choose either **Clone a repository** to clone from GitHub or **Open a local folder** if you already have a copy.
1. Open Terminal (*View -> Terminal*). Install the needed submodules to build the project, avoiding CMake telling you to do so with:
`git submodule update --init --recursive`
**Note**: This step is not necessary if you have chosen **Clone a repository** as Visual Studio automatically takes care of it.
1. Switch to folder view in the solution explorer
1. Select a configuration from the dropdown menu below the search box. The default configurations are:
- x64-native
Build x64 executables with 64-bit compiler (most common)
- x64-on-x86
Cross compile x64 executables with 32-bit compiler
- x86-native
Build x86 executables with 32-bit compiler
- x86-on-x64
Cross compile x86 executables with 64-bit compiler
On 64-bit Windows, all four configurations can be used. 32-bit platforms can only use 32-bit compiler.
1. Visual Studio will try generating CMake cache. If not, click **Project -> Configure Cache** or **Generate Cache**.
If CMake is busy, you will find **Generate Cache** greyed out. Wait until it finishes or click **Cancel CMake Cache Generation** to stop it.
The initial configuration will take a longer time since it needs to download and install dependencies.
1. When *CMake generation finished* is displayed, simply go to toolbar and click **Build -> Build All**.
1. Once building has finished, hopefully with no errors, look in the newly created `/build` directory in the project's folder.
Run `vpnsetup.exe` to install desired components.
1. Congrats, you now have a complete CMake development environment for SoftEtherVPN on Windows, enjoy and happy contributing!
## Notes
1. Build number
You can change the build number in `CMakeSettings.json`. Use any integer no less than 5180.
Delete and regenerate CMake cache after the change.
1. OpenSSL
The above instruction builds OpenSSL library statically in the SoftEther binaries,
so that when you distribute the installer to others they will not need to install OpenSSL separately.
However, the downside is that the OpenSSL library cannot be updated without a rebuild and reinstallation of SoftEther.
It's also possible to build OpenSSL library dynamically so that you can update OpenSSL without rebuilding SoftEther.
To achieve that, you need to remove `openssl` from `vcpkg.json` and install OpenSSL directly.
Installing from a package manager such as [Scoop](https://scoop.sh/) would make the subsequent updates easily.
However, you should avoid using [Winget](https://learn.microsoft.com/en-us/windows/package-manager/winget/)
for the time being because due to a bug it cannot detect the correct version of OpenSSL, causing endless updates.
If you install from Scoop, make sure to add the OpenSSL folder to the system's `PATH`.
As Scoop already adds it to the user's `PATH`, just copy the same location into the system environment variable(s).
SoftEther Client Service starts from the System account and will fail to start if OpenSSL is not in the global `PATH`.
Building should be straightforward. You can verify that the binaries are now linked against the locally installed OpenSSL
with tools like `ldd` (available from Git Bash):
```bash
$ ldd /c/Program\ Files/SoftEther\ VPN\ Client\ Developer\ Edition/vpnclient.exe
...
libcrypto-3-x64.dll => /c/Scoop/apps/openssl/current/bin/libcrypto-3-x64.dll (0x7ff8beb70000)
libssl-3-x64.dll => /c/Scoop/apps/openssl/current/bin/libssl-3-x64.dll (0x7ff8beaa0000)
...
```
1. 32-bit Windows
You don't need 32-bit Windows to build 32-bit executables. However, if 32-bit Windows is what you only have, things become a little complicated.
Visual Studio 2019 is the last version that works on 32-bit Windows. It does the job but its bundled CMake and Ninja are 64-bit versions.
After the installation of VS 2019, you need to download 32-bit CMake and Ninja and replace those that come with VS in:
```
C:\Program Files\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\CMake
```
Currently CMake has an official x86 installer but Ninja does not. You may need to download from a 3rd party or build from source.
+15
View File
@@ -60,6 +60,21 @@ include_directories(.)
if(WIN32) if(WIN32)
add_definitions(-DWIN32 -D_WINDOWS -DOS_WIN32 -D_CRT_SECURE_NO_WARNINGS) add_definitions(-DWIN32 -D_WINDOWS -DOS_WIN32 -D_CRT_SECURE_NO_WARNINGS)
#
# https://msrc-blog.microsoft.com/2020/08/17/control-flow-guard-for-clang-llvm-and-rust/
#
message("Setting CONTROL FLOW GUARD")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /guard:cf")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /guard:cf /DYNAMICBASE")
message("Setting QSPECTRE")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Qspectre")
message("Setting CETCOMPAT")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /CETCOMPAT")
endif() endif()
if(UNIX) if(UNIX)
+69 -40
View File
@@ -21,47 +21,47 @@
// Policy items // Policy items
POLICY_ITEM policy_item[] = POLICY_ITEM policy_item[] =
{ {
// ID, Value, Omittable, Min, Max, Default, Unit name // ID, Value, Omittable, Min, Max, Default, Unit name, Offset
// Ver 2.0 // Ver 2.0
{0, false, false, 0, 0, 0, NULL}, // Access {0, false, false, 0, 0, 0, NULL, offsetof(POLICY, Access)}, // Access
{1, false, false, 0, 0, 0, NULL}, // DHCPFilter {1, false, false, 0, 0, 0, NULL, offsetof(POLICY, DHCPFilter)}, // DHCPFilter
{2, false, false, 0, 0, 0, NULL}, // DHCPNoServer {2, false, false, 0, 0, 0, NULL, offsetof(POLICY, DHCPNoServer)}, // DHCPNoServer
{3, false, false, 0, 0, 0, NULL}, // DHCPForce {3, false, false, 0, 0, 0, NULL, offsetof(POLICY, DHCPForce)}, // DHCPForce
{4, false, false, 0, 0, 0, NULL}, // NoBridge {4, false, false, 0, 0, 0, NULL, offsetof(POLICY, NoBridge)}, // NoBridge
{5, false, false, 0, 0, 0, NULL}, // NoRouting {5, false, false, 0, 0, 0, NULL, offsetof(POLICY, NoRouting)}, // NoRouting
{6, false, false, 0, 0, 0, NULL}, // CheckMac {6, false, false, 0, 0, 0, NULL, offsetof(POLICY, CheckMac)}, // CheckMac
{7, false, false, 0, 0, 0, NULL}, // CheckIP {7, false, false, 0, 0, 0, NULL, offsetof(POLICY, CheckIP)}, // CheckIP
{8, false, false, 0, 0, 0, NULL}, // ArpDhcpOnly {8, false, false, 0, 0, 0, NULL, offsetof(POLICY, ArpDhcpOnly)}, // ArpDhcpOnly
{9, false, false, 0, 0, 0, NULL}, // PrivacyFilter {9, false, false, 0, 0, 0, NULL, offsetof(POLICY, PrivacyFilter)}, // PrivacyFilter
{10, false, false, 0, 0, 0, NULL}, // NoServer {10, false, false, 0, 0, 0, NULL, offsetof(POLICY, NoServer)}, // NoServer
{11, false, false, 0, 0, 0, NULL}, // NoBroadcastLimiter {11, false, false, 0, 0, 0, NULL, offsetof(POLICY, NoBroadcastLimiter)}, // NoBroadcastLimiter
{12, false, false, 0, 0, 0, NULL}, // MonitorPort {12, false, false, 0, 0, 0, NULL, offsetof(POLICY, MonitorPort)}, // MonitorPort
{13, true, false, 1, 32, 32, "POL_INT_COUNT"}, // MaxConnection {13, true, false, 1, 32, 32, "POL_INT_COUNT", offsetof(POLICY, MaxConnection)}, // MaxConnection
{14, true, false, 5, 60, 20, "POL_INT_SEC"}, // TimeOut {14, true, false, 5, 60, 20, "POL_INT_SEC", offsetof(POLICY, TimeOut)}, // TimeOut
{15, true, true, 1, 65535, 0, "POL_INT_COUNT"}, // MaxMac {15, true, true, 1, 65535, 0, "POL_INT_COUNT", offsetof(POLICY, MaxMac)}, // MaxMac
{16, true, true, 1, 65535, 0, "POL_INT_COUNT"}, // MaxIP {16, true, true, 1, 65535, 0, "POL_INT_COUNT", offsetof(POLICY, MaxIP)}, // MaxIP
{17, true, true, 1, 4294967295UL, 0, "POL_INT_BPS"}, // MaxUpload {17, true, true, 1, 4294967295UL, 0, "POL_INT_BPS", offsetof(POLICY, MaxUpload)}, // MaxUpload
{18, true, true, 1, 4294967295UL, 0, "POL_INT_BPS"}, // MaxDownload {18, true, true, 1, 4294967295UL, 0, "POL_INT_BPS", offsetof(POLICY, MaxDownload)}, // MaxDownload
{19, false, false, 0, 0, 0, NULL}, // FixPassword {19, false, false, 0, 0, 0, NULL, offsetof(POLICY, FixPassword)}, // FixPassword
{20, true, true, 1, 65535, 0, "POL_INT_COUNT"}, // MultiLogins {20, true, true, 1, 65535, 0, "POL_INT_COUNT", offsetof(POLICY, MultiLogins)}, // MultiLogins
{21, false, false, 0, 0, 0, NULL}, // NoQoS {21, false, false, 0, 0, 0, NULL, offsetof(POLICY, NoQoS)}, // NoQoS
// Ver 3.0 // Ver 3.0
{22, false, false, 0, 0, 0, NULL}, // RSandRAFilter {22, false, false, 0, 0, 0, NULL, offsetof(POLICY, RSandRAFilter)}, // RSandRAFilter
{23, false, false, 0, 0, 0, NULL}, // RAFilter {23, false, false, 0, 0, 0, NULL, offsetof(POLICY, RAFilter)}, // RAFilter
{24, false, false, 0, 0, 0, NULL}, // DHCPv6Filter {24, false, false, 0, 0, 0, NULL, offsetof(POLICY, DHCPv6Filter)}, // DHCPv6Filter
{25, false, false, 0, 0, 0, NULL}, // DHCPv6NoServer {25, false, false, 0, 0, 0, NULL, offsetof(POLICY, DHCPv6NoServer)}, // DHCPv6NoServer
{26, false, false, 0, 0, 0, NULL}, // NoRoutingV6 {26, false, false, 0, 0, 0, NULL, offsetof(POLICY, NoRoutingV6)}, // NoRoutingV6
{27, false, false, 0, 0, 0, NULL}, // CheckIPv6 {27, false, false, 0, 0, 0, NULL, offsetof(POLICY, CheckIPv6)}, // CheckIPv6
{28, false, false, 0, 0, 0, NULL}, // NoServerV6 {28, false, false, 0, 0, 0, NULL, offsetof(POLICY, NoServerV6)}, // NoServerV6
{29, true, true, 1, 65535, 0, "POL_INT_COUNT"}, // MaxIPv6 {29, true, true, 1, 65535, 0, "POL_INT_COUNT", offsetof(POLICY, MaxIPv6)}, // MaxIPv6
{30, false, false, 0, 0, 0, NULL}, // NoSavePassword {30, false, false, 0, 0, 0, NULL, offsetof(POLICY, NoSavePassword)}, // NoSavePassword
{31, true, true, 1, 4294967295UL, 0, "POL_INT_SEC"}, // AutoDisconnect {31, true, true, 1, 4294967295UL, 0, "POL_INT_SEC", offsetof(POLICY, AutoDisconnect)}, // AutoDisconnect
{32, false, false, 0, 0, 0, NULL}, // FilterIPv4 {32, false, false, 0, 0, 0, NULL, offsetof(POLICY, FilterIPv4)}, // FilterIPv4
{33, false, false, 0, 0, 0, NULL}, // FilterIPv6 {33, false, false, 0, 0, 0, NULL, offsetof(POLICY, FilterIPv6)}, // FilterIPv6
{34, false, false, 0, 0, 0, NULL}, // FilterNonIP {34, false, false, 0, 0, 0, NULL, offsetof(POLICY, FilterNonIP)}, // FilterNonIP
{35, false, false, 0, 0, 0, NULL}, // NoIPv6DefaultRouterInRA {35, false, false, 0, 0, 0, NULL, offsetof(POLICY, NoIPv6DefaultRouterInRA)}, // NoIPv6DefaultRouterInRA
{36, false, false, 0, 0, 0, NULL}, // NoIPv6DefaultRouterInRAWhenIPv6 {36, false, false, 0, 0, 0, NULL, offsetof(POLICY, NoIPv6DefaultRouterInRAWhenIPv6)}, // NoIPv6DefaultRouterInRAWhenIPv6
{37, true, true, 1, 4095, 0, "POL_INT_VLAN"}, // VLanId {37, true, true, 1, 4095, 0, "POL_INT_VLAN", offsetof(POLICY, VLanId)}, // VLanId
}; };
// Format policy value // Format policy value
@@ -390,7 +390,7 @@ void OverwritePolicy(POLICY **target, POLICY *p)
} }
else else
{ {
Copy(*target, p, NUM_POLICY_ITEM_FOR_VER2 * sizeof(UINT)); Copy(*target, p, policy_item[NUM_POLICY_ITEM_FOR_VER2].Offset);
} }
} }
} }
@@ -897,6 +897,35 @@ USER *AcGetUser(HUB *h, char *name)
return u; return u;
} }
USER* AcGetUserByCert(HUB *h, X *cert)
{
int i;
if (cert == NULL)
{
return NULL;
}
for (i = 0; i < LIST_NUM(h->HubDb->UserList); i++)
{
USER* u = LIST_DATA(h->HubDb->UserList, i);
if (u->AuthType == AUTHTYPE_USERCERT)
{
X* ucert = ((AUTHUSERCERT*)u->AuthData)->UserX;
if (ucert != NULL)
{
if (CompareX(cert, ucert))
{
AddRef(u->ref);
return u;
}
}
}
}
return NULL;
}
// Delete the user // Delete the user
bool AcDeleteUser(HUB *h, char *name) bool AcDeleteUser(HUB *h, char *name)
{ {
+5 -3
View File
@@ -25,6 +25,7 @@ struct POLICY_ITEM
UINT MaxValue; UINT MaxValue;
UINT DefaultValue; UINT DefaultValue;
char *FormatStr; char *FormatStr;
UINT Offset;
}; };
// Policy // Policy
@@ -144,17 +145,17 @@ struct AUTHNT
// Macro // Macro
#define POLICY_CURRENT_VERSION 3 #define POLICY_CURRENT_VERSION 3
#define NUM_POLICY_ITEM ((sizeof(POLICY) / sizeof(UINT)) - 1)
#define NUM_POLICY_ITEM_FOR_VER2 22 #define NUM_POLICY_ITEM_FOR_VER2 22
#define NUM_POLICY_ITEM_FOR_VER3 38 #define NUM_POLICY_ITEM_FOR_VER3 38
#define NUM_POLICY_ITEM NUM_POLICY_ITEM_FOR_VER3
#define IS_POLICY_FOR_VER2(index) (((index) >= 0) && ((index) < NUM_POLICY_ITEM_FOR_VER2)) #define IS_POLICY_FOR_VER2(index) (((index) >= 0) && ((index) < NUM_POLICY_ITEM_FOR_VER2))
#define IS_POLICY_FOR_VER3(index) (((index) >= 0) && ((index) < NUM_POLICY_ITEM_FOR_VER3)) #define IS_POLICY_FOR_VER3(index) (((index) >= 0) && ((index) < NUM_POLICY_ITEM_FOR_VER3))
#define IS_POLICY_FOR_CURRENT_VER(index, ver) ((ver) >= 3 ? IS_POLICY_FOR_VER3(index) : IS_POLICY_FOR_VER2(index)) #define IS_POLICY_FOR_CURRENT_VER(index, ver) ((ver) >= 3 ? IS_POLICY_FOR_VER3(index) : IS_POLICY_FOR_VER2(index))
#define POLICY_BOOL(p, i) (((bool *)(p))[(i)]) #define POLICY_BOOL(p, i) (*(bool *)((char *)p + policy_item[i].Offset))
#define POLICY_INT(p, i) (((UINT *)(p))[(i)]) #define POLICY_INT(p, i) (*(UINT *)((char *)p + policy_item[i].Offset))
extern POLICY_ITEM policy_item[]; extern POLICY_ITEM policy_item[];
@@ -176,6 +177,7 @@ void FreeAuthData(UINT authtype, void *authdata);
bool AcAddUser(HUB *h, USER *u); bool AcAddUser(HUB *h, USER *u);
bool AcAddGroup(HUB *h, USERGROUP *g); bool AcAddGroup(HUB *h, USERGROUP *g);
USER *AcGetUser(HUB *h, char *name); USER *AcGetUser(HUB *h, char *name);
USER* AcGetUserByCert(HUB* h, X *cert);
USERGROUP *AcGetGroup(HUB *h, char *name); USERGROUP *AcGetGroup(HUB *h, char *name);
bool AcIsUser(HUB *h, char *name); bool AcIsUser(HUB *h, char *name);
bool AcIsGroup(HUB *h, char *name); bool AcIsGroup(HUB *h, char *name);
+46 -126
View File
@@ -260,26 +260,6 @@ CAPSLIST *ScGetCapsEx(RPC *rpc)
AddCapsBool(t, "b_support_config_log", info.ServerType != SERVER_TYPE_FARM_MEMBER); AddCapsBool(t, "b_support_config_log", info.ServerType != SERVER_TYPE_FARM_MEMBER);
AddCapsBool(t, "b_support_autodelete", false); AddCapsBool(t, "b_support_autodelete", false);
} }
else
{
// Success getting Caps
if (info.ServerBuildInt <= 4350)
{
if (is_bridge == false)
{
// b_support_cluster should be true for build 4300 or earlier
CAPS *caps = GetCaps(t, "b_support_cluster");
if (caps == NULL)
{
AddCapsBool(t, "b_support_cluster", true);
}
else
{
caps->Value = 1;
}
}
}
}
if (true) if (true)
{ {
@@ -746,9 +726,8 @@ void AdminWebProcPost(CONNECTION *c, SOCK *s, HTTP_HEADER *h, UINT post_data_siz
if (RecvAll(s, data, post_data_size, s->SecureMode)) if (RecvAll(s, data, post_data_size, s->SecureMode))
{ {
c->JsonRpcAuthed = true; c->JsonRpcAuthed = true;
#ifndef GC_SOFTETHER_OSS
RemoveDosEntry(c->Listener, s); RemoveDosEntry(c->Listener, s);
#endif // GC_SOFTETHER_OSS
// Divide url_target into URL and query string // Divide url_target into URL and query string
StrCpy(url, sizeof(url), url_target); StrCpy(url, sizeof(url), url_target);
@@ -787,9 +766,8 @@ void AdminWebProcGet(CONNECTION *c, SOCK *s, HTTP_HEADER *h, char *url_target)
} }
c->JsonRpcAuthed = true; c->JsonRpcAuthed = true;
#ifndef GC_SOFTETHER_OSS
RemoveDosEntry(c->Listener, s); RemoveDosEntry(c->Listener, s);
#endif // GC_SOFTETHER_OSS
// Divide url_target into URL and query string // Divide url_target into URL and query string
StrCpy(url, sizeof(url), url_target); StrCpy(url, sizeof(url), url_target);
@@ -959,30 +937,26 @@ bool HttpParseBasicAuthHeader(HTTP_HEADER *h, char *username, UINT username_size
{ {
if (StrCmpi(key, "Basic") == 0 && IsEmptyStr(value) == false) if (StrCmpi(key, "Basic") == 0 && IsEmptyStr(value) == false)
{ {
UINT b64_dest_size = StrSize(value) * 2 + 256; char *str = Base64ToBin(NULL, value, StrLen(value));
char *b64_dest = ZeroMalloc(b64_dest_size); if (str != NULL)
Decode64(b64_dest, value);
if (IsEmptyStr(b64_dest) == false)
{ {
if (b64_dest[0] == ':') if (str[0] == ':')
{ {
// Empty username // Empty username
StrCpy(username, username_size, ""); StrCpy(username, username_size, "");
StrCpy(password, password_size, b64_dest + 1); StrCpy(password, password_size, str + 1);
ret = true; ret = true;
} }
else else
{ {
if (GetKeyAndValue(b64_dest, username, username_size, password, password_size, ":")) if (GetKeyAndValue(str, username, username_size, password, password_size, ":"))
{ {
ret = true; ret = true;
} }
} }
}
Free(b64_dest); Free(str);
}
} }
} }
} }
@@ -1223,9 +1197,7 @@ void JsonRpcProcOptions(CONNECTION *c, SOCK *s, HTTP_HEADER *h, char *url_target
c->JsonRpcAuthed = true; c->JsonRpcAuthed = true;
#ifndef GC_SOFTETHER_OSS
RemoveDosEntry(c->Listener, s); RemoveDosEntry(c->Listener, s);
#endif // GC_SOFTETHER_OSS
AdminWebSendBody(s, 200, "OK", NULL, 0, NULL, NULL, NULL, h); AdminWebSendBody(s, 200, "OK", NULL, 0, NULL, NULL, NULL, h);
} }
@@ -1252,9 +1224,7 @@ void JsonRpcProcGet(CONNECTION *c, SOCK *s, HTTP_HEADER *h, char *url_target)
c->JsonRpcAuthed = true; c->JsonRpcAuthed = true;
#ifndef GC_SOFTETHER_OSS
RemoveDosEntry(c->Listener, s); RemoveDosEntry(c->Listener, s);
#endif // GC_SOFTETHER_OSS
// Divide url_target into URL and query string // Divide url_target into URL and query string
StrCpy(url, sizeof(url), url_target); StrCpy(url, sizeof(url), url_target);
@@ -1381,9 +1351,7 @@ void JsonRpcProcPost(CONNECTION *c, SOCK *s, HTTP_HEADER *h, UINT post_data_size
c->JsonRpcAuthed = true; c->JsonRpcAuthed = true;
#ifndef GC_SOFTETHER_OSS
RemoveDosEntry(c->Listener, s); RemoveDosEntry(c->Listener, s);
#endif // GC_SOFTETHER_OSS
if (json_req == NULL || json_req_object == NULL) if (json_req == NULL || json_req_object == NULL)
{ {
@@ -6550,8 +6518,6 @@ UINT StSetAccessList(ADMIN *a, RPC_ENUM_ACCESS_LIST *t)
UINT i; UINT i;
bool no_jitter = false; bool no_jitter = false;
bool no_include = false; bool no_include = false;
UINT ret = ERR_NO_ERROR;
NO_SUPPORT_FOR_BRIDGE; NO_SUPPORT_FOR_BRIDGE;
if (s->ServerType == SERVER_TYPE_FARM_MEMBER) if (s->ServerType == SERVER_TYPE_FARM_MEMBER)
@@ -6595,59 +6561,19 @@ UINT StSetAccessList(ADMIN *a, RPC_ENUM_ACCESS_LIST *t)
LockList(h->AccessList); LockList(h->AccessList);
{ {
UINT i; // Delete whole access list
for (i = 0; i < LIST_NUM(h->AccessList); ++i)
if (a->ClientBuild != 0)
{ {
// Confirm whether the access list of form which cannot handle by the old client already exists ACCESS *access = LIST_DATA(h->AccessList, i);
if (a->ClientBuild < 6560) Free(access);
{
for (i = 0;i < LIST_NUM(h->AccessList);i++)
{
ACCESS *access = LIST_DATA(h->AccessList, i);
if (access->IsIPv6 ||
access->Jitter != 0 || access->Loss != 0 || access->Delay != 0)
{
ret = ERR_VERSION_INVALID;
break;
}
}
}
if (a->ClientBuild < 8234)
{
for (i = 0;i < LIST_NUM(h->AccessList);i++)
{
ACCESS *access = LIST_DATA(h->AccessList, i);
if (IsEmptyStr(access->RedirectUrl) == false)
{
ret = ERR_VERSION_INVALID;
break;
}
}
}
} }
if (ret == ERR_NO_ERROR) DeleteAll(h->AccessList);
{
// Delete whole access list
for (i = 0;i < LIST_NUM(h->AccessList);i++)
{
ACCESS *access = LIST_DATA(h->AccessList, i);
Free(access);
}
DeleteAll(h->AccessList);
}
}
if (ret == ERR_NO_ERROR)
{
ALog(a, h, "LA_SET_ACCESS_LIST", t->NumAccess); ALog(a, h, "LA_SET_ACCESS_LIST", t->NumAccess);
// Add whole access list // Add whole access list
for (i = 0;i < t->NumAccess;i++) for (i = 0; i < t->NumAccess; ++i)
{ {
ACCESS *a = &t->Accesses[i]; ACCESS *a = &t->Accesses[i];
@@ -6686,14 +6612,10 @@ UINT StSetAccessList(ADMIN *a, RPC_ENUM_ACCESS_LIST *t)
h->CurrentVersion++; h->CurrentVersion++;
SiHubUpdateProc(h); SiHubUpdateProc(h);
} }
else
{
UnlockList(h->AccessList);
}
ReleaseHub(h); ReleaseHub(h);
return ret; return ERR_NO_ERROR;
} }
// Add access list entry // Add access list entry
@@ -7420,6 +7342,7 @@ UINT StGetLink(ADMIN *a, RPC_CREATE_LINK *t)
Copy(&t->Policy, k->Policy, sizeof(POLICY)); Copy(&t->Policy, k->Policy, sizeof(POLICY));
t->CheckServerCert = k->CheckServerCert; t->CheckServerCert = k->CheckServerCert;
t->AddDefaultCA = k->AddDefaultCA;
t->ServerCert = CloneX(k->ServerCert); t->ServerCert = CloneX(k->ServerCert);
} }
Unlock(k->lock); Unlock(k->lock);
@@ -7524,7 +7447,7 @@ UINT StSetLink(ADMIN *a, RPC_CREATE_LINK *t)
if (t->Policy.Ver3 == false) if (t->Policy.Ver3 == false)
{ {
Copy(k->Policy, &t->Policy, sizeof(UINT) * NUM_POLICY_ITEM_FOR_VER2); Copy(k->Policy, &t->Policy, policy_item[NUM_POLICY_ITEM_FOR_VER2].Offset);
} }
else else
{ {
@@ -7535,6 +7458,7 @@ UINT StSetLink(ADMIN *a, RPC_CREATE_LINK *t)
k->Option->RequireMonitorMode = false; // Disable monitor mode k->Option->RequireMonitorMode = false; // Disable monitor mode
k->CheckServerCert = t->CheckServerCert; k->CheckServerCert = t->CheckServerCert;
k->AddDefaultCA = t->AddDefaultCA;
k->ServerCert = CloneX(t->ServerCert); k->ServerCert = CloneX(t->ServerCert);
} }
Unlock(k->lock); Unlock(k->lock);
@@ -7631,6 +7555,7 @@ UINT StCreateLink(ADMIN *a, RPC_CREATE_LINK *t)
// setting of verifying server certification // setting of verifying server certification
// //
k->CheckServerCert = t->CheckServerCert; k->CheckServerCert = t->CheckServerCert;
k->AddDefaultCA = t->AddDefaultCA;
k->ServerCert = CloneX(t->ServerCert); k->ServerCert = CloneX(t->ServerCert);
// stay this off-line // stay this off-line
@@ -7847,11 +7772,6 @@ UINT StAddCa(ADMIN *a, RPC_HUB_ADD_CA *t)
return ERR_INVALID_PARAMETER; return ERR_INVALID_PARAMETER;
} }
if (t->Cert->is_compatible_bit == false)
{
return ERR_NOT_RSA_1024;
}
CHECK_RIGHT; CHECK_RIGHT;
LockHubList(c); LockHubList(c);
@@ -9516,11 +9436,6 @@ UINT StSetServerCert(ADMIN *a, RPC_KEY_PAIR *t)
return ERR_PROTOCOL_ERROR; return ERR_PROTOCOL_ERROR;
} }
if (t->Cert->is_compatible_bit == false)
{
return ERR_NOT_RSA_1024;
}
if (CheckXandK(t->Cert, t->Key) == false) if (CheckXandK(t->Cert, t->Key) == false)
{ {
return ERR_PROTOCOL_ERROR; return ERR_PROTOCOL_ERROR;
@@ -9535,7 +9450,7 @@ UINT StSetServerCert(ADMIN *a, RPC_KEY_PAIR *t)
} }
} }
SetCedarCert(c, t->Cert, t->Key); SetCedarCertAndChain(c, t->Cert, t->Key, t->Chain);
ALog(a, NULL, "LA_SET_SERVER_CERT"); ALog(a, NULL, "LA_SET_SERVER_CERT");
@@ -10143,8 +10058,7 @@ UINT StSetPortsUDP(ADMIN *a, RPC_PORTS *t)
LockList(server_ports); LockList(server_ports);
{ {
char tmp[MAX_SIZE]; char str[MAX_SIZE];
wchar_t str[MAX_SIZE];
for (i = 0; i < LIST_NUM(server_ports); ++i) for (i = 0; i < LIST_NUM(server_ports); ++i)
{ {
@@ -10160,8 +10074,7 @@ UINT StSetPortsUDP(ADMIN *a, RPC_PORTS *t)
ProtoSetUdpPorts(a->Server->Proto, server_ports); ProtoSetUdpPorts(a->Server->Proto, server_ports);
IntListToStr(tmp, sizeof(tmp), server_ports, ", "); IntListToStr(str, sizeof(str), server_ports, ", ");
StrToUni(str, sizeof(str), tmp);
ALog(a, NULL, "LA_SET_PORTS_UDP", str); ALog(a, NULL, "LA_SET_PORTS_UDP", str);
} }
UnlockList(server_ports); UnlockList(server_ports);
@@ -13717,6 +13630,7 @@ void InRpcCreateLink(RPC_CREATE_LINK *t, PACK *p)
InRpcPolicy(&t->Policy, p); InRpcPolicy(&t->Policy, p);
t->CheckServerCert = PackGetBool(p, "CheckServerCert"); t->CheckServerCert = PackGetBool(p, "CheckServerCert");
t->AddDefaultCA = PackGetBool(p, "AddDefaultCA");
b = PackGetBuf(p, "ServerCert"); b = PackGetBuf(p, "ServerCert");
if (b != NULL) if (b != NULL)
{ {
@@ -13739,6 +13653,7 @@ void OutRpcCreateLink(PACK *p, RPC_CREATE_LINK *t)
OutRpcPolicy(p, &t->Policy); OutRpcPolicy(p, &t->Policy);
PackAddBool(p, "CheckServerCert", t->CheckServerCert); PackAddBool(p, "CheckServerCert", t->CheckServerCert);
PackAddBool(p, "AddDefaultCA", t->AddDefaultCA);
if (t->ServerCert != NULL) if (t->ServerCert != NULL)
{ {
BUF *b; BUF *b;
@@ -13784,12 +13699,14 @@ void InRpcEnumLink(RPC_ENUM_LINK *t, PACK *p)
PackGetUniStrEx(p, "AccountName", e->AccountName, sizeof(e->AccountName), i); PackGetUniStrEx(p, "AccountName", e->AccountName, sizeof(e->AccountName), i);
PackGetStrEx(p, "Hostname", e->Hostname, sizeof(e->Hostname), i); PackGetStrEx(p, "Hostname", e->Hostname, sizeof(e->Hostname), i);
PackGetStrEx(p, "ConnectedHubName", e->HubName, sizeof(e->HubName), i); if (PackGetStrEx(p, "ConnectedHubName", e->HubName, sizeof(e->HubName), i) == false)
{
PackGetStrEx(p, "TargetHubName", e->HubName, sizeof(e->HubName), i);
}
e->Online = PackGetBoolEx(p, "Online", i); e->Online = PackGetBoolEx(p, "Online", i);
e->ConnectedTime = PackGetInt64Ex(p, "ConnectedTime", i); e->ConnectedTime = PackGetInt64Ex(p, "ConnectedTime", i);
e->Connected = PackGetBoolEx(p, "Connected", i); e->Connected = PackGetBoolEx(p, "Connected", i);
e->LastError = PackGetIntEx(p, "LastError", i); e->LastError = PackGetIntEx(p, "LastError", i);
PackGetStrEx(p, "LinkHubName", e->HubName, sizeof(e->HubName), i);
} }
} }
void OutRpcEnumLink(PACK *p, RPC_ENUM_LINK *t) void OutRpcEnumLink(PACK *p, RPC_ENUM_LINK *t)
@@ -14637,6 +14554,7 @@ void InRpcKeyPair(RPC_KEY_PAIR *t, PACK *p)
} }
t->Cert = PackGetX(p, "Cert"); t->Cert = PackGetX(p, "Cert");
t->Chain = PackGetXList(p, "Chain");
t->Key = PackGetK(p, "Key"); t->Key = PackGetK(p, "Key");
t->Flag1 = PackGetInt(p, "Flag1"); t->Flag1 = PackGetInt(p, "Flag1");
} }
@@ -14649,12 +14567,14 @@ void OutRpcKeyPair(PACK *p, RPC_KEY_PAIR *t)
} }
PackAddX(p, "Cert", t->Cert); PackAddX(p, "Cert", t->Cert);
PackAddXList(p, "Chain", t->Chain);
PackAddK(p, "Key", t->Key); PackAddK(p, "Key", t->Key);
PackAddInt(p, "Flag1", t->Flag1); PackAddInt(p, "Flag1", t->Flag1);
} }
void FreeRpcKeyPair(RPC_KEY_PAIR *t) void FreeRpcKeyPair(RPC_KEY_PAIR *t)
{ {
FreeX(t->Cert); FreeX(t->Cert);
FreeXList(t->Chain);
FreeK(t->Key); FreeK(t->Key);
} }
@@ -14737,19 +14657,19 @@ void InRpcNodeInfo(NODE_INFO *t, PACK *p)
PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName));
PackGetData2(p, "UniqueId", t->UniqueId, sizeof(t->UniqueId)); PackGetData2(p, "UniqueId", t->UniqueId, sizeof(t->UniqueId));
t->ClientProductVer = PackGetInt(p, "ClientProductVer"); t->ClientProductVer = LittleEndian32(PackGetInt(p, "ClientProductVer"));
t->ClientProductBuild = PackGetInt(p, "ClientProductBuild"); t->ClientProductBuild = LittleEndian32(PackGetInt(p, "ClientProductBuild"));
t->ServerProductVer = PackGetInt(p, "ServerProductVer"); t->ServerProductVer = LittleEndian32(PackGetInt(p, "ServerProductVer"));
t->ServerProductBuild = PackGetInt(p, "ServerProductBuild"); t->ServerProductBuild = LittleEndian32(PackGetInt(p, "ServerProductBuild"));
t->ClientIpAddress = PackGetIp32(p, "ClientIpAddress"); t->ClientIpAddress = PackGetIp32(p, "ClientIpAddress");
PackGetData2(p, "ClientIpAddress6", t->ClientIpAddress6, sizeof(t->ClientIpAddress6)); PackGetData2(p, "ClientIpAddress6", t->ClientIpAddress6, sizeof(t->ClientIpAddress6));
t->ClientPort = PackGetInt(p, "ClientPort"); t->ClientPort = LittleEndian32(PackGetInt(p, "ClientPort"));
t->ServerIpAddress = PackGetIp32(p, "ServerIpAddress"); t->ServerIpAddress = PackGetIp32(p, "ServerIpAddress");
PackGetData2(p, "ServerIpAddress6", t->ServerIpAddress6, sizeof(t->ServerIpAddress6)); PackGetData2(p, "ServerIpAddress6", t->ServerIpAddress6, sizeof(t->ServerIpAddress6));
t->ServerPort = PackGetInt(p, "ServerPort2"); t->ServerPort = LittleEndian32(PackGetInt(p, "ServerPort2"));
t->ProxyIpAddress = PackGetIp32(p, "ProxyIpAddress"); t->ProxyIpAddress = PackGetIp32(p, "ProxyIpAddress");
PackGetData2(p, "ProxyIpAddress6", t->ProxyIpAddress6, sizeof(t->ProxyIpAddress6)); PackGetData2(p, "ProxyIpAddress6", t->ProxyIpAddress6, sizeof(t->ProxyIpAddress6));
t->ProxyPort = PackGetInt(p, "ProxyPort"); t->ProxyPort = LittleEndian32(PackGetInt(p, "ProxyPort"));
} }
void OutRpcNodeInfo(PACK *p, NODE_INFO *t) void OutRpcNodeInfo(PACK *p, NODE_INFO *t)
{ {
@@ -14770,19 +14690,19 @@ void OutRpcNodeInfo(PACK *p, NODE_INFO *t)
PackAddStr(p, "HubName", t->HubName); PackAddStr(p, "HubName", t->HubName);
PackAddData(p, "UniqueId", t->UniqueId, sizeof(t->UniqueId)); PackAddData(p, "UniqueId", t->UniqueId, sizeof(t->UniqueId));
PackAddInt(p, "ClientProductVer", t->ClientProductVer); PackAddInt(p, "ClientProductVer", LittleEndian32(t->ClientProductVer));
PackAddInt(p, "ClientProductBuild", t->ClientProductBuild); PackAddInt(p, "ClientProductBuild", LittleEndian32(t->ClientProductBuild));
PackAddInt(p, "ServerProductVer", t->ServerProductVer); PackAddInt(p, "ServerProductVer", LittleEndian32(t->ServerProductVer));
PackAddInt(p, "ServerProductBuild", t->ServerProductBuild); PackAddInt(p, "ServerProductBuild", LittleEndian32(t->ServerProductBuild));
PackAddIp32(p, "ClientIpAddress", t->ClientIpAddress); PackAddIp32(p, "ClientIpAddress", t->ClientIpAddress);
PackAddData(p, "ClientIpAddress6", t->ClientIpAddress6, sizeof(t->ClientIpAddress6)); PackAddData(p, "ClientIpAddress6", t->ClientIpAddress6, sizeof(t->ClientIpAddress6));
PackAddInt(p, "ClientPort", t->ClientPort); PackAddInt(p, "ClientPort", LittleEndian32(t->ClientPort));
PackAddIp32(p, "ServerIpAddress", t->ServerIpAddress); PackAddIp32(p, "ServerIpAddress", t->ServerIpAddress);
PackAddData(p, "ServerIpAddress6", t->ServerIpAddress6, sizeof(t->ServerIpAddress6)); PackAddData(p, "ServerIpAddress6", t->ServerIpAddress6, sizeof(t->ServerIpAddress6));
PackAddInt(p, "ServerPort2", t->ServerPort); PackAddInt(p, "ServerPort2", LittleEndian32(t->ServerPort));
PackAddIp32(p, "ProxyIpAddress", t->ProxyIpAddress); PackAddIp32(p, "ProxyIpAddress", t->ProxyIpAddress);
PackAddData(p, "ProxyIpAddress6", t->ProxyIpAddress6, sizeof(t->ProxyIpAddress6)); PackAddData(p, "ProxyIpAddress6", t->ProxyIpAddress6, sizeof(t->ProxyIpAddress6));
PackAddInt(p, "ProxyPort", t->ProxyPort); PackAddInt(p, "ProxyPort", LittleEndian32(t->ProxyPort));
} }
// RPC_SESSION_STATUS // RPC_SESSION_STATUS
+2
View File
@@ -230,6 +230,7 @@ struct RPC_FARM_CONNECTION_STATUS
struct RPC_KEY_PAIR struct RPC_KEY_PAIR
{ {
X *Cert; // Certificate X *Cert; // Certificate
LIST *Chain; // Trust chain
K *Key; // Secret key K *Key; // Secret key
UINT Flag1; // Flag1 UINT Flag1; // Flag1
}; };
@@ -435,6 +436,7 @@ struct RPC_CREATE_LINK
CLIENT_AUTH *ClientAuth; // Client authentication data CLIENT_AUTH *ClientAuth; // Client authentication data
POLICY Policy; // Policy POLICY Policy; // Policy
bool CheckServerCert; // Validate the server certificate bool CheckServerCert; // Validate the server certificate
bool AddDefaultCA; // Use default trust store
X *ServerCert; // Server certificate X *ServerCert; // Server certificate
}; };
+16 -1
View File
@@ -9,6 +9,7 @@
#include "Cedar.h" #include "Cedar.h"
#include "Command.h" #include "Command.h"
#include "Logging.h"
#include "Wpc.h" #include "Wpc.h"
#include "Mayaqua/Encrypt.h" #include "Mayaqua/Encrypt.h"
@@ -19,6 +20,7 @@
#include "Mayaqua/Object.h" #include "Mayaqua/Object.h"
#include "Mayaqua/Pack.h" #include "Mayaqua/Pack.h"
#include "Mayaqua/Str.h" #include "Mayaqua/Str.h"
#include "Mayaqua/Table.h"
#include "Mayaqua/Tick64.h" #include "Mayaqua/Tick64.h"
#include <stdlib.h> #include <stdlib.h>
@@ -80,6 +82,9 @@ void AcWaitForRequest(AZURE_CLIENT *ac, SOCK *s, AZURE_PARAM *param)
{ {
SOCK *ns; SOCK *ns;
Debug("Connect Request from %r:%u\n", &client_ip, client_port); Debug("Connect Request from %r:%u\n", &client_ip, client_port);
char ipstr[128];
IPToStr(ipstr, sizeof(ipstr), &client_ip);
SLog(ac->Cedar, "LS_AZURE_START", ipstr, client_port);
// Create new socket and connect VPN Azure Server // Create new socket and connect VPN Azure Server
if (ac->DDnsStatusCopy.InternetSetting.ProxyType == PROXY_DIRECT) if (ac->DDnsStatusCopy.InternetSetting.ProxyType == PROXY_DIRECT)
@@ -103,7 +108,10 @@ void AcWaitForRequest(AZURE_CLIENT *ac, SOCK *s, AZURE_PARAM *param)
SetTimeout(ns, param->DataTimeout); SetTimeout(ns, param->DataTimeout);
if (StartSSLEx(ns, NULL, NULL, 0, NULL)) UINT ssl_err = 0;
Copy(&ns->SslAcceptSettings, &ac->Cedar->SslAcceptSettings, sizeof(SSL_ACCEPT_SETTINGS));
if (StartSSLEx3(ns, NULL, NULL, NULL, 0, NULL, NULL, &ssl_err))
{ {
// Check certification // Check certification
char server_cert_hash_str[MAX_SIZE]; char server_cert_hash_str[MAX_SIZE];
@@ -157,6 +165,13 @@ void AcWaitForRequest(AZURE_CLIENT *ac, SOCK *s, AZURE_PARAM *param)
} }
} }
} }
else
{
if (ssl_err != 0)
{
SLog(ac->Cedar, "LS_AZURE_SSL_ERROR", GetUniErrorStr(ssl_err), ssl_err);
}
}
ReleaseSock(ns); ReleaseSock(ns);
} }
+14 -7
View File
@@ -29,11 +29,13 @@
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <sys/stat.h> #include <sys/stat.h>
#ifndef UNIX_OPENBSD #if !defined(UNIX_OPENBSD) && !defined(UNIX_SOLARIS)
#include <net/ethernet.h> #include <net/ethernet.h>
#endif #endif
#ifdef UNIX_SOLARIS #ifdef UNIX_SOLARIS
#include <stropts.h>
#include <sys/dlpi.h>
#include <sys/sockio.h> #include <sys/sockio.h>
#endif #endif
@@ -49,7 +51,7 @@
#endif #endif
#ifdef UNIX_LINUX #ifdef UNIX_LINUX
#include <linux/if_packet.h> #include <netpacket/packet.h>
struct my_tpacket_auxdata struct my_tpacket_auxdata
{ {
@@ -319,7 +321,7 @@ TOKEN_LIST *GetEthListLinux(bool enum_normal, bool enum_rawip)
{ {
if (IsInListStr(o, name) == false) if (IsInListStr(o, name) == false)
{ {
if (StartWith(name, "tap_") == false) if (StartWith(name, UNIX_VLAN_BRIDGE_IFACE_PREFIX"_") == false)
{ {
Add(o, CopyStr(name)); Add(o, CopyStr(name));
} }
@@ -504,7 +506,7 @@ ETH *OpenEthLinux(char *name, bool local, bool tapmode, char *tapaddr)
{ {
#ifndef NO_VLAN #ifndef NO_VLAN
// In tap mode // In tap mode
VLAN *v = NewTap(name, tapaddr, true); VLAN *v = NewBridgeTap(name, tapaddr, true);
if (v == NULL) if (v == NULL)
{ {
return NULL; return NULL;
@@ -803,7 +805,12 @@ bool EthIsChangeMtuSupported(ETH *e)
return false; return false;
} }
// FreeBSD seriously dislikes MTU changes; disable if compiled on that platform
#ifndef __FreeBSD__
return true; return true;
#else
return false;
#endif
#else // defined(UNIX_LINUX) || defined(UNIX_BSD) || defined(UNIX_SOLARIS) #else // defined(UNIX_LINUX) || defined(UNIX_BSD) || defined(UNIX_SOLARIS)
return false; return false;
#endif // defined(UNIX_LINUX) || defined(UNIX_BSD) || defined(UNIX_SOLARIS) #endif // defined(UNIX_LINUX) || defined(UNIX_BSD) || defined(UNIX_SOLARIS)
@@ -1397,7 +1404,7 @@ ETH *OpenEthBSD(char *name, bool local, bool tapmode, char *tapaddr)
{ {
#ifndef NO_VLAN #ifndef NO_VLAN
// In tap mode // In tap mode
VLAN *v = NewTap(name, tapaddr, true); VLAN *v = NewBridgeTap(name, tapaddr, true);
if (v == NULL) if (v == NULL)
{ {
return NULL; return NULL;
@@ -1414,7 +1421,7 @@ ETH *OpenEthBSD(char *name, bool local, bool tapmode, char *tapaddr)
return e; return e;
#else // NO_VLAN #else // NO_VLAN
return NULL: return NULL;
#endif // NO_VLAN #endif // NO_VLAN
} }
@@ -1473,7 +1480,7 @@ void CloseEth(ETH *e)
if (e->Tap != NULL) if (e->Tap != NULL)
{ {
#ifndef NO_VLAN #ifndef NO_VLAN
FreeTap(e->Tap); FreeBridgeTap(e->Tap);
#endif // NO_VLAN #endif // NO_VLAN
} }
+167 -50
View File
@@ -410,7 +410,7 @@ void CmEasyDlgOnKey(HWND hWnd, CM_EASY_DLG *d, bool ctrl, bool alt, UINT key)
break; break;
case 'O': case 'O':
// Option settings // Option settings
Command(hWnd, CMD_TRAFFIC); Command(hWnd, CMD_OPTION);
break; break;
case 'R': case 'R':
// Certificate management // Certificate management
@@ -4251,9 +4251,6 @@ UINT CmMainWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *p
case WM_TIMER: case WM_TIMER:
switch (wParam) switch (wParam)
{ {
case 1:
CmSetForegroundProcessToCnService();
break;
case 2: case 2:
CmPollingTray(hWnd); CmPollingTray(hWnd);
break; break;
@@ -5019,7 +5016,7 @@ void CmOnKey(HWND hWnd, bool ctrl, bool alt, UINT key)
break; break;
case 'O': case 'O':
// Option settings // Option settings
Command(hWnd, CMD_TRAFFIC); Command(hWnd, CMD_OPTION);
break; break;
case 'R': case 'R':
// Certificate management // Certificate management
@@ -5450,8 +5447,6 @@ void CmMainWindowOnCommandEx(HWND hWnd, WPARAM wParam, LPARAM lParam, bool easy)
CmStopUacHelper(helper); CmStopUacHelper(helper);
Free(name); Free(name);
CmRefresh(hWnd);
} }
break; break;
case CMD_DELETE_VLAN: case CMD_DELETE_VLAN:
@@ -5480,8 +5475,6 @@ void CmMainWindowOnCommandEx(HWND hWnd, WPARAM wParam, LPARAM lParam, bool easy)
} }
Free(s); Free(s);
} }
CmRefresh(hWnd);
} }
break; break;
case CMD_ENABLE_VLAN: case CMD_ENABLE_VLAN:
@@ -5501,8 +5494,6 @@ void CmMainWindowOnCommandEx(HWND hWnd, WPARAM wParam, LPARAM lParam, bool easy)
CALL(hWnd, CcEnableVLan(cm->Client, &c)); CALL(hWnd, CcEnableVLan(cm->Client, &c));
} }
Free(s); Free(s);
CmRefresh(hWnd);
} }
} }
break; break;
@@ -5523,8 +5514,6 @@ void CmMainWindowOnCommandEx(HWND hWnd, WPARAM wParam, LPARAM lParam, bool easy)
CALL(hWnd, CcDisableVLan(cm->Client, &c)); CALL(hWnd, CcDisableVLan(cm->Client, &c));
} }
Free(s); Free(s);
CmRefresh(hWnd);
} }
} }
break; break;
@@ -5560,8 +5549,6 @@ void CmMainWindowOnCommandEx(HWND hWnd, WPARAM wParam, LPARAM lParam, bool easy)
CmStopUacHelper(helper); CmStopUacHelper(helper);
} }
Free(s); Free(s);
CmRefresh(hWnd);
} }
} }
break; break;
@@ -6032,6 +6019,7 @@ void CmExportAccount(HWND hWnd, wchar_t *account_name)
t.StartupAccount = a->Startup; t.StartupAccount = a->Startup;
t.CheckServerCert = a->CheckServerCert; t.CheckServerCert = a->CheckServerCert;
t.RetryOnServerCert = a->RetryOnServerCert; t.RetryOnServerCert = a->RetryOnServerCert;
t.AddDefaultCA = a->AddDefaultCA;
t.ServerCert = a->ServerCert; t.ServerCert = a->ServerCert;
t.ClientOption->FromAdminPack = false; t.ClientOption->FromAdminPack = false;
@@ -6162,6 +6150,8 @@ void CmImportAccountMainEx(HWND hWnd, wchar_t *filename, bool overwrite)
t->ClientOption->RequireMonitorMode = old_option->RequireMonitorMode; t->ClientOption->RequireMonitorMode = old_option->RequireMonitorMode;
t->ClientOption->RequireBridgeRoutingMode = old_option->RequireBridgeRoutingMode; t->ClientOption->RequireBridgeRoutingMode = old_option->RequireBridgeRoutingMode;
t->ClientOption->DisableQoS = old_option->DisableQoS; t->ClientOption->DisableQoS = old_option->DisableQoS;
t->ClientOption->BindLocalIP = old_option->BindLocalIP;// Source IP address for outgoing connection
t->ClientOption->BindLocalPort = old_option->BindLocalPort;// Source port number for outgoing connection
// Inherit the authentication data // Inherit the authentication data
CiFreeClientAuth(t->ClientAuth); CiFreeClientAuth(t->ClientAuth);
@@ -6171,6 +6161,7 @@ void CmImportAccountMainEx(HWND hWnd, wchar_t *filename, bool overwrite)
t->StartupAccount = get.StartupAccount; t->StartupAccount = get.StartupAccount;
t->CheckServerCert = get.CheckServerCert; t->CheckServerCert = get.CheckServerCert;
t->RetryOnServerCert = get.RetryOnServerCert; t->RetryOnServerCert = get.RetryOnServerCert;
t->AddDefaultCA = get.AddDefaultCA;
if (t->ServerCert != NULL) if (t->ServerCert != NULL)
{ {
FreeX(t->ServerCert); FreeX(t->ServerCert);
@@ -6280,6 +6271,7 @@ void CmCopyAccount(HWND hWnd, wchar_t *account_name)
} }
c.CheckServerCert = a->CheckServerCert; c.CheckServerCert = a->CheckServerCert;
c.RetryOnServerCert = a->RetryOnServerCert; c.RetryOnServerCert = a->RetryOnServerCert;
c.AddDefaultCA = a->AddDefaultCA;
c.StartupAccount = false; // Don't copy the startup attribute c.StartupAccount = false; // Don't copy the startup attribute
CALL(hWnd, CcCreateAccount(cm->Client, &c)); CALL(hWnd, CcCreateAccount(cm->Client, &c));
@@ -6466,9 +6458,55 @@ void CmDetailDlgUpdate(HWND hWnd, CM_ACCOUNT *a)
Disable(hWnd, R_BRIDGE); Disable(hWnd, R_BRIDGE);
Disable(hWnd, R_MONITOR); Disable(hWnd, R_MONITOR);
Disable(hWnd, R_NO_ROUTING); Disable(hWnd, R_NO_ROUTING);
#if TYPE_BINDLOCALIP
Disable(hWnd, E_BIND_LOCALIP);// Source IP address for outgoing connection
Disable(hWnd, E_BIND_LOCALPORT);// Source port number for outgoing connection
#endif
} }
} }
#if TYPE_BINDLOCALIP
// Set the value of the IP type
void SetIp(HWND hWnd, UINT id, IP* ip)
{
char tmp[MAX_SIZE];
// Validate arguments
if (hWnd == NULL || ip == NULL)
{
return;
}
IPToStr(tmp, sizeof(tmp), ip);
SetTextA(hWnd, id, tmp);
}
// Get an IP address
bool GetIp(HWND hWnd, UINT id, IP* ip)
{
char tmp[MAX_SIZE];
// Validate arguments
if (hWnd == NULL || ip == NULL)
{
return false;
}
Zero(ip, sizeof(IP));
if (GetTxtA(hWnd, id, tmp, sizeof(tmp)) == false)
{
return false;
}
if (StrToIP(ip, tmp) == false)
{
return false;
}
return true;
}
#endif
// Advanced Settings dialog procedure // Advanced Settings dialog procedure
UINT CmDetailDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) UINT CmDetailDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param)
{ {
@@ -6505,6 +6543,11 @@ UINT CmDetailDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *pa
Check(hWnd, R_NO_ROUTING, a->ClientOption->NoRoutingTracking); Check(hWnd, R_NO_ROUTING, a->ClientOption->NoRoutingTracking);
Check(hWnd, R_DISABLE_QOS, a->ClientOption->DisableQoS); Check(hWnd, R_DISABLE_QOS, a->ClientOption->DisableQoS);
Check(hWnd, R_DISABLE_UDP, a->ClientOption->NoUdpAcceleration); Check(hWnd, R_DISABLE_UDP, a->ClientOption->NoUdpAcceleration);
#if TYPE_BINDLOCALIP
SetIp(hWnd, E_BIND_LOCALIP, &a->ClientOption->BindLocalIP);// Source IP address for outgoing connection
SetIntEx(hWnd, E_BIND_LOCALPORT, a->ClientOption->BindLocalPort);// Source port number for outgoing connection
//Disable(hWnd, E_BIND_LOCALPORT); // You can not edit
#endif
// Select the Connection Mode // Select the Connection Mode
if (a->LinkMode == false) if (a->LinkMode == false)
@@ -6552,6 +6595,20 @@ UINT CmDetailDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *pa
Focus(hWnd, E_INTERVAL); Focus(hWnd, E_INTERVAL);
break; break;
} }
#if TYPE_BINDLOCALIP
// Source IP address for outgoing connection
IP tmpIP;
if (GetIp(hWnd, E_BIND_LOCALIP, &tmpIP) == false)
{
FocusEx(hWnd, E_BIND_LOCALIP);
break;
}
// Source port number for outgoing connection
if ((GetInt(hWnd, E_BIND_LOCALPORT) < 0) || (GetInt(hWnd, E_BIND_LOCALPORT) > 65535)){
FocusEx(hWnd, E_BIND_LOCALPORT);
break;
}
#endif
a->ClientOption->MaxConnection = num; a->ClientOption->MaxConnection = num;
a->ClientOption->AdditionalConnectionInterval = GetInt(hWnd, E_INTERVAL); a->ClientOption->AdditionalConnectionInterval = GetInt(hWnd, E_INTERVAL);
@@ -6569,6 +6626,10 @@ UINT CmDetailDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *pa
a->ClientOption->NoRoutingTracking = IsChecked(hWnd, R_NO_ROUTING); a->ClientOption->NoRoutingTracking = IsChecked(hWnd, R_NO_ROUTING);
a->ClientOption->DisableQoS = IsChecked(hWnd, R_DISABLE_QOS); a->ClientOption->DisableQoS = IsChecked(hWnd, R_DISABLE_QOS);
a->ClientOption->NoUdpAcceleration = IsChecked(hWnd, R_DISABLE_UDP); a->ClientOption->NoUdpAcceleration = IsChecked(hWnd, R_DISABLE_UDP);
#if TYPE_BINDLOCALIP
a->ClientOption->BindLocalIP = tmpIP;// Source IP address for outgoing connection
a->ClientOption->BindLocalPort = GetInt(hWnd, E_BIND_LOCALPORT);// Source port number for outgoing connection
#endif
if (a->LinkMode) if (a->LinkMode)
{ {
@@ -6659,6 +6720,7 @@ void CmEditAccountDlgUpdate(HWND hWnd, CM_ACCOUNT *a)
// Host name // Host name
GetTxtA(hWnd, E_HOSTNAME, a->ClientOption->Hostname, sizeof(a->ClientOption->Hostname)); GetTxtA(hWnd, E_HOSTNAME, a->ClientOption->Hostname, sizeof(a->ClientOption->Hostname));
Trim(a->ClientOption->Hostname); Trim(a->ClientOption->Hostname);
a->ClientOption->HintStr[0] = 0;
if (InStr(a->ClientOption->Hostname, "/tcp")) if (InStr(a->ClientOption->Hostname, "/tcp"))
{ {
@@ -6695,9 +6757,13 @@ void CmEditAccountDlgUpdate(HWND hWnd, CM_ACCOUNT *a)
// To validate the server certificate // To validate the server certificate
a->CheckServerCert = IsChecked(hWnd, R_CHECK_CERT); a->CheckServerCert = IsChecked(hWnd, R_CHECK_CERT);
// Trust default CA list
a->AddDefaultCA = IsChecked(hWnd, R_TRUST_DEFAULT);
if (a->NatMode) if (a->NatMode)
{ {
Disable(hWnd, R_CHECK_CERT); Disable(hWnd, R_CHECK_CERT);
Disable(hWnd, R_TRUST_DEFAULT);
Disable(hWnd, B_TRUST); Disable(hWnd, B_TRUST);
} }
@@ -7040,6 +7106,7 @@ void CmEditAccountDlgUpdate(HWND hWnd, CM_ACCOUNT *a)
SetEnable(hWnd, S_STATIC7, false); SetEnable(hWnd, S_STATIC7, false);
SetEnable(hWnd, S_STATIC11, false); SetEnable(hWnd, S_STATIC11, false);
SetEnable(hWnd, R_CHECK_CERT, false); SetEnable(hWnd, R_CHECK_CERT, false);
SetEnable(hWnd, R_TRUST_DEFAULT, false);
SetEnable(hWnd, B_TRUST, false); SetEnable(hWnd, B_TRUST, false);
SetEnable(hWnd, B_SERVER_CERT, false); SetEnable(hWnd, B_SERVER_CERT, false);
SetEnable(hWnd, B_VIEW_SERVER_CERT, false); SetEnable(hWnd, B_VIEW_SERVER_CERT, false);
@@ -7101,10 +7168,17 @@ void CmEditAccountDlgInit(HWND hWnd, CM_ACCOUNT *a)
SetText(hWnd, E_ACCOUNT_NAME, a->ClientOption->AccountName); SetText(hWnd, E_ACCOUNT_NAME, a->ClientOption->AccountName);
// Host name // Host name
SetTextA(hWnd, E_HOSTNAME, a->ClientOption->Hostname); char hostname[MAX_SIZE];
StrCpy(a->old_server_name, sizeof(a->old_server_name), a->ClientOption->Hostname); StrCpy(hostname, sizeof(hostname), a->ClientOption->Hostname);
if (IsEmptyStr(a->ClientOption->HintStr) == false)
{
StrCat(hostname, sizeof(hostname), "/");
StrCat(hostname, sizeof(hostname), a->ClientOption->HintStr);
}
SetTextA(hWnd, E_HOSTNAME, hostname);
StrCpy(a->old_server_name, sizeof(a->old_server_name), hostname);
if (InStr(a->ClientOption->Hostname, "/tcp")) if (InStr(hostname, "/tcp"))
{ {
Check(hWnd, R_DISABLE_NATT, true); Check(hWnd, R_DISABLE_NATT, true);
} }
@@ -7134,6 +7208,9 @@ void CmEditAccountDlgInit(HWND hWnd, CM_ACCOUNT *a)
// Verify the server certificate // Verify the server certificate
Check(hWnd, R_CHECK_CERT, a->CheckServerCert); Check(hWnd, R_CHECK_CERT, a->CheckServerCert);
// Trust default CA list
Check(hWnd, R_TRUST_DEFAULT, a->AddDefaultCA);
// LAN card list // LAN card list
if (a->NatMode == false && a->LinkMode == false) if (a->NatMode == false && a->LinkMode == false)
{ {
@@ -7366,6 +7443,7 @@ UINT CmEditAccountDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, voi
case R_HTTPS: case R_HTTPS:
case R_SOCKS: case R_SOCKS:
case R_CHECK_CERT: case R_CHECK_CERT:
case R_TRUST_DEFAULT:
case C_TYPE: case C_TYPE:
case E_USERNAME: case E_USERNAME:
case E_PASSWORD: case E_PASSWORD:
@@ -8463,6 +8541,11 @@ bool CmLoadKExW(HWND hWnd, K **k, wchar_t *filename, UINT size)
// Read a set of certificate and private key // Read a set of certificate and private key
bool CmLoadXAndK(HWND hWnd, X **x, K **k) bool CmLoadXAndK(HWND hWnd, X **x, K **k)
{
return CmLoadXListAndK(hWnd, x, k, NULL);
}
// Read a set of certificate and private key and trust chain
bool CmLoadXListAndK(HWND hWnd, X **x, K **k, LIST **cc)
{ {
wchar_t *s; wchar_t *s;
bool is_p12; bool is_p12;
@@ -8510,7 +8593,7 @@ START_FIRST:
} }
if (IsEncryptedP12(p12) == false) if (IsEncryptedP12(p12) == false)
{ {
if (ParseP12(p12, x, k, NULL) == false) if (ParseP12Ex(p12, x, k, cc, NULL) == false)
{ {
MsgBoxEx(hWnd, MB_ICONSTOP, _UU("DLG_BAD_P12_W"), tmp); MsgBoxEx(hWnd, MB_ICONSTOP, _UU("DLG_BAD_P12_W"), tmp);
FreeP12(p12); FreeP12(p12);
@@ -8529,7 +8612,7 @@ START_FIRST:
} }
else else
{ {
if (ParseP12(p12, x, k, password) == false) if (ParseP12Ex(p12, x, k, cc, password) == false)
{ {
MsgBoxEx(hWnd, MB_ICONSTOP, _UU("DLG_BAD_P12_W"), tmp); MsgBoxEx(hWnd, MB_ICONSTOP, _UU("DLG_BAD_P12_W"), tmp);
FreeP12(p12); FreeP12(p12);
@@ -8542,6 +8625,10 @@ START_FIRST:
{ {
FreeX(*x); FreeX(*x);
FreeK(*k); FreeK(*k);
if (cc != NULL)
{
FreeXList(*cc);
}
FreeP12(p12); FreeP12(p12);
FreeBuf(b); FreeBuf(b);
if (MsgBox(hWnd, MB_ICONEXCLAMATION | MB_RETRYCANCEL, _UU("DLG_BAD_SIGNATURE")) == IDRETRY) if (MsgBox(hWnd, MB_ICONEXCLAMATION | MB_RETRYCANCEL, _UU("DLG_BAD_SIGNATURE")) == IDRETRY)
@@ -8550,6 +8637,11 @@ START_FIRST:
} }
return false; return false;
} }
if (cc != NULL && LIST_NUM(*cc) == 0)
{
ReleaseList(*cc);
*cc = NULL;
}
FreeP12(p12); FreeP12(p12);
FreeBuf(b); FreeBuf(b);
return true; return true;
@@ -8558,19 +8650,40 @@ START_FIRST:
{ {
// Processing of X509 // Processing of X509
BUF *b = ReadDumpW(tmp); BUF *b = ReadDumpW(tmp);
X *x509; X *x509 = NULL;
K *key; K *key;
LIST *chain = NULL;
if (b == NULL) if (b == NULL)
{ {
MsgBoxEx(hWnd, MB_ICONSTOP, _UU("DLG_OPEN_FILE_ERROR_W"), tmp); MsgBoxEx(hWnd, MB_ICONSTOP, _UU("DLG_OPEN_FILE_ERROR_W"), tmp);
return false; return false;
} }
x509 = BufToX(b, IsBase64(b)); // DER-encoded X509 files can't hold multiple certificates
if (cc == NULL || IsBase64(b) == false)
{
x509 = BufToX(b, IsBase64(b));
}
else
{
chain = BufToXList(b, true);
if (LIST_NUM(chain) > 0)
{
x509 = LIST_DATA(chain, 0);
Delete(chain, x509);
if (LIST_NUM(chain) == 0)
{
ReleaseList(chain);
chain = NULL;
}
}
}
FreeBuf(b); FreeBuf(b);
if (x509 == NULL) if (x509 == NULL)
{ {
MsgBoxEx(hWnd, MB_ICONSTOP, _UU("DLG_BAD_X509_W"), tmp); MsgBoxEx(hWnd, MB_ICONSTOP, _UU("DLG_BAD_X509_W"), tmp);
FreeXList(chain);
return false; return false;
} }
@@ -8579,6 +8692,7 @@ START_FIRST:
if (s == NULL) if (s == NULL)
{ {
FreeX(x509); FreeX(x509);
FreeXList(chain);
return false; return false;
} }
UniStrCpy(tmp, sizeof(tmp), s); UniStrCpy(tmp, sizeof(tmp), s);
@@ -8589,6 +8703,7 @@ START_FIRST:
{ {
MsgBoxEx(hWnd, MB_ICONSTOP, _UU("DLG_OPEN_FILE_ERROR_W"), tmp); MsgBoxEx(hWnd, MB_ICONSTOP, _UU("DLG_OPEN_FILE_ERROR_W"), tmp);
FreeX(x509); FreeX(x509);
FreeXList(chain);
return false; return false;
} }
@@ -8603,6 +8718,7 @@ START_FIRST:
{ {
FreeBuf(b); FreeBuf(b);
FreeX(x509); FreeX(x509);
FreeXList(chain);
return false; return false;
} }
key = BufToK(b, true, IsBase64(b), pass); key = BufToK(b, true, IsBase64(b), pass);
@@ -8612,6 +8728,7 @@ START_FIRST:
{ {
FreeBuf(b); FreeBuf(b);
FreeX(x509); FreeX(x509);
FreeXList(chain);
MsgBoxEx(hWnd, MB_ICONSTOP, _UU("DLG_BAD_KEY_W"), tmp); MsgBoxEx(hWnd, MB_ICONSTOP, _UU("DLG_BAD_KEY_W"), tmp);
return false; return false;
} }
@@ -8621,6 +8738,7 @@ START_FIRST:
FreeBuf(b); FreeBuf(b);
FreeX(x509); FreeX(x509);
FreeK(key); FreeK(key);
FreeXList(chain);
if (MsgBox(hWnd, MB_ICONEXCLAMATION | MB_RETRYCANCEL, _UU("DLG_BAD_SIGNATURE")) == IDRETRY) if (MsgBox(hWnd, MB_ICONEXCLAMATION | MB_RETRYCANCEL, _UU("DLG_BAD_SIGNATURE")) == IDRETRY)
{ {
goto START_FIRST; goto START_FIRST;
@@ -8631,6 +8749,10 @@ START_FIRST:
FreeBuf(b); FreeBuf(b);
*x = x509; *x = x509;
*k = key; *k = key;
if (cc != NULL)
{
*cc = chain;
}
return true; return true;
} }
} }
@@ -8728,6 +8850,7 @@ void CmEditAccountDlgOnOk(HWND hWnd, CM_ACCOUNT *a)
Copy(c.ClientOption, a->ClientOption, sizeof(CLIENT_OPTION)); Copy(c.ClientOption, a->ClientOption, sizeof(CLIENT_OPTION));
c.ClientAuth = CopyClientAuth(a->ClientAuth); c.ClientAuth = CopyClientAuth(a->ClientAuth);
c.CheckServerCert = a->CheckServerCert; c.CheckServerCert = a->CheckServerCert;
c.AddDefaultCA = a->AddDefaultCA;
if (a->ServerCert != NULL) if (a->ServerCert != NULL)
{ {
c.ServerCert = CloneX(a->ServerCert); c.ServerCert = CloneX(a->ServerCert);
@@ -8781,6 +8904,7 @@ void CmEditAccountDlgOnOk(HWND hWnd, CM_ACCOUNT *a)
Copy(t.ClientOption, a->ClientOption, sizeof(CLIENT_OPTION)); Copy(t.ClientOption, a->ClientOption, sizeof(CLIENT_OPTION));
t.ClientAuth = CopyClientAuth(a->ClientAuth); t.ClientAuth = CopyClientAuth(a->ClientAuth);
t.CheckServerCert = a->CheckServerCert; t.CheckServerCert = a->CheckServerCert;
t.AddDefaultCA = a->AddDefaultCA;
t.ServerCert = CloneX(a->ServerCert); t.ServerCert = CloneX(a->ServerCert);
// Save the settings for cascade connection // Save the settings for cascade connection
@@ -8973,6 +9097,7 @@ CM_ACCOUNT *CmGetExistAccountObject(HWND hWnd, wchar_t *account_name)
a->EditMode = true; a->EditMode = true;
a->CheckServerCert = c.CheckServerCert; a->CheckServerCert = c.CheckServerCert;
a->RetryOnServerCert = c.RetryOnServerCert; a->RetryOnServerCert = c.RetryOnServerCert;
a->AddDefaultCA = c.AddDefaultCA;
a->Startup = c.StartupAccount; a->Startup = c.StartupAccount;
if (c.ServerCert != NULL) if (c.ServerCert != NULL)
{ {
@@ -9003,6 +9128,7 @@ CM_ACCOUNT *CmCreateNewAccountObject(HWND hWnd)
a->EditMode = false; a->EditMode = false;
a->CheckServerCert = false; a->CheckServerCert = false;
a->RetryOnServerCert = false; a->RetryOnServerCert = false;
a->AddDefaultCA = false;
a->Startup = false; a->Startup = false;
a->ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); a->ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION));
@@ -9518,7 +9644,11 @@ void CmPrintStatusToListViewEx(LVB *b, RPC_CLIENT_GET_CONNECTION_STATUS *s, bool
} }
else else
{ {
if (StrLen(s->CipherName) != 0) if (StrLen(s->CipherName) != 0 && StrLen(s->ProtocolName) != 0)
{
UniFormat(tmp, sizeof(tmp), _UU("CM_ST_USE_ENCRYPT_TRUE3"), s->ProtocolName, s->CipherName);
}
else if (StrLen(s->CipherName) != 0)
{ {
UniFormat(tmp, sizeof(tmp), _UU("CM_ST_USE_ENCRYPT_TRUE"), s->CipherName); UniFormat(tmp, sizeof(tmp), _UU("CM_ST_USE_ENCRYPT_TRUE"), s->CipherName);
} }
@@ -10410,7 +10540,7 @@ void CmRefreshAccountListEx2(HWND hWnd, bool easy, bool style_changed)
UINT num = 0; UINT num = 0;
RPC_CLIENT_ENUM_ACCOUNT a; RPC_CLIENT_ENUM_ACCOUNT a;
UINT num_connecting = 0, num_connected = 0; UINT num_connecting = 0, num_connected = 0;
wchar_t tmp[MAX_SIZE]; wchar_t tooltip[MAX_SIZE];
wchar_t new_inserted_item[MAX_ACCOUNT_NAME_LEN + 1]; wchar_t new_inserted_item[MAX_ACCOUNT_NAME_LEN + 1];
bool select_new_inserted_item = true; bool select_new_inserted_item = true;
// Validate arguments // Validate arguments
@@ -10464,6 +10594,8 @@ void CmRefreshAccountListEx2(HWND hWnd, bool easy, bool style_changed)
select_new_inserted_item = false; select_new_inserted_item = false;
} }
UniStrCpy(tooltip, sizeof(tooltip), _UU("CM_TRAY_INITING"));
// Enumerate the account list // Enumerate the account list
if (CALL(hWnd, CcEnumAccount(cm->Client, &a))) if (CALL(hWnd, CcEnumAccount(cm->Client, &a)))
{ {
@@ -10587,10 +10719,16 @@ void CmRefreshAccountListEx2(HWND hWnd, bool easy, bool style_changed)
if (t->Connected) if (t->Connected)
{ {
num_connected++; num_connected++;
UniStrCat(tooltip, sizeof(tooltip), L"\r\n"L"\r\n");
UniStrCat(tooltip, sizeof(tooltip), t->AccountName);
UniStrCat(tooltip, sizeof(tooltip), _UU("CM_TRAY_CONNECTED"));
} }
else else
{ {
num_connecting++; num_connecting++;
UniStrCat(tooltip, sizeof(tooltip), L"\r\n"L"\r\n");
UniStrCat(tooltip, sizeof(tooltip), t->AccountName);
UniStrCat(tooltip, sizeof(tooltip), _UU("CM_TRAY_CONNECTING"));
} }
} }
} }
@@ -10643,22 +10781,8 @@ void CmRefreshAccountListEx2(HWND hWnd, bool easy, bool style_changed)
if (num_connecting == 0 && num_connected == 0) if (num_connecting == 0 && num_connected == 0)
{ {
// There is no connecting or connected account // There is no connecting or connected account
UniStrCpy(tmp, sizeof(tmp), _UU("CM_TRAY_NOT_CONNECTED")); UniStrCat(tooltip, sizeof(tooltip), L"\r\n");
} UniStrCat(tooltip, sizeof(tooltip), _UU("CM_TRAY_NOT_CONNECTED"));
else if (num_connected == 0)
{
// There is only connecting account
UniFormat(tmp, sizeof(tmp), _UU("CM_TRAY_CONNECTED_1"), num_connecting);
}
else if (num_connecting == 0)
{
// There is only connected account
UniFormat(tmp, sizeof(tmp), _UU("CM_TRAY_CONNECTED_2"), num_connected);
}
else
{
// There are both
UniFormat(tmp, sizeof(tmp), _UU("CM_TRAY_CONNECTED_0"), num_connected, num_connecting);
} }
if (num_connecting == 0 && num_connected == 0) if (num_connecting == 0 && num_connected == 0)
@@ -10680,7 +10804,7 @@ void CmRefreshAccountListEx2(HWND hWnd, bool easy, bool style_changed)
} }
} }
CmChangeTrayString(hWnd, tmp); CmChangeTrayString(hWnd, tooltip);
} }
Refresh(hWnd); Refresh(hWnd);
@@ -11207,7 +11331,6 @@ void CmMainWindowOnInit(HWND hWnd)
CmInitNotifyClientThread(); CmInitNotifyClientThread();
// Timer setting // Timer setting
SetTimer(hWnd, 1, 128, NULL);
SetTimer(hWnd, 6, 5000, NULL); SetTimer(hWnd, 6, 5000, NULL);
// Initialize the task tray // Initialize the task tray
@@ -11844,7 +11967,6 @@ bool LoginCM()
// Try to login with an empty password first // Try to login with an empty password first
bool bad_pass, no_remote; bool bad_pass, no_remote;
wchar_t server_name[MAX_SIZE]; wchar_t server_name[MAX_SIZE];
RPC_CLIENT_VERSION a;
RETRY: RETRY:
if (cm->server_name != NULL) if (cm->server_name != NULL)
@@ -11896,13 +12018,8 @@ RETRY:
} }
} }
Zero(&a, sizeof(a)); cm->CmSettingSupported = true;
CcGetClientVersion(cm->Client, &a); cm->CmEasyModeSupported = true;
if (a.ClientBuildInt >= 5192)
{
cm->CmSettingSupported = true;
cm->CmEasyModeSupported = true;
}
return true; return true;
} }
+2
View File
@@ -140,6 +140,7 @@ typedef struct CM_ACCOUNT
bool Startup; // Startup account bool Startup; // Startup account
bool CheckServerCert; // Check the server certificate bool CheckServerCert; // Check the server certificate
bool RetryOnServerCert; // Retry on invalid server certificate bool RetryOnServerCert; // Retry on invalid server certificate
bool AddDefaultCA; // Use default trust store
X *ServerCert; // Server certificate X *ServerCert; // Server certificate
char old_server_name[MAX_HOST_NAME_LEN + 1]; // Old server name char old_server_name[MAX_HOST_NAME_LEN + 1]; // Old server name
bool Inited; // Initialization flag bool Inited; // Initialization flag
@@ -409,6 +410,7 @@ void CmEditAccountDlgInit(HWND hWnd, CM_ACCOUNT *a);
void CmEditAccountDlgOnOk(HWND hWnd, CM_ACCOUNT *a); void CmEditAccountDlgOnOk(HWND hWnd, CM_ACCOUNT *a);
void CmEditAccountDlgStartEnumHub(HWND hWnd, CM_ACCOUNT *a); void CmEditAccountDlgStartEnumHub(HWND hWnd, CM_ACCOUNT *a);
bool CmLoadXAndK(HWND hWnd, X **x, K **k); bool CmLoadXAndK(HWND hWnd, X **x, K **k);
bool CmLoadXListAndK(HWND hWnd, X **x, K **k, LIST **cc);
bool CmLoadKEx(HWND hWnd, K **k, char *filename, UINT size); bool CmLoadKEx(HWND hWnd, K **k, char *filename, UINT size);
bool CmLoadKExW(HWND hWnd, K **k, wchar_t *filename, UINT size); bool CmLoadKExW(HWND hWnd, K **k, wchar_t *filename, UINT size);
bool CmLoadXFromFileOrSecureCard(HWND hWnd, X **x); bool CmLoadXFromFileOrSecureCard(HWND hWnd, X **x);
+9 -1
View File
@@ -19,6 +19,8 @@ set_target_properties(cedar
RUNTIME_OUTPUT_DIRECTORY "${BUILD_DIRECTORY}" RUNTIME_OUTPUT_DIRECTORY "${BUILD_DIRECTORY}"
) )
target_link_libraries(cedar PUBLIC mayaqua)
cmake_host_system_information(RESULT HAS_SSE2 QUERY HAS_SSE2) cmake_host_system_information(RESULT HAS_SSE2 QUERY HAS_SSE2)
set(BLAKE2_SRC_PATH $<IF:$<BOOL:${HAS_SSE2}>,${TOP_DIRECTORY}/3rdparty/BLAKE2/sse,${TOP_DIRECTORY}/3rdparty/BLAKE2/ref>) set(BLAKE2_SRC_PATH $<IF:$<BOOL:${HAS_SSE2}>,${TOP_DIRECTORY}/3rdparty/BLAKE2/sse,${TOP_DIRECTORY}/3rdparty/BLAKE2/ref>)
@@ -27,6 +29,12 @@ set(BLAKE2_SRC $<IF:$<BOOL:${HAS_SSE2}>,${BLAKE2_SRC_PATH}/blake2s.c,${BLAKE2_SR
target_include_directories(cedar PUBLIC ${BLAKE2_SRC_PATH}) target_include_directories(cedar PUBLIC ${BLAKE2_SRC_PATH})
target_sources(cedar PRIVATE ${BLAKE2_SRC}) target_sources(cedar PRIVATE ${BLAKE2_SRC})
if(HAS_SSE2)
# If SSE2 is enabled, a build failure occurs with MSVC because it doesn't define "__SSE2__".
# The fix consists in defining "HAVE_SSE2" manually, effectively overriding the check.
set_property(SOURCE ${BLAKE2_SRC} PROPERTY COMPILE_DEFINITIONS "HAVE_SSE2")
endif()
if(VCPKG_TARGET_TRIPLET) if(VCPKG_TARGET_TRIPLET)
find_package(unofficial-sodium CONFIG REQUIRED) find_package(unofficial-sodium CONFIG REQUIRED)
target_link_libraries(cedar PUBLIC unofficial-sodium::sodium) target_link_libraries(cedar PUBLIC unofficial-sodium::sodium)
@@ -93,6 +101,6 @@ if(UNIX)
install(TARGETS cedar install(TARGETS cedar
COMPONENT "common" COMPONENT "common"
DESTINATION "${CMAKE_INSTALL_LIBDIR}" DESTINATION "${CMAKE_INSTALL_LIBDIR}"
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
) )
endif() endif()
+89 -3
View File
@@ -322,6 +322,34 @@ void DecrementNoSsl(CEDAR *c, IP *ip, UINT num_dec)
UnlockList(c->NonSslList); UnlockList(c->NonSslList);
} }
// Check whether the specified IP address is in Non-SSL connection list
bool IsInNoSsl(CEDAR *c, IP *ip)
{
bool ret = false;
// Validate arguments
if (c == NULL || ip == NULL)
{
return false;
}
LockList(c->NonSslList);
{
NON_SSL *n = SearchNoSslList(c, ip);
if (n != NULL)
{
if (n->EntryExpires > Tick64() && n->Count > NON_SSL_MIN_COUNT)
{
n->EntryExpires = Tick64() + (UINT64)NON_SSL_ENTRY_EXPIRES;
ret = true;
}
}
}
UnlockList(c->NonSslList);
return ret;
}
// Add new entry to Non-SSL connection list // Add new entry to Non-SSL connection list
bool AddNoSsl(CEDAR *c, IP *ip) bool AddNoSsl(CEDAR *c, IP *ip)
{ {
@@ -704,6 +732,47 @@ void DelConnection(CEDAR *cedar, CONNECTION *c)
UnlockList(cedar->ConnectionList); UnlockList(cedar->ConnectionList);
} }
// Get the number of unestablished connections
UINT GetUnestablishedConnections(CEDAR *cedar)
{
UINT i, ret;
// Validate arguments
if (cedar == NULL)
{
return 0;
}
ret = 0;
LockList(cedar->ConnectionList);
{
for (i = 0;i < LIST_NUM(cedar->ConnectionList);i++)
{
CONNECTION *c = LIST_DATA(cedar->ConnectionList, i);
switch (c->Type)
{
case CONNECTION_TYPE_CLIENT:
case CONNECTION_TYPE_INIT:
case CONNECTION_TYPE_LOGIN:
case CONNECTION_TYPE_ADDITIONAL:
switch (c->Status)
{
case CONNECTION_STATUS_ACCEPTED:
case CONNECTION_STATUS_NEGOTIATION:
case CONNECTION_STATUS_USERAUTH:
ret++;
break;
}
break;
}
}
}
UnlockList(cedar->ConnectionList);
return ret + Count(cedar->AcceptingSockets);
}
// Add connection to Cedar // Add connection to Cedar
void AddConnection(CEDAR *cedar, CONNECTION *c) void AddConnection(CEDAR *cedar, CONNECTION *c)
{ {
@@ -1157,6 +1226,10 @@ void CleanupCedar(CEDAR *c)
{ {
FreeK(c->ServerK); FreeK(c->ServerK);
} }
if (c->ServerChain)
{
FreeXList(c->ServerChain);
}
if (c->CipherList) if (c->CipherList)
{ {
@@ -1386,6 +1459,10 @@ void FreeNetSvcList(CEDAR *cedar)
// Change certificate of Cedar // Change certificate of Cedar
void SetCedarCert(CEDAR *c, X *server_x, K *server_k) void SetCedarCert(CEDAR *c, X *server_x, K *server_k)
{
SetCedarCertAndChain(c, server_x, server_k, NULL);
}
void SetCedarCertAndChain(CEDAR *c, X *server_x, K *server_k, LIST *server_chain)
{ {
// Validate arguments // Validate arguments
if (server_x == NULL || server_k == NULL) if (server_x == NULL || server_k == NULL)
@@ -1405,8 +1482,14 @@ void SetCedarCert(CEDAR *c, X *server_x, K *server_k)
FreeK(c->ServerK); FreeK(c->ServerK);
} }
if (c->ServerChain != NULL)
{
FreeXList(c->ServerChain);
}
c->ServerX = CloneX(server_x); c->ServerX = CloneX(server_x);
c->ServerK = CloneK(server_k); c->ServerK = CloneK(server_k);
c->ServerChain = CloneXList(server_chain);
} }
Unlock(c->lock); Unlock(c->lock);
} }
@@ -1550,11 +1633,14 @@ CEDAR *NewCedar(X *server_x, K *server_k)
#endif // ALPHA_VERSION #endif // ALPHA_VERSION
ToStr(tmp2, c->Beta); ToStr(tmp2, c->Beta);
Format(tmp2, sizeof(tmp2), " %s %s ", beta_str, tmp2);
Format(tmp, sizeof(tmp), "Version %u.%02u Build %u %s %s (%s)", Format(tmp, sizeof(tmp),
"Version %u.%02u Build %u"
"%s" // Alpha, Beta, Release Candidate or nothing
"(%s)", // Language
CEDAR_VERSION_MAJOR, CEDAR_VERSION_MINOR, CEDAR_VERSION_BUILD, CEDAR_VERSION_MAJOR, CEDAR_VERSION_MINOR, CEDAR_VERSION_BUILD,
c->Beta == 0 ? "" : beta_str, c->Beta == 0 ? " " : tmp2,
c->Beta == 0 ? "" : tmp2,
_SS("LANGSTR")); _SS("LANGSTR"));
Trim(tmp); Trim(tmp);
+12
View File
@@ -366,6 +366,7 @@
#define AUTHTYPE_ROOTCERT 3 // Root certificate which is issued by trusted Certificate Authority #define AUTHTYPE_ROOTCERT 3 // Root certificate which is issued by trusted Certificate Authority
#define AUTHTYPE_RADIUS 4 // Radius authentication #define AUTHTYPE_RADIUS 4 // Radius authentication
#define AUTHTYPE_NT 5 // Windows NT authentication #define AUTHTYPE_NT 5 // Windows NT authentication
#define AUTHTYPE_EXTERNAL 96 // External authentication (completed)
#define AUTHTYPE_WIREGUARD_KEY 97 // WireGuard public key authentication #define AUTHTYPE_WIREGUARD_KEY 97 // WireGuard public key authentication
#define AUTHTYPE_OPENVPN_CERT 98 // TLS client certificate authentication #define AUTHTYPE_OPENVPN_CERT 98 // TLS client certificate authentication
#define AUTHTYPE_TICKET 99 // Ticket authentication #define AUTHTYPE_TICKET 99 // Ticket authentication
@@ -675,6 +676,9 @@
// //
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
#define UNIX_VLAN_CLIENT_IFACE_PREFIX "vpn" // Prefix of UNIX virtual LAN card interface (used for client)
#define UNIX_VLAN_BRIDGE_IFACE_PREFIX "tap" // Prefix of UNIX virtual LAN card interface (used for bridge destination)
#ifndef UNIX_BSD #ifndef UNIX_BSD
#define TAP_FILENAME_1 "/dev/net/tun" #define TAP_FILENAME_1 "/dev/net/tun"
#define TAP_FILENAME_2 "/dev/tun" #define TAP_FILENAME_2 "/dev/tun"
@@ -869,6 +873,10 @@
#define ERR_VPNGATE_INCLIENT_CANT_STOP 146 // Can not be stopped if operating within VPN Client mode #define ERR_VPNGATE_INCLIENT_CANT_STOP 146 // Can not be stopped if operating within VPN Client mode
#define ERR_NOT_SUPPORTED_FUNCTION_ON_OPENSOURCE 147 // It is a feature that is not supported in the open source version #define ERR_NOT_SUPPORTED_FUNCTION_ON_OPENSOURCE 147 // It is a feature that is not supported in the open source version
#define ERR_SUSPENDING 148 // System is suspending #define ERR_SUSPENDING 148 // System is suspending
#define ERR_HOSTNAME_MISMATCH 149 // SSL hostname mismatch
#define ERR_SSL_PROTOCOL_VERSION 150 // SSL version not supported
#define ERR_SSL_SHARED_CIPHER 151 // Can't find common cipher
#define ERR_SSL_HANDSHAKE 152 // Other SSL handshake error
//////////////////////////// ////////////////////////////
@@ -930,6 +938,7 @@ struct CEDAR
COUNTER *ConnectionIncrement; // Connection increment counter COUNTER *ConnectionIncrement; // Connection increment counter
X *ServerX; // Server certificate X *ServerX; // Server certificate
K *ServerK; // Private key of the server certificate K *ServerK; // Private key of the server certificate
LIST *ServerChain; // Server trust chain
char UsernameHubSeparator; // Character which separates the username from the hub name char UsernameHubSeparator; // Character which separates the username from the hub name
char *CipherList; // List of encryption algorithms char *CipherList; // List of encryption algorithms
UINT Version; // Version information UINT Version; // Version information
@@ -1000,6 +1009,7 @@ CEDAR *NewCedar(X *server_x, K *server_k);
void CedarForceLink(); void CedarForceLink();
void SetCedarVpnBridge(CEDAR *c); void SetCedarVpnBridge(CEDAR *c);
void SetCedarCert(CEDAR *c, X *server_x, K *server_k); void SetCedarCert(CEDAR *c, X *server_x, K *server_k);
void SetCedarCertAndChain(CEDAR *c, X *server_x, K *server_k, LIST *server_chain);
void ReleaseCedar(CEDAR *c); void ReleaseCedar(CEDAR *c);
void CleanupCedar(CEDAR *c); void CleanupCedar(CEDAR *c);
void StopCedar(CEDAR *c); void StopCedar(CEDAR *c);
@@ -1012,6 +1022,7 @@ void DelHubEx(CEDAR *c, HUB *h, bool no_lock);
void StopAllHub(CEDAR *c); void StopAllHub(CEDAR *c);
void StopAllConnection(CEDAR *c); void StopAllConnection(CEDAR *c);
void AddConnection(CEDAR *cedar, CONNECTION *c); void AddConnection(CEDAR *cedar, CONNECTION *c);
UINT GetUnestablishedConnections(CEDAR *cedar);
void DelConnection(CEDAR *cedar, CONNECTION *c); void DelConnection(CEDAR *cedar, CONNECTION *c);
void SetCedarCipherList(CEDAR *cedar, char *name); void SetCedarCipherList(CEDAR *cedar, char *name);
void InitCedar(); void InitCedar();
@@ -1036,6 +1047,7 @@ bool AddNoSsl(CEDAR *c, IP *ip);
void DecrementNoSsl(CEDAR *c, IP *ip, UINT num_dec); void DecrementNoSsl(CEDAR *c, IP *ip, UINT num_dec);
void DeleteOldNoSsl(CEDAR *c); void DeleteOldNoSsl(CEDAR *c);
NON_SSL *SearchNoSslList(CEDAR *c, IP *ip); NON_SSL *SearchNoSslList(CEDAR *c, IP *ip);
bool IsInNoSsl(CEDAR *c, IP *ip);
void FreeTinyLog(TINY_LOG *t); void FreeTinyLog(TINY_LOG *t);
void WriteTinyLog(TINY_LOG *t, char *str); void WriteTinyLog(TINY_LOG *t, char *str);
TINY_LOG *NewTinyLog(); TINY_LOG *NewTinyLog();
+136 -39
View File
@@ -22,6 +22,9 @@
#include "VLanWin32.h" #include "VLanWin32.h"
#include "Win32Com.h" #include "Win32Com.h"
#include "WinUi.h" #include "WinUi.h"
#ifdef NO_VLAN
#include "NullLan.h"
#endif
#include "Mayaqua/Cfg.h" #include "Mayaqua/Cfg.h"
#include "Mayaqua/Encrypt.h" #include "Mayaqua/Encrypt.h"
@@ -1957,6 +1960,7 @@ RPC_CLIENT_CREATE_ACCOUNT *CiCfgToAccount(BUF *b)
t->StartupAccount = a->StartupAccount; t->StartupAccount = a->StartupAccount;
t->CheckServerCert = a->CheckServerCert; t->CheckServerCert = a->CheckServerCert;
t->RetryOnServerCert = a->RetryOnServerCert; t->RetryOnServerCert = a->RetryOnServerCert;
t->AddDefaultCA = a->AddDefaultCA;
t->ServerCert = a->ServerCert; t->ServerCert = a->ServerCert;
Free(a); Free(a);
@@ -1981,6 +1985,7 @@ BUF *CiAccountToCfg(RPC_CLIENT_CREATE_ACCOUNT *t)
a.ClientAuth = t->ClientAuth; a.ClientAuth = t->ClientAuth;
a.CheckServerCert = t->CheckServerCert; a.CheckServerCert = t->CheckServerCert;
a.RetryOnServerCert = t->RetryOnServerCert; a.RetryOnServerCert = t->RetryOnServerCert;
a.AddDefaultCA = t->AddDefaultCA;
a.ServerCert = t->ServerCert; a.ServerCert = t->ServerCert;
a.StartupAccount = t->StartupAccount; a.StartupAccount = t->StartupAccount;
@@ -4315,6 +4320,13 @@ void InRpcClientOption(CLIENT_OPTION *c, PACK *p)
PackGetUniStr(p, "AccountName", c->AccountName, sizeof(c->AccountName)); PackGetUniStr(p, "AccountName", c->AccountName, sizeof(c->AccountName));
PackGetStr(p, "Hostname", c->Hostname, sizeof(c->Hostname)); PackGetStr(p, "Hostname", c->Hostname, sizeof(c->Hostname));
// Extract hint string from hostname
UINT i = SearchStrEx(c->Hostname, "/", 0, false);
if (i != INFINITE)
{
StrCpy(c->HintStr, sizeof(c->HintStr), c->Hostname + i + 1);
c->Hostname[i] = 0;
}
c->Port = PackGetInt(p, "Port"); c->Port = PackGetInt(p, "Port");
c->PortUDP = PackGetInt(p, "PortUDP"); c->PortUDP = PackGetInt(p, "PortUDP");
c->ProxyType = PackGetInt(p, "ProxyType"); c->ProxyType = PackGetInt(p, "ProxyType");
@@ -4333,6 +4345,9 @@ void InRpcClientOption(CLIENT_OPTION *c, PACK *p)
PackGetStr(p, "CustomHttpHeader", c->CustomHttpHeader, sizeof(c->CustomHttpHeader)); PackGetStr(p, "CustomHttpHeader", c->CustomHttpHeader, sizeof(c->CustomHttpHeader));
PackGetStr(p, "HubName", c->HubName, sizeof(c->HubName)); PackGetStr(p, "HubName", c->HubName, sizeof(c->HubName));
PackGetStr(p, "DeviceName", c->DeviceName, sizeof(c->DeviceName)); PackGetStr(p, "DeviceName", c->DeviceName, sizeof(c->DeviceName));
PackGetIp(p, "BindLocalIP", &c->BindLocalIP);// Source IP address for outgoing connection
c->BindLocalPort = PackGetInt(p, "BindLocalPort");// Source port nubmer for outgoing connection
c->UseEncrypt = PackGetInt(p, "UseEncrypt") ? true : false; c->UseEncrypt = PackGetInt(p, "UseEncrypt") ? true : false;
c->UseCompress = PackGetInt(p, "UseCompress") ? true : false; c->UseCompress = PackGetInt(p, "UseCompress") ? true : false;
c->HalfConnection = PackGetInt(p, "HalfConnection") ? true : false; c->HalfConnection = PackGetInt(p, "HalfConnection") ? true : false;
@@ -4352,7 +4367,20 @@ void OutRpcClientOption(PACK *p, CLIENT_OPTION *c)
} }
PackAddUniStr(p, "AccountName", c->AccountName); PackAddUniStr(p, "AccountName", c->AccountName);
PackAddStr(p, "Hostname", c->Hostname); // Append hint string to hostname
if (IsEmptyStr(c->HintStr))
{
// No hint
PackAddStr(p, "Hostname", c->Hostname);
}
else
{
char hostname[MAX_SIZE];
StrCpy(hostname, sizeof(hostname), c->Hostname);
StrCat(hostname, sizeof(hostname), "/");
StrCat(hostname, sizeof(hostname), c->HintStr);
PackAddStr(p, "Hostname", hostname);
}
PackAddStr(p, "ProxyName", c->ProxyName); PackAddStr(p, "ProxyName", c->ProxyName);
PackAddStr(p, "ProxyUsername", c->ProxyUsername); PackAddStr(p, "ProxyUsername", c->ProxyUsername);
PackAddStr(p, "ProxyPassword", c->ProxyPassword); PackAddStr(p, "ProxyPassword", c->ProxyPassword);
@@ -4380,6 +4408,8 @@ void OutRpcClientOption(PACK *p, CLIENT_OPTION *c)
PackAddBool(p, "FromAdminPack", c->FromAdminPack); PackAddBool(p, "FromAdminPack", c->FromAdminPack);
PackAddBool(p, "NoUdpAcceleration", c->NoUdpAcceleration); PackAddBool(p, "NoUdpAcceleration", c->NoUdpAcceleration);
PackAddData(p, "HostUniqueKey", c->HostUniqueKey, SHA1_SIZE); PackAddData(p, "HostUniqueKey", c->HostUniqueKey, SHA1_SIZE);
PackAddIp(p, "BindLocalIP", &c->BindLocalIP);// Source IP address for outgoing connection
PackAddInt(p, "BindLocalPort", c->BindLocalPort);// Source port number for outgoing connection
} }
// CLIENT_AUTH // CLIENT_AUTH
@@ -4522,6 +4552,7 @@ void InRpcClientCreateAccount(RPC_CLIENT_CREATE_ACCOUNT *c, PACK *p)
c->StartupAccount = PackGetInt(p, "StartupAccount") ? true : false; c->StartupAccount = PackGetInt(p, "StartupAccount") ? true : false;
c->CheckServerCert = PackGetInt(p, "CheckServerCert") ? true : false; c->CheckServerCert = PackGetInt(p, "CheckServerCert") ? true : false;
c->RetryOnServerCert = PackGetInt(p, "RetryOnServerCert") ? true : false; c->RetryOnServerCert = PackGetInt(p, "RetryOnServerCert") ? true : false;
c->AddDefaultCA = PackGetInt(p, "AddDefaultCA") ? true : false;
b = PackGetBuf(p, "ServerCert"); b = PackGetBuf(p, "ServerCert");
if (b != NULL) if (b != NULL)
{ {
@@ -4545,6 +4576,7 @@ void OutRpcClientCreateAccount(PACK *p, RPC_CLIENT_CREATE_ACCOUNT *c)
PackAddInt(p, "StartupAccount", c->StartupAccount); PackAddInt(p, "StartupAccount", c->StartupAccount);
PackAddInt(p, "CheckServerCert", c->CheckServerCert); PackAddInt(p, "CheckServerCert", c->CheckServerCert);
PackAddInt(p, "RetryOnServerCert", c->RetryOnServerCert); PackAddInt(p, "RetryOnServerCert", c->RetryOnServerCert);
PackAddInt(p, "AddDefaultCA", c->AddDefaultCA);
if (c->ServerCert != NULL) if (c->ServerCert != NULL)
{ {
b = XToBuf(c->ServerCert, false); b = XToBuf(c->ServerCert, false);
@@ -4695,6 +4727,7 @@ void InRpcClientGetAccount(RPC_CLIENT_GET_ACCOUNT *c, PACK *p)
c->StartupAccount = PackGetInt(p, "StartupAccount") ? true : false; c->StartupAccount = PackGetInt(p, "StartupAccount") ? true : false;
c->CheckServerCert = PackGetInt(p, "CheckServerCert") ? true : false; c->CheckServerCert = PackGetInt(p, "CheckServerCert") ? true : false;
c->RetryOnServerCert = PackGetInt(p, "RetryOnServerCert") ? true : false; c->RetryOnServerCert = PackGetInt(p, "RetryOnServerCert") ? true : false;
c->AddDefaultCA = PackGetInt(p, "AddDefaultCA") ? true : false;
b = PackGetBuf(p, "ServerCert"); b = PackGetBuf(p, "ServerCert");
if (b != NULL) if (b != NULL)
{ {
@@ -4724,6 +4757,7 @@ void OutRpcClientGetAccount(PACK *p, RPC_CLIENT_GET_ACCOUNT *c)
PackAddInt(p, "StartupAccount", c->StartupAccount); PackAddInt(p, "StartupAccount", c->StartupAccount);
PackAddInt(p, "CheckServerCert", c->CheckServerCert); PackAddInt(p, "CheckServerCert", c->CheckServerCert);
PackAddInt(p, "RetryOnServerCert", c->RetryOnServerCert); PackAddInt(p, "RetryOnServerCert", c->RetryOnServerCert);
PackAddInt(p, "AddDefaultCA", c->AddDefaultCA);
if (c->ServerCert != NULL) if (c->ServerCert != NULL)
{ {
@@ -4810,6 +4844,7 @@ void InRpcClientGetConnectionStatus(RPC_CLIENT_GET_CONNECTION_STATUS *s, PACK *p
PackGetStr(p, "ServerName", s->ServerName, sizeof(s->ServerName)); PackGetStr(p, "ServerName", s->ServerName, sizeof(s->ServerName));
PackGetStr(p, "ServerProductName", s->ServerProductName, sizeof(s->ServerProductName)); PackGetStr(p, "ServerProductName", s->ServerProductName, sizeof(s->ServerProductName));
PackGetStr(p, "ProtocolVersion", s->ProtocolName, sizeof(s->ProtocolName));
PackGetStr(p, "CipherName", s->CipherName, sizeof(s->CipherName)); PackGetStr(p, "CipherName", s->CipherName, sizeof(s->CipherName));
PackGetStr(p, "SessionName", s->SessionName, sizeof(s->SessionName)); PackGetStr(p, "SessionName", s->SessionName, sizeof(s->SessionName));
PackGetStr(p, "ConnectionName", s->ConnectionName, sizeof(s->ConnectionName)); PackGetStr(p, "ConnectionName", s->ConnectionName, sizeof(s->ConnectionName));
@@ -4846,6 +4881,7 @@ void InRpcClientGetConnectionStatus(RPC_CLIENT_GET_CONNECTION_STATUS *s, PACK *p
s->UseCompress = PackGetInt(p, "UseCompress") ? true : false; s->UseCompress = PackGetInt(p, "UseCompress") ? true : false;
s->IsRUDPSession = PackGetInt(p, "IsRUDPSession") ? true : false; s->IsRUDPSession = PackGetInt(p, "IsRUDPSession") ? true : false;
PackGetStr(p, "UnderlayProtocol", s->UnderlayProtocol, sizeof(s->UnderlayProtocol)); PackGetStr(p, "UnderlayProtocol", s->UnderlayProtocol, sizeof(s->UnderlayProtocol));
PackGetStr(p, "ProtocolDetails", s->ProtocolDetails, sizeof(s->ProtocolDetails));
s->IsUdpAccelerationEnabled = PackGetInt(p, "IsUdpAccelerationEnabled") ? true : false; s->IsUdpAccelerationEnabled = PackGetInt(p, "IsUdpAccelerationEnabled") ? true : false;
s->IsUsingUdpAcceleration = PackGetInt(p, "IsUsingUdpAcceleration") ? true : false; s->IsUsingUdpAcceleration = PackGetInt(p, "IsUsingUdpAcceleration") ? true : false;
@@ -4885,6 +4921,7 @@ void OutRpcClientGetConnectionStatus(PACK *p, RPC_CLIENT_GET_CONNECTION_STATUS *
PackAddStr(p, "ServerName", c->ServerName); PackAddStr(p, "ServerName", c->ServerName);
PackAddStr(p, "ServerProductName", c->ServerProductName); PackAddStr(p, "ServerProductName", c->ServerProductName);
PackAddStr(p, "ProtocolVersion", c->ProtocolName);
PackAddStr(p, "CipherName", c->CipherName); PackAddStr(p, "CipherName", c->CipherName);
PackAddStr(p, "SessionName", c->SessionName); PackAddStr(p, "SessionName", c->SessionName);
PackAddStr(p, "ConnectionName", c->ConnectionName); PackAddStr(p, "ConnectionName", c->ConnectionName);
@@ -4908,6 +4945,7 @@ void OutRpcClientGetConnectionStatus(PACK *p, RPC_CLIENT_GET_CONNECTION_STATUS *
PackAddBool(p, "UseCompress", c->UseCompress); PackAddBool(p, "UseCompress", c->UseCompress);
PackAddBool(p, "IsRUDPSession", c->IsRUDPSession); PackAddBool(p, "IsRUDPSession", c->IsRUDPSession);
PackAddStr(p, "UnderlayProtocol", c->UnderlayProtocol); PackAddStr(p, "UnderlayProtocol", c->UnderlayProtocol);
PackAddStr(p, "ProtocolDetails", c->ProtocolDetails);
PackAddBool(p, "IsUdpAccelerationEnabled", c->IsUdpAccelerationEnabled); PackAddBool(p, "IsUdpAccelerationEnabled", c->IsUdpAccelerationEnabled);
PackAddBool(p, "IsUsingUdpAcceleration", c->IsUsingUdpAcceleration); PackAddBool(p, "IsUsingUdpAcceleration", c->IsUsingUdpAcceleration);
@@ -5117,6 +5155,22 @@ void CiRpcAccepted(CLIENT *c, SOCK *s)
retcode = 0; retcode = 0;
} }
if (retcode == 0)
{
if (IsLocalHostIP(&s->RemoteIP) == false)
{
// If the RPC client is from network check whether the password is empty
UCHAR empty_password_hash[20];
Sha0(empty_password_hash, "", 0);
if (Cmp(empty_password_hash, hashed_password, SHA1_SIZE) == 0 ||
IsZero(hashed_password, SHA1_SIZE))
{
// Regard it as incorrect password
retcode = 1;
}
}
}
Lock(c->lock); Lock(c->lock);
{ {
if (c->Config.AllowRemoteConfig == false) if (c->Config.AllowRemoteConfig == false)
@@ -5220,14 +5274,21 @@ void CiRpcServerThread(THREAD *thread, void *param)
// Open the port // Open the port
listener = NULL; listener = NULL;
for (i = CLIENT_CONFIG_PORT;i < (CLIENT_CONFIG_PORT + 5);i++) if (c->Config.DisableRpcDynamicPortListener == false)
{ {
listener = Listen(i); for (i = CLIENT_CONFIG_PORT;i < (CLIENT_CONFIG_PORT + 5);i++)
if (listener != NULL)
{ {
break; listener = ListenEx(i, !c->Config.AllowRemoteConfig);
if (listener != NULL)
{
break;
}
} }
} }
else
{
listener = ListenEx(CLIENT_CONFIG_PORT, !c->Config.AllowRemoteConfig);
}
if (listener == NULL) if (listener == NULL)
{ {
@@ -5410,7 +5471,7 @@ NOTIFY_CLIENT *CcConnectNotify(REMOTE_CLIENT *rc)
NOTIFY_CLIENT *n; NOTIFY_CLIENT *n;
SOCK *s; SOCK *s;
char tmp[MAX_SIZE]; char tmp[MAX_SIZE];
bool rpc_mode = false; UINT rpc_mode = 0;
UINT port; UINT port;
// Validate arguments // Validate arguments
if (rc == NULL || rc->Rpc == NULL || rc->Rpc->Sock == NULL) if (rc == NULL || rc->Rpc == NULL || rc->Rpc->Sock == NULL)
@@ -5838,6 +5899,7 @@ void CiGetSessionStatus(RPC_CLIENT_GET_CONNECTION_STATUS *st, SESSION *s)
if (st->UseEncrypt) if (st->UseEncrypt)
{ {
StrCpy(st->CipherName, sizeof(st->CipherName), s->Connection->CipherName); StrCpy(st->CipherName, sizeof(st->CipherName), s->Connection->CipherName);
StrCpy(st->ProtocolName, sizeof(st->ProtocolName), s->Connection->SslVersion);
} }
// Use of compression // Use of compression
st->UseCompress = s->UseCompress; st->UseCompress = s->UseCompress;
@@ -6447,9 +6509,9 @@ bool CtConnect(CLIENT *c, RPC_CLIENT_CONNECT *connect)
// Register a procedure for secure device authentication // Register a procedure for secure device authentication
r->ClientAuth->SecureSignProc = CiSecureSignProc; r->ClientAuth->SecureSignProc = CiSecureSignProc;
} }
else if (r->ClientAuth->AuthType == CLIENT_AUTHTYPE_OPENSSLENGINE) else if (r->ClientAuth->AuthType == CLIENT_AUTHTYPE_OPENSSLENGINE)
{ {
/* r->ClientAuth->ClientK = OpensslEngineToK("asdf"); */ /* r->ClientAuth->ClientK = OpensslEngineToK("asdf"); */
r->ClientAuth->SecureSignProc = NULL; r->ClientAuth->SecureSignProc = NULL;
} }
else else
@@ -6493,9 +6555,7 @@ bool CtConnect(CLIENT *c, RPC_CLIENT_CONNECT *connect)
// Requires account and VLan lists of the CLIENT argument to be already locked // Requires account and VLan lists of the CLIENT argument to be already locked
bool CtVLansDown(CLIENT *c) bool CtVLansDown(CLIENT *c)
{ {
#ifndef UNIX_LINUX #if defined(UNIX_LINUX) || defined(UNIX_BSD)
return true;
#else
int i; int i;
LIST *tmpVLanList; LIST *tmpVLanList;
UNIX_VLAN t, *r; UNIX_VLAN t, *r;
@@ -6537,6 +6597,8 @@ bool CtVLansDown(CLIENT *c)
ReleaseList(tmpVLanList); ReleaseList(tmpVLanList);
return result; return result;
#else
return true;
#endif #endif
} }
@@ -6544,9 +6606,7 @@ bool CtVLansDown(CLIENT *c)
// Requires VLan list of the CLIENT argument to be already locked // Requires VLan list of the CLIENT argument to be already locked
bool CtVLansUp(CLIENT *c) bool CtVLansUp(CLIENT *c)
{ {
#ifndef UNIX_LINUX #if defined(UNIX_LINUX) || defined(UNIX_BSD)
return true;
#else
int i; int i;
UNIX_VLAN *r; UNIX_VLAN *r;
@@ -6560,9 +6620,8 @@ bool CtVLansUp(CLIENT *c)
r = LIST_DATA(c->UnixVLanList, i); r = LIST_DATA(c->UnixVLanList, i);
UnixVLanSetState(r->Name, true); UnixVLanSetState(r->Name, true);
} }
return true;
#endif #endif
return true;
} }
// Get the account information // Get the account information
@@ -6597,6 +6656,9 @@ bool CtGetAccount(CLIENT *c, RPC_CLIENT_GET_ACCOUNT *a)
Lock(r->lock); Lock(r->lock);
{ {
// Copy account name (restore the correct case)
UniStrCpy(a->AccountName, sizeof(a->AccountName), r->ClientOption->AccountName);
// Copy the client option // Copy the client option
if (a->ClientOption != NULL) if (a->ClientOption != NULL)
{ {
@@ -6616,6 +6678,7 @@ bool CtGetAccount(CLIENT *c, RPC_CLIENT_GET_ACCOUNT *a)
a->CheckServerCert = r->CheckServerCert; a->CheckServerCert = r->CheckServerCert;
a->RetryOnServerCert = r->RetryOnServerCert; a->RetryOnServerCert = r->RetryOnServerCert;
a->AddDefaultCA = r->AddDefaultCA;
a->ServerCert = NULL; a->ServerCert = NULL;
if (r->ServerCert != NULL) if (r->ServerCert != NULL)
{ {
@@ -7027,6 +7090,12 @@ bool CtEnumAccount(CLIENT *c, RPC_CLIENT_ENUM_ACCOUNT *e)
// Server name // Server name
StrCpy(item->ServerName, sizeof(item->ServerName), a->ClientOption->Hostname); StrCpy(item->ServerName, sizeof(item->ServerName), a->ClientOption->Hostname);
// Append hint string to hostname
if (IsEmptyStr(a->ClientOption->HintStr) == false)
{
StrCat(item->ServerName, sizeof(item->ServerName), "/");
StrCat(item->ServerName, sizeof(item->ServerName), a->ClientOption->HintStr);
}
// Proxy type // Proxy type
item->ProxyType = a->ClientOption->ProxyType; item->ProxyType = a->ClientOption->ProxyType;
@@ -7109,14 +7178,6 @@ bool CtSetAccount(CLIENT *c, RPC_CLIENT_CREATE_ACCOUNT *a, bool inner)
} }
} }
if (a->ServerCert != NULL && a->ServerCert->is_compatible_bit == false)
{
// Server certificate is invalid
UnlockList(c->AccountList);
CiSetError(c, ERR_NOT_RSA_1024);
return false;
}
Lock(ret->lock); Lock(ret->lock);
{ {
@@ -7152,6 +7213,7 @@ bool CtSetAccount(CLIENT *c, RPC_CLIENT_CREATE_ACCOUNT *a, bool inner)
ret->CheckServerCert = a->CheckServerCert; ret->CheckServerCert = a->CheckServerCert;
ret->RetryOnServerCert = a->RetryOnServerCert; ret->RetryOnServerCert = a->RetryOnServerCert;
ret->AddDefaultCA = a->AddDefaultCA;
if (a->ServerCert != NULL) if (a->ServerCert != NULL)
{ {
@@ -7236,14 +7298,6 @@ bool CtCreateAccount(CLIENT *c, RPC_CLIENT_CREATE_ACCOUNT *a, bool inner)
} }
} }
if (a->ServerCert != NULL && a->ServerCert->is_compatible_bit == false)
{
// The server certificate is invalid
UnlockList(c->AccountList);
CiSetError(c, ERR_NOT_RSA_1024);
return false;
}
// Add a new account // Add a new account
new_account = ZeroMalloc(sizeof(ACCOUNT)); new_account = ZeroMalloc(sizeof(ACCOUNT));
new_account->lock = NewLock(); new_account->lock = NewLock();
@@ -7259,6 +7313,7 @@ bool CtCreateAccount(CLIENT *c, RPC_CLIENT_CREATE_ACCOUNT *a, bool inner)
new_account->CheckServerCert = a->CheckServerCert; new_account->CheckServerCert = a->CheckServerCert;
new_account->RetryOnServerCert = a->RetryOnServerCert; new_account->RetryOnServerCert = a->RetryOnServerCert;
new_account->AddDefaultCA = a->AddDefaultCA;
if (a->ServerCert != NULL) if (a->ServerCert != NULL)
{ {
new_account->ServerCert = CloneX(a->ServerCert); new_account->ServerCert = CloneX(a->ServerCert);
@@ -8536,12 +8591,6 @@ bool CtAddCa(CLIENT *c, RPC_CERT *cert)
return false; return false;
} }
if (cert->x->is_compatible_bit == false)
{
CiSetError(c, ERR_NOT_RSA_1024);
return false;
}
AddCa(c->Cedar, cert->x); AddCa(c->Cedar, cert->x);
CiSaveConfigurationFile(c); CiSaveConfigurationFile(c);
@@ -9002,6 +9051,12 @@ void CiInitConfiguration(CLIENT *c)
c->Config.UseKeepConnect = false; // Don't use the connection maintenance function by default in the Client c->Config.UseKeepConnect = false; // Don't use the connection maintenance function by default in the Client
// Eraser // Eraser
c->Eraser = NewEraser(c->Logger, 0); c->Eraser = NewEraser(c->Logger, 0);
#ifdef OS_WIN32
c->Config.DisableRpcDynamicPortListener = false;
#else // OS_WIN32
c->Config.DisableRpcDynamicPortListener = true;
#endif // OS_WIN32
} }
else else
{ {
@@ -9148,6 +9203,19 @@ void CiLoadClientConfig(CLIENT_CONFIG *c, FOLDER *f)
c->AllowRemoteConfig = CfgGetBool(f, "AllowRemoteConfig"); c->AllowRemoteConfig = CfgGetBool(f, "AllowRemoteConfig");
c->KeepConnectInterval = MAKESURE(CfgGetInt(f, "KeepConnectInterval"), KEEP_INTERVAL_MIN, KEEP_INTERVAL_MAX); c->KeepConnectInterval = MAKESURE(CfgGetInt(f, "KeepConnectInterval"), KEEP_INTERVAL_MIN, KEEP_INTERVAL_MAX);
c->NoChangeWcmNetworkSettingOnWindows8 = CfgGetBool(f, "NoChangeWcmNetworkSettingOnWindows8"); c->NoChangeWcmNetworkSettingOnWindows8 = CfgGetBool(f, "NoChangeWcmNetworkSettingOnWindows8");
if (CfgIsItem(f, "DisableRpcDynamicPortListener"))
{
c->DisableRpcDynamicPortListener = CfgGetBool(f, "DisableRpcDynamicPortListener");
}
else
{
#ifdef OS_WIN32
c->DisableRpcDynamicPortListener = false;
#else // OS_WIN32
c->DisableRpcDynamicPortListener = true;
#endif // OS_WIN32
}
} }
// Read the client authentication data // Read the client authentication data
@@ -9241,6 +9309,13 @@ CLIENT_OPTION *CiLoadClientOption(FOLDER *f)
CfgGetUniStr(f, "AccountName", o->AccountName, sizeof(o->AccountName)); CfgGetUniStr(f, "AccountName", o->AccountName, sizeof(o->AccountName));
CfgGetStr(f, "Hostname", o->Hostname, sizeof(o->Hostname)); CfgGetStr(f, "Hostname", o->Hostname, sizeof(o->Hostname));
// Extract hint string from hostname
UINT i = SearchStrEx(o->Hostname, "/", 0, false);
if (i != INFINITE)
{
StrCpy(o->HintStr, sizeof(o->HintStr), o->Hostname + i + 1);
o->Hostname[i] = 0;
}
o->Port = CfgGetInt(f, "Port"); o->Port = CfgGetInt(f, "Port");
o->PortUDP = CfgGetInt(f, "PortUDP"); o->PortUDP = CfgGetInt(f, "PortUDP");
o->ProxyType = CfgGetInt(f, "ProxyType"); o->ProxyType = CfgGetInt(f, "ProxyType");
@@ -9271,6 +9346,8 @@ CLIENT_OPTION *CiLoadClientOption(FOLDER *f)
o->DisableQoS = CfgGetBool(f, "DisableQoS"); o->DisableQoS = CfgGetBool(f, "DisableQoS");
o->FromAdminPack = CfgGetBool(f, "FromAdminPack"); o->FromAdminPack = CfgGetBool(f, "FromAdminPack");
o->NoUdpAcceleration = CfgGetBool(f, "NoUdpAcceleration"); o->NoUdpAcceleration = CfgGetBool(f, "NoUdpAcceleration");
CfgGetIp(f, "BindLocalIP", &o->BindLocalIP);// Source IP address for outgoing connection
o->BindLocalPort = CfgGetInt(f, "BindLocalPort");// Source port number for outgoing connection
b = CfgGetBuf(f, "HostUniqueKey"); b = CfgGetBuf(f, "HostUniqueKey");
if (b != NULL) if (b != NULL)
@@ -9322,6 +9399,7 @@ ACCOUNT *CiLoadClientAccount(FOLDER *f)
a->StartupAccount = CfgGetBool(f, "StartupAccount"); a->StartupAccount = CfgGetBool(f, "StartupAccount");
a->CheckServerCert = CfgGetBool(f, "CheckServerCert"); a->CheckServerCert = CfgGetBool(f, "CheckServerCert");
a->RetryOnServerCert = CfgGetBool(f, "RetryOnServerCert"); a->RetryOnServerCert = CfgGetBool(f, "RetryOnServerCert");
a->AddDefaultCA = CfgGetBool(f, "AddDefaultCA");
a->CreateDateTime = CfgGetInt64(f, "CreateDateTime"); a->CreateDateTime = CfgGetInt64(f, "CreateDateTime");
a->UpdateDateTime = CfgGetInt64(f, "UpdateDateTime"); a->UpdateDateTime = CfgGetInt64(f, "UpdateDateTime");
a->LastConnectDateTime = CfgGetInt64(f, "LastConnectDateTime"); a->LastConnectDateTime = CfgGetInt64(f, "LastConnectDateTime");
@@ -9712,6 +9790,7 @@ void CiWriteClientConfig(FOLDER *cc, CLIENT_CONFIG *config)
CfgAddBool(cc, "AllowRemoteConfig", config->AllowRemoteConfig); CfgAddBool(cc, "AllowRemoteConfig", config->AllowRemoteConfig);
CfgAddInt(cc, "KeepConnectInterval", config->KeepConnectInterval); CfgAddInt(cc, "KeepConnectInterval", config->KeepConnectInterval);
CfgAddBool(cc, "NoChangeWcmNetworkSettingOnWindows8", config->NoChangeWcmNetworkSettingOnWindows8); CfgAddBool(cc, "NoChangeWcmNetworkSettingOnWindows8", config->NoChangeWcmNetworkSettingOnWindows8);
CfgAddBool(cc, "DisableRpcDynamicPortListener", config->DisableRpcDynamicPortListener);
} }
// Write the client authentication data // Write the client authentication data
@@ -9783,7 +9862,20 @@ void CiWriteClientOption(FOLDER *f, CLIENT_OPTION *o)
} }
CfgAddUniStr(f, "AccountName", o->AccountName); CfgAddUniStr(f, "AccountName", o->AccountName);
CfgAddStr(f, "Hostname", o->Hostname); // Append hint string to hostname
if (IsEmptyStr(o->HintStr))
{
// No hint
CfgAddStr(f, "Hostname", o->Hostname);
}
else
{
char hostname[MAX_SIZE];
StrCpy(hostname, sizeof(hostname), o->Hostname);
StrCat(hostname, sizeof(hostname), "/");
StrCat(hostname, sizeof(hostname), o->HintStr);
CfgAddStr(f, "Hostname", hostname);
}
CfgAddInt(f, "Port", o->Port); CfgAddInt(f, "Port", o->Port);
CfgAddInt(f, "PortUDP", o->PortUDP); CfgAddInt(f, "PortUDP", o->PortUDP);
CfgAddInt(f, "ProxyType", o->ProxyType); CfgAddInt(f, "ProxyType", o->ProxyType);
@@ -9811,6 +9903,8 @@ void CiWriteClientOption(FOLDER *f, CLIENT_OPTION *o)
CfgAddBool(f, "RequireBridgeRoutingMode", o->RequireBridgeRoutingMode); CfgAddBool(f, "RequireBridgeRoutingMode", o->RequireBridgeRoutingMode);
CfgAddBool(f, "DisableQoS", o->DisableQoS); CfgAddBool(f, "DisableQoS", o->DisableQoS);
CfgAddBool(f, "NoUdpAcceleration", o->NoUdpAcceleration); CfgAddBool(f, "NoUdpAcceleration", o->NoUdpAcceleration);
CfgAddIp(f, "BindLocalIP", &o->BindLocalIP);// Source IP address for outgoing connection
CfgAddInt(f, "BindLocalPort", o->BindLocalPort);// Source port number for outgoing connection
if (o->FromAdminPack) if (o->FromAdminPack)
{ {
@@ -9947,6 +10041,9 @@ void CiWriteAccountData(FOLDER *f, ACCOUNT *a)
// Retry on invalid server certificate flag // Retry on invalid server certificate flag
CfgAddBool(f, "RetryOnServerCert", a->RetryOnServerCert); CfgAddBool(f, "RetryOnServerCert", a->RetryOnServerCert);
// Add default SSL trust store
CfgAddBool(f, "AddDefaultCA", a->AddDefaultCA);
// Date and time // Date and time
CfgAddInt64(f, "CreateDateTime", a->CreateDateTime); CfgAddInt64(f, "CreateDateTime", a->CreateDateTime);
CfgAddInt64(f, "UpdateDateTime", a->UpdateDateTime); CfgAddInt64(f, "UpdateDateTime", a->UpdateDateTime);
+4
View File
@@ -61,6 +61,7 @@ struct ACCOUNT
CLIENT_AUTH *ClientAuth; // Client authentication data CLIENT_AUTH *ClientAuth; // Client authentication data
bool CheckServerCert; // Check the server certificate bool CheckServerCert; // Check the server certificate
bool RetryOnServerCert; // Retry on invalid server certificate bool RetryOnServerCert; // Retry on invalid server certificate
bool AddDefaultCA; // Use default trust store
X *ServerCert; // Server certificate X *ServerCert; // Server certificate
bool StartupAccount; // Start-up account bool StartupAccount; // Start-up account
UCHAR ShortcutKey[SHA1_SIZE]; // Key UCHAR ShortcutKey[SHA1_SIZE]; // Key
@@ -86,6 +87,7 @@ struct CLIENT_CONFIG
UINT KeepConnectProtocol; // Protocol UINT KeepConnectProtocol; // Protocol
UINT KeepConnectInterval; // Interval UINT KeepConnectInterval; // Interval
bool NoChangeWcmNetworkSettingOnWindows8; // Don't change the WCM network settings on Windows 8 bool NoChangeWcmNetworkSettingOnWindows8; // Don't change the WCM network settings on Windows 8
bool DisableRpcDynamicPortListener;
}; };
// Version acquisition // Version acquisition
@@ -239,6 +241,7 @@ struct RPC_CLIENT_CREATE_ACCOUNT
bool StartupAccount; // Startup account bool StartupAccount; // Startup account
bool CheckServerCert; // Checking of the server certificate bool CheckServerCert; // Checking of the server certificate
bool RetryOnServerCert; // Retry on invalid server certificate bool RetryOnServerCert; // Retry on invalid server certificate
bool AddDefaultCA; // Use default trust store
X *ServerCert; // Server certificate X *ServerCert; // Server certificate
UCHAR ShortcutKey[SHA1_SIZE]; // Shortcut Key UCHAR ShortcutKey[SHA1_SIZE]; // Shortcut Key
}; };
@@ -292,6 +295,7 @@ struct RPC_CLIENT_GET_ACCOUNT
bool StartupAccount; // Startup account bool StartupAccount; // Startup account
bool CheckServerCert; // Check the server certificate bool CheckServerCert; // Check the server certificate
bool RetryOnServerCert; // Retry on invalid server certificate bool RetryOnServerCert; // Retry on invalid server certificate
bool AddDefaultCA; // Use default trust store
X *ServerCert; // Server certificate X *ServerCert; // Server certificate
UCHAR ShortcutKey[SHA1_SIZE]; // Shortcut Key UCHAR ShortcutKey[SHA1_SIZE]; // Shortcut Key
UINT64 CreateDateTime; // Creation date and time (Ver 3.0 or later) UINT64 CreateDateTime; // Creation date and time (Ver 3.0 or later)
+551 -245
View File
File diff suppressed because it is too large Load Diff
+8
View File
@@ -236,6 +236,7 @@ bool CmdEvalPortList(CONSOLE *c, wchar_t *str, void *param);
wchar_t *PsClusterSettingMemberPromptPorts(CONSOLE *c, void *param); wchar_t *PsClusterSettingMemberPromptPorts(CONSOLE *c, void *param);
K *CmdLoadKey(CONSOLE *c, wchar_t *filename); K *CmdLoadKey(CONSOLE *c, wchar_t *filename);
bool CmdLoadCertAndKey(CONSOLE *c, X **xx, K **kk, wchar_t *cert_filename, wchar_t *key_filename); bool CmdLoadCertAndKey(CONSOLE *c, X **xx, K **kk, wchar_t *cert_filename, wchar_t *key_filename);
bool CmdLoadCertChainAndKey(CONSOLE *c, X **xx, K **kk, LIST **cc, wchar_t *cert_filename, wchar_t *key_filename);
bool CmdEvalTcpOrUdp(CONSOLE *c, wchar_t *str, void *param); bool CmdEvalTcpOrUdp(CONSOLE *c, wchar_t *str, void *param);
wchar_t *GetConnectionTypeStr(UINT type); wchar_t *GetConnectionTypeStr(UINT type);
bool CmdEvalHostAndSubnetMask4(CONSOLE *c, wchar_t *str, void *param); bool CmdEvalHostAndSubnetMask4(CONSOLE *c, wchar_t *str, void *param);
@@ -307,6 +308,8 @@ UINT PtConnect(CONSOLE *c, wchar_t *cmdline);
PT *NewPt(CONSOLE *c, wchar_t *cmdline); PT *NewPt(CONSOLE *c, wchar_t *cmdline);
void FreePt(PT *pt); void FreePt(PT *pt);
void PtMain(PT *pt); void PtMain(PT *pt);
UINT PtGenX25519(CONSOLE *c, char *cmd_name, wchar_t *str, void *param);
UINT PtGetPublicX25519(CONSOLE *c, char *cmd_name, wchar_t *str, void *param);
UINT PtMakeCert(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); UINT PtMakeCert(CONSOLE *c, char *cmd_name, wchar_t *str, void *param);
UINT PtMakeCert2048(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); UINT PtMakeCert2048(CONSOLE *c, char *cmd_name, wchar_t *str, void *param);
UINT PtTrafficClient(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); UINT PtTrafficClient(CONSOLE *c, char *cmd_name, wchar_t *str, void *param);
@@ -339,6 +342,7 @@ UINT PcNicDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param);
UINT PcNicList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); UINT PcNicList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param);
UINT PcAccountList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); UINT PcAccountList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param);
UINT PcAccountCreate(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); UINT PcAccountCreate(CONSOLE *c, char *cmd_name, wchar_t *str, void *param);
void SetRpcClientCreateAccountFromGetAccount(RPC_CLIENT_CREATE_ACCOUNT *c, RPC_CLIENT_GET_ACCOUNT *t);
UINT PcAccountSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); UINT PcAccountSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param);
UINT PcAccountGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); UINT PcAccountGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param);
UINT PcAccountDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); UINT PcAccountDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param);
@@ -362,6 +366,8 @@ UINT PcAccountServerCertEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *p
UINT PcAccountServerCertDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); UINT PcAccountServerCertDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param);
UINT PcAccountRetryOnServerCertEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); UINT PcAccountRetryOnServerCertEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param);
UINT PcAccountRetryOnServerCertDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); UINT PcAccountRetryOnServerCertDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param);
UINT PcAccountDefaultCAEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param);
UINT PcAccountDefaultCADisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param);
UINT PcAccountServerCertSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); UINT PcAccountServerCertSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param);
UINT PcAccountServerCertDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); UINT PcAccountServerCertDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param);
UINT PcAccountServerCertGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); UINT PcAccountServerCertGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param);
@@ -507,6 +513,8 @@ UINT PsCascadeProxySocks(CONSOLE *c, char *cmd_name, wchar_t *str, void *param);
UINT PsCascadeProxySocks5(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); UINT PsCascadeProxySocks5(CONSOLE *c, char *cmd_name, wchar_t *str, void *param);
UINT PsCascadeServerCertEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); UINT PsCascadeServerCertEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param);
UINT PsCascadeServerCertDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); UINT PsCascadeServerCertDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param);
UINT PsCascadeDefaultCAEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param);
UINT PsCascadeDefaultCADisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param);
UINT PsCascadeServerCertSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); UINT PsCascadeServerCertSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param);
UINT PsCascadeServerCertDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); UINT PsCascadeServerCertDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param);
UINT PsCascadeServerCertGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); UINT PsCascadeServerCertGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param);
+23 -4
View File
@@ -28,6 +28,7 @@
#include "Mayaqua/Object.h" #include "Mayaqua/Object.h"
#include "Mayaqua/Pack.h" #include "Mayaqua/Pack.h"
#include "Mayaqua/Str.h" #include "Mayaqua/Str.h"
#include "Mayaqua/Table.h"
#include "Mayaqua/Tick64.h" #include "Mayaqua/Tick64.h"
#include <stdlib.h> #include <stdlib.h>
@@ -909,20 +910,24 @@ void SendKeepAlive(CONNECTION *c, TCPSOCK *ts)
if (s->UseUdpAcceleration && udp_accel != NULL) if (s->UseUdpAcceleration && udp_accel != NULL)
{ {
UINT required_size = 0;
if (udp_accel->MyPortNatT != 0) if (udp_accel->MyPortNatT != 0)
{ {
size = MAX(size, (StrLen(UDP_NAT_T_PORT_SIGNATURE_IN_KEEP_ALIVE) + sizeof(USHORT))); required_size += StrLen(UDP_NAT_T_PORT_SIGNATURE_IN_KEEP_ALIVE) + sizeof(USHORT);
insert_natt_port = true; insert_natt_port = true;
} }
if (IsZeroIP(&udp_accel->MyIpNatT) == false) if (IsZeroIP(&udp_accel->MyIpNatT) == false)
{ {
size = MAX(size, (StrLen(UDP_NAT_T_IP_SIGNATURE_IN_KEEP_ALIVE) + sizeof(udp_accel->MyIpNatT.address))); required_size += StrLen(UDP_NAT_T_IP_SIGNATURE_IN_KEEP_ALIVE) + sizeof(udp_accel->MyIpNatT.address);
insert_natt_ip = true; insert_natt_ip = true;
} }
size = MAX(size, required_size);
} }
buf = MallocFast(size); buf = MallocFast(size);
@@ -2986,6 +2991,7 @@ void ConnectionAccept(CONNECTION *c)
SOCK *s; SOCK *s;
X *x; X *x;
K *k; K *k;
LIST *chain;
char tmp[128]; char tmp[128];
UINT initial_timeout = CONNECTING_TIMEOUT; UINT initial_timeout = CONNECTING_TIMEOUT;
UCHAR ctoken_hash[SHA1_SIZE]; UCHAR ctoken_hash[SHA1_SIZE];
@@ -3036,26 +3042,34 @@ void ConnectionAccept(CONNECTION *c)
x = CloneX(c->Cedar->ServerX); x = CloneX(c->Cedar->ServerX);
k = CloneK(c->Cedar->ServerK); k = CloneK(c->Cedar->ServerK);
chain = CloneXList(c->Cedar->ServerChain);
} }
Unlock(c->Cedar->lock); Unlock(c->Cedar->lock);
// Start the SSL communication // Start the SSL communication
Copy(&s->SslAcceptSettings, &c->Cedar->SslAcceptSettings, sizeof(SSL_ACCEPT_SETTINGS)); Copy(&s->SslAcceptSettings, &c->Cedar->SslAcceptSettings, sizeof(SSL_ACCEPT_SETTINGS));
if (StartSSL(s, x, k) == false) UINT ssl_err = 0;
if (StartSSLEx3(s, x, k, chain, 0, NULL, NULL, &ssl_err) == false)
{ {
// Failed // Failed
AddNoSsl(c->Cedar, &s->RemoteIP); AddNoSsl(c->Cedar, &s->RemoteIP);
Debug("ConnectionAccept(): StartSSL() failed\n"); Debug("ConnectionAccept(): StartSSL() failed\n");
if (ssl_err != 0)
{
SLog(c->Cedar, "LS_SSL_START_ERROR", c->Name, GetUniErrorStr(ssl_err), ssl_err);
}
FreeX(x); FreeX(x);
FreeK(k); FreeK(k);
FreeXList(chain);
goto FINAL; goto FINAL;
} }
FreeX(x); FreeX(x);
FreeK(k); FreeK(k);
FreeXList(chain);
SLog(c->Cedar, "LS_SSL_START", c->Name, s->CipherName); SLog(c->Cedar, "LS_SSL_START", c->Name, s->SslVersion, s->CipherName);
Copy(c->CToken_Hash, ctoken_hash, SHA1_SIZE); Copy(c->CToken_Hash, ctoken_hash, SHA1_SIZE);
@@ -3391,6 +3405,11 @@ void CleanupConnection(CONNECTION *c)
Free(c->CipherName); Free(c->CipherName);
} }
if (c->SslVersion != NULL)
{
Free(c->SslVersion);
}
Free(c); Free(c);
} }
+20 -1
View File
@@ -58,8 +58,11 @@ struct RC4_KEY_PAIR
UCHAR ServerToClientKey[16]; UCHAR ServerToClientKey[16];
UCHAR ClientToServerKey[16]; UCHAR ClientToServerKey[16];
}; };
#define TYPE_BINDLOCALIP 1 // Enable HMI user to edit Source IP address & Source port number for outgoing connection
// Client Options // Client Options
// Do not change item size or order and only add new items at the end!
// See comments in struct SETTING (SMInner.h)
struct CLIENT_OPTION struct CLIENT_OPTION
{ {
wchar_t AccountName[MAX_ACCOUNT_NAME_LEN + 1]; // Connection setting name wchar_t AccountName[MAX_ACCOUNT_NAME_LEN + 1]; // Connection setting name
@@ -71,26 +74,41 @@ struct CLIENT_OPTION
UINT ProxyPort; // Port number of the proxy server UINT ProxyPort; // Port number of the proxy server
char ProxyUsername[PROXY_MAX_USERNAME_LEN + 1]; // Maximum user name length char ProxyUsername[PROXY_MAX_USERNAME_LEN + 1]; // Maximum user name length
char ProxyPassword[PROXY_MAX_PASSWORD_LEN + 1]; // Maximum password length char ProxyPassword[PROXY_MAX_PASSWORD_LEN + 1]; // Maximum password length
char CustomHttpHeader[HTTP_CUSTOM_HEADER_MAX_SIZE + 1]; // Custom HTTP proxy header
UINT NumRetry; // Automatic retries UINT NumRetry; // Automatic retries
UINT RetryInterval; // Retry interval UINT RetryInterval; // Retry interval
char HubName[MAX_HUBNAME_LEN + 1]; // HUB name char HubName[MAX_HUBNAME_LEN + 1]; // HUB name
UINT MaxConnection; // Maximum number of concurrent TCP connections UINT MaxConnection; // Maximum number of concurrent TCP connections
bool UseEncrypt; // Use encrypted communication bool UseEncrypt; // Use encrypted communication
char pad1[3];
bool UseCompress; // Use data compression bool UseCompress; // Use data compression
char pad2[3];
bool HalfConnection; // Use half connection in TCP bool HalfConnection; // Use half connection in TCP
char pad3[3];
bool NoRoutingTracking; // Disable the routing tracking bool NoRoutingTracking; // Disable the routing tracking
char pad4[3];
char DeviceName[MAX_DEVICE_NAME_LEN + 1]; // VLAN device name char DeviceName[MAX_DEVICE_NAME_LEN + 1]; // VLAN device name
UINT AdditionalConnectionInterval; // Connection attempt interval when additional connection establish UINT AdditionalConnectionInterval; // Connection attempt interval when additional connection establish
UINT ConnectionDisconnectSpan; // Disconnection interval UINT ConnectionDisconnectSpan; // Disconnection interval
bool HideStatusWindow; // Hide the status window bool HideStatusWindow; // Hide the status window
char pad5[3];
bool HideNicInfoWindow; // Hide the NIC status window bool HideNicInfoWindow; // Hide the NIC status window
char pad6[3];
bool RequireMonitorMode; // Monitor port mode bool RequireMonitorMode; // Monitor port mode
char pad7[3];
bool RequireBridgeRoutingMode; // Bridge or routing mode bool RequireBridgeRoutingMode; // Bridge or routing mode
char pad8[3];
bool DisableQoS; // Disable the VoIP / QoS function bool DisableQoS; // Disable the VoIP / QoS function
char pad9[3];
bool FromAdminPack; // For Administration Pack bool FromAdminPack; // For Administration Pack
char pad10[3];
char pad11[4]; // Removed bool
bool NoUdpAcceleration; // Do not use UDP acceleration mode bool NoUdpAcceleration; // Do not use UDP acceleration mode
char pad12[3];
UCHAR HostUniqueKey[SHA1_SIZE]; // Host unique key UCHAR HostUniqueKey[SHA1_SIZE]; // Host unique key
char CustomHttpHeader[HTTP_CUSTOM_HEADER_MAX_SIZE]; // Custom HTTP proxy header
char HintStr[MAX_HOST_NAME_LEN + 1]; // Hint string for NAT-T
IP BindLocalIP; // Source IP address for outgoing connection
UINT BindLocalPort; // Source port number for outgoing connection
}; };
// Client authentication data // Client authentication data
@@ -208,6 +226,7 @@ struct CONNECTION
X *ServerX; // Server certificate X *ServerX; // Server certificate
X *ClientX; // Client certificate X *ClientX; // Client certificate
char *CipherName; // Encryption algorithm name char *CipherName; // Encryption algorithm name
char *SslVersion; // SSL protocol version
UINT64 ConnectedTick; // Time it is connected UINT64 ConnectedTick; // Time it is connected
IP ClientIp; // Client IP address IP ClientIp; // Client IP address
char ClientHostname[MAX_HOST_NAME_LEN + 1]; // Client host name char ClientHostname[MAX_HOST_NAME_LEN + 1]; // Client host name
-4
View File
@@ -541,13 +541,9 @@ UINT DCRegister(DDNS_CLIENT *c, bool ipv6, DDNS_REGISTER_PARAM *p, char *replace
} }
} }
Format(url2, sizeof(url2), "%s?v=%I64u", url, Rand64()); Format(url2, sizeof(url2), "%s?v=%I64u", url, Rand64());
Format(url3, sizeof(url3), url2, key_hash_str[2], key_hash_str[3]); Format(url3, sizeof(url3), url2, key_hash_str[2], key_hash_str[3]);
ReplaceStr(url3, sizeof(url3), url3, "https://", "http://");
ReplaceStr(url3, sizeof(url3), url3, ".servers", ".open.servers"); ReplaceStr(url3, sizeof(url3), url3, ".servers", ".open.servers");
cert_hash = StrToBin(DDNS_CERT_HASH); cert_hash = StrToBin(DDNS_CERT_HASH);
+6 -2
View File
@@ -18,7 +18,11 @@
"439BAFA75A6EE5671FC9F9A02D34FF29881761A0" \ "439BAFA75A6EE5671FC9F9A02D34FF29881761A0" \
"EFAC5FA0CDD14E0F864EED58A73C35D7E33B62F3" \ "EFAC5FA0CDD14E0F864EED58A73C35D7E33B62F3" \
"74DF99D4B1B5F0488A388B50D347D26013DC67A5" \ "74DF99D4B1B5F0488A388B50D347D26013DC67A5" \
"6EBB39AFCA8C900635CFC11218CF293A612457E4" "6EBB39AFCA8C900635CFC11218CF293A612457E4" \
"05A9386C5E2B233F7BAB2479620EAAA2793709ED" \
"A811C64BB715351E36B6C1E022648D8BE0ACD128" \
"BD264DB3B0B1B3ABA0AF3074AA574ED1EF3B42D7" \
"9AB61D691536645DD55A8730FC6D2CDF33C8C73F"
#define DDNS_SNI_VER_STRING "DDNS" #define DDNS_SNI_VER_STRING "DDNS"
@@ -43,7 +47,7 @@
#define DDNS_URL2_V4_ALT "http://get-my-ip.ddns.uxcom.jp/ddns/getmyip.ashx" #define DDNS_URL2_V4_ALT "http://get-my-ip.ddns.uxcom.jp/ddns/getmyip.ashx"
#define DDNS_URL2_V6_ALT "http://get-my-ip-v6.ddns.uxcom.jp/ddns/getmyip.ashx" #define DDNS_URL2_V6_ALT "http://get-my-ip-v6.ddns.uxcom.jp/ddns/getmyip.ashx"
#define DDNS_RPC_MAX_RECV_SIZE DYN32(DDNS_RPC_MAX_RECV_SIZE, (128 * 1024 * 1024)) #define DDNS_RPC_MAX_RECV_SIZE DYN32(DDNS_RPC_MAX_RECV_SIZE, (38 * 1024 * 1024))
// Connection Timeout // Connection Timeout
#define DDNS_CONNECT_TIMEOUT DYN32(DDNS_CONNECT_TIMEOUT, (15 * 1000)) #define DDNS_CONNECT_TIMEOUT DYN32(DDNS_CONNECT_TIMEOUT, (15 * 1000))
+36 -8
View File
@@ -91,7 +91,8 @@ UINT num_admin_options = sizeof(admin_options) / sizeof(ADMIN_OPTION);
// Create an EAP client for the specified Virtual Hub // Create an EAP client for the specified Virtual Hub
EAP_CLIENT *HubNewEapClient(CEDAR *cedar, char *hubname, char *client_ip_str, char *username, char *vpn_protocol_state_str) EAP_CLIENT *HubNewEapClient(CEDAR *cedar, char *hubname, char *client_ip_str, char *username, char *vpn_protocol_state_str, bool proxy_only,
PPP_LCP **response, UCHAR last_recv_eapid)
{ {
HUB *hub = NULL; HUB *hub = NULL;
EAP_CLIENT *ret = NULL; EAP_CLIENT *ret = NULL;
@@ -137,7 +138,7 @@ EAP_CLIENT *HubNewEapClient(CEDAR *cedar, char *hubname, char *client_ip_str, ch
if (GetIP(&ip, radius_servers_list->Token[i])) if (GetIP(&ip, radius_servers_list->Token[i]))
{ {
eap = NewEapClient(&ip, radius_port, radius_secret, radius_retry_interval, eap = NewEapClient(&ip, radius_port, radius_secret, radius_retry_interval,
RADIUS_INITIAL_EAP_TIMEOUT, client_ip_str, username, hubname); RADIUS_INITIAL_EAP_TIMEOUT, client_ip_str, username, hubname, last_recv_eapid);
if (eap != NULL) if (eap != NULL)
{ {
@@ -146,7 +147,19 @@ EAP_CLIENT *HubNewEapClient(CEDAR *cedar, char *hubname, char *client_ip_str, ch
StrCpy(eap->In_VpnProtocolState, sizeof(eap->In_VpnProtocolState), vpn_protocol_state_str); StrCpy(eap->In_VpnProtocolState, sizeof(eap->In_VpnProtocolState), vpn_protocol_state_str);
} }
if (use_peap == false) if (proxy_only && response != NULL)
{
// EAP proxy for EAP-capable clients
PPP_LCP *lcp = EapClientSendEapIdentity(eap);
if (lcp != NULL)
{
*response = lcp;
eap->GiveupTimeout = RADIUS_RETRY_TIMEOUT;
ret = eap;
finish = true;
}
}
else if (use_peap == false)
{ {
// EAP // EAP
if (EapClientSendMsChapv2AuthRequest(eap)) if (EapClientSendMsChapv2AuthRequest(eap))
@@ -606,6 +619,7 @@ void DataToHubOptionStruct(HUB_OPTION *o, RPC_ADMIN_OPTION *ao)
GetHubAdminOptionDataAndSet(ao, "DoNotSaveHeavySecurityLogs", o->DoNotSaveHeavySecurityLogs); GetHubAdminOptionDataAndSet(ao, "DoNotSaveHeavySecurityLogs", o->DoNotSaveHeavySecurityLogs);
GetHubAdminOptionDataAndSet(ao, "DropBroadcastsInPrivacyFilterMode", o->DropBroadcastsInPrivacyFilterMode); GetHubAdminOptionDataAndSet(ao, "DropBroadcastsInPrivacyFilterMode", o->DropBroadcastsInPrivacyFilterMode);
GetHubAdminOptionDataAndSet(ao, "DropArpInPrivacyFilterMode", o->DropArpInPrivacyFilterMode); GetHubAdminOptionDataAndSet(ao, "DropArpInPrivacyFilterMode", o->DropArpInPrivacyFilterMode);
GetHubAdminOptionDataAndSet(ao, "AllowSameUserInPrivacyFilterMode", o->AllowSameUserInPrivacyFilterMode);
GetHubAdminOptionDataAndSet(ao, "SuppressClientUpdateNotification", o->SuppressClientUpdateNotification); GetHubAdminOptionDataAndSet(ao, "SuppressClientUpdateNotification", o->SuppressClientUpdateNotification);
GetHubAdminOptionDataAndSet(ao, "FloodingSendQueueBufferQuota", o->FloodingSendQueueBufferQuota); GetHubAdminOptionDataAndSet(ao, "FloodingSendQueueBufferQuota", o->FloodingSendQueueBufferQuota);
GetHubAdminOptionDataAndSet(ao, "AssignVLanIdByRadiusAttribute", o->AssignVLanIdByRadiusAttribute); GetHubAdminOptionDataAndSet(ao, "AssignVLanIdByRadiusAttribute", o->AssignVLanIdByRadiusAttribute);
@@ -615,6 +629,7 @@ void DataToHubOptionStruct(HUB_OPTION *o, RPC_ADMIN_OPTION *ao)
GetHubAdminOptionDataAndSet(ao, "NoPhysicalIPOnPacketLog", o->NoPhysicalIPOnPacketLog); GetHubAdminOptionDataAndSet(ao, "NoPhysicalIPOnPacketLog", o->NoPhysicalIPOnPacketLog);
GetHubAdminOptionDataAndSet(ao, "UseHubNameAsDhcpUserClassOption", o->UseHubNameAsDhcpUserClassOption); GetHubAdminOptionDataAndSet(ao, "UseHubNameAsDhcpUserClassOption", o->UseHubNameAsDhcpUserClassOption);
GetHubAdminOptionDataAndSet(ao, "UseHubNameAsRadiusNasId", o->UseHubNameAsRadiusNasId); GetHubAdminOptionDataAndSet(ao, "UseHubNameAsRadiusNasId", o->UseHubNameAsRadiusNasId);
GetHubAdminOptionDataAndSet(ao, "AllowEapMatchUserByCert", o->AllowEapMatchUserByCert);
} }
// Convert the contents of the HUB_OPTION to data // Convert the contents of the HUB_OPTION to data
@@ -679,6 +694,7 @@ void HubOptionStructToData(RPC_ADMIN_OPTION *ao, HUB_OPTION *o, char *hub_name)
Add(aol, NewAdminOption("DoNotSaveHeavySecurityLogs", o->DoNotSaveHeavySecurityLogs)); Add(aol, NewAdminOption("DoNotSaveHeavySecurityLogs", o->DoNotSaveHeavySecurityLogs));
Add(aol, NewAdminOption("DropBroadcastsInPrivacyFilterMode", o->DropBroadcastsInPrivacyFilterMode)); Add(aol, NewAdminOption("DropBroadcastsInPrivacyFilterMode", o->DropBroadcastsInPrivacyFilterMode));
Add(aol, NewAdminOption("DropArpInPrivacyFilterMode", o->DropArpInPrivacyFilterMode)); Add(aol, NewAdminOption("DropArpInPrivacyFilterMode", o->DropArpInPrivacyFilterMode));
Add(aol, NewAdminOption("AllowSameUserInPrivacyFilterMode", o->AllowSameUserInPrivacyFilterMode));
Add(aol, NewAdminOption("SuppressClientUpdateNotification", o->SuppressClientUpdateNotification)); Add(aol, NewAdminOption("SuppressClientUpdateNotification", o->SuppressClientUpdateNotification));
Add(aol, NewAdminOption("FloodingSendQueueBufferQuota", o->FloodingSendQueueBufferQuota)); Add(aol, NewAdminOption("FloodingSendQueueBufferQuota", o->FloodingSendQueueBufferQuota));
Add(aol, NewAdminOption("AssignVLanIdByRadiusAttribute", o->AssignVLanIdByRadiusAttribute)); Add(aol, NewAdminOption("AssignVLanIdByRadiusAttribute", o->AssignVLanIdByRadiusAttribute));
@@ -688,6 +704,7 @@ void HubOptionStructToData(RPC_ADMIN_OPTION *ao, HUB_OPTION *o, char *hub_name)
Add(aol, NewAdminOption("NoPhysicalIPOnPacketLog", o->NoPhysicalIPOnPacketLog)); Add(aol, NewAdminOption("NoPhysicalIPOnPacketLog", o->NoPhysicalIPOnPacketLog));
Add(aol, NewAdminOption("UseHubNameAsDhcpUserClassOption", o->UseHubNameAsDhcpUserClassOption)); Add(aol, NewAdminOption("UseHubNameAsDhcpUserClassOption", o->UseHubNameAsDhcpUserClassOption));
Add(aol, NewAdminOption("UseHubNameAsRadiusNasId", o->UseHubNameAsRadiusNasId)); Add(aol, NewAdminOption("UseHubNameAsRadiusNasId", o->UseHubNameAsRadiusNasId));
Add(aol, NewAdminOption("AllowEapMatchUserByCert", o->AllowEapMatchUserByCert));
Zero(ao, sizeof(RPC_ADMIN_OPTION)); Zero(ao, sizeof(RPC_ADMIN_OPTION));
@@ -3562,7 +3579,7 @@ bool HubPaPutPacket(SESSION *s, void *data, UINT size)
target_mss = MIN(target_mss, session_mss); target_mss = MIN(target_mss, session_mss);
if (s->IsUsingUdpAcceleration && s->UdpAccelMss != 0) if (s->UseUdpAcceleration && s->UdpAccelMss != 0)
{ {
// If the link is established with UDP acceleration function, use optimum value of the UDP acceleration function // If the link is established with UDP acceleration function, use optimum value of the UDP acceleration function
target_mss = MIN(target_mss, s->UdpAccelMss); target_mss = MIN(target_mss, s->UdpAccelMss);
@@ -3915,6 +3932,7 @@ void StorePacket(HUB *hub, SESSION *s, PKT *packet)
bool no_heavy = false; bool no_heavy = false;
bool drop_broadcast_packet_privacy = false; bool drop_broadcast_packet_privacy = false;
bool drop_arp_packet_privacy = false; bool drop_arp_packet_privacy = false;
bool allow_same_user_packet_privacy = false;
UINT tcp_queue_quota = 0; UINT tcp_queue_quota = 0;
UINT64 dormant_interval = 0; UINT64 dormant_interval = 0;
// Validate arguments // Validate arguments
@@ -3939,6 +3957,7 @@ void StorePacket(HUB *hub, SESSION *s, PKT *packet)
no_heavy = hub->Option->DoNotSaveHeavySecurityLogs; no_heavy = hub->Option->DoNotSaveHeavySecurityLogs;
drop_broadcast_packet_privacy = hub->Option->DropBroadcastsInPrivacyFilterMode; drop_broadcast_packet_privacy = hub->Option->DropBroadcastsInPrivacyFilterMode;
drop_arp_packet_privacy = hub->Option->DropArpInPrivacyFilterMode; drop_arp_packet_privacy = hub->Option->DropArpInPrivacyFilterMode;
allow_same_user_packet_privacy = hub->Option->AllowSameUserInPrivacyFilterMode;
tcp_queue_quota = hub->Option->FloodingSendQueueBufferQuota; tcp_queue_quota = hub->Option->FloodingSendQueueBufferQuota;
if (hub->Option->DetectDormantSessionInterval != 0) if (hub->Option->DetectDormantSessionInterval != 0)
{ {
@@ -4840,7 +4859,11 @@ UPDATE_FDB:
// Privacy filter // Privacy filter
if (drop_arp_packet_privacy || packet->TypeL3 != L3_ARPV4) if (drop_arp_packet_privacy || packet->TypeL3 != L3_ARPV4)
{ {
goto DISCARD_UNICAST_PACKET; // Do not block sessions owned by the same user, if the corresponding option is enabled.
if (allow_same_user_packet_privacy == false || StrCmp(s->Username, dest_session->Username))
{
goto DISCARD_UNICAST_PACKET;
}
} }
} }
@@ -5057,7 +5080,11 @@ DISCARD_UNICAST_PACKET:
// Privacy filter // Privacy filter
if (drop_arp_packet_privacy || packet->TypeL3 != L3_ARPV4) if (drop_arp_packet_privacy || packet->TypeL3 != L3_ARPV4)
{ {
discard = true; // Do not block sessions owned by the same user, if the corresponding option is enabled.
if (allow_same_user_packet_privacy == false || StrCmp(s->Username, dest_session->Username))
{
discard = true;
}
} }
} }
@@ -5350,7 +5377,7 @@ void StorePacketToHubPa(HUB_PA *dest, SESSION *src, void *data, UINT size, PKT *
if (src != NULL && dest->Session != NULL && src->Hub != NULL && src->Hub->Option != NULL) if (src != NULL && dest->Session != NULL && src->Hub != NULL && src->Hub->Option != NULL)
{ {
if (dest->Session->AdjustMss != 0 || if (dest->Session->AdjustMss != 0 ||
(dest->Session->IsUsingUdpAcceleration && dest->Session->UdpAccelMss != 0) || (dest->Session->UseUdpAcceleration && dest->Session->UdpAccelMss != 0) ||
(dest->Session->IsRUDPSession && dest->Session->RUdpMss != 0)) (dest->Session->IsRUDPSession && dest->Session->RUdpMss != 0))
{ {
if (src->Hub->Option->DisableAdjustTcpMss == false) if (src->Hub->Option->DisableAdjustTcpMss == false)
@@ -5362,7 +5389,7 @@ void StorePacketToHubPa(HUB_PA *dest, SESSION *src, void *data, UINT size, PKT *
target_mss = MIN(target_mss, dest->Session->AdjustMss); target_mss = MIN(target_mss, dest->Session->AdjustMss);
} }
if (dest->Session->IsUsingUdpAcceleration && dest->Session->UdpAccelMss != 0) if (dest->Session->UseUdpAcceleration && dest->Session->UdpAccelMss != 0)
{ {
target_mss = MIN(target_mss, dest->Session->UdpAccelMss); target_mss = MIN(target_mss, dest->Session->UdpAccelMss);
} }
@@ -6955,6 +6982,7 @@ HUB *NewHub(CEDAR *cedar, char *HubName, HUB_OPTION *option)
h->Option->DropBroadcastsInPrivacyFilterMode = true; h->Option->DropBroadcastsInPrivacyFilterMode = true;
h->Option->DropArpInPrivacyFilterMode = true; h->Option->DropArpInPrivacyFilterMode = true;
h->Option->AllowSameUserInPrivacyFilterMode = false;
Rand(h->HubSignature, sizeof(h->HubSignature)); Rand(h->HubSignature, sizeof(h->HubSignature));
+4 -1
View File
@@ -172,6 +172,7 @@ struct HUB_OPTION
bool DoNotSaveHeavySecurityLogs; // Do not take heavy security log bool DoNotSaveHeavySecurityLogs; // Do not take heavy security log
bool DropBroadcastsInPrivacyFilterMode; // Drop broadcasting packets if the both source and destination session is PrivacyFilter mode bool DropBroadcastsInPrivacyFilterMode; // Drop broadcasting packets if the both source and destination session is PrivacyFilter mode
bool DropArpInPrivacyFilterMode; // Drop ARP packets if the both source and destination session is PrivacyFilter mode bool DropArpInPrivacyFilterMode; // Drop ARP packets if the both source and destination session is PrivacyFilter mode
bool AllowSameUserInPrivacyFilterMode; // Allow packets if both the source and destination session user are the same
bool SuppressClientUpdateNotification; // Suppress the update notification function on the VPN Client bool SuppressClientUpdateNotification; // Suppress the update notification function on the VPN Client
UINT FloodingSendQueueBufferQuota; // The global quota of send queues of flooding packets UINT FloodingSendQueueBufferQuota; // The global quota of send queues of flooding packets
bool AssignVLanIdByRadiusAttribute; // Assign the VLAN ID for the VPN session, by the attribute value of RADIUS bool AssignVLanIdByRadiusAttribute; // Assign the VLAN ID for the VPN session, by the attribute value of RADIUS
@@ -181,6 +182,7 @@ struct HUB_OPTION
bool NoPhysicalIPOnPacketLog; // Disable saving physical IP address on the packet log bool NoPhysicalIPOnPacketLog; // Disable saving physical IP address on the packet log
bool UseHubNameAsDhcpUserClassOption; // Add HubName to DHCP request as User-Class option bool UseHubNameAsDhcpUserClassOption; // Add HubName to DHCP request as User-Class option
bool UseHubNameAsRadiusNasId; // Add HubName to Radius request as NAS-Identifier attrioption bool UseHubNameAsRadiusNasId; // Add HubName to Radius request as NAS-Identifier attrioption
bool AllowEapMatchUserByCert; // Allow matching EAP Identity with user certificate CNs
}; };
// MAC table entry // MAC table entry
@@ -535,7 +537,8 @@ bool IsUserMatchInUserList(LIST *o, char *filename, UINT64 user_hash);
bool IsUserMatchInUserListWithCacheExpires(LIST *o, char *filename, UINT64 user_hash, UINT64 lifetime); bool IsUserMatchInUserListWithCacheExpires(LIST *o, char *filename, UINT64 user_hash, UINT64 lifetime);
bool IsUserMatchInUserListWithCacheExpiresAcl(LIST *o, char *name_in_acl, UINT64 user_hash, UINT64 lifetime); bool IsUserMatchInUserListWithCacheExpiresAcl(LIST *o, char *name_in_acl, UINT64 user_hash, UINT64 lifetime);
bool CheckMaxLoggedPacketsPerMinute(SESSION *s, UINT max_packets, UINT64 now); bool CheckMaxLoggedPacketsPerMinute(SESSION *s, UINT max_packets, UINT64 now);
EAP_CLIENT *HubNewEapClient(CEDAR *cedar, char *hubname, char *client_ip_str, char *username, char *vpn_protocol_state_str); EAP_CLIENT *HubNewEapClient(CEDAR *cedar, char *hubname, char *client_ip_str, char *username, char *vpn_protocol_state_str, bool proxy_only,
PPP_LCP **response, UCHAR last_recv_eapid);
#endif // HUB_H #endif // HUB_H
+148 -69
View File
@@ -244,7 +244,8 @@ IPC *NewIPCByParam(CEDAR *cedar, IPC_PARAM *param, UINT *error_code)
param->UserName, param->Password, param->WgKey, error_code, param->UserName, param->Password, param->WgKey, error_code,
&param->ClientIp, param->ClientPort, &param->ServerIp, param->ServerPort, &param->ClientIp, param->ClientPort, &param->ServerIp, param->ServerPort,
param->ClientHostname, param->CryptName, param->ClientHostname, param->CryptName,
param->BridgeMode, param->Mss, NULL, param->ClientCertificate, param->Layer); param->BridgeMode, param->Mss, NULL, param->ClientCertificate, param->RadiusOK,
param->Layer);
return ipc; return ipc;
} }
@@ -253,7 +254,7 @@ IPC *NewIPCByParam(CEDAR *cedar, IPC_PARAM *param, UINT *error_code)
IPC *NewIPC(CEDAR *cedar, char *client_name, char *postfix, char *hubname, char *username, char *password, char *wg_key, IPC *NewIPC(CEDAR *cedar, char *client_name, char *postfix, char *hubname, char *username, char *password, char *wg_key,
UINT *error_code, IP *client_ip, UINT client_port, IP *server_ip, UINT server_port, UINT *error_code, IP *client_ip, UINT client_port, IP *server_ip, UINT server_port,
char *client_hostname, char *crypt_name, char *client_hostname, char *crypt_name,
bool bridge_mode, UINT mss, EAP_CLIENT *eap_client, X *client_certificate, bool bridge_mode, UINT mss, EAP_CLIENT *eap_client, X *client_certificate, bool external_auth,
UINT layer) UINT layer)
{ {
IPC *ipc; IPC *ipc;
@@ -360,6 +361,10 @@ IPC *NewIPC(CEDAR *cedar, char *client_name, char *postfix, char *hubname, char
{ {
p = PackLoginWithOpenVPNCertificate(hubname, username, client_certificate); p = PackLoginWithOpenVPNCertificate(hubname, username, client_certificate);
} }
else if (external_auth)
{
p = PackLoginWithExternal(hubname, username);
}
else else
{ {
p = PackLoginWithPlainPassword(hubname, username, password); p = PackLoginWithPlainPassword(hubname, username, password);
@@ -497,6 +502,8 @@ IPC *NewIPC(CEDAR *cedar, char *client_name, char *postfix, char *hubname, char
ZeroIP4(&ipc->BroadcastAddress); ZeroIP4(&ipc->BroadcastAddress);
} }
ReleaseHub(hub);
ZeroIP4(&ipc->ClientIPAddress); ZeroIP4(&ipc->ClientIPAddress);
MacToStr(macstr, sizeof(macstr), ipc->MacAddress); MacToStr(macstr, sizeof(macstr), ipc->MacAddress);
@@ -1501,6 +1508,7 @@ void IPCProcessL3EventsEx(IPC *ipc, UINT64 now)
if (p->IPv6HeaderPacketInfo.Protocol == IP_PROTO_ICMPV6) if (p->IPv6HeaderPacketInfo.Protocol == IP_PROTO_ICMPV6)
{ {
IP icmpHeaderAddr; IP icmpHeaderAddr;
UINT header_size = 0;
// We need to parse the Router Advertisement and Neighbor Advertisement messages // We need to parse the Router Advertisement and Neighbor Advertisement messages
// to build the Neighbor Discovery Table (aka ARP table for IPv6) // to build the Neighbor Discovery Table (aka ARP table for IPv6)
switch (p->ICMPv6HeaderPacketInfo.Type) switch (p->ICMPv6HeaderPacketInfo.Type)
@@ -1510,6 +1518,8 @@ void IPCProcessL3EventsEx(IPC *ipc, UINT64 now)
IPCIPv6AddRouterPrefixes(ipc, &p->ICMPv6HeaderPacketInfo.OptionList, src_mac, &ip_src); IPCIPv6AddRouterPrefixes(ipc, &p->ICMPv6HeaderPacketInfo.OptionList, src_mac, &ip_src);
IPCIPv6AssociateOnNDTEx(ipc, &ip_src, src_mac, true); IPCIPv6AssociateOnNDTEx(ipc, &ip_src, src_mac, true);
IPCIPv6AssociateOnNDTEx(ipc, &ip_src, p->ICMPv6HeaderPacketInfo.OptionList.SourceLinkLayer->Address, true); IPCIPv6AssociateOnNDTEx(ipc, &ip_src, p->ICMPv6HeaderPacketInfo.OptionList.SourceLinkLayer->Address, true);
ndtProcessed = true;
header_size = sizeof(ICMPV6_ROUTER_ADVERTISEMENT_HEADER);
break; break;
case ICMPV6_TYPE_NEIGHBOR_ADVERTISEMENT: case ICMPV6_TYPE_NEIGHBOR_ADVERTISEMENT:
// We save the neighbor advertisements into NDT // We save the neighbor advertisements into NDT
@@ -1517,7 +1527,76 @@ void IPCProcessL3EventsEx(IPC *ipc, UINT64 now)
IPCIPv6AssociateOnNDTEx(ipc, &icmpHeaderAddr, src_mac, true); IPCIPv6AssociateOnNDTEx(ipc, &icmpHeaderAddr, src_mac, true);
IPCIPv6AssociateOnNDTEx(ipc, &ip_src, src_mac, true); IPCIPv6AssociateOnNDTEx(ipc, &ip_src, src_mac, true);
ndtProcessed = true; ndtProcessed = true;
header_size = sizeof(ICMPV6_NEIGHBOR_ADVERTISEMENT_HEADER);
break; break;
case ICMPV6_TYPE_NEIGHBOR_SOLICIATION:
header_size = sizeof(ICMPV6_NEIGHBOR_SOLICIATION_HEADER);
break;
}
// Remove link-layer address options for Windows clients (required on Windows 11)
if (header_size > 0)
{
UCHAR *src = p->ICMPv6HeaderPacketInfo.Headers.HeaderPointer + header_size;
UINT opt_size = p->ICMPv6HeaderPacketInfo.DataSize - header_size;
UCHAR *dst = src;
UINT removed = 0;
while (opt_size > sizeof(ICMPV6_OPTION))
{
ICMPV6_OPTION *option_header;
UINT header_total_size;
option_header = (ICMPV6_OPTION *)src;
// Calculate the entire header size
header_total_size = option_header->Length * 8;
if (header_total_size == 0)
{
// The size is zero
break;
}
if (opt_size < header_total_size)
{
// Size shortage
break;
}
switch (option_header->Type)
{
case ICMPV6_OPTION_TYPE_SOURCE_LINK_LAYER:
case ICMPV6_OPTION_TYPE_TARGET_LINK_LAYER:
// Skip source or target link-layer option
removed += header_total_size;
break;
default:
// Copy options other than source link-layer
if (src != dst)
{
UCHAR *tmp = Clone(src, header_total_size);
Copy(dst, tmp, header_total_size);
Free(tmp);
}
dst += header_total_size;
}
src += header_total_size;
opt_size -= header_total_size;
}
// Recalculate length and checksum if modified
if (removed > 0)
{
size -= removed;
p->L3.IPv6Header->PayloadLength = Endian16(size - sizeof(IPV6_HEADER));
p->L4.ICMPHeader->Checksum = 0;
p->L4.ICMPHeader->Checksum =
CalcChecksumForIPv6(&p->L3.IPv6Header->SrcAddress,
&p->L3.IPv6Header->DestAddress, IP_PROTO_ICMPV6,
p->L4.ICMPHeader, size - sizeof(IPV6_HEADER), 0);
Copy(data, b->Buf + 14, size);
}
} }
} }
@@ -2054,7 +2133,7 @@ void IPCIPv6Init(IPC *ipc)
ipc->IPv6RouterAdvs = NewList(NULL); ipc->IPv6RouterAdvs = NewList(NULL);
ipc->IPv6ClientEUI = 0; ipc->IPv6ClientEUI = 0;
ipc->IPv6ServerEUI = 0; GenerateEui64Address6((UCHAR *)&ipc->IPv6ServerEUI, ipc->MacAddress);
ipc->IPv6State = IPC_PROTO_STATUS_CLOSED; ipc->IPv6State = IPC_PROTO_STATUS_CLOSED;
} }
@@ -2290,6 +2369,15 @@ bool IPCIPv6CheckUnicastFromRouterPrefix(IPC *ipc, IP *ip, IPC_IPV6_ROUTER_ADVER
UINT i; UINT i;
IPC_IPV6_ROUTER_ADVERTISEMENT *matchingRA = NULL; IPC_IPV6_ROUTER_ADVERTISEMENT *matchingRA = NULL;
bool isInPrefix = false; bool isInPrefix = false;
if (LIST_NUM(ipc->IPv6RouterAdvs) == 0)
{
// We have a unicast packet but we haven't got any RAs.
// The client is probably misconfigured in IPv6. We send non-blocking RS at best effort.
IPCSendIPv6RouterSoliciation(ipc, false);
return false;
}
for (i = 0; i < LIST_NUM(ipc->IPv6RouterAdvs); i++) for (i = 0; i < LIST_NUM(ipc->IPv6RouterAdvs); i++)
{ {
IPC_IPV6_ROUTER_ADVERTISEMENT *ra = LIST_DATA(ipc->IPv6RouterAdvs, i); IPC_IPV6_ROUTER_ADVERTISEMENT *ra = LIST_DATA(ipc->IPv6RouterAdvs, i);
@@ -2309,91 +2397,71 @@ bool IPCIPv6CheckUnicastFromRouterPrefix(IPC *ipc, IP *ip, IPC_IPV6_ROUTER_ADVER
return isInPrefix; return isInPrefix;
} }
// Send router solicitation and then eventually populate the info from Router Advertisements // Send router solicitation to find a router
UINT64 IPCIPv6GetServerEui(IPC *ipc) bool IPCSendIPv6RouterSoliciation(IPC *ipc, bool blocking)
{ {
// It is already configured, nothing to do here IP destIP;
if (ipc->IPv6ServerEUI != 0) IPV6_ADDR destV6;
{ UCHAR destMacAddress[6];
return ipc->IPv6ServerEUI; IPV6_ADDR linkLocal;
} BUF *packet;
UINT64 giveup_time = Tick64() + (UINT64)(IPC_IPV6_RA_MAX_RETRIES * IPC_IPV6_RA_INTERVAL);
UINT64 timeout_retry = 0;
// If we don't have a valid client EUI, we can't generate a correct link local // If we don't have a valid client EUI, we can't generate a correct link local
if (ipc->IPv6ClientEUI == 0) if (ipc->IPv6ClientEUI == 0)
{ {
return ipc->IPv6ServerEUI; return false;
} }
if (LIST_NUM(ipc->IPv6RouterAdvs) == 0) Zero(&linkLocal, sizeof(IPV6_ADDR));
{
IP destIP;
IPV6_ADDR destV6;
UCHAR destMacAddress[6];
IPV6_ADDR linkLocal;
BUF *packet;
UINT64 giveup_time = Tick64() + (UINT64)(IPC_IPV6_RA_MAX_RETRIES * IPC_IPV6_RA_INTERVAL);
UINT64 timeout_retry = 0;
Zero(&linkLocal, sizeof(IPV6_ADDR)); // Generate link local from client's EUI
linkLocal.Value[0] = 0xFE;
linkLocal.Value[1] = 0x80;
Copy(&linkLocal.Value[8], &ipc->IPv6ClientEUI, sizeof(UINT64));
// Generate link local from client's EUI GetAllRouterMulticastAddress6(&destIP);
linkLocal.Value[0] = 0xFE;
linkLocal.Value[1] = 0x80;
Copy(&linkLocal.Value[8], &ipc->IPv6ClientEUI, sizeof(UINT64));
GetAllRouterMulticastAddress6(&destIP); // Generate the MAC address from the multicast address
destMacAddress[0] = 0x33;
destMacAddress[1] = 0x33;
Copy(&destMacAddress[2], &destIP.address[12], sizeof(UINT));
// Generate the MAC address from the multicast address IPToIPv6Addr(&destV6, &destIP);
destMacAddress[0] = 0x33;
destMacAddress[1] = 0x33;
Copy(&destMacAddress[2], &destIP.address[12], sizeof(UINT));
IPToIPv6Addr(&destV6, &destIP); packet = BuildICMPv6RouterSoliciation(&linkLocal, &destV6, ipc->MacAddress, 0);
packet = BuildICMPv6RouterSoliciation(&linkLocal, &destV6, ipc->MacAddress, 0);
while (LIST_NUM(ipc->IPv6RouterAdvs) == 0)
{
UINT64 now = Tick64();
if (now >= timeout_retry)
{
timeout_retry = now + (UINT64)IPC_IPV6_RA_INTERVAL;
IPCIPv6SendWithDestMacAddr(ipc, packet->Buf, packet->Size, destMacAddress);
}
AddInterrupt(ipc->Interrupt, timeout_retry);
if (Tick64() >= giveup_time)
{
// We failed to receive any router advertisements
break;
}
// The processing should populate the received RAs by itself
IPCProcessL3Events(ipc);
}
if (blocking == false) {
IPCIPv6SendWithDestMacAddr(ipc, packet->Buf, packet->Size, destMacAddress);
FreeBuf(packet); FreeBuf(packet);
return false;
} }
// Populating the IPv6 Server EUI for IPV6CP while (LIST_NUM(ipc->IPv6RouterAdvs) == 0)
if (LIST_NUM(ipc->IPv6RouterAdvs) > 0)
{ {
IPC_IPV6_ROUTER_ADVERTISEMENT *ra = LIST_DATA(ipc->IPv6RouterAdvs, 0); UINT64 now = Tick64();
Copy(&ipc->IPv6ServerEUI, &ra->RouterAddress.address[8], sizeof(ipc->IPv6ServerEUI)); if (now >= timeout_retry)
}
// If it is still not defined, let's just generate something random
while (ipc->IPv6ServerEUI == 0)
{
ipc->IPv6ServerEUI = Rand64();
if (ipc->IPv6ClientEUI == ipc->IPv6ServerEUI)
{ {
ipc->IPv6ServerEUI = 0; timeout_retry = now + (UINT64)IPC_IPV6_RA_INTERVAL;
IPCIPv6SendWithDestMacAddr(ipc, packet->Buf, packet->Size, destMacAddress);
} }
AddInterrupt(ipc->Interrupt, timeout_retry);
if (Tick64() >= giveup_time)
{
// We failed to receive any router advertisements
FreeBuf(packet);
return false;
}
// The processing should populate the received RAs by itself
IPCProcessL3Events(ipc);
} }
return ipc->IPv6ServerEUI; FreeBuf(packet);
return true;
} }
// Data flow // Data flow
@@ -2481,10 +2549,20 @@ void IPCIPv6SendWithDestMacAddr(IPC *ipc, void *data, UINT size, UCHAR *dest_mac
BUF *buf; BUF *buf;
BUF *optBuf; BUF *optBuf;
BUF *packet; BUF *packet;
UINT header_size = 0;
// We need to rebuild the packet to // We need to rebuild the packet to
switch (p->ICMPv6HeaderPacketInfo.Type) switch (p->ICMPv6HeaderPacketInfo.Type)
{ {
case ICMPV6_TYPE_ROUTER_SOLICIATION:
header_size = sizeof(ICMPV6_ROUTER_SOLICIATION_HEADER);
if (p->ICMPv6HeaderPacketInfo.OptionList.SourceLinkLayer == NULL)
{
p->ICMPv6HeaderPacketInfo.OptionList.SourceLinkLayer = &linkLayer;
}
Copy(p->ICMPv6HeaderPacketInfo.OptionList.SourceLinkLayer->Address, ipc->MacAddress, 6);
break;
case ICMPV6_TYPE_NEIGHBOR_SOLICIATION: case ICMPV6_TYPE_NEIGHBOR_SOLICIATION:
header_size = sizeof(ICMPV6_NEIGHBOR_SOLICIATION_HEADER);
if (p->ICMPv6HeaderPacketInfo.OptionList.SourceLinkLayer == NULL) if (p->ICMPv6HeaderPacketInfo.OptionList.SourceLinkLayer == NULL)
{ {
p->ICMPv6HeaderPacketInfo.OptionList.SourceLinkLayer = &linkLayer; p->ICMPv6HeaderPacketInfo.OptionList.SourceLinkLayer = &linkLayer;
@@ -2492,6 +2570,7 @@ void IPCIPv6SendWithDestMacAddr(IPC *ipc, void *data, UINT size, UCHAR *dest_mac
Copy(p->ICMPv6HeaderPacketInfo.OptionList.SourceLinkLayer->Address, ipc->MacAddress, 6); Copy(p->ICMPv6HeaderPacketInfo.OptionList.SourceLinkLayer->Address, ipc->MacAddress, 6);
break; break;
case ICMPV6_TYPE_NEIGHBOR_ADVERTISEMENT: case ICMPV6_TYPE_NEIGHBOR_ADVERTISEMENT:
header_size = sizeof(ICMPV6_NEIGHBOR_ADVERTISEMENT_HEADER);
if (p->ICMPv6HeaderPacketInfo.OptionList.TargetLinkLayer == NULL) if (p->ICMPv6HeaderPacketInfo.OptionList.TargetLinkLayer == NULL)
{ {
p->ICMPv6HeaderPacketInfo.OptionList.TargetLinkLayer = &linkLayer; p->ICMPv6HeaderPacketInfo.OptionList.TargetLinkLayer = &linkLayer;
@@ -2501,12 +2580,12 @@ void IPCIPv6SendWithDestMacAddr(IPC *ipc, void *data, UINT size, UCHAR *dest_mac
} }
switch (p->ICMPv6HeaderPacketInfo.Type) switch (p->ICMPv6HeaderPacketInfo.Type)
{ {
case ICMPV6_TYPE_ROUTER_SOLICIATION:
case ICMPV6_TYPE_NEIGHBOR_SOLICIATION: case ICMPV6_TYPE_NEIGHBOR_SOLICIATION:
case ICMPV6_TYPE_NEIGHBOR_ADVERTISEMENT: case ICMPV6_TYPE_NEIGHBOR_ADVERTISEMENT:
optBuf = BuildICMPv6Options(&p->ICMPv6HeaderPacketInfo.OptionList); optBuf = BuildICMPv6Options(&p->ICMPv6HeaderPacketInfo.OptionList);
buf = NewBuf(); buf = NewBuf();
WriteBuf(buf, p->ICMPv6HeaderPacketInfo.Headers.HeaderPointer, WriteBuf(buf, p->ICMPv6HeaderPacketInfo.Headers.HeaderPointer, header_size);
p->ICMPv6HeaderPacketInfo.Type == ICMPV6_TYPE_NEIGHBOR_SOLICIATION ? sizeof(ICMPV6_NEIGHBOR_SOLICIATION_HEADER) : sizeof(ICMPV6_NEIGHBOR_ADVERTISEMENT_HEADER));
WriteBufBuf(buf, optBuf); WriteBufBuf(buf, optBuf);
packet = BuildICMPv6(&p->IPv6HeaderPacketInfo.IPv6Header->SrcAddress, packet = BuildICMPv6(&p->IPv6HeaderPacketInfo.IPv6Header->SrcAddress,
&p->IPv6HeaderPacketInfo.IPv6Header->DestAddress, &p->IPv6HeaderPacketInfo.IPv6Header->DestAddress,
+4 -3
View File
@@ -91,6 +91,7 @@ struct IPC_PARAM
UINT Mss; UINT Mss;
bool IsL3Mode; bool IsL3Mode;
X *ClientCertificate; X *ClientCertificate;
bool RadiusOK;
UINT Layer; UINT Layer;
}; };
@@ -155,7 +156,7 @@ struct IPC
LIST *IPv6NeighborTable; // Neighbor Discovery Table LIST *IPv6NeighborTable; // Neighbor Discovery Table
LIST *IPv6RouterAdvs; // Router offered prefixes LIST *IPv6RouterAdvs; // Router offered prefixes
UINT64 IPv6ClientEUI; // The EUI of the client (for the SLAAC autoconf) UINT64 IPv6ClientEUI; // The EUI of the client (for the SLAAC autoconf)
UINT64 IPv6ServerEUI; // The EUI of the server (from the RA discovery) UINT64 IPv6ServerEUI; // The EUI of the server (from the IPC Mac address)
}; };
// MS-CHAPv2 authentication information // MS-CHAPv2 authentication information
@@ -180,7 +181,7 @@ struct IPC_IPV6_ROUTER_ADVERTISEMENT
IPC *NewIPC(CEDAR *cedar, char *client_name, char *postfix, char *hubname, char *username, char *password, char *wg_key, IPC *NewIPC(CEDAR *cedar, char *client_name, char *postfix, char *hubname, char *username, char *password, char *wg_key,
UINT *error_code, IP *client_ip, UINT client_port, IP *server_ip, UINT server_port, UINT *error_code, IP *client_ip, UINT client_port, IP *server_ip, UINT server_port,
char *client_hostname, char *crypt_name, char *client_hostname, char *crypt_name,
bool bridge_mode, UINT mss, EAP_CLIENT *eap_client, X *client_certificate, bool bridge_mode, UINT mss, EAP_CLIENT *eap_client, X *client_certificate, bool external_auth,
UINT layer); UINT layer);
IPC *NewIPCByParam(CEDAR *cedar, IPC_PARAM *param, UINT *error_code); IPC *NewIPCByParam(CEDAR *cedar, IPC_PARAM *param, UINT *error_code);
IPC *NewIPCBySock(CEDAR *cedar, SOCK *s, void *mac_address); IPC *NewIPCBySock(CEDAR *cedar, SOCK *s, void *mac_address);
@@ -233,7 +234,7 @@ bool IPCIPv6CheckExistingLinkLocal(IPC *ipc, UINT64 eui);
// RA // RA
void IPCIPv6AddRouterPrefixes(IPC *ipc, ICMPV6_OPTION_LIST *recvPrefix, UCHAR *macAddress, IP *ip); void IPCIPv6AddRouterPrefixes(IPC *ipc, ICMPV6_OPTION_LIST *recvPrefix, UCHAR *macAddress, IP *ip);
bool IPCIPv6CheckUnicastFromRouterPrefix(IPC *ipc, IP *ip, IPC_IPV6_ROUTER_ADVERTISEMENT *matchedRA); bool IPCIPv6CheckUnicastFromRouterPrefix(IPC *ipc, IP *ip, IPC_IPV6_ROUTER_ADVERTISEMENT *matchedRA);
UINT64 IPCIPv6GetServerEui(IPC *ipc); bool IPCSendIPv6RouterSoliciation(IPC *ipc, bool blocking);
// Data flow // Data flow
BLOCK *IPCIPv6Recv(IPC *ipc); BLOCK *IPCIPv6Recv(IPC *ipc);
void IPCIPv6Send(IPC *ipc, void *data, UINT size); void IPCIPv6Send(IPC *ipc, void *data, UINT size);
+1
View File
@@ -31,6 +31,7 @@ struct LINK
UINT CurrentSendPacketQueueSize; // Current send packet queue size UINT CurrentSendPacketQueueSize; // Current send packet queue size
UINT LastError; // Last error UINT LastError; // Last error
bool CheckServerCert; // To check the server certificate bool CheckServerCert; // To check the server certificate
bool AddDefaultCA; // Use default trust store
X *ServerCert; // Server certificate X *ServerCert; // Server certificate
bool LockFlag; // Lock flag bool LockFlag; // Lock flag
bool *StopAllLinkFlag; // Stop all link flag bool *StopAllLinkFlag; // Stop all link flag
+225 -1
View File
@@ -17,6 +17,7 @@
#include "Mayaqua/Memory.h" #include "Mayaqua/Memory.h"
#include "Mayaqua/Object.h" #include "Mayaqua/Object.h"
#include "Mayaqua/Str.h" #include "Mayaqua/Str.h"
#include "Mayaqua/Tick64.h"
static bool disable_dos = false; static bool disable_dos = false;
static UINT max_connections_per_ip = DEFAULT_MAX_CONNECTIONS_PER_IP; static UINT max_connections_per_ip = DEFAULT_MAX_CONNECTIONS_PER_IP;
@@ -181,6 +182,11 @@ void TCPAcceptedThread(THREAD *t, void *param)
ConnectionAccept(c); ConnectionAccept(c);
flag1 = c->flag1; flag1 = c->flag1;
if (c->JsonRpcAuthed)
{
RemoveDosEntry(r, s);
}
// Release // Release
SLog(r->Cedar, "LS_CONNECTION_END_1", c->Name); SLog(r->Cedar, "LS_CONNECTION_END_1", c->Name);
ReleaseListener(c->Listener); ReleaseListener(c->Listener);
@@ -221,6 +227,46 @@ void TCPAccepted(LISTENER *r, SOCK *s)
num_clients_from_this_ip = GetNumIpClient(&s->RemoteIP); num_clients_from_this_ip = GetNumIpClient(&s->RemoteIP);
#ifdef USE_DOS_ATTACK_DETECTION
if (disable_dos == false && r->DisableDos == false && r->Protocol != LISTENER_INPROC)
{
UINT max_uec, now_uec;
// DOS attack check
if (CheckDosAttack(r, s) == false)
{
Debug("DOS Attack 1 !!\n");
IPToStr(tmp, sizeof(tmp), &s->RemoteIP);
SLog(r->Cedar, "LS_LISTENER_DOS", r->Port, tmp, s->RemotePort);
return;
}
if (StrCmpi(s->UnderlayProtocol, SOCK_UNDERLAY_NATIVE_V6) == 0 ||
StrCmpi(s->UnderlayProtocol, SOCK_UNDERLAY_NATIVE_V4) == 0)
{
if (IsInNoSsl(r->Cedar, &s->RemoteIP))
{
Debug("DOS Attack 2 !!\n");
IPToStr(tmp, sizeof(tmp), &s->RemoteIP);
SLog(r->Cedar, "LS_LISTENER_DOS", r->Port, tmp, s->RemotePort);
return;
}
}
if (num_clients_from_this_ip > GetMaxConnectionsPerIp())
{
Debug("DOS Attack 3 !!\n");
IPToStr(tmp, sizeof(tmp), &s->RemoteIP);
SLog(r->Cedar, "LS_LISTENER_DOS", r->Port, tmp, s->RemotePort);
return;
}
max_uec = GetMaxUnestablishedConnections();
now_uec = GetUnestablishedConnections(cedar);
if (now_uec > max_uec)
{
Debug("DOS Attack 4 !!\n");
SLog(r->Cedar, "LS_LISTENER_MAXUEC", max_uec, now_uec);
return;
}
}
#endif // USE_DOS_ATTACK_DETECTION
IPToStr(tmp, sizeof(tmp), &s->RemoteIP); IPToStr(tmp, sizeof(tmp), &s->RemoteIP);
@@ -239,6 +285,169 @@ void TCPAccepted(LISTENER *r, SOCK *s)
ReleaseThread(t); ReleaseThread(t);
} }
// Remove a DOS entry
bool RemoveDosEntry(LISTENER *r, SOCK *s)
{
DOS *d;
bool ok = false;
// Validate arguments
if (r == NULL || s == NULL)
{
return false;
}
LockList(r->DosList);
{
// Delete old entries from the DOS attack list
RefreshDosList(r);
// Search the table
d = SearchDosList(r, &s->RemoteIP);
if (d != NULL)
{
Delete(r->DosList, d);
Free(d);
ok = true;
}
}
UnlockList(r->DosList);
return ok;
}
// Check whether this is a DOS attack
bool CheckDosAttack(LISTENER *r, SOCK *s)
{
DOS *d;
bool ok = true;
// Validate arguments
if (r == NULL || s == NULL)
{
return false;
}
LockList(r->DosList);
{
// Delete old entries from the DOS attack list
RefreshDosList(r);
// Search the table
d = SearchDosList(r, &s->RemoteIP);
if (d != NULL)
{
// There is a entry already
// This should mean being under a DOS attack
d->LastConnectedTick = Tick64();
d->CurrentExpireSpan = MIN(d->CurrentExpireSpan * (UINT64)2, DOS_TABLE_EXPIRES_MAX);
d->AccessCount++;
if (d->AccessCount > DOS_TABLE_MAX_LIMIT_PER_IP)
{
ok = false;
}
}
else
{
// Create a new entry
d = ZeroMalloc(sizeof(DOS));
d->CurrentExpireSpan = (UINT64)DOS_TABLE_EXPIRES_FIRST;
d->FirstConnectedTick = d->LastConnectedTick = Tick64();
d->AccessCount = 1;
d->DeleteEntryTick = d->FirstConnectedTick + (UINT64)DOS_TABLE_EXPIRES_TOTAL;
Copy(&d->IpAddress, &s->RemoteIP, sizeof(IP));
Add(r->DosList, d);
}
}
UnlockList(r->DosList);
return ok;
}
// Delete old entries from the DOS attack list
void RefreshDosList(LISTENER *r)
{
// Validate arguments
if (r == NULL)
{
return;
}
if (r->DosListLastRefreshTime == 0 ||
(r->DosListLastRefreshTime + (UINT64)DOS_TABLE_REFRESH_INTERVAL) <= Tick64())
{
UINT i;
LIST *o;
r->DosListLastRefreshTime = Tick64();
o = NewListFast(NULL);
for (i = 0;i < LIST_NUM(r->DosList);i++)
{
DOS *d = LIST_DATA(r->DosList, i);
if ((d->LastConnectedTick + d->CurrentExpireSpan) <= Tick64() ||
(d->DeleteEntryTick <= Tick64()))
{
Add(o, d);
}
}
for (i = 0;i < LIST_NUM(o);i++)
{
DOS *d = LIST_DATA(o, i);
Delete(r->DosList, d);
Free(d);
}
ReleaseList(o);
}
}
// Search the DOS attack list by the IP address
DOS *SearchDosList(LISTENER *r, IP *ip)
{
DOS *d, t;
// Validate arguments
if (r == NULL || ip == NULL)
{
return NULL;
}
Copy(&t.IpAddress, ip, sizeof(IP));
d = Search(r->DosList, &t);
if (d != NULL)
{
if ((d->LastConnectedTick + d->CurrentExpireSpan) <= Tick64() ||
(d->DeleteEntryTick <= Tick64()))
{
// Delete old entries
Delete(r->DosList, d);
Free(d);
return NULL;
}
}
return d;
}
// Comparison of DOS attack list entries
int CompareDos(void *p1, void *p2)
{
DOS *d1, *d2;
if (p1 == NULL || p2 == NULL)
{
return 0;
}
d1 = *(DOS **)p1;
d2 = *(DOS **)p2;
if (d1 == NULL || d2 == NULL)
{
return 0;
}
return CmpIpAddr(&d1->IpAddress, &d2->IpAddress);
}
// UDP listener main loop // UDP listener main loop
void ListenerUDPMainLoop(LISTENER *r) void ListenerUDPMainLoop(LISTENER *r)
@@ -386,7 +595,14 @@ void ListenerTCPMainLoop(LISTENER *r)
} }
else else
{ {
s = ListenEx6(r->Port, r->LocalOnly); if (r->Cedar->Server == NULL)
{
s = ListenEx6(r->Port, r->LocalOnly);
}
else
{
s = ListenEx63(r->Port, r->LocalOnly, false, &r->Cedar->Server->ListenIP);
}
} }
} }
else if (r->Protocol == LISTENER_INPROC) else if (r->Protocol == LISTENER_INPROC)
@@ -646,6 +862,13 @@ void CleanupListener(LISTENER *r)
return; return;
} }
// Release the DOS attack list
for (i = 0;i < LIST_NUM(r->DosList);i++)
{
DOS *d = LIST_DATA(r->DosList, i);
Free(d);
}
ReleaseList(r->DosList);
if (r->Sock != NULL) if (r->Sock != NULL)
{ {
@@ -795,6 +1018,7 @@ LISTENER *NewListenerEx5(CEDAR *cedar, UINT proto, UINT port, THREAD_PROC *proc,
r->Port = port; r->Port = port;
r->Event = NewEvent(); r->Event = NewEvent();
r->DosList = NewList(CompareDos);
r->LocalOnly = local_only; r->LocalOnly = local_only;
r->ShadowIPv6 = shadow_ipv6; r->ShadowIPv6 = shadow_ipv6;
+19
View File
@@ -10,12 +10,24 @@
#include "CedarType.h" #include "CedarType.h"
#include "Mayaqua/MayaType.h"
#include "Mayaqua/Kernel.h" #include "Mayaqua/Kernel.h"
#include "Mayaqua/Network.h"
// Function to call when receiving a new connection // Function to call when receiving a new connection
typedef void (NEW_CONNECTION_PROC)(CONNECTION *c); typedef void (NEW_CONNECTION_PROC)(CONNECTION *c);
// DOS attack list
struct DOS
{
IP IpAddress; // IP address
UINT64 FirstConnectedTick; // Time which a client connects at the first time
UINT64 LastConnectedTick; // Time which a client connected at the last time
UINT64 CurrentExpireSpan; // Current time-out period of this record
UINT64 DeleteEntryTick; // Time planned to delete this entry
UINT AccessCount; // The number of accesses
};
// Listener structure // Listener structure
struct LISTENER struct LISTENER
@@ -31,6 +43,8 @@ struct LISTENER
volatile bool Halt; // Halting flag volatile bool Halt; // Halting flag
UINT Status; // State UINT Status; // State
LIST *DosList; // DOS attack list
UINT64 DosListLastRefreshTime; // Time that the DOS list is refreshed at the last
THREAD_PROC *ThreadProc; // Thread procedure THREAD_PROC *ThreadProc; // Thread procedure
void *ThreadParam; // Thread parameters void *ThreadParam; // Thread parameters
@@ -105,6 +119,11 @@ void FreeDynamicListener(DYNAMIC_LISTENER *d);
bool ListenerRUDPRpcRecvProc(RUDP_STACK *r, UDPPACKET *p); bool ListenerRUDPRpcRecvProc(RUDP_STACK *r, UDPPACKET *p);
void ListenerSetProcRecvRpcEnable(bool b); void ListenerSetProcRecvRpcEnable(bool b);
int CompareDos(void *p1, void *p2);
DOS *SearchDosList(LISTENER *r, IP *ip);
void RefreshDosList(LISTENER *r);
bool CheckDosAttack(LISTENER *r, SOCK *s);
bool RemoveDosEntry(LISTENER *r, SOCK *s);
#endif // LISTENER_H #endif // LISTENER_H
+1 -1
View File
@@ -75,7 +75,7 @@ void EtherIPIpcConnectThread(THREAD *t, void *p)
&s->ClientIP, s->ClientPort, &s->ClientIP, s->ClientPort,
&s->ServerIP, s->ServerPort, &s->ServerIP, s->ServerPort,
tmp, tmp,
s->CryptName, true, mss, NULL, NULL, IPC_LAYER_2); s->CryptName, true, mss, NULL, NULL, false, IPC_LAYER_2);
if (ipc != NULL) if (ipc != NULL)
{ {
+3 -6
View File
@@ -2008,7 +2008,6 @@ UINT CalcL2TPMss(L2TP_SERVER *l2tp, L2TP_TUNNEL *t, L2TP_SESSION *s)
// Start the L2TP thread // Start the L2TP thread
void StartL2TPThread(L2TP_SERVER *l2tp, L2TP_TUNNEL *t, L2TP_SESSION *s) void StartL2TPThread(L2TP_SERVER *l2tp, L2TP_TUNNEL *t, L2TP_SESSION *s)
{ {
PPP_SESSION* underlyingSession;
// Validate arguments // Validate arguments
if (l2tp == NULL || t == NULL || s == NULL) if (l2tp == NULL || t == NULL || s == NULL)
{ {
@@ -2037,11 +2036,9 @@ void StartL2TPThread(L2TP_SERVER *l2tp, L2TP_TUNNEL *t, L2TP_SESSION *s)
} }
// Create a PPP thread // Create a PPP thread
underlyingSession = NewPPPSession(l2tp->Cedar, &t->ClientIp, t->ClientPort, &t->ServerIp, t->ServerPort, s->Thread = NewPPPSession(l2tp->Cedar, &t->ClientIp, t->ClientPort, &t->ServerIp, t->ServerPort,
s->TubeSend, s->TubeRecv, L2TP_IPC_POSTFIX, tmp, t->HostName, l2tp->CryptName, s->TubeSend, s->TubeRecv, L2TP_IPC_POSTFIX, tmp, t->HostName, l2tp->CryptName,
CalcL2TPMss(l2tp, t, s)); CalcL2TPMss(l2tp, t, s));
s->Thread = underlyingSession->SessionThread;
s->PPPSession = underlyingSession;
} }
} }
@@ -2145,9 +2142,9 @@ void L2TPProcessInterrupts(L2TP_SERVER *l2tp)
{ {
L2TP_SESSION* s = LIST_DATA(t->SessionList, i); L2TP_SESSION* s = LIST_DATA(t->SessionList, i);
if (s->PPPSession != NULL && s->PPPSession->DataTimeout > l2tpTimeout) if (s->TubeRecv != NULL && s->TubeRecv->DataTimeout > l2tpTimeout)
{ {
l2tpTimeout = s->PPPSession->DataTimeout; l2tpTimeout = s->TubeRecv->DataTimeout;
} }
} }
-1
View File
@@ -171,7 +171,6 @@ struct L2TP_SESSION
UINT64 DisconnectTimeout; // Disconnection completion time-out UINT64 DisconnectTimeout; // Disconnection completion time-out
bool HasThread; // Whether have a thread bool HasThread; // Whether have a thread
THREAD *Thread; // Thread THREAD *Thread; // Thread
PPP_SESSION* PPPSession; // Underlying PPP session
TUBE *TubeSend; // Tube of PPP to L2TP direction TUBE *TubeSend; // Tube of PPP to L2TP direction
TUBE *TubeRecv; // Tube of L2TP to PPP direction TUBE *TubeRecv; // Tube of L2TP to PPP direction
UINT PseudowireType; // Type of L2TPv3 virtual line UINT PseudowireType; // Type of L2TPv3 virtual line
+12 -4
View File
@@ -147,7 +147,7 @@ bool OvsProcessData(void *param, TCP_RAW_DATA *in, FIFO *out)
payload_size = READ_USHORT(FifoPtr(fifo)); payload_size = READ_USHORT(FifoPtr(fifo));
packet_size = payload_size + sizeof(USHORT); packet_size = payload_size + sizeof(USHORT);
if (payload_size == 0 || packet_size > sizeof(buf)) if (payload_size == 0 || payload_size > (sizeof(buf) - sizeof(USHORT)))
{ {
ret = false; ret = false;
Debug("OvsProcessData(): Invalid payload size: %u bytes\n", payload_size); Debug("OvsProcessData(): Invalid payload size: %u bytes\n", payload_size);
@@ -824,6 +824,10 @@ void OvsProcessRecvControlPacket(OPENVPN_SERVER *s, OPENVPN_SESSION *se, OPENVPN
} }
c->SslPipe = NewSslPipeEx(true, s->Cedar->ServerX, s->Cedar->ServerK, s->Dh, true, &c->ClientCert); c->SslPipe = NewSslPipeEx(true, s->Cedar->ServerX, s->Cedar->ServerK, s->Dh, true, &c->ClientCert);
if (c->SslPipe == NULL)
{
return;
}
} }
Unlock(s->Cedar->lock); Unlock(s->Cedar->lock);
@@ -1902,6 +1906,10 @@ BUF *OvsBuildPacket(OPENVPN_PACKET *p)
// NumAck // NumAck
num_ack = MIN(p->NumAck, OPENVPN_MAX_NUMACK); num_ack = MIN(p->NumAck, OPENVPN_MAX_NUMACK);
if (p->OpCode != OPENVPN_P_ACK_V1)
{
num_ack = MIN(num_ack, OPENVPN_MAX_NUMACK_NONACK);
}
WriteBufChar(b, (UCHAR)num_ack); WriteBufChar(b, (UCHAR)num_ack);
if (p->NumAck >= 1) if (p->NumAck >= 1)
@@ -1982,7 +1990,7 @@ OPENVPN_PACKET *OvsParsePacket(UCHAR *data, UINT size)
ret->NumAck = uc; ret->NumAck = uc;
if (ret->NumAck > 4) if (ret->NumAck > OPENVPN_MAX_NUMACK)
{ {
goto LABEL_ERROR; goto LABEL_ERROR;
} }
@@ -2486,8 +2494,8 @@ void OvsRecvPacket(OPENVPN_SERVER *s, LIST *recv_packet_list, UINT protocol)
if (r->Exists) if (r->Exists)
{ {
Format(l3_options, sizeof(l3_options), Format(l3_options, sizeof(l3_options),
",route %r %r vpn_gateway", ",route %r %r %r",
&r->Network, &r->SubnetMask); &r->Network, &r->SubnetMask, &r->Gateway);
StrCat(option_str, sizeof(option_str), l3_options); StrCat(option_str, sizeof(option_str), l3_options);
} }
+2 -1
View File
@@ -14,7 +14,8 @@
#define OPENVPN_UDP_PORT 1194 // OpenVPN default UDP port number #define OPENVPN_UDP_PORT 1194 // OpenVPN default UDP port number
#define OPENVPN_UDP_PORT_INCLUDE 1195 // OpenVPN default UDP port number (Operating within the client) #define OPENVPN_UDP_PORT_INCLUDE 1195 // OpenVPN default UDP port number (Operating within the client)
#define OPENVPN_MAX_NUMACK 4 // The maximum number of ACKs #define OPENVPN_MAX_NUMACK 8 // The maximum number of ACKs
#define OPENVPN_MAX_NUMACK_NONACK 4 // The maximum number of ACKs in != P_ACK_V1
#define OPENVPN_NUM_CHANNELS 8 // Maximum number of channels during a session #define OPENVPN_NUM_CHANNELS 8 // Maximum number of channels during a session
#define OPENVPN_CONTROL_PACKET_RESEND_INTERVAL 500 // Control packet retransmission interval #define OPENVPN_CONTROL_PACKET_RESEND_INTERVAL 500 // Control packet retransmission interval
#define OPENVPN_CONTROL_PACKET_MAX_DATASIZE 1200 // Maximum data size that can be stored in one control packet #define OPENVPN_CONTROL_PACKET_MAX_DATASIZE 1200 // Maximum data size that can be stored in one control packet
+693 -232
View File
File diff suppressed because it is too large Load Diff
+14 -7
View File
@@ -9,6 +9,7 @@
#define PROTO_PPP_H #define PROTO_PPP_H
#include "CedarType.h" #include "CedarType.h"
#include "Proto_IPsec.h"
#include "Mayaqua/TcpIp.h" #include "Mayaqua/TcpIp.h"
@@ -111,6 +112,7 @@
#define PPP_EAP_TYPE_NOTIFICATION 2 #define PPP_EAP_TYPE_NOTIFICATION 2
#define PPP_EAP_TYPE_NAK 3 #define PPP_EAP_TYPE_NAK 3
#define PPP_EAP_TYPE_TLS 13 #define PPP_EAP_TYPE_TLS 13
#define PPP_EAP_TYPE_MSCHAPV2 26
// EAP-TLS Flags // EAP-TLS Flags
#define PPP_EAP_TLS_FLAG_NONE 0 #define PPP_EAP_TLS_FLAG_NONE 0
@@ -228,6 +230,8 @@ struct PPP_EAP_TLS_CONTEXT
UCHAR *CachedBufferRecvPntr; UCHAR *CachedBufferRecvPntr;
UCHAR *CachedBufferSend; UCHAR *CachedBufferSend;
UCHAR *CachedBufferSendPntr; UCHAR *CachedBufferSendPntr;
bool DisableTls13;
int Tls13SessionTicketsCount;
}; };
// PPP request resend // PPP request resend
@@ -290,7 +294,7 @@ struct PPP_SESSION
UINT MsChapV2_ErrorCode; // Authentication failure error code of MS-CHAPv2 UINT MsChapV2_ErrorCode; // Authentication failure error code of MS-CHAPv2
UINT MsChapV2_PacketId; // MS-CHAPv2 Packet ID UINT MsChapV2_PacketId; // MS-CHAPv2 Packet ID
bool MsChapV2_UseDoubleMsChapV2; // Use the double-MSCHAPv2 technique bool UseEapRadius; // Use EAP for RADIUS authentication
EAP_CLIENT *EapClient; // EAP client EAP_CLIENT *EapClient; // EAP client
UCHAR ServerInterfaceId[8]; // Server IPv6CP Interface Identifier UCHAR ServerInterfaceId[8]; // Server IPv6CP Interface Identifier
@@ -301,7 +305,8 @@ struct PPP_SESSION
// EAP contexts // EAP contexts
UINT Eap_Protocol; // Current EAP Protocol used UINT Eap_Protocol; // Current EAP Protocol used
UINT Eap_PacketId; // EAP Packet ID; UINT Eap_PacketId; // EAP Packet ID;
UCHAR Eap_Identity[MAX_SIZE]; // Received from client identity ETHERIP_ID Eap_Identity; // Received from client identity
bool Eap_MatchUserByCert; // Attempt to match the user from it's certificate during EAP-TLS, ignoring the EAP-identification
PPP_EAP_TLS_CONTEXT Eap_TlsCtx; // Context information for EAP TLS. May be possibly reused for EAP TTLS? PPP_EAP_TLS_CONTEXT Eap_TlsCtx; // Context information for EAP TLS. May be possibly reused for EAP TTLS?
LIST *SentReqPacketList; // Sent requests list LIST *SentReqPacketList; // Sent requests list
@@ -313,8 +318,6 @@ struct PPP_SESSION
UINT64 DataTimeout; UINT64 DataTimeout;
UINT64 UserConnectionTimeout; UINT64 UserConnectionTimeout;
UINT64 UserConnectionTick; UINT64 UserConnectionTick;
THREAD *SessionThread; // Thread of the PPP session
}; };
@@ -325,7 +328,7 @@ struct PPP_SESSION
void PPPThread(THREAD *thread, void *param); void PPPThread(THREAD *thread, void *param);
// Entry point // Entry point
PPP_SESSION *NewPPPSession(CEDAR *cedar, IP *client_ip, UINT client_port, IP *server_ip, UINT server_port, TUBE *send_tube, TUBE *recv_tube, char *postfix, char *client_software_name, char *client_hostname, char *crypt_name, UINT adjust_mss); THREAD *NewPPPSession(CEDAR *cedar, IP *client_ip, UINT client_port, IP *server_ip, UINT server_port, TUBE *send_tube, TUBE *recv_tube, char *postfix, char *client_software_name, char *client_hostname, char *crypt_name, UINT adjust_mss);
// PPP processing functions // PPP processing functions
bool PPPRejectUnsupportedPacket(PPP_SESSION *p, PPP_PACKET *pp); bool PPPRejectUnsupportedPacket(PPP_SESSION *p, PPP_PACKET *pp);
@@ -336,9 +339,11 @@ bool PPPSendEchoRequest(PPP_SESSION *p);
bool PPPProcessResponsePacket(PPP_SESSION *p, PPP_PACKET *pp, PPP_PACKET *req); bool PPPProcessResponsePacket(PPP_SESSION *p, PPP_PACKET *pp, PPP_PACKET *req);
bool PPPProcessLCPResponsePacket(PPP_SESSION *p, PPP_PACKET *pp, PPP_PACKET *req); bool PPPProcessLCPResponsePacket(PPP_SESSION *p, PPP_PACKET *pp, PPP_PACKET *req);
bool PPPProcessCHAPResponsePacket(PPP_SESSION *p, PPP_PACKET *pp, PPP_PACKET *req); bool PPPProcessCHAPResponsePacket(PPP_SESSION *p, PPP_PACKET *pp, PPP_PACKET *req);
bool PPPProcessCHAPResponsePacketEx(PPP_SESSION *p, PPP_PACKET *pp, PPP_PACKET *req, PPP_LCP *chap, bool use_eap);
bool PPPProcessIPCPResponsePacket(PPP_SESSION *p, PPP_PACKET *pp, PPP_PACKET *req); bool PPPProcessIPCPResponsePacket(PPP_SESSION *p, PPP_PACKET *pp, PPP_PACKET *req);
bool PPPProcessEAPResponsePacket(PPP_SESSION *p, PPP_PACKET *pp, PPP_PACKET *req); bool PPPProcessEAPResponsePacket(PPP_SESSION *p, PPP_PACKET *pp, PPP_PACKET *req);
bool PPPProcessIPv6CPResponsePacket(PPP_SESSION *p, PPP_PACKET *pp, PPP_PACKET *req); bool PPPProcessIPv6CPResponsePacket(PPP_SESSION *p, PPP_PACKET *pp, PPP_PACKET *req);
bool PPPProcessEapResponseForRadius(PPP_SESSION *p, PPP_EAP *eap_packet, UINT eap_datasize);
// Request packets // Request packets
bool PPPProcessRequestPacket(PPP_SESSION *p, PPP_PACKET *pp); bool PPPProcessRequestPacket(PPP_SESSION *p, PPP_PACKET *pp);
bool PPPProcessLCPRequestPacket(PPP_SESSION *p, PPP_PACKET *pp); bool PPPProcessLCPRequestPacket(PPP_SESSION *p, PPP_PACKET *pp);
@@ -375,7 +380,8 @@ PPP_OPTION *NewPPPOption(UCHAR type, void *data, UINT size);
// Packet parse utilities // Packet parse utilities
PPP_PACKET *ParsePPPPacket(void *data, UINT size); PPP_PACKET *ParsePPPPacket(void *data, UINT size);
PPP_LCP *PPPParseLCP(USHORT protocol, void *data, UINT size); PPP_LCP *PPPParseLCP(USHORT protocol, void *data, UINT size);
bool PPPParseMSCHAP2ResponsePacket(PPP_SESSION *p, PPP_PACKET *req); bool PPPParseMSCHAP2ResponsePacket(PPP_SESSION *p, PPP_PACKET *pp);
bool PPPParseMSCHAP2ResponsePacketEx(PPP_SESSION *p, PPP_LCP *lcp, bool use_eap);
// Packet building utilities // Packet building utilities
BUF *BuildPPPPacketData(PPP_PACKET *pp); BUF *BuildPPPPacketData(PPP_PACKET *pp);
BUF *BuildLCPData(PPP_LCP *c); BUF *BuildLCPData(PPP_LCP *c);
@@ -386,7 +392,7 @@ bool PPPSetIPOptionToLCP(PPP_IPOPTION *o, PPP_LCP *c, bool only_modify);
bool PPPGetIPAddressValueFromLCP(PPP_LCP *c, UINT type, IP *ip); bool PPPGetIPAddressValueFromLCP(PPP_LCP *c, UINT type, IP *ip);
bool PPPSetIPAddressValueToLCP(PPP_LCP *c, UINT type, IP *ip, bool only_modify); bool PPPSetIPAddressValueToLCP(PPP_LCP *c, UINT type, IP *ip, bool only_modify);
// EAP packet utilities // EAP packet utilities
bool PPPProcessEAPTlsResponse(PPP_SESSION *p, PPP_EAP *eap_packet, UINT eapTlsSize); bool PPPProcessEAPTlsResponse(PPP_SESSION *p, PPP_EAP *eap_packet, UINT eapSize);
PPP_LCP *BuildEAPPacketEx(UCHAR code, UCHAR id, UCHAR type, UINT datasize); PPP_LCP *BuildEAPPacketEx(UCHAR code, UCHAR id, UCHAR type, UINT datasize);
PPP_LCP *BuildEAPTlsPacketEx(UCHAR code, UCHAR id, UCHAR type, UINT datasize, UCHAR flags); PPP_LCP *BuildEAPTlsPacketEx(UCHAR code, UCHAR id, UCHAR type, UINT datasize, UCHAR flags);
PPP_LCP *BuildEAPTlsRequest(UCHAR id, UINT datasize, UCHAR flags); PPP_LCP *BuildEAPTlsRequest(UCHAR id, UINT datasize, UCHAR flags);
@@ -408,6 +414,7 @@ bool PPPParseUsername(CEDAR *cedar, char *src, ETHERIP_ID *dst);
void GenerateNtPasswordHash(UCHAR *dst, char *password); void GenerateNtPasswordHash(UCHAR *dst, char *password);
void GenerateNtPasswordHashHash(UCHAR *dst_hash, UCHAR *src_hash); void GenerateNtPasswordHashHash(UCHAR *dst_hash, UCHAR *src_hash);
void MsChapV2Server_GenerateChallenge(UCHAR *dst); void MsChapV2Server_GenerateChallenge(UCHAR *dst);
void MsChapV2Client_GenerateChallenge(UCHAR *dst);
void MsChapV2_GenerateChallenge8(UCHAR *dst, UCHAR *client_challenge, UCHAR *server_challenge, char *username); void MsChapV2_GenerateChallenge8(UCHAR *dst, UCHAR *client_challenge, UCHAR *server_challenge, char *username);
void MsChapV2Client_GenerateResponse(UCHAR *dst, UCHAR *challenge8, UCHAR *nt_password_hash); void MsChapV2Client_GenerateResponse(UCHAR *dst, UCHAR *challenge8, UCHAR *nt_password_hash);
void MsChapV2Server_GenerateResponse(UCHAR *dst, UCHAR *nt_password_hash_hash, UCHAR *client_response, UCHAR *challenge8); void MsChapV2Server_GenerateResponse(UCHAR *dst, UCHAR *nt_password_hash_hash, UCHAR *client_response, UCHAR *challenge8);
+3 -7
View File
@@ -275,8 +275,6 @@ void SstpProcessControlPacket(SSTP_SERVER *s, SSTP_PACKET *p)
// Process the SSTP received data packet // Process the SSTP received data packet
void SstpProcessDataPacket(SSTP_SERVER *s, SSTP_PACKET *p) void SstpProcessDataPacket(SSTP_SERVER *s, SSTP_PACKET *p)
{ {
PPP_SESSION *underlyingSession;
// Validate arguments // Validate arguments
if (s == NULL || p == NULL || p->IsControl) if (s == NULL || p == NULL || p->IsControl)
{ {
@@ -288,11 +286,9 @@ void SstpProcessDataPacket(SSTP_SERVER *s, SSTP_PACKET *p)
if (s->PPPThread == NULL) if (s->PPPThread == NULL)
{ {
// Create a thread to initialize the new PPP module // Create a thread to initialize the new PPP module
underlyingSession = NewPPPSession(s->Cedar, &s->ClientIp, s->ClientPort, &s->ServerIp, s->ServerPort, s->PPPThread = NewPPPSession(s->Cedar, &s->ClientIp, s->ClientPort, &s->ServerIp, s->ServerPort,
s->TubeSend, s->TubeRecv, SSTP_IPC_POSTFIX, SSTP_IPC_CLIENT_NAME, s->TubeSend, s->TubeRecv, SSTP_IPC_POSTFIX, SSTP_IPC_CLIENT_NAME,
s->ClientHostName, s->ClientCipherName, 0); s->ClientHostName, s->ClientCipherName, 0);
s->PPPSession = underlyingSession;
s->PPPThread = underlyingSession->SessionThread;
} }
// Pass the received data to the PPP module // Pass the received data to the PPP module
@@ -444,9 +440,9 @@ void SstpProcessInterrupt(SSTP_SERVER *s)
} }
} }
if (s->PPPSession != NULL && s->PPPSession->DataTimeout > sstpTimeout) if (s->TubeRecv != NULL && s->TubeRecv->DataTimeout > sstpTimeout)
{ {
sstpTimeout = s->PPPSession->DataTimeout; sstpTimeout = s->TubeRecv->DataTimeout;
} }
if ((s->LastRecvTick + sstpTimeout) <= s->Now) if ((s->LastRecvTick + sstpTimeout) <= s->Now)
-1
View File
@@ -119,7 +119,6 @@ struct SSTP_SERVER
UINT64 LastRecvTick; // Tick when some data has received at the end UINT64 LastRecvTick; // Tick when some data has received at the end
bool FlushRecvTube; // Flag whether to flush the reception tube bool FlushRecvTube; // Flag whether to flush the reception tube
UINT EstablishedCount; // Number of session establishment UINT EstablishedCount; // Number of session establishment
PPP_SESSION *PPPSession; // Underlying PPP Session
}; };
+276 -171
View File
@@ -940,6 +940,7 @@ UINT ChangePasswordAccept(CONNECTION *c, PACK *p)
{ {
Copy(pw->HashedKey, new_password, SHA1_SIZE); Copy(pw->HashedKey, new_password, SHA1_SIZE);
Copy(pw->NtLmSecureHash, new_password_ntlm, MD5_SIZE); Copy(pw->NtLmSecureHash, new_password_ntlm, MD5_SIZE);
IncrementServerConfigRevision(cedar->Server);
} }
HLog(hub, "LH_CHANGE_PASSWORD_5", c->Name, username); HLog(hub, "LH_CHANGE_PASSWORD_5", c->Name, username);
} }
@@ -1572,6 +1573,12 @@ bool ServerAccept(CONNECTION *c)
c->CipherName = NULL; c->CipherName = NULL;
if (c->SslVersion != NULL)
{
Free(c->SslVersion);
}
c->SslVersion = NULL;
if (IsEmptyStr(tmp) == false) if (IsEmptyStr(tmp) == false)
{ {
c->CipherName = CopyStr(tmp); c->CipherName = CopyStr(tmp);
@@ -1591,11 +1598,22 @@ bool ServerAccept(CONNECTION *c)
} }
c->CipherName = NULL; c->CipherName = NULL;
if (c->SslVersion != NULL)
{
Free(c->SslVersion);
}
c->SslVersion = NULL;
if (c->FirstSock != NULL && IsEmptyStr(c->FirstSock->CipherName) == false) if (c->FirstSock != NULL && IsEmptyStr(c->FirstSock->CipherName) == false)
{ {
c->CipherName = CopyStr(c->FirstSock->CipherName); c->CipherName = CopyStr(c->FirstSock->CipherName);
} }
if (c->FirstSock != NULL && IsEmptyStr(c->FirstSock->SslVersion) == false)
{
c->SslVersion = CopyStr(c->FirstSock->SslVersion);
}
Format(radius_login_opt.In_VpnProtocolState, sizeof(radius_login_opt.In_VpnProtocolState), Format(radius_login_opt.In_VpnProtocolState, sizeof(radius_login_opt.In_VpnProtocolState),
"L%u:%s", IPC_LAYER_2, "SEVPN"); "L%u:%s", IPC_LAYER_2, "SEVPN");
} }
@@ -1684,6 +1702,9 @@ bool ServerAccept(CONNECTION *c)
case CLIENT_AUTHTYPE_CERT: case CLIENT_AUTHTYPE_CERT:
authtype_str = _UU("LH_AUTH_CERT"); authtype_str = _UU("LH_AUTH_CERT");
break; break;
case AUTHTYPE_EXTERNAL:
authtype_str = _UU("LH_AUTH_EXTERNAL");
break;
case AUTHTYPE_WIREGUARD_KEY: case AUTHTYPE_WIREGUARD_KEY:
authtype_str = _UU("LH_AUTH_WIREGUARD_KEY"); authtype_str = _UU("LH_AUTH_WIREGUARD_KEY");
break; break;
@@ -1811,6 +1832,11 @@ bool ServerAccept(CONNECTION *c)
// Anonymous authentication (this have been already attempted) // Anonymous authentication (this have been already attempted)
break; break;
case AUTHTYPE_EXTERNAL:
// External authentication already completed
auth_ret = true;
break;
case AUTHTYPE_TICKET: case AUTHTYPE_TICKET:
// Ticket authentication // Ticket authentication
if (PackGetDataSize(p, "ticket") == SHA1_SIZE) if (PackGetDataSize(p, "ticket") == SHA1_SIZE)
@@ -1896,7 +1922,7 @@ bool ServerAccept(CONNECTION *c)
if (auth_ret == false) if (auth_ret == false)
{ {
// Attempt external authentication registered users // Attempt external authentication
bool fail_ext_user_auth = false; bool fail_ext_user_auth = false;
if (GetGlobalServerFlag(GSF_DISABLE_RADIUS_AUTH) != 0) if (GetGlobalServerFlag(GSF_DISABLE_RADIUS_AUTH) != 0)
{ {
@@ -1905,7 +1931,7 @@ bool ServerAccept(CONNECTION *c)
if (fail_ext_user_auth == false) if (fail_ext_user_auth == false)
{ {
auth_ret = SamAuthUserByPlainPassword(c, hub, username, plain_password, false, mschap_v2_server_response_20, &radius_login_opt); auth_ret = SamAuthUserByPlainPassword(c, hub, username, plain_password, true, mschap_v2_server_response_20, &radius_login_opt);
} }
if (auth_ret && pol == NULL) if (auth_ret && pol == NULL)
@@ -1914,37 +1940,6 @@ bool ServerAccept(CONNECTION *c)
} }
} }
if (auth_ret == false)
{
// Attempt external authentication asterisk user
bool b = false;
bool fail_ext_user_auth = false;
if (GetGlobalServerFlag(GSF_DISABLE_RADIUS_AUTH) != 0)
{
fail_ext_user_auth = true;
}
if (fail_ext_user_auth == false)
{
AcLock(hub);
{
b = AcIsUser(hub, "*");
}
AcUnlock(hub);
// If there is asterisk user, log on as the user
if (b)
{
auth_ret = SamAuthUserByPlainPassword(c, hub, username, plain_password, true, mschap_v2_server_response_20, &radius_login_opt);
if (auth_ret && pol == NULL)
{
pol = SamGetUserPolicy(hub, "*");
}
}
}
}
if (pol != NULL) if (pol != NULL)
{ {
no_save_password = pol->NoSavePassword; no_save_password = pol->NoSavePassword;
@@ -2385,23 +2380,6 @@ bool ServerAccept(CONNECTION *c)
goto CLEANUP; goto CLEANUP;
} }
if ((policy->NoSavePassword) || (policy->AutoDisconnect != 0))
{
if (c->ClientBuild < 6560 && InStrEx(c->ClientStr, "client", false))
{
// If NoSavePassword policy is specified,
// only supported client can connect
HLog(hub, "LH_CLIENT_VERSION_OLD", c->Name, c->ClientBuild, 6560);
Unlock(hub->lock);
ReleaseHub(hub);
c->Err = ERR_VERSION_INVALID;
error_detail = "ERR_VERSION_INVALID";
Free(policy);
goto CLEANUP;
}
}
if (user_expires != 0 && user_expires <= SystemTime64()) if (user_expires != 0 && user_expires <= SystemTime64())
{ {
// User expired // User expired
@@ -2956,6 +2934,8 @@ bool ServerAccept(CONNECTION *c)
rudp_bulk_version = 2; rudp_bulk_version = 2;
} }
s->BulkOnRUDPVersion = rudp_bulk_version;
if (s->EnableBulkOnRUDP) if (s->EnableBulkOnRUDP)
{ {
AddProtocolDetailsKeyValueInt(s->ProtocolDetails, sizeof(s->ProtocolDetails), "RUDP_Bulk_Ver", s->BulkOnRUDPVersion); AddProtocolDetailsKeyValueInt(s->ProtocolDetails, sizeof(s->ProtocolDetails), "RUDP_Bulk_Ver", s->BulkOnRUDPVersion);
@@ -3217,7 +3197,7 @@ bool ServerAccept(CONNECTION *c)
#endif // OS_WIN32 #endif // OS_WIN32
tmp2 = ZeroMalloc(tmp2_size); tmp2 = ZeroMalloc(tmp2_size);
UniFormat(tmp2, tmp2_size, _UU(c->ClientBuild >= 9428 ? "NATT_MSG" : "NATT_MSG2"), local_name); UniFormat(tmp2, tmp2_size, _UU("NATT_MSG"), local_name);
UniStrCat(tmp, tmpsize, tmp2); UniStrCat(tmp, tmpsize, tmp2);
@@ -3843,7 +3823,18 @@ void CreateNodeInfo(NODE_INFO *info, CONNECTION *c)
// Server host name // Server host name
StrCpy(info->ServerHostname, sizeof(info->ServerHostname), c->ServerName); StrCpy(info->ServerHostname, sizeof(info->ServerHostname), c->ServerName);
// Server IP address // Server IP address
if (GetIP(&ip, info->ServerHostname)) if (s->ClientOption->ProxyType == PROXY_DIRECT)
{
if (IsIP6(&c->FirstSock->RemoteIP) == false)
{
info->ServerIpAddress = IPToUINT(&c->FirstSock->RemoteIP);
}
else
{
Copy(info->ServerIpAddress6, c->FirstSock->RemoteIP.address, sizeof(info->ServerIpAddress6));
}
}
else if (GetIP(&ip, info->ServerHostname))
{ {
if (IsIP6(&ip) == false) if (IsIP6(&ip) == false)
{ {
@@ -4300,7 +4291,6 @@ bool ClientCheckServerCert(CONNECTION *c, bool *expired)
X *x; X *x;
CHECK_CERT_THREAD_PROC *p; CHECK_CERT_THREAD_PROC *p;
THREAD *thread; THREAD *thread;
CEDAR *cedar;
bool ret; bool ret;
UINT64 start; UINT64 start;
// Validate arguments // Validate arguments
@@ -4315,31 +4305,10 @@ bool ClientCheckServerCert(CONNECTION *c, bool *expired)
} }
auth = c->Session->ClientAuth; auth = c->Session->ClientAuth;
cedar = c->Cedar;
if (auth->CheckCertProc == NULL && c->Session->LinkModeClient == false) if (auth->CheckCertProc == NULL)
{ {
// No checking function return false;
return true;
}
if (c->Session->LinkModeClient && c->Session->Link->CheckServerCert == false)
{
// It's in cascade connection mode, but do not check the server certificate
return true;
}
if (c->UseTicket)
{
// Check the certificate of the redirected VPN server
if (CompareX(c->FirstSock->RemoteX, c->ServerX) == false)
{
return false;
}
else
{
return true;
}
} }
x = CloneX(c->FirstSock->RemoteX); x = CloneX(c->FirstSock->RemoteX);
@@ -4349,63 +4318,6 @@ bool ClientCheckServerCert(CONNECTION *c, bool *expired)
return false; return false;
} }
if (CheckXDateNow(x))
{
// Check whether it is signed by the root certificate to trust
if (c->Session->LinkModeClient == false)
{
// Normal VPN Client mode
if (CheckSignatureByCa(cedar, x))
{
// This certificate can be trusted because it is signed
FreeX(x);
return true;
}
}
else
{
// Cascade connection mode
if (CheckSignatureByCaLinkMode(c->Session, x))
{
// This certificate can be trusted because it is signed
FreeX(x);
return true;
}
}
}
if (c->Session->LinkModeClient)
{
if (CheckXDateNow(x))
{
Lock(c->Session->Link->lock);
{
if (c->Session->Link->ServerCert != NULL)
{
if (CompareX(c->Session->Link->ServerCert, x))
{
Unlock(c->Session->Link->lock);
// Exactly match the certificate that is registered in the cascade configuration
FreeX(x);
return true;
}
}
}
Unlock(c->Session->Link->lock);
}
else
{
if (expired != NULL)
{
*expired = true;
}
}
// Verification failure at this point in the case of cascade connection mode
FreeX(x);
return false;
}
p = ZeroMalloc(sizeof(CHECK_CERT_THREAD_PROC)); p = ZeroMalloc(sizeof(CHECK_CERT_THREAD_PROC));
p->ServerX = x; p->ServerX = x;
p->CheckCertProc = auth->CheckCertProc; p->CheckCertProc = auth->CheckCertProc;
@@ -4423,7 +4335,8 @@ bool ClientCheckServerCert(CONNECTION *c, bool *expired)
{ {
// Send a NOOP periodically for disconnection prevention // Send a NOOP periodically for disconnection prevention
start = Tick64(); start = Tick64();
ClientUploadNoop(c); // Do not send because we now ask for user permission before sending signature
//ClientUploadNoop(c);
} }
if (p->UserSelected) if (p->UserSelected)
{ {
@@ -4482,10 +4395,43 @@ REDIRECTED:
s = ClientConnectToServer(c); s = ClientConnectToServer(c);
if (s == NULL) if (s == NULL)
{ {
// Do not retry if untrusted or hostname mismatched
if (c->Session->LinkModeClient == false && (c->Err == ERR_CERT_NOT_TRUSTED || c->Err == ERR_HOSTNAME_MISMATCH)
&& (c->Session->Account == NULL || ! c->Session->Account->RetryOnServerCert))
{
c->Session->ForceStopFlag = true;
}
PrintStatus(sess, L"free"); PrintStatus(sess, L"free");
return false; return false;
} }
PrintStatus(sess, _UU("STATUS_5"));
// Prompt user whether to continue on verification errors
if ((c->Err == ERR_CERT_NOT_TRUSTED || c->Err == ERR_HOSTNAME_MISMATCH || c->Err == ERR_SERVER_CERT_EXPIRES) && ClientCheckServerCert(c, &expired) == false)
{
if (expired)
{
c->Err = ERR_SERVER_CERT_EXPIRES;
}
// Do not retry if untrusted or hostname mismatched
if (c->Session->LinkModeClient == false && (c->Err == ERR_CERT_NOT_TRUSTED || c->Err == ERR_HOSTNAME_MISMATCH)
&& (c->Session->Account == NULL || ! c->Session->Account->RetryOnServerCert))
{
c->Session->ForceStopFlag = true;
}
goto CLEANUP;
}
// Check the certificate of the redirected VPN server
if (c->UseTicket && CompareX(s->RemoteX, c->ServerX) == false)
{
c->Err = ERR_CERT_NOT_TRUSTED;
goto CLEANUP;
}
Copy(&server_ip, &s->RemoteIP, sizeof(IP)); Copy(&server_ip, &s->RemoteIP, sizeof(IP));
if (c->Halt) if (c->Halt)
@@ -4537,8 +4483,6 @@ REDIRECTED:
goto CLEANUP; goto CLEANUP;
} }
PrintStatus(sess, _UU("STATUS_5"));
// Receive a Hello packet // Receive a Hello packet
Debug("Downloading Hello...\n"); Debug("Downloading Hello...\n");
if (ClientDownloadHello(c, s) == false) if (ClientDownloadHello(c, s) == false)
@@ -4574,27 +4518,6 @@ REDIRECTED:
// During user authentication // During user authentication
c->Session->ClientStatus = CLIENT_STATUS_AUTH; c->Session->ClientStatus = CLIENT_STATUS_AUTH;
// Verify the server certificate by the client
if (ClientCheckServerCert(c, &expired) == false)
{
if (expired == false)
{
c->Err = ERR_CERT_NOT_TRUSTED;
}
else
{
c->Err = ERR_SERVER_CERT_EXPIRES;
}
if (c->Session->LinkModeClient == false && c->Err == ERR_CERT_NOT_TRUSTED
&& (c->Session->Account == NULL || ! c->Session->Account->RetryOnServerCert))
{
c->Session->ForceStopFlag = true;
}
goto CLEANUP;
}
PrintStatus(sess, _UU("STATUS_6")); PrintStatus(sess, _UU("STATUS_6"));
// Send the authentication data // Send the authentication data
@@ -5048,6 +4971,13 @@ REDIRECTED:
} }
c->CipherName = CopyStr(c->FirstSock->CipherName); c->CipherName = CopyStr(c->FirstSock->CipherName);
if (c->SslVersion != NULL)
{
Free(c->SslVersion);
}
c->SslVersion = CopyStr(c->FirstSock->SslVersion);
} }
Unlock(c->lock); Unlock(c->lock);
@@ -6223,16 +6153,29 @@ SOCK *ClientConnectToServer(CONNECTION *c)
SetTimeout(s, CONNECTING_TIMEOUT); SetTimeout(s, CONNECTING_TIMEOUT);
// Start the SSL communication // Start the SSL communication
if (StartSSLEx(s, x, k, 0, c->ServerName) == false) UINT err = 0;
if (StartSSLEx3(s, x, k, NULL, 0, c->ServerName, c->Session->SslOption, &err) == false)
{ {
// SSL communication start failure // SSL communication start failure
Disconnect(s); Disconnect(s);
ReleaseSock(s); ReleaseSock(s);
c->FirstSock = NULL; c->FirstSock = NULL;
c->Err = ERR_SERVER_IS_NOT_VPN; if (err != 0)
{
c->Err = err;
}
else
{
c->Err = ERR_SERVER_IS_NOT_VPN;
}
return NULL; return NULL;
} }
if (err != 0)
{
c->Err = err;
}
if (s->RemoteX == NULL) if (s->RemoteX == NULL)
{ {
// SSL communication start failure // SSL communication start failure
@@ -6243,6 +6186,8 @@ SOCK *ClientConnectToServer(CONNECTION *c)
return NULL; return NULL;
} }
CLog(c->Cedar->Client, "LC_SSL_CONNECTED", c->Session->ClientOption->AccountName, s->SslVersion, s->CipherName);
return s; return s;
} }
@@ -6251,6 +6196,8 @@ SOCK *ClientConnectGetSocket(CONNECTION *c, bool additional_connect)
{ {
volatile bool *cancel_flag = NULL; volatile bool *cancel_flag = NULL;
char hostname[MAX_HOST_NAME_LEN]; char hostname[MAX_HOST_NAME_LEN];
char localaddr[MAX_HOST_NAME_LEN];
bool save_resolved_ip = false; bool save_resolved_ip = false;
CLIENT_OPTION *o; CLIENT_OPTION *o;
SESSION *sess; SESSION *sess;
@@ -6282,7 +6229,7 @@ SOCK *ClientConnectGetSocket(CONNECTION *c, bool additional_connect)
c->ServerPort = o->Port; c->ServerPort = o->Port;
} }
if (IsZeroIP(&sess->ServerIP_CacheForNextConnect) == false) if (additional_connect && IsZeroIP(&sess->ServerIP_CacheForNextConnect) == false)
{ {
IPToStr(hostname, sizeof(hostname), &sess->ServerIP_CacheForNextConnect); IPToStr(hostname, sizeof(hostname), &sess->ServerIP_CacheForNextConnect);
Debug("ClientConnectGetSocket(): Using cached IP address %s\n", hostname); Debug("ClientConnectGetSocket(): Using cached IP address %s\n", hostname);
@@ -6302,6 +6249,7 @@ SOCK *ClientConnectGetSocket(CONNECTION *c, bool additional_connect)
if (o->ProxyType == PROXY_DIRECT) if (o->ProxyType == PROXY_DIRECT)
{ {
UINT ssl_err = 0;
UINT nat_t_err = 0; UINT nat_t_err = 0;
wchar_t tmp[MAX_SIZE]; wchar_t tmp[MAX_SIZE];
UniFormat(tmp, sizeof(tmp), _UU("STATUS_4"), hostname); UniFormat(tmp, sizeof(tmp), _UU("STATUS_4"), hostname);
@@ -6309,11 +6257,50 @@ SOCK *ClientConnectGetSocket(CONNECTION *c, bool additional_connect)
if (o->PortUDP == 0) if (o->PortUDP == 0)
{ {
IP *localIP;
UINT localport;
// Top of Bind outgoing connection
// Decide the binding operation which is explicitly executed on the client-side
// In the case of first TCP/IP connection
if (additional_connect == false) {
if (sess->ClientOption->NoRoutingTracking == false) {
localIP = BIND_LOCALIP_NULL; // Specify not to bind
}
else {
// Nonzero address is for source IP address to bind. Zero address is for dummy not to bind.
if (IsZeroIP(&sess->ClientOption->BindLocalIP) == true) {
localIP = BIND_LOCALIP_NULL;
}
else {
localIP = &sess->ClientOption->BindLocalIP;
}
Debug("ClientConnectGetSocket(): Source IP address %r and source port number %d for binding\n"
, &sess->ClientOption->BindLocalIP, sess->ClientOption->BindLocalPort);
}
}
// In the case of second and subsequent TCP/IP connections
else {
// Bind the socket to the actual local IP address of first TCP / IP connection
localIP = &sess->LocalIP_CacheForNextConnect;
//localIP = BIND_LOCALIP_NULL; // Specify not to bind for test
}
if (sess->ClientOption->BindLocalPort == 0) {
localport = BIND_LOCALPORT_NULL;
}
else {
localport = sess->ClientOption->BindLocalPort + Count(sess->Connection->CurrentNumConnection) - 1;
Debug("ClientConnectGetSocket(): Additional source port number %u\n", localport);
}
// Bottom of Bind outgoing connection
// If additional_connect == false, enable trying to NAT-T connection // If additional_connect == false, enable trying to NAT-T connection
// If additional_connect == true, follow the IsRUDPSession setting in this session // If additional_connect == true, follow the IsRUDPSession setting in this session
sock = TcpIpConnectEx(hostname, c->ServerPort, // In additional connect or redirect we do not need ssl verification as the certificate is always compared with a saved one
sock = BindTcpIpConnectEx2(localIP, localport, hostname, c->ServerPort,
(bool *)cancel_flag, c->hWndForUI, &nat_t_err, (additional_connect ? (!sess->IsRUDPSession) : false), (bool *)cancel_flag, c->hWndForUI, &nat_t_err, (additional_connect ? (!sess->IsRUDPSession) : false),
true, &resolved_ip); true, ((additional_connect || c->UseTicket) ? NULL : sess->SslOption), &ssl_err, o->HintStr, &resolved_ip);
} }
else else
{ {
@@ -6336,7 +6323,14 @@ SOCK *ClientConnectGetSocket(CONNECTION *c, bool additional_connect)
// Connection failure // Connection failure
if (nat_t_err != RUDP_ERROR_NAT_T_TWO_OR_MORE) if (nat_t_err != RUDP_ERROR_NAT_T_TWO_OR_MORE)
{ {
c->Err = ERR_CONNECT_FAILED; if (ssl_err != 0)
{
c->Err = ssl_err;
}
else
{
c->Err = ERR_CONNECT_FAILED;
}
} }
else else
{ {
@@ -6345,6 +6339,11 @@ SOCK *ClientConnectGetSocket(CONNECTION *c, bool additional_connect)
return NULL; return NULL;
} }
if (ssl_err != 0)
{
c->Err = ssl_err;
}
} }
else else
{ {
@@ -6369,6 +6368,33 @@ SOCK *ClientConnectGetSocket(CONNECTION *c, bool additional_connect)
StrCpy(in.HttpCustomHeader, sizeof(in.HttpCustomHeader), o->CustomHttpHeader); StrCpy(in.HttpCustomHeader, sizeof(in.HttpCustomHeader), o->CustomHttpHeader);
StrCpy(in.HttpUserAgent, sizeof(in.HttpUserAgent), c->Cedar->HttpUserAgent); StrCpy(in.HttpUserAgent, sizeof(in.HttpUserAgent), c->Cedar->HttpUserAgent);
// Top of Bind outgoing connection
// In the case of first TCP/IP connection
if (additional_connect == false) {
if (sess->ClientOption->NoRoutingTracking == false) {
in.BindLocalIP = BIND_LOCALIP_NULL; // Specify not to bind
}
else {
if (IsZeroIP(&sess->ClientOption->BindLocalIP) == true) {
in.BindLocalIP = BIND_LOCALIP_NULL;
}
else {
in.BindLocalIP = &sess->ClientOption->BindLocalIP;
}
}
}
// In the case of second and subsequent TCP/IP connections
else {
in.BindLocalIP = &sess->LocalIP_CacheForNextConnect;
}
if (sess->ClientOption->BindLocalPort == 0) {
in.BindLocalPort = BIND_LOCALPORT_NULL;
}
else {
in.BindLocalPort = sess->ClientOption->BindLocalPort + Count(sess->Connection->CurrentNumConnection) - 1;
}
// Bottom of Bind outgoing connection
#ifdef OS_WIN32 #ifdef OS_WIN32
in.Hwnd = c->hWndForUI; in.Hwnd = c->hWndForUI;
#endif #endif
@@ -6379,13 +6405,16 @@ SOCK *ClientConnectGetSocket(CONNECTION *c, bool additional_connect)
switch (o->ProxyType) switch (o->ProxyType)
{ {
case PROXY_HTTP: case PROXY_HTTP:
ret = ProxyHttpConnect(&out, &in, cancel_flag); // ret = ProxyHttpConnect(&out, &in, cancel_flag);
ret = BindProxyHttpConnect(&out, &in, cancel_flag); // Bind outgoing connection
break; break;
case PROXY_SOCKS: case PROXY_SOCKS:
ret = ProxySocks4Connect(&out, &in, cancel_flag); // ret = ProxySocks4Connect(&out, &in, cancel_flag);
ret = BindProxySocks4Connect(&out, &in, cancel_flag); // Bind outgoing connection
break; break;
case PROXY_SOCKS5: case PROXY_SOCKS5:
ret = ProxySocks5Connect(&out, &in, cancel_flag); // ret = ProxySocks5Connect(&out, &in, cancel_flag);
ret = BindProxySocks5Connect(&out, &in, cancel_flag); // Bind outgoing connection
break; break;
default: default:
c->Err = ERR_INTERNAL_ERROR; c->Err = ERR_INTERNAL_ERROR;
@@ -6408,7 +6437,7 @@ SOCK *ClientConnectGetSocket(CONNECTION *c, bool additional_connect)
if (additional_connect == false || IsZeroIP(&sock->RemoteIP)) if (additional_connect == false || IsZeroIP(&sock->RemoteIP))
{ {
if (((sock->IsRUDPSocket || sock->IPv6) && IsZeroIP(&sock->RemoteIP) == false && o->ProxyType == PROXY_DIRECT) || GetIP(&c->Session->ServerIP, hostname) == false) if (IsZeroIP(&sock->RemoteIP) == false || (sock->IPv6 && GetIP6(&c->Session->ServerIP, hostname) == false) || (sock->IPv6 == false && GetIP4(&c->Session->ServerIP, hostname) == false))
{ {
Copy(&c->Session->ServerIP, &sock->RemoteIP, sizeof(c->Session->ServerIP)); Copy(&c->Session->ServerIP, &sock->RemoteIP, sizeof(c->Session->ServerIP));
} }
@@ -6420,6 +6449,25 @@ SOCK *ClientConnectGetSocket(CONNECTION *c, bool additional_connect)
Debug("ClientConnectGetSocket(): Saved %s IP address %r for future connections.\n", hostname, &resolved_ip); Debug("ClientConnectGetSocket(): Saved %s IP address %r for future connections.\n", hostname, &resolved_ip);
} }
// Top of Bind outgoing connection
IPToStr(localaddr, sizeof(localaddr), &sock->LocalIP);
// In the case of first TCP/IP connection, save the local IP address
if (additional_connect == false) {
c->Session->LocalIP_CacheForNextConnect = sock->LocalIP;
Debug("ClientConnectGetSocket(): Saved local IP address %r for future connections.\n", &sock->LocalIP);
}
// In the case of second and subsequent TCP/IP connections, check to see whether or not the local IP address is same as the first one
else {
if (memcmp(sock->LocalIP.address, c->Session->LocalIP_CacheForNextConnect.address, sizeof(sock->LocalIP.address)) == 0) {
Debug("ClientConnectGetSocket(): Binded local IP address %s OK\n", localaddr);
}
else {
Debug("ClientConnectGetSocket(): Binded local IP address %s NG\n", localaddr);
}
}
// Bottom of Bind outgoing connection
return sock; return sock;
} }
@@ -6449,23 +6497,60 @@ UINT ProxyCodeToCedar(UINT code)
// TCP connection function // TCP connection function
SOCK *TcpConnectEx3(char *hostname, UINT port, UINT timeout, bool *cancel_flag, void *hWnd, bool no_nat_t, UINT *nat_t_error_code, bool try_start_ssl, IP *ret_ip) SOCK *TcpConnectEx3(char *hostname, UINT port, UINT timeout, bool *cancel_flag, void *hWnd, bool no_nat_t, UINT *nat_t_error_code, bool try_start_ssl, IP *ret_ip)
{
return BindTcpConnectEx3(BIND_LOCALIP_NULL, BIND_LOCALPORT_NULL, hostname, port, timeout, cancel_flag, hWnd, no_nat_t, nat_t_error_code, try_start_ssl, ret_ip);
}
SOCK *TcpConnectEx4(char * hostname, UINT port, UINT timeout, bool * cancel_flag, void *hWnd, bool no_nat_t, UINT *nat_t_error_code, bool try_start_ssl, SSL_VERIFY_OPTION *ssl_option, UINT *ssl_err, char *hint_str, IP *ret_ip)
{
return BindTcpConnectEx4(BIND_LOCALIP_NULL, BIND_LOCALPORT_NULL, hostname, port, timeout, cancel_flag, hWnd, no_nat_t, nat_t_error_code, try_start_ssl, ssl_option, ssl_err, hint_str, ret_ip);
}
// Connect with TCP/IP
SOCK *TcpIpConnectEx(char *hostname, UINT port, bool *cancel_flag, void *hWnd, UINT *nat_t_error_code, bool no_nat_t, bool try_start_ssl, IP *ret_ip)
{
return BindTcpIpConnectEx(BIND_LOCALIP_NULL, BIND_LOCALPORT_NULL, hostname, port, cancel_flag, hWnd, nat_t_error_code, no_nat_t, try_start_ssl, ret_ip);
}
SOCK *TcpIpConnectEx2(char * hostname, UINT port, bool * cancel_flag, void *hWnd, UINT *nat_t_error_code, bool no_nat_t, bool try_start_ssl, SSL_VERIFY_OPTION *ssl_option, UINT *ssl_err, char *hint_str, IP *ret_ip)
{
return BindTcpIpConnectEx2(BIND_LOCALIP_NULL, BIND_LOCALPORT_NULL, hostname, port, cancel_flag, hWnd, nat_t_error_code, no_nat_t, try_start_ssl, ssl_option, ssl_err, hint_str, ret_ip);
}
// TCP connection function
//SOCK* TcpConnectEx3(char* hostname, UINT port, UINT timeout, bool* cancel_flag, void* hWnd, bool no_nat_t, UINT* nat_t_error_code, bool try_start_ssl, IP* ret_ip)
SOCK *BindTcpConnectEx3(IP *localIP, UINT localport, char *hostname, UINT port, UINT timeout, bool *cancel_flag, void *hWnd, bool no_nat_t, UINT *nat_t_error_code, bool try_start_ssl, IP *ret_ip)
{
// return TcpConnectEx4(hostname, port, timeout, cancel_flag, hWnd, no_nat_t, nat_t_error_code, try_start_ssl, NULL, NULL, NULL, ret_ip);
return BindTcpConnectEx4(localIP, localport, hostname, port, timeout, cancel_flag, hWnd, no_nat_t, nat_t_error_code, try_start_ssl, NULL, NULL, NULL, ret_ip);
}
//SOCK *TcpConnectEx4(char *hostname, UINT port, UINT timeout, bool *cancel_flag, void *hWnd, bool no_nat_t, UINT *nat_t_error_code, bool try_start_ssl, SSL_VERIFY_OPTION *ssl_option, UINT *ssl_err, char *hint_str, IP *ret_ip)
SOCK *BindTcpConnectEx4(IP *localIP, UINT localport, char *hostname, UINT port, UINT timeout, bool *cancel_flag, void *hWnd, bool no_nat_t, UINT *nat_t_error_code, bool try_start_ssl, SSL_VERIFY_OPTION *ssl_option, UINT *ssl_err, char *hint_str, IP *ret_ip)
{ {
#ifdef OS_WIN32 #ifdef OS_WIN32
if (hWnd == NULL) if (hWnd == NULL)
{ {
#endif // OS_WIN32 #endif // OS_WIN32
return ConnectEx4(hostname, port, timeout, cancel_flag, (no_nat_t ? NULL : VPN_RUDP_SVC_NAME), nat_t_error_code, try_start_ssl, true, ret_ip); // return ConnectEx5(hostname, port, timeout, cancel_flag, (no_nat_t ? NULL : VPN_RUDP_SVC_NAME), nat_t_error_code, try_start_ssl, true, ssl_option, ssl_err, hint_str, ret_ip);
return BindConnectEx5(localIP, localport, hostname, port, timeout, cancel_flag, (no_nat_t ? NULL : VPN_RUDP_SVC_NAME), nat_t_error_code, try_start_ssl, true, ssl_option, ssl_err, hint_str, ret_ip);
#ifdef OS_WIN32 #ifdef OS_WIN32
} }
else else
{ {
return WinConnectEx3((HWND)hWnd, hostname, port, timeout, 0, NULL, NULL, nat_t_error_code, (no_nat_t ? NULL : VPN_RUDP_SVC_NAME), try_start_ssl); return WinConnectEx4((HWND)hWnd, hostname, port, timeout, 0, NULL, NULL, nat_t_error_code, (no_nat_t ? NULL : VPN_RUDP_SVC_NAME), try_start_ssl, ssl_option, ssl_err, hint_str);
} }
#endif // OS_WIN32 #endif // OS_WIN32
} }
// Connect with TCP/IP // Connect with TCP/IP
SOCK *TcpIpConnectEx(char *hostname, UINT port, bool *cancel_flag, void *hWnd, UINT *nat_t_error_code, bool no_nat_t, bool try_start_ssl, IP *ret_ip) //SOCK *TcpIpConnectEx(char *hostname, UINT port, bool *cancel_flag, void *hWnd, UINT *nat_t_error_code, bool no_nat_t, bool try_start_ssl, IP *ret_ip)
SOCK *BindTcpIpConnectEx(IP *localIP, UINT localport, char *hostname, UINT port, bool *cancel_flag, void *hWnd, UINT *nat_t_error_code, bool no_nat_t, bool try_start_ssl, IP *ret_ip)
{
// return TcpIpConnectEx2(hostname, port, cancel_flag, hWnd, nat_t_error_code, no_nat_t, try_start_ssl, NULL, NULL, NULL, ret_ip);
return BindTcpIpConnectEx2(localIP, localport, hostname, port, cancel_flag, hWnd, nat_t_error_code, no_nat_t, try_start_ssl, NULL, NULL, NULL, ret_ip);
}
//SOCK *TcpIpConnectEx2(char *hostname, UINT port, bool *cancel_flag, void *hWnd, UINT *nat_t_error_code, bool no_nat_t, bool try_start_ssl, SSL_VERIFY_OPTION *ssl_option, UINT *ssl_err, char *hint_str, IP *ret_ip)
SOCK *BindTcpIpConnectEx2(IP *localIP, UINT localport, char *hostname, UINT port, bool *cancel_flag, void *hWnd, UINT *nat_t_error_code, bool no_nat_t, bool try_start_ssl, SSL_VERIFY_OPTION *ssl_option, UINT *ssl_err, char *hint_str, IP *ret_ip)
{ {
SOCK *s = NULL; SOCK *s = NULL;
UINT dummy_int = 0; UINT dummy_int = 0;
@@ -6480,7 +6565,8 @@ SOCK *TcpIpConnectEx(char *hostname, UINT port, bool *cancel_flag, void *hWnd, U
return NULL; return NULL;
} }
s = TcpConnectEx3(hostname, port, 0, cancel_flag, hWnd, no_nat_t, nat_t_error_code, try_start_ssl, ret_ip); // s = TcpConnectEx4(hostname, port, 0, cancel_flag, hWnd, no_nat_t, nat_t_error_code, try_start_ssl, ssl_option, ssl_err, hint_str, ret_ip);
s = BindTcpConnectEx4(localIP, localport, hostname, port, 0, cancel_flag, hWnd, no_nat_t, nat_t_error_code, try_start_ssl, ssl_option, ssl_err, hint_str, ret_ip);
if (s == NULL) if (s == NULL)
{ {
return NULL; return NULL;
@@ -6752,6 +6838,25 @@ PACK *PackLoginWithAnonymous(char *hubname, char *username)
return p; return p;
} }
// Create a packet for external login
PACK *PackLoginWithExternal(char *hubname, char *username)
{
PACK *p;
// Validate arguments
if (hubname == NULL || username == NULL)
{
return NULL;
}
p = NewPack();
PackAddStr(p, "method", "login");
PackAddStr(p, "hubname", hubname);
PackAddStr(p, "username", username);
PackAddInt(p, "authtype", AUTHTYPE_EXTERNAL);
return p;
}
// Create a packet for the additional connection // Create a packet for the additional connection
PACK *PackAdditionalConnect(UCHAR *session_key) PACK *PackAdditionalConnect(UCHAR *session_key)
{ {
+12
View File
@@ -114,6 +114,12 @@ bool ServerAccept(CONNECTION *c);
bool ClientConnect(CONNECTION *c); bool ClientConnect(CONNECTION *c);
SOCK *ClientConnectToServer(CONNECTION *c); SOCK *ClientConnectToServer(CONNECTION *c);
SOCK *TcpIpConnectEx(char *hostname, UINT port, bool *cancel_flag, void *hWnd, UINT *nat_t_error_code, bool no_nat_t, bool try_start_ssl, IP *ret_ip); SOCK *TcpIpConnectEx(char *hostname, UINT port, bool *cancel_flag, void *hWnd, UINT *nat_t_error_code, bool no_nat_t, bool try_start_ssl, IP *ret_ip);
SOCK *TcpIpConnectEx2(char *hostname, UINT port, bool *cancel_flag, void *hWnd, UINT *nat_t_error_code, bool no_nat_t, bool try_start_ssl, SSL_VERIFY_OPTION *ssl_option, UINT *ssl_err, char *hint_str, IP *ret_ip);
// New function named with prefix "Bind" binds outgoing connection to a specific address. New one is wrapped in original one.
SOCK* BindTcpIpConnectEx(IP *localIP, UINT localport, char *hostname, UINT port, bool *cancel_flag, void *hWnd, UINT *nat_t_error_code, bool no_nat_t, bool try_start_ssl, IP *ret_ip);
SOCK* BindTcpIpConnectEx2(IP *localIP, UINT localport, char *hostname, UINT port, bool *cancel_flag, void *hWnd, UINT *nat_t_error_code, bool no_nat_t, bool try_start_ssl, SSL_VERIFY_OPTION *ssl_option, UINT *ssl_err, char *hint_str, IP *ret_ip);
bool ClientUploadSignature(SOCK *s); bool ClientUploadSignature(SOCK *s);
bool ClientDownloadHello(CONNECTION *c, SOCK *s); bool ClientDownloadHello(CONNECTION *c, SOCK *s);
bool ServerDownloadSignature(CONNECTION *c, char **error_detail_str); bool ServerDownloadSignature(CONNECTION *c, char **error_detail_str);
@@ -121,6 +127,11 @@ bool ServerUploadHello(CONNECTION *c);
bool ClientUploadAuth(CONNECTION *c); bool ClientUploadAuth(CONNECTION *c);
SOCK *ClientConnectGetSocket(CONNECTION *c, bool additional_connect); SOCK *ClientConnectGetSocket(CONNECTION *c, bool additional_connect);
SOCK *TcpConnectEx3(char *hostname, UINT port, UINT timeout, bool *cancel_flag, void *hWnd, bool no_nat_t, UINT *nat_t_error_code, bool try_start_ssl, IP *ret_ip); SOCK *TcpConnectEx3(char *hostname, UINT port, UINT timeout, bool *cancel_flag, void *hWnd, bool no_nat_t, UINT *nat_t_error_code, bool try_start_ssl, IP *ret_ip);
SOCK *TcpConnectEx4(char *hostname, UINT port, UINT timeout, bool *cancel_flag, void *hWnd, bool no_nat_t, UINT *nat_t_error_code, bool try_start_ssl, SSL_VERIFY_OPTION *ssl_option, UINT *ssl_err, char *hint_str, IP *ret_ip);
// New function named with prefix "Bind" binds outgoing connection to a specific address. New one is wrapped in original one.
SOCK* BindTcpConnectEx3(IP *localIP, UINT localport, char *hostname, UINT port, UINT timeout, bool *cancel_flag, void *hWnd, bool no_nat_t, UINT *nat_t_error_code, bool try_start_ssl, IP *ret_ip);
SOCK* BindTcpConnectEx4(IP *localIP, UINT localport, char *hostname, UINT port, UINT timeout, bool *cancel_flag, void *hWnd, bool no_nat_t, UINT *nat_t_error_code, bool try_start_ssl, SSL_VERIFY_OPTION *ssl_option, UINT *ssl_err, char *hint_str, IP *ret_ip);
UINT ProxyCodeToCedar(UINT code); UINT ProxyCodeToCedar(UINT code);
@@ -132,6 +143,7 @@ void PackAddPolicy(PACK *p, POLICY *y);
PACK *PackWelcome(SESSION *s); PACK *PackWelcome(SESSION *s);
PACK *PackHello(void *random, UINT ver, UINT build, char *server_str); PACK *PackHello(void *random, UINT ver, UINT build, char *server_str);
bool GetHello(PACK *p, void *random, UINT *ver, UINT *build, char *server_str, UINT server_str_size); bool GetHello(PACK *p, void *random, UINT *ver, UINT *build, char *server_str, UINT server_str_size);
PACK *PackLoginWithExternal(char *hubname, char *username);
PACK *PackLoginWithAnonymous(char *hubname, char *username); PACK *PackLoginWithAnonymous(char *hubname, char *username);
PACK *PackLoginWithPassword(char *hubname, char *username, void *secure_password); PACK *PackLoginWithPassword(char *hubname, char *username, void *secure_password);
PACK *PackLoginWithPlainPassword(char *hubname, char *username, void *plain_password); PACK *PackLoginWithPlainPassword(char *hubname, char *username, void *plain_password);
+173 -29
View File
@@ -10,6 +10,7 @@
#include "Connection.h" #include "Connection.h"
#include "IPC.h" #include "IPC.h"
#include "Server.h" #include "Server.h"
#include "Proto_PPP.h"
#include "Mayaqua/DNS.h" #include "Mayaqua/DNS.h"
#include "Mayaqua/Internat.h" #include "Mayaqua/Internat.h"
@@ -19,7 +20,7 @@
#include "Mayaqua/Tick64.h" #include "Mayaqua/Tick64.h"
// send PEAP-MSCHAPv2 auth client response // send PEAP-MSCHAPv2 auth client response
bool PeapClientSendMsChapv2AuthClientResponse(EAP_CLIENT *e, UCHAR *client_response, UCHAR *client_challenge) bool PeapClientSendMsChapv2AuthClientResponse(EAP_CLIENT *e, UCHAR *client_response, UCHAR *client_challenge, char *username)
{ {
bool ret = false; bool ret = false;
EAP_MSCHAPV2_RESPONSE msg1; EAP_MSCHAPV2_RESPONSE msg1;
@@ -37,13 +38,13 @@ bool PeapClientSendMsChapv2AuthClientResponse(EAP_CLIENT *e, UCHAR *client_respo
msg1.Type = EAP_TYPE_MS_AUTH; msg1.Type = EAP_TYPE_MS_AUTH;
msg1.Chap_Opcode = EAP_MSCHAPV2_OP_RESPONSE; msg1.Chap_Opcode = EAP_MSCHAPV2_OP_RESPONSE;
msg1.Chap_Id = e->MsChapV2Challenge.Chap_Id; msg1.Chap_Id = e->MsChapV2Challenge.Chap_Id;
msg1.Chap_Len = Endian16(54 + StrLen(e->Username)); msg1.Chap_Len = Endian16(54 + StrLen(username));
msg1.Chap_ValueSize = 49; msg1.Chap_ValueSize = 49;
Copy(msg1.Chap_PeerChallenge, client_challenge, 16); Copy(msg1.Chap_PeerChallenge, client_challenge, 16);
Copy(msg1.Chap_NtResponse, client_response, 24); Copy(msg1.Chap_NtResponse, client_response, 24);
Copy(msg1.Chap_Name, e->Username, MIN(StrLen(e->Username), 255)); Copy(msg1.Chap_Name, username, MIN(StrLen(username), 255));
if (SendPeapPacket(e, &msg1, 59 + StrLen(e->Username)) && if (SendPeapPacket(e, &msg1, 59 + StrLen(username)) &&
GetRecvPeapMessage(e, &msg2)) GetRecvPeapMessage(e, &msg2))
{ {
if (msg2.Type == EAP_TYPE_MS_AUTH && if (msg2.Type == EAP_TYPE_MS_AUTH &&
@@ -300,7 +301,7 @@ bool SendPeapRawPacket(EAP_CLIENT *e, UCHAR *peap_data, UINT peap_size)
Add(send_packet->AvpList, eap_avp); Add(send_packet->AvpList, eap_avp);
response_packet = EapSendPacketAndRecvResponse(e, send_packet); response_packet = EapSendPacketAndRecvResponse(e, send_packet, true);
if (response_packet != NULL) if (response_packet != NULL)
{ {
@@ -416,6 +417,11 @@ bool StartPeapSslClient(EAP_CLIENT *e)
} }
e->SslPipe = NewSslPipe(false, NULL, NULL, NULL); e->SslPipe = NewSslPipe(false, NULL, NULL, NULL);
if (e->SslPipe == NULL)
{
return false;
}
send_fifo = e->SslPipe->RawOut->RecvFifo; send_fifo = e->SslPipe->RawOut->RecvFifo;
recv_fifo = e->SslPipe->RawIn->SendFifo; recv_fifo = e->SslPipe->RawIn->SendFifo;
@@ -502,7 +508,7 @@ bool StartPeapClient(EAP_CLIENT *e)
Copy(eap1->Data, e->Username, StrLen(e->Username)); Copy(eap1->Data, e->Username, StrLen(e->Username));
Add(request1->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_EAP_MESSAGE, 0, 0, eap1, StrLen(e->Username) + 5)); Add(request1->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_EAP_MESSAGE, 0, 0, eap1, StrLen(e->Username) + 5));
response1 = EapSendPacketAndRecvResponse(e, request1); response1 = EapSendPacketAndRecvResponse(e, request1, true);
if (response1 != NULL) if (response1 != NULL)
{ {
@@ -532,7 +538,7 @@ bool StartPeapClient(EAP_CLIENT *e)
Add(request2->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_EAP_MESSAGE, 0, 0, eap2, 6)); Add(request2->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_EAP_MESSAGE, 0, 0, eap2, 6));
response2 = EapSendPacketAndRecvResponse(e, request2); response2 = EapSendPacketAndRecvResponse(e, request2, true);
if (response2 != NULL && response2->Parse_EapMessage_DataSize != 0 && response2->Parse_EapMessage != NULL) if (response2 != NULL && response2->Parse_EapMessage_DataSize != 0 && response2->Parse_EapMessage != NULL)
{ {
@@ -632,7 +638,7 @@ void EapSetRadiusGeneralAttributes(RADIUS_PACKET *r, EAP_CLIENT *e)
} }
// Send a MSCHAPv2 client auth response1 // Send a MSCHAPv2 client auth response1
bool EapClientSendMsChapv2AuthClientResponse(EAP_CLIENT *e, UCHAR *client_response, UCHAR *client_challenge) bool EapClientSendMsChapv2AuthClientResponse(EAP_CLIENT *e, UCHAR *client_response, UCHAR *client_challenge, char *username)
{ {
bool ret = false; bool ret = false;
RADIUS_PACKET *request1 = NULL; RADIUS_PACKET *request1 = NULL;
@@ -657,20 +663,20 @@ bool EapClientSendMsChapv2AuthClientResponse(EAP_CLIENT *e, UCHAR *client_respon
eap1 = ZeroMalloc(sizeof(EAP_MSCHAPV2_RESPONSE)); eap1 = ZeroMalloc(sizeof(EAP_MSCHAPV2_RESPONSE));
eap1->Code = EAP_CODE_RESPONSE; eap1->Code = EAP_CODE_RESPONSE;
eap1->Id = e->NextEapId++; eap1->Id = e->LastRecvEapId;
eap1->Len = Endian16(59 + StrLen(e->Username)); eap1->Len = Endian16(59 + StrLen(username));
eap1->Type = EAP_TYPE_MS_AUTH; eap1->Type = EAP_TYPE_MS_AUTH;
eap1->Chap_Opcode = EAP_MSCHAPV2_OP_RESPONSE; eap1->Chap_Opcode = EAP_MSCHAPV2_OP_RESPONSE;
eap1->Chap_Id = e->MsChapV2Challenge.Chap_Id; eap1->Chap_Id = e->MsChapV2Challenge.Chap_Id;
eap1->Chap_Len = Endian16(54 + StrLen(e->Username)); eap1->Chap_Len = Endian16(54 + StrLen(username));
eap1->Chap_ValueSize = 49; eap1->Chap_ValueSize = 49;
Copy(eap1->Chap_PeerChallenge, client_challenge, 16); Copy(eap1->Chap_PeerChallenge, client_challenge, 16);
Copy(eap1->Chap_NtResponse, client_response, 24); Copy(eap1->Chap_NtResponse, client_response, 24);
Copy(eap1->Chap_Name, e->Username, MIN(StrLen(e->Username), 255)); Copy(eap1->Chap_Name, username, MIN(StrLen(username), 255));
Add(request1->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_EAP_MESSAGE, 0, 0, eap1, StrLen(e->Username) + 59)); Add(request1->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_EAP_MESSAGE, 0, 0, eap1, StrLen(username) + 59));
response1 = EapSendPacketAndRecvResponse(e, request1); response1 = EapSendPacketAndRecvResponse(e, request1, false);
if (response1 != NULL) if (response1 != NULL)
{ {
@@ -713,14 +719,14 @@ bool EapClientSendMsChapv2AuthClientResponse(EAP_CLIENT *e, UCHAR *client_respon
eap2 = ZeroMalloc(sizeof(EAP_MSCHAPV2_SUCCESS_CLIENT)); eap2 = ZeroMalloc(sizeof(EAP_MSCHAPV2_SUCCESS_CLIENT));
eap2->Code = EAP_CODE_RESPONSE; eap2->Code = EAP_CODE_RESPONSE;
eap2->Id = e->NextEapId++; eap2->Id = e->LastRecvEapId;
eap2->Len = Endian16(6); eap2->Len = Endian16(6);
eap2->Type = EAP_TYPE_MS_AUTH; eap2->Type = EAP_TYPE_MS_AUTH;
eap2->Chap_Opcode = EAP_MSCHAPV2_OP_SUCCESS; eap2->Chap_Opcode = EAP_MSCHAPV2_OP_SUCCESS;
Add(request2->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_EAP_MESSAGE, 0, 0, eap2, 6)); Add(request2->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_EAP_MESSAGE, 0, 0, eap2, 6));
response2 = EapSendPacketAndRecvResponse(e, request2); response2 = EapSendPacketAndRecvResponse(e, request2, false);
if (response2 != NULL) if (response2 != NULL)
{ {
@@ -770,13 +776,13 @@ bool EapClientSendMsChapv2AuthRequest(EAP_CLIENT *e)
eap1 = ZeroMalloc(sizeof(EAP_MESSAGE)); eap1 = ZeroMalloc(sizeof(EAP_MESSAGE));
eap1->Code = EAP_CODE_RESPONSE; eap1->Code = EAP_CODE_RESPONSE;
eap1->Id = e->NextEapId++; eap1->Id = e->LastRecvEapId;
eap1->Len = Endian16(StrLen(e->Username) + 5); eap1->Len = Endian16(StrLen(e->Username) + 5);
eap1->Type = EAP_TYPE_IDENTITY; eap1->Type = EAP_TYPE_IDENTITY;
Copy(eap1->Data, e->Username, StrLen(e->Username)); Copy(eap1->Data, e->Username, StrLen(e->Username));
Add(request1->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_EAP_MESSAGE, 0, 0, eap1, StrLen(e->Username) + 5)); Add(request1->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_EAP_MESSAGE, 0, 0, eap1, StrLen(e->Username) + 5));
response1 = EapSendPacketAndRecvResponse(e, request1); response1 = EapSendPacketAndRecvResponse(e, request1, false);
if (response1 != NULL) if (response1 != NULL)
{ {
@@ -799,14 +805,14 @@ bool EapClientSendMsChapv2AuthRequest(EAP_CLIENT *e)
eap2 = ZeroMalloc(sizeof(EAP_MESSAGE)); eap2 = ZeroMalloc(sizeof(EAP_MESSAGE));
eap2->Code = EAP_CODE_RESPONSE; eap2->Code = EAP_CODE_RESPONSE;
eap2->Id = e->NextEapId++; eap2->Id = e->LastRecvEapId;
eap2->Len = Endian16(6); eap2->Len = Endian16(6);
eap2->Type = EAP_TYPE_LEGACY_NAK; eap2->Type = EAP_TYPE_LEGACY_NAK;
eap2->Data[0] = EAP_TYPE_MS_AUTH; eap2->Data[0] = EAP_TYPE_MS_AUTH;
Add(request2->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_EAP_MESSAGE, 0, 0, eap2, 6)); Add(request2->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_EAP_MESSAGE, 0, 0, eap2, 6));
response2 = EapSendPacketAndRecvResponse(e, request2); response2 = EapSendPacketAndRecvResponse(e, request2, false);
if (response2 != NULL && response2->Parse_EapMessage_DataSize != 0 && response2->Parse_EapMessage != NULL) if (response2 != NULL && response2->Parse_EapMessage_DataSize != 0 && response2->Parse_EapMessage != NULL)
{ {
@@ -849,8 +855,141 @@ LABEL_PARSE_EAP:
return ret; return ret;
} }
// Send a EAP identity request to Radius
PPP_LCP *EapClientSendEapIdentity(EAP_CLIENT *e)
{
PPP_LCP *lcp = NULL;
RADIUS_PACKET *request = NULL;
RADIUS_PACKET *response = NULL;
EAP_MESSAGE *eap1 = NULL;
if (e == NULL)
{
return NULL;
}
request = NewRadiusPacket(RADIUS_CODE_ACCESS_REQUEST, e->NextRadiusPacketId++);
EapSetRadiusGeneralAttributes(request, e);
eap1 = ZeroMalloc(sizeof(EAP_MESSAGE));
eap1->Code = EAP_CODE_RESPONSE;
eap1->Id = e->LastRecvEapId;
eap1->Len = Endian16(StrLen(e->Username) + 5);
eap1->Type = EAP_TYPE_IDENTITY;
Copy(eap1->Data, e->Username, StrLen(e->Username));
Add(request->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_EAP_MESSAGE, 0, 0, eap1, StrLen(e->Username) + 5));
Debug("Radius proxy: send access-request %d with EAP code %d id %d type %d datasize %d\n",
request->PacketId, eap1->Code, eap1->Id, eap1->Type, StrLen(e->Username));
response = EapSendPacketAndRecvResponse(e, request, false);
if (response != NULL)
{
if (response->Parse_EapMessage_DataSize >= 5 && response->Parse_EapMessage != NULL)
{
EAP_MESSAGE *eap2 = response->Parse_EapMessage;
UINT datasize = response->Parse_EapMessage_DataSize - 5;
lcp = BuildEAPPacketEx(eap2->Code, eap2->Id, eap2->Type, datasize);
PPP_EAP *eap_packet = lcp->Data;
Copy(eap_packet->Data, eap2->Data, datasize);
Debug("Radius proxy: received access-challenge %d with EAP code %d id %d type %d datasize %d\n",
response->PacketId, eap2->Code, eap2->Id, eap2->Type, datasize);
}
}
FreeRadiusPacket(request);
FreeRadiusPacket(response);
Free(eap1);
return lcp;
}
// Send generic EAP Radius request (client EAP response) and get reply
PPP_LCP *EapClientSendEapRequest(EAP_CLIENT *e, PPP_EAP *eap_request, UINT request_datasize)
{
PPP_LCP *lcp = NULL;
RADIUS_PACKET *request = NULL;
RADIUS_PACKET *response = NULL;
EAP_MESSAGE *eap1 = NULL;
UCHAR *pos;
UINT remaining;
if (e == NULL || eap_request == NULL)
{
return NULL;
}
request = NewRadiusPacket(RADIUS_CODE_ACCESS_REQUEST, e->NextRadiusPacketId++);
EapSetRadiusGeneralAttributes(request, e);
if (e->LastStateSize != 0)
{
Add(request->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_STATE, 0, 0,
e->LastState, e->LastStateSize));
}
eap1 = ZeroMalloc(sizeof(EAP_MESSAGE));
eap1->Code = EAP_CODE_RESPONSE;
eap1->Id = e->LastRecvEapId;
eap1->Len = Endian16(request_datasize + 5);
eap1->Type = eap_request->Type;
Copy(eap1->Data, eap_request->Data, request_datasize);
// Fragmentation
pos = (UCHAR *)eap1;
remaining = request_datasize + 5;
while (remaining > 0)
{
UINT size = MIN(253, remaining);
Add(request->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_EAP_MESSAGE, 0, 0, pos, size));
pos += size;
remaining -= size;
}
Debug("Radius proxy: send access-request %d with EAP code %d id %d type %d datasize %d\n",
request->PacketId, eap1->Code, eap1->Id, eap1->Type, request_datasize);
response = EapSendPacketAndRecvResponse(e, request, false);
if (response != NULL)
{
switch (response->Code)
{
case RADIUS_CODE_ACCESS_CHALLENGE:
if (response->Parse_EapMessage_DataSize >= 5 && response->Parse_EapMessage != NULL)
{
EAP_MESSAGE *eap2 = response->Parse_EapMessage;
UINT datasize = response->Parse_EapMessage_DataSize - 5;
lcp = BuildEAPPacketEx(eap2->Code, eap2->Id, eap2->Type, datasize);
PPP_EAP *eap_packet = lcp->Data;
Copy(eap_packet->Data, eap2->Data, datasize);
Debug("Radius proxy: received access-challenge %d with EAP code %d id %d type %d datasize %d\n",
response->PacketId, eap2->Code, eap2->Id, eap2->Type, datasize);
}
else
{
Debug("Radius proxy error: received access-challenge %d without EAP\n", response->PacketId);
lcp = NewPPPLCP(PPP_EAP_CODE_FAILURE, e->LastRecvEapId);
}
break;
case RADIUS_CODE_ACCESS_ACCEPT:
Debug("Radius proxy: received access-accept %d\n", response->PacketId);
lcp = NewPPPLCP(PPP_EAP_CODE_SUCCESS, e->LastRecvEapId);
break;
case RADIUS_CODE_ACCESS_REJECT:
default:
Debug("Radius proxy: received access-reject %d\n", response->PacketId);
lcp = NewPPPLCP(PPP_EAP_CODE_FAILURE, e->LastRecvEapId);
break;
}
}
FreeRadiusPacket(request);
FreeRadiusPacket(response);
Free(eap1);
return lcp;
}
// Send a packet and recv a response // Send a packet and recv a response
RADIUS_PACKET *EapSendPacketAndRecvResponse(EAP_CLIENT *e, RADIUS_PACKET *r) RADIUS_PACKET *EapSendPacketAndRecvResponse(EAP_CLIENT *e, RADIUS_PACKET *r, bool parse_inner)
{ {
SOCKSET set; SOCKSET set;
UINT64 giveup_tick = 0; UINT64 giveup_tick = 0;
@@ -990,7 +1129,7 @@ RADIUS_PACKET *EapSendPacketAndRecvResponse(EAP_CLIENT *e, RADIUS_PACKET *r)
{ {
EAP_MESSAGE *eap_msg = (EAP_MESSAGE *)rp->Parse_EapMessage; EAP_MESSAGE *eap_msg = (EAP_MESSAGE *)rp->Parse_EapMessage;
if (eap_msg->Type == EAP_TYPE_PEAP) if (parse_inner && eap_msg->Type == EAP_TYPE_PEAP)
{ {
EAP_PEAP *peap_message = (EAP_PEAP *)eap_msg; EAP_PEAP *peap_message = (EAP_PEAP *)eap_msg;
@@ -1069,7 +1208,8 @@ RADIUS_PACKET *EapSendPacketAndRecvResponse(EAP_CLIENT *e, RADIUS_PACKET *r)
is_finish = true; is_finish = true;
Free(rp->Parse_EapMessage); Free(rp->Parse_EapMessage);
rp->Parse_EapMessage = Clone(e->PEAP_CurrentReceivingMsg->Buf, e->PEAP_CurrentReceivingMsg->Size); rp->Parse_EapMessage = ZeroMalloc(sizeof(EAP_MESSAGE));
Copy(rp->Parse_EapMessage, e->PEAP_CurrentReceivingMsg->Buf, e->PEAP_CurrentReceivingMsg->Size);
rp->Parse_EapMessage_DataSize = e->PEAP_CurrentReceivingMsg->Size; rp->Parse_EapMessage_DataSize = e->PEAP_CurrentReceivingMsg->Size;
} }
} }
@@ -1165,7 +1305,8 @@ bool EapSendPacket(EAP_CLIENT *e, RADIUS_PACKET *r)
} }
// New EAP client // New EAP client
EAP_CLIENT *NewEapClient(IP *server_ip, UINT server_port, char *shared_secret, UINT resend_timeout, UINT giveup_timeout, char *client_ip_str, char *username, char *hubname) EAP_CLIENT *NewEapClient(IP *server_ip, UINT server_port, char *shared_secret, UINT resend_timeout, UINT giveup_timeout, char *client_ip_str,
char *username, char *hubname, UCHAR last_recv_eapid)
{ {
EAP_CLIENT *e; EAP_CLIENT *e;
if (server_ip == NULL) if (server_ip == NULL)
@@ -1197,7 +1338,7 @@ EAP_CLIENT *NewEapClient(IP *server_ip, UINT server_port, char *shared_secret, U
StrCpy(e->CalledStationStr, sizeof(e->CalledStationStr), hubname); StrCpy(e->CalledStationStr, sizeof(e->CalledStationStr), hubname);
StrCpy(e->ClientIpStr, sizeof(e->ClientIpStr), client_ip_str); StrCpy(e->ClientIpStr, sizeof(e->ClientIpStr), client_ip_str);
StrCpy(e->Username, sizeof(e->Username), username); StrCpy(e->Username, sizeof(e->Username), username);
e->LastRecvEapId = 0; e->LastRecvEapId = last_recv_eapid;
e->PEAP_CurrentReceivingMsg = NewBuf(); e->PEAP_CurrentReceivingMsg = NewBuf();
@@ -1508,7 +1649,8 @@ RADIUS_PACKET *ParseRadiusPacket(void *data, UINT size)
{ {
if (p->Parse_EapMessage == NULL) if (p->Parse_EapMessage == NULL)
{ {
EAP_MESSAGE *eap = Clone(a.Data, a.DataSize); EAP_MESSAGE *eap = ZeroMalloc(sizeof(EAP_MESSAGE));
Copy(eap, a.Data, a.DataSize);
p->Parse_EapMessage_DataSize = sz_tmp; p->Parse_EapMessage_DataSize = sz_tmp;
@@ -1603,7 +1745,8 @@ RADIUS_PACKET *ParseRadiusPacket(void *data, UINT size)
p->Parse_EapMessage_DataSize = b->Size; p->Parse_EapMessage_DataSize = b->Size;
p->Parse_EapMessage_DataSize = MIN(p->Parse_EapMessage_DataSize, 1500); p->Parse_EapMessage_DataSize = MIN(p->Parse_EapMessage_DataSize, 1500);
p->Parse_EapMessage = Clone(b->Buf, p->Parse_EapMessage_DataSize); p->Parse_EapMessage = ZeroMalloc(sizeof(EAP_MESSAGE));
Copy(p->Parse_EapMessage, b->Buf, p->Parse_EapMessage_DataSize);
} }
FreeBuf(b); FreeBuf(b);
@@ -1676,15 +1819,16 @@ bool RadiusLogin(CONNECTION *c, char *server, UINT port, UCHAR *secret, UINT sec
StrCpy(eap->In_VpnProtocolState, sizeof(eap->In_VpnProtocolState), opt->In_VpnProtocolState); StrCpy(eap->In_VpnProtocolState, sizeof(eap->In_VpnProtocolState), opt->In_VpnProtocolState);
} }
// Use the username known to the client instead of parsed by us, or response may be invalid
if (eap->PeapMode == false) if (eap->PeapMode == false)
{ {
ret = EapClientSendMsChapv2AuthClientResponse(eap, mschap.MsChapV2_ClientResponse, ret = EapClientSendMsChapv2AuthClientResponse(eap, mschap.MsChapV2_ClientResponse,
mschap.MsChapV2_ClientChallenge); mschap.MsChapV2_ClientChallenge, mschap.MsChapV2_PPPUsername);
} }
else else
{ {
ret = PeapClientSendMsChapv2AuthClientResponse(eap, mschap.MsChapV2_ClientResponse, ret = PeapClientSendMsChapv2AuthClientResponse(eap, mschap.MsChapV2_ClientResponse,
mschap.MsChapV2_ClientChallenge); mschap.MsChapV2_ClientChallenge, mschap.MsChapV2_PPPUsername);
} }
if (ret) if (ret)
+7 -5
View File
@@ -215,7 +215,6 @@ struct EAP_CLIENT
UINT ResendTimeout; UINT ResendTimeout;
UINT GiveupTimeout; UINT GiveupTimeout;
UCHAR TmpBuffer[4096]; UCHAR TmpBuffer[4096];
UCHAR NextEapId;
UCHAR LastRecvEapId; UCHAR LastRecvEapId;
bool PeapMode; bool PeapMode;
@@ -249,17 +248,20 @@ RADIUS_AVP *GetRadiusAvp(RADIUS_PACKET *p, UCHAR type);
void RadiusTest(); void RadiusTest();
EAP_CLIENT *NewEapClient(IP *server_ip, UINT server_port, char *shared_secret, UINT resend_timeout, UINT giveup_timeout, char *client_ip_str, char *username, char *hubname); EAP_CLIENT *NewEapClient(IP *server_ip, UINT server_port, char *shared_secret, UINT resend_timeout, UINT giveup_timeout, char *client_ip_str,
char *username, char *hubname, UCHAR last_recv_eapid);
void ReleaseEapClient(EAP_CLIENT *e); void ReleaseEapClient(EAP_CLIENT *e);
void CleanupEapClient(EAP_CLIENT *e); void CleanupEapClient(EAP_CLIENT *e);
bool EapClientSendMsChapv2AuthRequest(EAP_CLIENT *e); bool EapClientSendMsChapv2AuthRequest(EAP_CLIENT *e);
bool EapClientSendMsChapv2AuthClientResponse(EAP_CLIENT *e, UCHAR *client_response, UCHAR *client_challenge); bool EapClientSendMsChapv2AuthClientResponse(EAP_CLIENT *e, UCHAR *client_response, UCHAR *client_challenge, char *username);
PPP_LCP *EapClientSendEapIdentity(EAP_CLIENT *e);
PPP_LCP *EapClientSendEapRequest(EAP_CLIENT *e, PPP_EAP *eap_request, UINT request_datasize);
void EapSetRadiusGeneralAttributes(RADIUS_PACKET *r, EAP_CLIENT *e); void EapSetRadiusGeneralAttributes(RADIUS_PACKET *r, EAP_CLIENT *e);
bool EapSendPacket(EAP_CLIENT *e, RADIUS_PACKET *r); bool EapSendPacket(EAP_CLIENT *e, RADIUS_PACKET *r);
RADIUS_PACKET *EapSendPacketAndRecvResponse(EAP_CLIENT *e, RADIUS_PACKET *r); RADIUS_PACKET *EapSendPacketAndRecvResponse(EAP_CLIENT *e, RADIUS_PACKET *r, bool parse_inner);
bool PeapClientSendMsChapv2AuthRequest(EAP_CLIENT *eap); bool PeapClientSendMsChapv2AuthRequest(EAP_CLIENT *eap);
bool PeapClientSendMsChapv2AuthClientResponse(EAP_CLIENT *e, UCHAR *client_response, UCHAR *client_challenge); bool PeapClientSendMsChapv2AuthClientResponse(EAP_CLIENT *e, UCHAR *client_response, UCHAR *client_challenge, char *username);
bool StartPeapClient(EAP_CLIENT *e); bool StartPeapClient(EAP_CLIENT *e);
bool StartPeapSslClient(EAP_CLIENT *e); bool StartPeapSslClient(EAP_CLIENT *e);
+288 -20
View File
@@ -806,9 +806,6 @@ static UINT SmDdnsGetKey(char *key, SM_DDNS *d){
void SmDDnsDlgInit(HWND hWnd, SM_DDNS *d) void SmDDnsDlgInit(HWND hWnd, SM_DDNS *d)
{ {
char key[20];
char encodedkey[20 * 4 + 32];
// Validate arguments // Validate arguments
if (hWnd == NULL || d == NULL) if (hWnd == NULL || d == NULL)
{ {
@@ -845,10 +842,15 @@ void SmDDnsDlgInit(HWND hWnd, SM_DDNS *d)
Hide(hWnd, B_PROXY); Hide(hWnd, B_PROXY);
if(SmDdnsGetKey(key, d) == ERR_NO_ERROR){ char key[20];
encodedkey[ B64_Encode(encodedkey, key, 20) ] = 0; if (SmDdnsGetKey(key, d) == ERR_NO_ERROR)
SetTextA(hWnd, E_KEY, encodedkey); {
}else{ char *encoded_key = Base64FromBin(NULL, key, sizeof(key));
SetTextA(hWnd, E_KEY, encoded_key);
Free(encoded_key);
}
else
{
SetText(hWnd, E_KEY, _UU("SM_DDNS_KEY_ERR")); SetText(hWnd, E_KEY, _UU("SM_DDNS_KEY_ERR"));
} }
@@ -7985,7 +7987,9 @@ void SmBridgeDlgOnOk(HWND hWnd, SM_SERVER *s)
StrCpy(t.HubName, sizeof(t.HubName), hub); StrCpy(t.HubName, sizeof(t.HubName), hub);
t.TapMode = tapmode; t.TapMode = tapmode;
if (InStrEx(t.DeviceName, "vpn", false) || InStrEx(t.DeviceName, "tun", false) if (InStrEx(t.DeviceName, UNIX_VLAN_CLIENT_IFACE_PREFIX, false)
|| InStrEx(t.DeviceName, UNIX_VLAN_BRIDGE_IFACE_PREFIX, false)
|| InStrEx(t.DeviceName, "tun", false)
|| InStrEx(t.DeviceName, "tap", false)) || InStrEx(t.DeviceName, "tap", false))
{ {
// Trying to make a local bridge to the VPN device // Trying to make a local bridge to the VPN device
@@ -9331,12 +9335,6 @@ void SmSessionDlgUpdate(HWND hWnd, SM_HUB *s)
} }
} }
if (s->p->ServerInfo.ServerBuildInt < 2844)
{
// Old version doesn't support for remote management of the sessions
ok2 = ok;
}
SetEnable(hWnd, IDOK, ok2); SetEnable(hWnd, IDOK, ok2);
SetEnable(hWnd, B_DISCONNECT, ok2); SetEnable(hWnd, B_DISCONNECT, ok2);
SetEnable(hWnd, B_SESSION_IP_TABLE, ok); SetEnable(hWnd, B_SESSION_IP_TABLE, ok);
@@ -9618,7 +9616,7 @@ bool SmRefreshSessionStatus(HWND hWnd, SM_SERVER *s, void *param)
b = LvInsertStart(); b = LvInsertStart();
if (t.ClientIp != 0) if (t.ClientIp != 0 || IsZero(t.ClientIp6, sizeof(t.ClientIp6)) == false)
{ {
IPToStr4or6(str, sizeof(str), t.ClientIp, t.ClientIp6); IPToStr4or6(str, sizeof(str), t.ClientIp, t.ClientIp6);
StrToUni(tmp, sizeof(tmp), str); StrToUni(tmp, sizeof(tmp), str);
@@ -10290,6 +10288,7 @@ bool SmLinkEdit(HWND hWnd, SM_HUB *s, wchar_t *name)
a.ClientAuth = CopyClientAuth(t.ClientAuth); a.ClientAuth = CopyClientAuth(t.ClientAuth);
Copy(&a.Policy, &t.Policy, sizeof(POLICY)); Copy(&a.Policy, &t.Policy, sizeof(POLICY));
a.CheckServerCert = t.CheckServerCert; a.CheckServerCert = t.CheckServerCert;
a.AddDefaultCA = t.AddDefaultCA;
a.ServerCert = CloneX(t.ServerCert); a.ServerCert = CloneX(t.ServerCert);
a.HideTrustCert = GetCapsBool(s->p->CapsList, "b_support_config_hub"); a.HideTrustCert = GetCapsBool(s->p->CapsList, "b_support_config_hub");
FreeRpcCreateLink(&t); FreeRpcCreateLink(&t);
@@ -16813,6 +16812,7 @@ void SmSslDlgOnOk(HWND hWnd, SM_SSL *s)
t.Cert = CloneX(s->Cert); t.Cert = CloneX(s->Cert);
t.Key = CloneK(s->Key); t.Key = CloneK(s->Key);
t.Chain = CloneXList(s->Chain);
if (CALL(hWnd, ScSetServerCert(s->p->Rpc, &t)) == false) if (CALL(hWnd, ScSetServerCert(s->p->Rpc, &t)) == false)
{ {
@@ -16927,6 +16927,7 @@ void SmSslDlgInit(HWND hWnd, SM_SSL *s)
// Copy the certificate and key // Copy the certificate and key
s->Cert = CloneX(t.Cert); s->Cert = CloneX(t.Cert);
s->Key = CloneK(t.Key); s->Key = CloneK(t.Key);
s->Chain = CloneXList(t.Chain);
if (t.Key != NULL) if (t.Key != NULL)
{ {
@@ -17178,6 +17179,7 @@ UINT SmSslDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param
SM_SSL *s = (SM_SSL *)param; SM_SSL *s = (SM_SSL *)param;
X *x; X *x;
K *k; K *k;
LIST *chain = NULL;
// Validate arguments // Validate arguments
if (hWnd == NULL) if (hWnd == NULL)
{ {
@@ -17226,16 +17228,18 @@ UINT SmSslDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param
case B_IMPORT: case B_IMPORT:
// Import // Import
if (CmLoadXAndK(hWnd, &x, &k)) if (CmLoadXListAndK(hWnd, &x, &k, &chain))
{ {
wchar_t tmp[MAX_SIZE]; wchar_t tmp[MAX_SIZE];
LABEL_APPLY_NEW_CERT: LABEL_APPLY_NEW_CERT:
FreeX(s->Cert); FreeX(s->Cert);
FreeK(s->Key); FreeK(s->Key);
FreeXList(s->Chain);
s->Cert = x; s->Cert = x;
s->Key = k; s->Key = k;
s->SetCertAndKey = true; s->SetCertAndKey = true;
s->Chain = chain;
// Show the Certificate Information // Show the Certificate Information
SmGetCertInfoStr(tmp, sizeof(tmp), s->Cert); SmGetCertInfoStr(tmp, sizeof(tmp), s->Cert);
SetText(hWnd, S_CERT_INFO, tmp); SetText(hWnd, S_CERT_INFO, tmp);
@@ -17314,6 +17318,7 @@ void SmSslDlg(HWND hWnd, SM_SERVER *p)
// Cleanup // Cleanup
FreeX(s.Cert); FreeX(s.Cert);
FreeK(s.Key); FreeK(s.Key);
FreeXList(s.Chain);
} }
// Listener creation dialog procedure // Listener creation dialog procedure
@@ -19358,7 +19363,14 @@ void SmEditSettingDlgInit(HWND hWnd, SM_EDIT_SETTING *p)
SetText(hWnd, E_ACCOUNT_NAME, s->Title); SetText(hWnd, E_ACCOUNT_NAME, s->Title);
// Host name // Host name
SetTextA(hWnd, E_HOSTNAME, s->ClientOption.Hostname); char hostname[MAX_SIZE];
StrCpy(hostname, sizeof(hostname), s->ClientOption.Hostname);
if (IsEmptyStr(s->ClientOption.HintStr) == false)
{
StrCat(hostname, sizeof(hostname), "/");
StrCat(hostname, sizeof(hostname), s->ClientOption.HintStr);
}
SetTextA(hWnd, E_HOSTNAME, hostname);
// Port number // Port number
CbSetHeight(hWnd, C_PORT, 18); CbSetHeight(hWnd, C_PORT, 18);
@@ -19448,6 +19460,16 @@ void SmEditSettingDlgUpdate(HWND hWnd, SM_EDIT_SETTING *p)
GetTxtA(hWnd, E_HOSTNAME, tmp, sizeof(tmp)); GetTxtA(hWnd, E_HOSTNAME, tmp, sizeof(tmp));
Trim(tmp); Trim(tmp);
UINT i = SearchStrEx(tmp, "/", 0, false);
if (i != INFINITE)
{
StrCpy(s->ClientOption.HintStr, sizeof(s->ClientOption.HintStr), tmp + i + 1);
tmp[i] = 0;
}
else
{
s->ClientOption.HintStr[0] = 0;
}
if (StrCmpi(tmp, s->ClientOption.Hostname) != 0) if (StrCmpi(tmp, s->ClientOption.Hostname) != 0)
{ {
@@ -19955,6 +19977,215 @@ void SmWriteSettingList()
} }
} }
SETTING *LoadSetting9658(BUF *b)
{
typedef struct OLD_CLIENT_OPTION
{
wchar_t AccountName[256]; // Connection setting name
char Hostname[256]; // Host name
UINT Port; // Port number
UINT PortUDP; // UDP port number (0: Use only TCP)
UINT ProxyType; // Type of proxy
char ProxyName[256]; // Proxy server name
UINT ProxyPort; // Port number of the proxy server
char ProxyUsername[256]; // Maximum user name length
char ProxyPassword[256]; // Maximum password length
UINT NumRetry; // Automatic retries
UINT RetryInterval; // Retry interval
char HubName[256]; // HUB name
UINT MaxConnection; // Maximum number of concurrent TCP connections
UINT UseEncrypt; // Use encrypted communication
UINT UseCompress; // Use data compression
UINT HalfConnection; // Use half connection in TCP
UINT NoRoutingTracking; // Disable the routing tracking
char DeviceName[32]; // VLAN device name
UINT AdditionalConnectionInterval; // Connection attempt interval when additional connection establish
UINT ConnectionDisconnectSpan; // Disconnection interval
UINT HideStatusWindow; // Hide the status window
UINT HideNicInfoWindow; // Hide the NIC status window
UINT RequireMonitorMode; // Monitor port mode
UINT RequireBridgeRoutingMode; // Bridge or routing mode
UINT DisableQoS; // Disable the VoIP / QoS function
UINT FromAdminPack; // For Administration Pack
UINT NoUdpAcceleration; // Do not use UDP acceleration mode
UCHAR HostUniqueKey[20]; // Host unique key
} OLD_CLIENT_OPTION;
typedef struct OLD_SETTING
{
wchar_t Title[512]; // Setting Name
UINT ServerAdminMode; // Server management mode
char HubName[256]; // HUB name
UCHAR HashedPassword[20]; // Password
OLD_CLIENT_OPTION ClientOption; // Client Option
UCHAR Reserved[10188]; // Reserved area
} OLD_SETTING;
if (b->Size != sizeof(OLD_SETTING)) // 13416
{
return NULL;
}
OLD_SETTING s0;
Copy(&s0, b->Buf, sizeof(OLD_SETTING));
SETTING *s = ZeroMalloc(sizeof(SETTING));
UniStrCpy(s->Title, sizeof(s->Title), s0.Title);
s->ServerAdminMode = s0.ServerAdminMode;
StrCpy(s->HubName, sizeof(s->HubName), s0.HubName);
Copy(s->HashedPassword, s0.HashedPassword, sizeof(s->HashedPassword));
UniStrCpy(s->ClientOption.AccountName, sizeof(s->ClientOption.AccountName), s0.ClientOption.AccountName);
StrCpy(s->ClientOption.Hostname, sizeof(s->ClientOption.Hostname), s0.ClientOption.Hostname);
s->ClientOption.Port = s0.ClientOption.Port;
s->ClientOption.ProxyType = s0.ClientOption.ProxyType;
StrCpy(s->ClientOption.ProxyName, sizeof(s->ClientOption.ProxyName), s0.ClientOption.ProxyName);
s->ClientOption.ProxyPort = s0.ClientOption.ProxyPort;
StrCpy(s->ClientOption.ProxyUsername, sizeof(s->ClientOption.ProxyUsername), s0.ClientOption.ProxyUsername);
StrCpy(s->ClientOption.ProxyPassword, sizeof(s->ClientOption.ProxyPassword), s0.ClientOption.ProxyPassword);
return s;
}
SETTING *LoadSetting9666(BUF *b)
{
typedef struct OLD_CLIENT_OPTION
{
wchar_t AccountName[256]; // Connection setting name
char Hostname[256]; // Host name
UINT Port; // Port number
UINT PortUDP; // UDP port number (0: Use only TCP)
UINT ProxyType; // Type of proxy
char ProxyName[256]; // Proxy server name
UINT ProxyPort; // Port number of the proxy server
char ProxyUsername[256]; // Maximum user name length
char ProxyPassword[256]; // Maximum password length
char CustomHttpHeader[1025]; // Custom HTTP proxy header
UINT NumRetry; // Automatic retries
UINT RetryInterval; // Retry interval
char HubName[256]; // HUB name
UINT MaxConnection; // Maximum number of concurrent TCP connections
UINT UseEncrypt; // Use encrypted communication
UINT UseCompress; // Use data compression
UINT HalfConnection; // Use half connection in TCP
UINT NoRoutingTracking; // Disable the routing tracking
char DeviceName[32]; // VLAN device name
UINT AdditionalConnectionInterval; // Connection attempt interval when additional connection establish
UINT ConnectionDisconnectSpan; // Disconnection interval
UINT HideStatusWindow; // Hide the status window
UINT HideNicInfoWindow; // Hide the NIC status window
UINT RequireMonitorMode; // Monitor port mode
UINT RequireBridgeRoutingMode; // Bridge or routing mode
UINT DisableQoS; // Disable the VoIP / QoS function
UINT FromAdminPack; // For Administration Pack
UINT NoUdpAcceleration; // Do not use UDP acceleration mode
UCHAR HostUniqueKey[20]; // Host unique key
} OLD_CLIENT_OPTION;
typedef struct OLD_SETTING
{
wchar_t Title[512]; // Setting Name
UINT ServerAdminMode; // Server management mode
char HubName[256]; // HUB name
UCHAR HashedPassword[20]; // Password
OLD_CLIENT_OPTION ClientOption; // Client Option
UCHAR Reserved[10188]; // Reserved area
} OLD_SETTING;
if (b->Size != sizeof(OLD_SETTING)) // 14444
{
return NULL;
}
OLD_SETTING s0;
Copy(&s0, b->Buf, sizeof(OLD_SETTING));
SETTING *s = ZeroMalloc(sizeof(SETTING));
UniStrCpy(s->Title, sizeof(s->Title), s0.Title);
s->ServerAdminMode = s0.ServerAdminMode;
StrCpy(s->HubName, sizeof(s->HubName), s0.HubName);
Copy(s->HashedPassword, s0.HashedPassword, sizeof(s->HashedPassword));
UniStrCpy(s->ClientOption.AccountName, sizeof(s->ClientOption.AccountName), s0.ClientOption.AccountName);
StrCpy(s->ClientOption.Hostname, sizeof(s->ClientOption.Hostname), s0.ClientOption.Hostname);
s->ClientOption.Port = s0.ClientOption.Port;
s->ClientOption.ProxyType = s0.ClientOption.ProxyType;
StrCpy(s->ClientOption.ProxyName, sizeof(s->ClientOption.ProxyName), s0.ClientOption.ProxyName);
s->ClientOption.ProxyPort = s0.ClientOption.ProxyPort;
StrCpy(s->ClientOption.ProxyUsername, sizeof(s->ClientOption.ProxyUsername), s0.ClientOption.ProxyUsername);
StrCpy(s->ClientOption.ProxyPassword, sizeof(s->ClientOption.ProxyPassword), s0.ClientOption.ProxyPassword);
return s;
}
SETTING *LoadSetting502(BUF *b)
{
typedef struct OLD_CLIENT_OPTION
{
wchar_t AccountName[256]; // Connection setting name
char Hostname[256]; // Host name
UINT Port; // Port number
UINT PortUDP; // UDP port number (0: Use only TCP)
UINT ProxyType; // Type of proxy
char ProxyName[256]; // Proxy server name
UINT ProxyPort; // Port number of the proxy server
char ProxyUsername[256]; // Maximum user name length
char ProxyPassword[256]; // Maximum password length
char CustomHttpHeader[1025]; // Custom HTTP proxy header
UINT NumRetry; // Automatic retries
UINT RetryInterval; // Retry interval
char HubName[256]; // HUB name
UINT MaxConnection; // Maximum number of concurrent TCP connections
bool UseEncrypt; // Use encrypted communication
bool UseCompress; // Use data compression
bool HalfConnection; // Use half connection in TCP
bool NoRoutingTracking; // Disable the routing tracking
char DeviceName[32]; // VLAN device name
UINT AdditionalConnectionInterval; // Connection attempt interval when additional connection establish
UINT ConnectionDisconnectSpan; // Disconnection interval
bool HideStatusWindow; // Hide the status window
bool HideNicInfoWindow; // Hide the NIC status window
bool RequireMonitorMode; // Monitor port mode
bool RequireBridgeRoutingMode; // Bridge or routing mode
bool DisableQoS; // Disable the VoIP / QoS function
bool FromAdminPack; // For Administration Pack
bool NoUdpAcceleration; // Do not use UDP acceleration mode
UCHAR HostUniqueKey[20]; // Host unique key
} OLD_CLIENT_OPTION;
typedef struct OLD_SETTING
{
wchar_t Title[512]; // Setting Name
bool ServerAdminMode; // Server management mode
char HubName[256]; // HUB name
UCHAR HashedPassword[20]; // Password
OLD_CLIENT_OPTION ClientOption; // Client Option
UCHAR Reserved[10212]; // Reserved area
} OLD_SETTING;
if (b->Size != sizeof(OLD_SETTING)) // 14436
{
return NULL;
}
OLD_SETTING s0;
Copy(&s0, b->Buf, sizeof(OLD_SETTING));
SETTING *s = ZeroMalloc(sizeof(SETTING));
UniStrCpy(s->Title, sizeof(s->Title), s0.Title);
s->ServerAdminMode = s0.ServerAdminMode;
StrCpy(s->HubName, sizeof(s->HubName), s0.HubName);
Copy(s->HashedPassword, s0.HashedPassword, sizeof(s->HashedPassword));
UniStrCpy(s->ClientOption.AccountName, sizeof(s->ClientOption.AccountName), s0.ClientOption.AccountName);
StrCpy(s->ClientOption.Hostname, sizeof(s->ClientOption.Hostname), s0.ClientOption.Hostname);
s->ClientOption.Port = s0.ClientOption.Port;
s->ClientOption.ProxyType = s0.ClientOption.ProxyType;
StrCpy(s->ClientOption.ProxyName, sizeof(s->ClientOption.ProxyName), s0.ClientOption.ProxyName);
s->ClientOption.ProxyPort = s0.ClientOption.ProxyPort;
StrCpy(s->ClientOption.ProxyUsername, sizeof(s->ClientOption.ProxyUsername), s0.ClientOption.ProxyUsername);
StrCpy(s->ClientOption.ProxyPassword, sizeof(s->ClientOption.ProxyPassword), s0.ClientOption.ProxyPassword);
return s;
}
// Load the connection list // Load the connection list
void SmLoadSettingList() void SmLoadSettingList()
{ {
@@ -19979,11 +20210,34 @@ void SmLoadSettingList()
BUF *b = MsRegReadBin(REG_CURRENT_USER, key_name, name); BUF *b = MsRegReadBin(REG_CURRENT_USER, key_name, name);
if (b != NULL) if (b != NULL)
{ {
if (b->Size == sizeof(SETTING)) SETTING *s = NULL;
if (b->Size == 13416) // 5.01 Build 9658 - 9665
{ {
SETTING *s = ZeroMalloc(sizeof(SETTING)); s = LoadSetting9658(b);
}
else if (b->Size == 14444) // 5.01 Build 9666 - 9674
{
s = LoadSetting9666(b);
}
else if (b->Size == 14436) // 5.02
{
s = LoadSetting502(b);
}
else if (b->Size == sizeof(SETTING)) // Must be 13420 (the size used since version 4.x)
{
s = ZeroMalloc(sizeof(SETTING));
Copy(s, b->Buf, sizeof(SETTING)); Copy(s, b->Buf, sizeof(SETTING));
}
if (s != NULL)
{
// Migrate from old settings that mixed hint string with hostname
UINT i = SearchStrEx(s->ClientOption.Hostname, "/", 0, false);
if (i != INFINITE)
{
StrCpy(s->ClientOption.HintStr, sizeof(s->ClientOption.HintStr), s->ClientOption.Hostname + i + 1);
s->ClientOption.Hostname[i] = 0;
}
Add(sm->SettingList, s); Add(sm->SettingList, s);
} }
FreeBuf(b); FreeBuf(b);
@@ -20046,6 +20300,7 @@ void SmInitDefaultSettingList()
Sha0(s->HashedPassword, "", 0); Sha0(s->HashedPassword, "", 0);
UniStrCpy(s->ClientOption.AccountName, sizeof(s->ClientOption.AccountName), s->Title); UniStrCpy(s->ClientOption.AccountName, sizeof(s->ClientOption.AccountName), s->Title);
StrCpy(s->ClientOption.Hostname, sizeof(s->ClientOption.Hostname), "localhost"); StrCpy(s->ClientOption.Hostname, sizeof(s->ClientOption.Hostname), "localhost");
s->ClientOption.HintStr[0] = 0;
s->ClientOption.Port = GC_DEFAULT_PORT; s->ClientOption.Port = GC_DEFAULT_PORT;
Add(sm->SettingList, s); Add(sm->SettingList, s);
@@ -20135,7 +20390,14 @@ void SmRefreshSettingEx(HWND hWnd, wchar_t *select_name)
UniFormat(tmp, sizeof(tmp), _UU("SM_MODE_HUB"), s->HubName); UniFormat(tmp, sizeof(tmp), _UU("SM_MODE_HUB"), s->HubName);
} }
StrToUni(tmp2, sizeof(tmp2), s->ClientOption.Hostname); char hostname[MAX_SIZE];
StrCpy(hostname, sizeof(hostname), s->ClientOption.Hostname);
if (IsEmptyStr(s->ClientOption.HintStr) == false)
{
StrCat(hostname, sizeof(hostname), "/");
StrCat(hostname, sizeof(hostname), s->ClientOption.HintStr);
}
StrToUni(tmp2, sizeof(tmp2), hostname);
LvInsertAdd(b, LvInsertAdd(b,
(s->ServerAdminMode ? ICO_SERVER_ONLINE : ICO_HUB), (s->ServerAdminMode ? ICO_SERVER_ONLINE : ICO_HUB),
@@ -20554,6 +20816,12 @@ void SmParseCommandLine()
UniStrCpy(o->AccountName, sizeof(o->AccountName), s->Title); UniStrCpy(o->AccountName, sizeof(o->AccountName), s->Title);
StrCpy(o->Hostname, sizeof(o->Hostname), host); StrCpy(o->Hostname, sizeof(o->Hostname), host);
UINT i = SearchStrEx(o->Hostname, "/", 0, false);
if (i != INFINITE)
{
StrCpy(o->HintStr, sizeof(o->HintStr), o->Hostname + i + 1);
o->Hostname[i] = 0;
}
o->Port = port; o->Port = port;
o->ProxyType = PROXY_DIRECT; o->ProxyType = PROXY_DIRECT;
StrCpy(o->DeviceName, sizeof(o->DeviceName), "DUMMY"); StrCpy(o->DeviceName, sizeof(o->DeviceName), "DUMMY");
+8 -1
View File
@@ -31,14 +31,20 @@
#define SM_SETTING_REG_KEY_OLD "Software\\SoftEther Corporation\\PacketiX VPN\\Server Manager\\Settings" #define SM_SETTING_REG_KEY_OLD "Software\\SoftEther Corporation\\PacketiX VPN\\Server Manager\\Settings"
// Connection setting // Connection setting
// Do not change item size or order
// Size must be kept at 13420 (use Reserved to adjust for new items)
typedef struct SETTING typedef struct SETTING
{ {
wchar_t Title[MAX_SIZE]; // Setting Name wchar_t Title[MAX_SIZE]; // Setting Name
bool ServerAdminMode; // Server management mode bool ServerAdminMode; // Server management mode
char pad1[3];
char HubName[MAX_HUBNAME_LEN + 1]; // HUB name char HubName[MAX_HUBNAME_LEN + 1]; // HUB name
UCHAR HashedPassword[SHA1_SIZE]; // Password UCHAR HashedPassword[SHA1_SIZE]; // Password
CLIENT_OPTION ClientOption; // Client Option CLIENT_OPTION ClientOption; // Client Option
UCHAR Reserved[10240 - sizeof(bool) * 8 - SHA1_SIZE]; // Reserved area
#define SRC_SIZE (sizeof(IP) + sizeof(UINT)) // Source IP address & port number for outgoing connection
// UCHAR Reserved[10240 - sizeof(UINT) * 8 - SHA1_SIZE - HTTP_CUSTOM_HEADER_MAX_SIZE - MAX_HOST_NAME_LEN - 1]; // Reserved area
UCHAR Reserved[10240 - sizeof(UINT) * 8 - SHA1_SIZE - HTTP_CUSTOM_HEADER_MAX_SIZE - MAX_HOST_NAME_LEN - 1 - SRC_SIZE]; // Reserved area
} SETTING; } SETTING;
// Structure declaration // Structure declaration
@@ -112,6 +118,7 @@ typedef struct SM_SSL
SM_SERVER *p; // P SM_SERVER *p; // P
X *Cert; // Certificate X *Cert; // Certificate
K *Key; // Secret key K *Key; // Secret key
LIST *Chain; // Trust chain
bool SetCertAndKey; // Set the key bool SetCertAndKey; // Set the key
} SM_SSL; } SM_SSL;
+6 -5
View File
@@ -113,9 +113,12 @@ bool SwCompileSfx(LIST *o, wchar_t *dst_filename)
} }
// Get the API related to the resource editing // Get the API related to the resource editing
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
_BeginUpdateResourceW = (HANDLE (__stdcall *)(LPCWSTR,UINT))GetProcAddress(hKernel32, "BeginUpdateResourceW"); _BeginUpdateResourceW = (HANDLE (__stdcall *)(LPCWSTR,UINT))GetProcAddress(hKernel32, "BeginUpdateResourceW");
_UpdateResourceA = (UINT (__stdcall *)(HANDLE,LPCSTR,LPCSTR,WORD,LPVOID,DWORD))GetProcAddress(hKernel32, "UpdateResourceA"); _UpdateResourceA = (UINT (__stdcall *)(HANDLE,LPCSTR,LPCSTR,WORD,LPVOID,DWORD))GetProcAddress(hKernel32, "UpdateResourceA");
_EndUpdateResourceW = (UINT (__stdcall *)(HANDLE,UINT))GetProcAddress(hKernel32, "EndUpdateResourceW"); _EndUpdateResourceW = (UINT (__stdcall *)(HANDLE,UINT))GetProcAddress(hKernel32, "EndUpdateResourceW");
#pragma clang diagnostic pop
if (_BeginUpdateResourceW != NULL && _UpdateResourceA != NULL && _EndUpdateResourceW != NULL) if (_BeginUpdateResourceW != NULL && _UpdateResourceA != NULL && _EndUpdateResourceW != NULL)
{ {
@@ -647,7 +650,10 @@ UINT SWExec()
bool is_datafile_exists = false; bool is_datafile_exists = false;
// Examine whether DATAFILE resources are stored in setup.exe that is currently running // Examine whether DATAFILE resources are stored in setup.exe that is currently running
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
EnumResourceNamesA(NULL, SW_SFX_RESOURCE_TYPE, SwEnumResourceNamesProc, (LONG_PTR)(&is_datafile_exists)); EnumResourceNamesA(NULL, SW_SFX_RESOURCE_TYPE, SwEnumResourceNamesProc, (LONG_PTR)(&is_datafile_exists));
#pragma clang diagnostic pop
if (is_datafile_exists) if (is_datafile_exists)
{ {
@@ -4005,11 +4011,6 @@ SW_LOGFILE *SwLoadLogFile(SW *sw, wchar_t *filename)
CfgGetStr(info, "ComponentName", component_name, sizeof(component_name)); CfgGetStr(info, "ComponentName", component_name, sizeof(component_name));
build = CfgGetInt(info, "Build"); build = CfgGetInt(info, "Build");
if (build == 0)
{
goto LABEL_CLEANUP;
}
c = SwFindComponent(sw, component_name); c = SwFindComponent(sw, component_name);
if (c == NULL) if (c == NULL)
{ {
+111 -58
View File
@@ -9,12 +9,14 @@
#include "Account.h" #include "Account.h"
#include "Cedar.h" #include "Cedar.h"
#include "Connection.h"
#include "Hub.h" #include "Hub.h"
#include "IPC.h" #include "IPC.h"
#include "Proto_PPP.h" #include "Proto_PPP.h"
#include "Radius.h" #include "Radius.h"
#include "Server.h" #include "Server.h"
#include "Mayaqua/Encoding.h"
#include "Mayaqua/Internat.h" #include "Mayaqua/Internat.h"
#include "Mayaqua/Memory.h" #include "Mayaqua/Memory.h"
#include "Mayaqua/Microsoft.h" #include "Mayaqua/Microsoft.h"
@@ -31,11 +33,6 @@
#include <unistd.h> #include <unistd.h>
#endif #endif
int base64_enc_len(unsigned int plainLen) {
unsigned int n = plainLen;
return (n + 2 - ((n + 2) % 3)) / 3 * 4;
}
PID OpenChildProcess(const char* path, char* const parameter[], int fd[] ) PID OpenChildProcess(const char* path, char* const parameter[], int fd[] )
{ {
#ifdef OS_WIN32 #ifdef OS_WIN32
@@ -134,7 +131,6 @@ bool SmbAuthenticate(char* name, char* password, char* domainname, char* groupna
int fds[2]; int fds[2];
FILE* out, *in; FILE* out, *in;
PID pid; PID pid;
char buffer[255];
char ntlm_timeout[32]; char ntlm_timeout[32];
char* proc_parameter[6]; char* proc_parameter[6];
@@ -153,8 +149,6 @@ bool SmbAuthenticate(char* name, char* password, char* domainname, char* groupna
return false; return false;
} }
Zero(buffer, sizeof(buffer));
// Truncate string if unsafe char // Truncate string if unsafe char
EnSafeStr(domainname, '\0'); EnSafeStr(domainname, '\0');
@@ -218,64 +212,48 @@ bool SmbAuthenticate(char* name, char* password, char* domainname, char* groupna
return false; return false;
} }
if (base64_enc_len((unsigned int)strlen(name)) < sizeof(buffer)-1 &&
base64_enc_len((unsigned int)strlen(password)) < sizeof(buffer)-1 &&
base64_enc_len((unsigned int)strlen(domainname)) < sizeof(buffer)-1)
{ {
char answer[300]; char *base64 = Base64FromBin(NULL, name, StrLen(name));
unsigned int end = B64_Encode(buffer, name, (int)strlen(name));
buffer[end] = '\0';
fputs("Username:: ", out); fputs("Username:: ", out);
fputs(buffer, out); fputs(base64, out);
fputs("\n", out); fputs("\n", out);
Debug("Username: %s\n", buffer); Free(base64);
buffer[0] = 0;
end = B64_Encode(buffer, domainname, (int)strlen(domainname)); base64 = Base64FromBin(NULL, domainname, StrLen(domainname));
buffer[end] = '\0';
fputs("NT-Domain:: ", out); fputs("NT-Domain:: ", out);
fputs(buffer, out); fputs(base64, out);
fputs("\n", out); fputs("\n", out);
Debug("NT-Domain: %s\n", buffer); Free(base64);
buffer[0] = 0;
if (password[0] != '\0') if (IsEmptyStr(password) == false)
{ {
Debug("Password authentication\n"); Debug("SmbAuthenticate(): Using password authentication...\n");
end = B64_Encode(buffer, password, (int)strlen(password));
buffer[end] = '\0'; base64 = Base64FromBin(NULL, password, StrLen(password));
fputs("Password:: ", out); fputs("Password:: ", out);
fputs(buffer, out); fputs(base64, out);
fputs("\n", out); fputs("\n", out);
Debug("Password: %s\n", buffer); Free(base64);
buffer[0] = 0;
} }
else else
{ {
char* mschapv2_client_response; Debug("SmbAuthenticate(): Using MsChapV2 authentication...\n");
char* base64_challenge8;
Debug("MsChapV2 authentication\n"); char *mschapv2_client_response = CopyBinToStr(MsChapV2_ClientResponse, 24);
mschapv2_client_response = CopyBinToStr(MsChapV2_ClientResponse, 24); base64 = Base64FromBin(NULL, mschapv2_client_response, 48);
end = B64_Encode(buffer, mschapv2_client_response, 48);
buffer[end] = '\0';
fputs("NT-Response:: ", out);
fputs(buffer, out);
fputs("\n", out);
Debug("NT-Response:: %s\n", buffer);
buffer[0] = 0;
Free(mschapv2_client_response); Free(mschapv2_client_response);
fputs("NT-Response:: ", out);
base64_challenge8 = CopyBinToStr(challenge8, 8); fputs(base64, out);
end = B64_Encode(buffer, base64_challenge8 , 16);
buffer[end] = '\0';
fputs("LANMAN-Challenge:: ", out);
fputs(buffer, out);
fputs("\n", out); fputs("\n", out);
Debug("LANMAN-Challenge:: %s\n", buffer); Free(base64);
buffer[0] = 0;
char *base64_challenge8 = CopyBinToStr(challenge8, 8);
base64 = Base64FromBin(NULL, base64_challenge8, 16);
Free(base64_challenge8); Free(base64_challenge8);
fputs("LANMAN-Challenge:: ", out);
fputs(base64, out);
fputs("\n", out);
Free(base64);
fputs("Request-User-Session-Key: Yes\n", out); fputs("Request-User-Session-Key: Yes\n", out);
} }
@@ -285,6 +263,7 @@ bool SmbAuthenticate(char* name, char* password, char* domainname, char* groupna
fflush (out); fflush (out);
// Request send! // Request send!
char answer[300];
Zero(answer, sizeof(answer)); Zero(answer, sizeof(answer));
while (fgets(answer, sizeof(answer)-1, in)) while (fgets(answer, sizeof(answer)-1, in))
@@ -323,7 +302,7 @@ bool SmbAuthenticate(char* name, char* password, char* domainname, char* groupna
response_parameter[0] ='\0'; response_parameter[0] ='\0';
response_parameter++; response_parameter++;
end = Decode64(response_parameter, response_parameter); const UINT end = Base64Decode(response_parameter, response_parameter, StrLen(response_parameter));
response_parameter[end] = '\0'; response_parameter[end] = '\0';
} }
@@ -442,7 +421,7 @@ bool SamAuthUserByPlainPassword(CONNECTION *c, HUB *hub, char *username, char *p
bool auth_by_nt = false; bool auth_by_nt = false;
HUB *h; HUB *h;
// Validate arguments // Validate arguments
if (hub == NULL || c == NULL || username == NULL) if (hub == NULL || c == NULL || username == NULL || password == NULL || opt == NULL)
{ {
return false; return false;
} }
@@ -460,7 +439,14 @@ bool SamAuthUserByPlainPassword(CONNECTION *c, HUB *hub, char *username, char *p
AcLock(hub); AcLock(hub);
{ {
USER *u; USER *u;
u = AcGetUser(hub, ast == false ? username : "*");
// Find exact user first
u = AcGetUser(hub, username);
if (u == NULL && ast)
{
u = AcGetUser(hub, "*");
}
if (u) if (u)
{ {
Lock(u->lock); Lock(u->lock);
@@ -469,7 +455,7 @@ bool SamAuthUserByPlainPassword(CONNECTION *c, HUB *hub, char *username, char *p
{ {
// Radius authentication // Radius authentication
AUTHRADIUS *auth = (AUTHRADIUS *)u->AuthData; AUTHRADIUS *auth = (AUTHRADIUS *)u->AuthData;
if (ast || auth->RadiusUsername == NULL || UniStrLen(auth->RadiusUsername) == 0) if (auth->RadiusUsername == NULL || UniStrLen(auth->RadiusUsername) == 0)
{ {
if( IsEmptyStr(h->RadiusRealm) == false ) if( IsEmptyStr(h->RadiusRealm) == false )
{ {
@@ -494,7 +480,7 @@ bool SamAuthUserByPlainPassword(CONNECTION *c, HUB *hub, char *username, char *p
{ {
// NT authentication // NT authentication
AUTHNT *auth = (AUTHNT *)u->AuthData; AUTHNT *auth = (AUTHNT *)u->AuthData;
if (ast || auth->NtUsername == NULL || UniStrLen(auth->NtUsername) == 0) if (auth->NtUsername == NULL || UniStrLen(auth->NtUsername) == 0)
{ {
name = CopyStrToUni(username); name = CopyStrToUni(username);
} }
@@ -530,10 +516,75 @@ bool SamAuthUserByPlainPassword(CONNECTION *c, HUB *hub, char *username, char *p
char suffix_filter[MAX_SIZE]; char suffix_filter[MAX_SIZE];
wchar_t suffix_filter_w[MAX_SIZE]; wchar_t suffix_filter_w[MAX_SIZE];
UINT interval; UINT interval;
EAP_CLIENT *eap = NULL;
char password1[MAX_SIZE];
UCHAR client_challenge[16];
UCHAR server_challenge[16];
UCHAR challenge8[8];
UCHAR client_response[24];
UCHAR ntlm_hash[MD5_SIZE];
Zero(suffix_filter, sizeof(suffix_filter)); Zero(suffix_filter, sizeof(suffix_filter));
Zero(suffix_filter_w, sizeof(suffix_filter_w)); Zero(suffix_filter_w, sizeof(suffix_filter_w));
// MSCHAPv2 / EAP wrapper for SEVPN
if (c->IsInProc == false && StartWith(password, IPC_PASSWORD_MSCHAPV2_TAG) == false)
{
char client_ip_str[MAX_SIZE];
char utf8[MAX_SIZE];
// Convert the user name to a Unicode string
UniToStr(utf8, sizeof(utf8), name);
utf8[MAX_SIZE-1] = 0;
Zero(client_ip_str, sizeof(client_ip_str));
if (c != NULL && c->FirstSock != NULL)
{
IPToStr(client_ip_str, sizeof(client_ip_str), &c->FirstSock->RemoteIP);
}
if (hub->RadiusConvertAllMsChapv2AuthRequestToEap)
{
// Do EAP or PEAP
eap = HubNewEapClient(hub->Cedar, hub->Name, client_ip_str, utf8, opt->In_VpnProtocolState, false, NULL, 0);
// Prepare MSCHAP response and replace plain password
if (eap != NULL)
{
char server_challenge_hex[MAX_SIZE];
char client_challenge_hex[MAX_SIZE];
char client_response_hex[MAX_SIZE];
char eap_client_hex[64];
MsChapV2Client_GenerateChallenge(client_challenge);
GenerateNtPasswordHash(ntlm_hash, password);
Copy(server_challenge, eap->MsChapV2Challenge.Chap_ChallengeValue, 16);
MsChapV2_GenerateChallenge8(challenge8, client_challenge, server_challenge, utf8);
MsChapV2Client_GenerateResponse(client_response, challenge8, ntlm_hash);
BinToStr(server_challenge_hex, sizeof(server_challenge_hex),
server_challenge, sizeof(server_challenge));
BinToStr(client_challenge_hex, sizeof(client_challenge_hex),
client_challenge, sizeof(client_challenge));
BinToStr(client_response_hex, sizeof(client_response_hex),
client_response, sizeof(client_response));
BinToStr(eap_client_hex, sizeof(eap_client_hex), &eap, 8);
Format(password1, sizeof(password1), "%s%s:%s:%s:%s:%s",
IPC_PASSWORD_MSCHAPV2_TAG,
utf8,
server_challenge_hex,
client_challenge_hex,
client_response_hex,
eap_client_hex);
password = password1;
}
}
else
{
// Todo: Do MSCHAPv2
}
}
// Get the Radius server information // Get the Radius server information
if (GetRadiusServerEx2(hub, radius_server_addr, sizeof(radius_server_addr), &radius_server_port, radius_secret, sizeof(radius_secret), &interval, suffix_filter, sizeof(suffix_filter))) if (GetRadiusServerEx2(hub, radius_server_addr, sizeof(radius_server_addr), &radius_server_port, radius_secret, sizeof(radius_secret), &interval, suffix_filter, sizeof(suffix_filter)))
{ {
@@ -550,10 +601,7 @@ bool SamAuthUserByPlainPassword(CONNECTION *c, HUB *hub, char *username, char *p
if (b) if (b)
{ {
if (opt != NULL) opt->Out_IsRadiusLogin = true;
{
opt->Out_IsRadiusLogin = true;
}
} }
} }
@@ -563,6 +611,11 @@ bool SamAuthUserByPlainPassword(CONNECTION *c, HUB *hub, char *username, char *p
{ {
HLog(hub, "LH_NO_RADIUS_SETTING", name); HLog(hub, "LH_NO_RADIUS_SETTING", name);
} }
if (eap != NULL)
{
ReleaseEapClient(eap);
}
} }
else else
{ {
+3
View File
@@ -93,9 +93,12 @@ void SuDeleteGarbageInfsInner()
return; return;
} }
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
_SetupUninstallOEMInfA = _SetupUninstallOEMInfA =
(UINT (__stdcall *)(PCSTR,DWORD,PVOID)) (UINT (__stdcall *)(PCSTR,DWORD,PVOID))
GetProcAddress(hSetupApiDll, "SetupUninstallOEMInfA"); GetProcAddress(hSetupApiDll, "SetupUninstallOEMInfA");
#pragma clang diagnostic pop
if (_SetupUninstallOEMInfA != NULL) if (_SetupUninstallOEMInfA != NULL)
{ {
+54 -18
View File
@@ -1092,10 +1092,15 @@ UINT GetServerCapsInt(SERVER *s, char *name)
return 0; return 0;
} }
Zero(&t, sizeof(t));
GetServerCaps(s, &t);
ret = GetCapsInt(&t, name); Lock(s->CapsCacheLock);
{
Zero(&t, sizeof(t));
GetServerCaps(s, &t);
ret = GetCapsInt(&t, name);
}
Unlock(s->CapsCacheLock);
return ret; return ret;
} }
@@ -1164,10 +1169,14 @@ void FlushServerCaps(SERVER *s)
return; return;
} }
DestroyServerCapsCache(s); Lock(s->CapsCacheLock);
{
DestroyServerCapsCache(s);
Zero(&t, sizeof(t)); Zero(&t, sizeof(t));
GetServerCaps(s, &t); GetServerCaps(s, &t);
}
Unlock(s->CapsCacheLock);
} }
// Get the Caps list for this server // Get the Caps list for this server
@@ -2320,7 +2329,7 @@ void SiSetDefaultHubOption(HUB_OPTION *o)
o->DefaultSubnet = SetIP32(255, 255, 255, 0); o->DefaultSubnet = SetIP32(255, 255, 255, 0);
o->MaxSession = 0; o->MaxSession = 0;
o->VlanTypeId = MAC_PROTO_TAGVLAN; o->VlanTypeId = MAC_PROTO_TAGVLAN;
o->NoIPv6DefaultRouterInRAWhenIPv6 = true; o->NoIPv6DefaultRouterInRAWhenIPv6 = false;
o->ManageOnlyPrivateIP = true; o->ManageOnlyPrivateIP = true;
o->ManageOnlyLocalUnicastIPv6 = true; o->ManageOnlyLocalUnicastIPv6 = true;
o->NoMacAddressLog = true; o->NoMacAddressLog = true;
@@ -3400,6 +3409,7 @@ void SiWriteHubLinkCfg(FOLDER *f, LINK *k)
} }
CfgAddBool(f, "CheckServerCert", k->CheckServerCert); CfgAddBool(f, "CheckServerCert", k->CheckServerCert);
CfgAddBool(f, "AddDefaultCA", k->AddDefaultCA);
if (k->ServerCert != NULL) if (k->ServerCert != NULL)
{ {
@@ -3450,6 +3460,7 @@ void SiLoadHubLinkCfg(FOLDER *f, HUB *h)
{ {
BUF *b; BUF *b;
k->CheckServerCert = CfgGetBool(f, "CheckServerCert"); k->CheckServerCert = CfgGetBool(f, "CheckServerCert");
k->AddDefaultCA = CfgGetBool(f, "AddDefaultCA");
b = CfgGetBuf(f, "ServerCert"); b = CfgGetBuf(f, "ServerCert");
if (b != NULL) if (b != NULL)
{ {
@@ -3457,16 +3468,8 @@ void SiLoadHubLinkCfg(FOLDER *f, HUB *h)
FreeBuf(b); FreeBuf(b);
} }
if (online) k->Offline = !online;
{
k->Offline = true;
SetLinkOnline(k);
}
else
{
k->Offline = false;
SetLinkOffline(k);
}
ReleaseLink(k); ReleaseLink(k);
} }
@@ -3880,6 +3883,16 @@ void SiLoadHubOptionCfg(FOLDER *f, HUB_OPTION *o)
o->DropArpInPrivacyFilterMode = true; o->DropArpInPrivacyFilterMode = true;
} }
if (CfgIsItem(f, "AllowSameUserInPrivacyFilterMode"))
{
o->AllowSameUserInPrivacyFilterMode = CfgGetBool(f, "AllowSameUserInPrivacyFilterMode");
}
else
{
o->AllowSameUserInPrivacyFilterMode = false;
}
o->NoLookBPDUBridgeId = CfgGetBool(f, "NoLookBPDUBridgeId"); o->NoLookBPDUBridgeId = CfgGetBool(f, "NoLookBPDUBridgeId");
o->AdjustTcpMssValue = CfgGetInt(f, "AdjustTcpMssValue"); o->AdjustTcpMssValue = CfgGetInt(f, "AdjustTcpMssValue");
o->DisableAdjustTcpMss = CfgGetBool(f, "DisableAdjustTcpMss"); o->DisableAdjustTcpMss = CfgGetBool(f, "DisableAdjustTcpMss");
@@ -3928,6 +3941,7 @@ void SiLoadHubOptionCfg(FOLDER *f, HUB_OPTION *o)
o->NoPhysicalIPOnPacketLog = CfgGetBool(f, "NoPhysicalIPOnPacketLog"); o->NoPhysicalIPOnPacketLog = CfgGetBool(f, "NoPhysicalIPOnPacketLog");
o->UseHubNameAsDhcpUserClassOption = CfgGetBool(f, "UseHubNameAsDhcpUserClassOption"); o->UseHubNameAsDhcpUserClassOption = CfgGetBool(f, "UseHubNameAsDhcpUserClassOption");
o->UseHubNameAsRadiusNasId = CfgGetBool(f, "UseHubNameAsRadiusNasId"); o->UseHubNameAsRadiusNasId = CfgGetBool(f, "UseHubNameAsRadiusNasId");
o->AllowEapMatchUserByCert = CfgGetBool(f, "AllowEapMatchUserByCert");
// Enabled by default // Enabled by default
if (CfgIsItem(f, "ManageOnlyPrivateIP")) if (CfgIsItem(f, "ManageOnlyPrivateIP"))
@@ -4004,6 +4018,7 @@ void SiWriteHubOptionCfg(FOLDER *f, HUB_OPTION *o)
CfgAddBool(f, "DoNotSaveHeavySecurityLogs", o->DoNotSaveHeavySecurityLogs); CfgAddBool(f, "DoNotSaveHeavySecurityLogs", o->DoNotSaveHeavySecurityLogs);
CfgAddBool(f, "DropBroadcastsInPrivacyFilterMode", o->DropBroadcastsInPrivacyFilterMode); CfgAddBool(f, "DropBroadcastsInPrivacyFilterMode", o->DropBroadcastsInPrivacyFilterMode);
CfgAddBool(f, "DropArpInPrivacyFilterMode", o->DropArpInPrivacyFilterMode); CfgAddBool(f, "DropArpInPrivacyFilterMode", o->DropArpInPrivacyFilterMode);
CfgAddBool(f, "AllowSameUserInPrivacyFilterMode", o->AllowSameUserInPrivacyFilterMode);
CfgAddBool(f, "SuppressClientUpdateNotification", o->SuppressClientUpdateNotification); CfgAddBool(f, "SuppressClientUpdateNotification", o->SuppressClientUpdateNotification);
CfgAddBool(f, "AssignVLanIdByRadiusAttribute", o->AssignVLanIdByRadiusAttribute); CfgAddBool(f, "AssignVLanIdByRadiusAttribute", o->AssignVLanIdByRadiusAttribute);
CfgAddBool(f, "DenyAllRadiusLoginWithNoVlanAssign", o->DenyAllRadiusLoginWithNoVlanAssign); CfgAddBool(f, "DenyAllRadiusLoginWithNoVlanAssign", o->DenyAllRadiusLoginWithNoVlanAssign);
@@ -4032,6 +4047,7 @@ void SiWriteHubOptionCfg(FOLDER *f, HUB_OPTION *o)
CfgAddBool(f, "DisableCorrectIpOffloadChecksum", o->DisableCorrectIpOffloadChecksum); CfgAddBool(f, "DisableCorrectIpOffloadChecksum", o->DisableCorrectIpOffloadChecksum);
CfgAddBool(f, "UseHubNameAsDhcpUserClassOption", o->UseHubNameAsDhcpUserClassOption); CfgAddBool(f, "UseHubNameAsDhcpUserClassOption", o->UseHubNameAsDhcpUserClassOption);
CfgAddBool(f, "UseHubNameAsRadiusNasId", o->UseHubNameAsRadiusNasId); CfgAddBool(f, "UseHubNameAsRadiusNasId", o->UseHubNameAsRadiusNasId);
CfgAddBool(f, "AllowEapMatchUserByCert", o->AllowEapMatchUserByCert);
} }
// Write the user // Write the user
@@ -5608,6 +5624,7 @@ void SiLoadServerCfg(SERVER *s, FOLDER *f)
char tmp[MAX_SIZE]; char tmp[MAX_SIZE];
X *x = NULL; X *x = NULL;
K *k = NULL; K *k = NULL;
LIST *chain = NewList(NULL);
FOLDER *params_folder; FOLDER *params_folder;
UINT i; UINT i;
// Validate arguments // Validate arguments
@@ -5847,10 +5864,14 @@ void SiLoadServerCfg(SERVER *s, FOLDER *f)
FreeBuf(b); FreeBuf(b);
} }
// Server trust chain
SiLoadCertList(chain, CfgGetFolder(f, "ServerChain"));
if (x == NULL || k == NULL || CheckXandK(x, k) == false) if (x == NULL || k == NULL || CheckXandK(x, k) == false)
{ {
FreeX(x); FreeX(x);
FreeK(k); FreeK(k);
FreeXList(chain);
SiGenerateDefaultCert(&x, &k); SiGenerateDefaultCert(&x, &k);
SetCedarCert(c, x, k); SetCedarCert(c, x, k);
@@ -5860,10 +5881,18 @@ void SiLoadServerCfg(SERVER *s, FOLDER *f)
} }
else else
{ {
SetCedarCert(c, x, k); if (LIST_NUM(chain) == 0)
{
SetCedarCert(c, x, k);
}
else
{
SetCedarCertAndChain(c, x, k, chain);
}
FreeX(x); FreeX(x);
FreeK(k); FreeK(k);
FreeXList(chain);
} }
// Character which separates the username from the hub name // Character which separates the username from the hub name
@@ -6246,6 +6275,9 @@ void SiWriteServerCfg(FOLDER *f, SERVER *s)
CfgAddBuf(f, "ServerKey", b); CfgAddBuf(f, "ServerKey", b);
FreeBuf(b); FreeBuf(b);
// Server trust chain
SiWriteCertList(CfgCreateFolder(f, "ServerChain"), c->ServerChain);
{ {
// Character which separates the username from the hub name // Character which separates the username from the hub name
char str[2]; char str[2];
@@ -7449,6 +7481,7 @@ void SiCalledUpdateHub(SERVER *s, PACK *p)
o.DoNotSaveHeavySecurityLogs = PackGetBool(p, "DoNotSaveHeavySecurityLogs"); o.DoNotSaveHeavySecurityLogs = PackGetBool(p, "DoNotSaveHeavySecurityLogs");
o.DropBroadcastsInPrivacyFilterMode = PackGetBool(p, "DropBroadcastsInPrivacyFilterMode"); o.DropBroadcastsInPrivacyFilterMode = PackGetBool(p, "DropBroadcastsInPrivacyFilterMode");
o.DropArpInPrivacyFilterMode = PackGetBool(p, "DropArpInPrivacyFilterMode"); o.DropArpInPrivacyFilterMode = PackGetBool(p, "DropArpInPrivacyFilterMode");
o.AllowSameUserInPrivacyFilterMode= PackGetBool(p, "AllowSameUserInPrivacyFilterMode");
o.SuppressClientUpdateNotification = PackGetBool(p, "SuppressClientUpdateNotification"); o.SuppressClientUpdateNotification = PackGetBool(p, "SuppressClientUpdateNotification");
o.AssignVLanIdByRadiusAttribute = PackGetBool(p, "AssignVLanIdByRadiusAttribute"); o.AssignVLanIdByRadiusAttribute = PackGetBool(p, "AssignVLanIdByRadiusAttribute");
o.DenyAllRadiusLoginWithNoVlanAssign = PackGetBool(p, "DenyAllRadiusLoginWithNoVlanAssign"); o.DenyAllRadiusLoginWithNoVlanAssign = PackGetBool(p, "DenyAllRadiusLoginWithNoVlanAssign");
@@ -7499,6 +7532,7 @@ void SiCalledUpdateHub(SERVER *s, PACK *p)
o.DisableCorrectIpOffloadChecksum = PackGetBool(p, "DisableCorrectIpOffloadChecksum"); o.DisableCorrectIpOffloadChecksum = PackGetBool(p, "DisableCorrectIpOffloadChecksum");
o.UseHubNameAsDhcpUserClassOption = PackGetBool(p, "UseHubNameAsDhcpUserClassOption"); o.UseHubNameAsDhcpUserClassOption = PackGetBool(p, "UseHubNameAsDhcpUserClassOption");
o.UseHubNameAsRadiusNasId = PackGetBool(p, "UseHubNameAsRadiusNasId"); o.UseHubNameAsRadiusNasId = PackGetBool(p, "UseHubNameAsRadiusNasId");
o.AllowEapMatchUserByCert = PackGetBool(p, "AllowEapMatchUserByCert");
save_packet_log = PackGetInt(p, "SavePacketLog"); save_packet_log = PackGetInt(p, "SavePacketLog");
packet_log_switch_type = PackGetInt(p, "PacketLogSwitchType"); packet_log_switch_type = PackGetInt(p, "PacketLogSwitchType");
@@ -9275,6 +9309,7 @@ void SiPackAddCreateHub(PACK *p, HUB *h)
PackAddBool(p, "DoNotSaveHeavySecurityLogs", h->Option->DoNotSaveHeavySecurityLogs); PackAddBool(p, "DoNotSaveHeavySecurityLogs", h->Option->DoNotSaveHeavySecurityLogs);
PackAddBool(p, "DropBroadcastsInPrivacyFilterMode", h->Option->DropBroadcastsInPrivacyFilterMode); PackAddBool(p, "DropBroadcastsInPrivacyFilterMode", h->Option->DropBroadcastsInPrivacyFilterMode);
PackAddBool(p, "DropArpInPrivacyFilterMode", h->Option->DropArpInPrivacyFilterMode); PackAddBool(p, "DropArpInPrivacyFilterMode", h->Option->DropArpInPrivacyFilterMode);
PackAddBool(p, "AllowSameUserInPrivacyFilterMode", h->Option->AllowSameUserInPrivacyFilterMode);
PackAddBool(p, "SuppressClientUpdateNotification", h->Option->SuppressClientUpdateNotification); PackAddBool(p, "SuppressClientUpdateNotification", h->Option->SuppressClientUpdateNotification);
PackAddBool(p, "AssignVLanIdByRadiusAttribute", h->Option->AssignVLanIdByRadiusAttribute); PackAddBool(p, "AssignVLanIdByRadiusAttribute", h->Option->AssignVLanIdByRadiusAttribute);
PackAddBool(p, "DenyAllRadiusLoginWithNoVlanAssign", h->Option->DenyAllRadiusLoginWithNoVlanAssign); PackAddBool(p, "DenyAllRadiusLoginWithNoVlanAssign", h->Option->DenyAllRadiusLoginWithNoVlanAssign);
@@ -9332,6 +9367,7 @@ void SiPackAddCreateHub(PACK *p, HUB *h)
PackAddData(p, "SecurePassword", h->SecurePassword, SHA1_SIZE); PackAddData(p, "SecurePassword", h->SecurePassword, SHA1_SIZE);
PackAddBool(p, "UseHubNameAsDhcpUserClassOption", h->Option->UseHubNameAsDhcpUserClassOption); PackAddBool(p, "UseHubNameAsDhcpUserClassOption", h->Option->UseHubNameAsDhcpUserClassOption);
PackAddBool(p, "UseHubNameAsRadiusNasId", h->Option->UseHubNameAsRadiusNasId); PackAddBool(p, "UseHubNameAsRadiusNasId", h->Option->UseHubNameAsRadiusNasId);
PackAddBool(p, "AllowEapMatchUserByCert", h->Option->AllowEapMatchUserByCert);
SiAccessListToPack(p, h->AccessList); SiAccessListToPack(p, h->AccessList);
+71 -11
View File
@@ -609,6 +609,24 @@ void SessionMain(SESSION *s)
WHERE; WHERE;
} }
} }
// If all the specified number of tcp connections are not alive continuously, then terminate the session.
UINT num_tcp_conn = LIST_NUM(s->Connection->Tcp->TcpSockList);
UINT max_conn = s->ClientOption->MaxConnection;
if ((s->CurrentConnectionEstablishTime +
(UINT64)(s->ClientOption->AdditionalConnectionInterval * 1000 * 2 + CONNECTING_TIMEOUT * 2))
<= Tick64())
{
if (s->ClientOption->BindLocalPort != 0 || num_tcp_conn == 0)
{
timeouted = true;
WHERE;
}
}
//Debug("SessionMain(): The number of TCP connections short... Num_Tcp_Conn=%d Max_Conn=%d Curr_Conn_Time=%llu Tick64=%llu\n"
// , num_tcp_conn, max_conn, s->CurrentConnectionEstablishTime, Tick64());
} }
} }
@@ -1270,6 +1288,13 @@ void CleanupSession(SESSION *s)
Free(s->ClientAuth); Free(s->ClientAuth);
} }
if (s->SslOption != NULL)
{
FreeXList(s->SslOption->CaList);
FreeX(s->SslOption->SavedCert);
Free(s->SslOption);
}
FreeTraffic(s->Traffic); FreeTraffic(s->Traffic);
Free(s->Name); Free(s->Name);
@@ -1423,6 +1448,9 @@ void ClientThread(THREAD *t, void *param)
while (true) while (true)
{ {
Zero(&s->ServerIP_CacheForNextConnect, sizeof(IP)); Zero(&s->ServerIP_CacheForNextConnect, sizeof(IP));
Zero(&s->LocalIP_CacheForNextConnect, sizeof(IP)); // Assigned by first outgoing connection
Zero(s->UnderlayProtocol, sizeof(s->UnderlayProtocol));
Zero(s->ProtocolDetails, sizeof(s->ProtocolDetails));
if (s->Link != NULL && ((*s->Link->StopAllLinkFlag) || s->Link->Halting)) if (s->Link != NULL && ((*s->Link->StopAllLinkFlag) || s->Link->Halting))
{ {
@@ -1949,23 +1977,55 @@ SESSION *NewClientSessionEx(CEDAR *cedar, CLIENT_OPTION *option, CLIENT_AUTH *au
{ {
s->ClientAuth->ClientX = CloneX(s->ClientAuth->ClientX); s->ClientAuth->ClientX = CloneX(s->ClientAuth->ClientX);
} }
if (s->ClientAuth->ClientK != NULL) if (s->ClientAuth->ClientK != NULL)
{ {
if (s->ClientAuth->AuthType != CLIENT_AUTHTYPE_OPENSSLENGINE) if (s->ClientAuth->AuthType != CLIENT_AUTHTYPE_OPENSSLENGINE)
{ {
s->ClientAuth->ClientK = CloneK(s->ClientAuth->ClientK); s->ClientAuth->ClientK = CloneK(s->ClientAuth->ClientK);
} }
else else
{ {
s->ClientAuth->ClientK = OpensslEngineToK(s->ClientAuth->OpensslEnginePrivateKeyName, s->ClientAuth->OpensslEngineName); s->ClientAuth->ClientK = OpensslEngineToK(s->ClientAuth->OpensslEnginePrivateKeyName, s->ClientAuth->OpensslEngineName);
} }
} }
if (StrCmpi(s->ClientOption->DeviceName, LINK_DEVICE_NAME) == 0) if (StrCmpi(s->ClientOption->DeviceName, LINK_DEVICE_NAME) == 0)
{ {
// Link client mode // Link client mode
s->LinkModeClient = true; s->LinkModeClient = true;
s->Link = (LINK *)s->PacketAdapter->Param; s->Link = (LINK *)s->PacketAdapter->Param;
if (s->Link != NULL && s->Link->CheckServerCert && s->Link->Hub->HubDb != NULL)
{
// Enable SSL peer verification
s->SslOption = ZeroMalloc(sizeof(SSL_VERIFY_OPTION));
s->SslOption->VerifyPeer = true;
s->SslOption->AddDefaultCA = s->Link->AddDefaultCA;
s->SslOption->VerifyHostname = true;
s->SslOption->SavedCert = CloneX(s->Link->ServerCert);
// Copy trusted CA
LIST *o = s->Link->Hub->HubDb->RootCertList;
s->SslOption->CaList = CloneXList(o);
}
}
else
{
if (account != NULL && account->CheckServerCert)
{
// Enable SSL peer verification
s->SslOption = ZeroMalloc(sizeof(SSL_VERIFY_OPTION));
s->SslOption->VerifyPeer = true;
#ifdef OS_WIN32
s->SslOption->PromptOnVerifyFail = true;
#endif
s->SslOption->AddDefaultCA = account->AddDefaultCA;
s->SslOption->VerifyHostname = true;
s->SslOption->SavedCert = CloneX(account->ServerCert);
// Copy trusted CA
LIST *o = cedar->CaList;
s->SslOption->CaList = CloneXList(o);
}
} }
if (StrCmpi(s->ClientOption->DeviceName, SNAT_DEVICE_NAME) == 0) if (StrCmpi(s->ClientOption->DeviceName, SNAT_DEVICE_NAME) == 0)
+2
View File
@@ -91,6 +91,7 @@ struct SESSION
char ClientIP[64]; // Client IP char ClientIP[64]; // Client IP
CLIENT_OPTION *ClientOption; // Client connection options CLIENT_OPTION *ClientOption; // Client connection options
CLIENT_AUTH *ClientAuth; // Client authentication data CLIENT_AUTH *ClientAuth; // Client authentication data
SSL_VERIFY_OPTION *SslOption; // SSL verification option
volatile bool Halt; // Halting flag volatile bool Halt; // Halting flag
volatile bool CancelConnect; // Cancel the connection volatile bool CancelConnect; // Cancel the connection
EVENT *HaltEvent; // Halting event EVENT *HaltEvent; // Halting event
@@ -129,6 +130,7 @@ struct SESSION
UCHAR Padding[2]; UCHAR Padding[2];
IP ServerIP_CacheForNextConnect; // Server IP, cached for next connect IP ServerIP_CacheForNextConnect; // Server IP, cached for next connect
IP LocalIP_CacheForNextConnect; // Local IP, cached for next connect (2nd and subsequent), assigned by first outgoing connection
UINT64 CreatedTime; // Creation date and time UINT64 CreatedTime; // Creation date and time
UINT64 LastCommTime; // Last communication date and time UINT64 LastCommTime; // Last communication date and time
+6 -4
View File
@@ -338,6 +338,8 @@ void UdpAccelSend(UDP_ACCEL *a, UCHAR *data, UINT data_size, UCHAR flag, UINT ma
UINT size = 0; UINT size = 0;
UINT64 tmp; UINT64 tmp;
UINT ret; UINT ret;
UINT u32;
USHORT u16;
// Validate arguments // Validate arguments
if (a == NULL || (data_size != 0 && data == NULL)) if (a == NULL || (data_size != 0 && data == NULL))
{ {
@@ -367,8 +369,8 @@ void UdpAccelSend(UDP_ACCEL *a, UCHAR *data, UINT data_size, UCHAR flag, UINT ma
} }
// Cookie // Cookie
tmp = Endian32(a->YourCookie); u32 = Endian32(a->YourCookie);
Copy(buf, &tmp, sizeof(UINT)); Copy(buf, &u32, sizeof(UINT));
buf += sizeof(UINT); buf += sizeof(UINT);
size += sizeof(UINT); size += sizeof(UINT);
@@ -385,8 +387,8 @@ void UdpAccelSend(UDP_ACCEL *a, UCHAR *data, UINT data_size, UCHAR flag, UINT ma
size += sizeof(UINT64); size += sizeof(UINT64);
// Size // Size
tmp = Endian16(data_size); u16 = Endian16(data_size);
Copy(buf, &tmp, sizeof(USHORT)); Copy(buf, &u16, sizeof(USHORT));
buf += sizeof(USHORT); buf += sizeof(USHORT);
size += sizeof(USHORT); size += sizeof(USHORT);
+103 -11
View File
@@ -29,7 +29,7 @@
#include <net/if.h> #include <net/if.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#ifdef UNIX_OPENBSD #if defined(UNIX_OPENBSD) || defined(UNIX_SOLARIS)
#include <netinet/if_ether.h> #include <netinet/if_ether.h>
#else #else
#include <net/ethernet.h> #include <net/ethernet.h>
@@ -263,7 +263,7 @@ void FreeVLan(VLAN *v)
} }
// Create a tap // Create a tap
VLAN *NewTap(char *name, char *mac_address, bool create_up) VLAN *NewBridgeTap(char *name, char *mac_address, bool create_up)
{ {
int fd; int fd;
VLAN *v; VLAN *v;
@@ -273,7 +273,7 @@ VLAN *NewTap(char *name, char *mac_address, bool create_up)
return NULL; return NULL;
} }
fd = UnixCreateTapDeviceEx(name, "tap", mac_address, create_up); fd = UnixCreateTapDeviceEx(name, UNIX_VLAN_BRIDGE_IFACE_PREFIX, mac_address, create_up);
if (fd == -1) if (fd == -1)
{ {
return NULL; return NULL;
@@ -288,7 +288,7 @@ VLAN *NewTap(char *name, char *mac_address, bool create_up)
} }
// Close the tap // Close the tap
void FreeTap(VLAN *v) void FreeBridgeTap(VLAN *v)
{ {
// Validate arguments // Validate arguments
if (v == NULL) if (v == NULL)
@@ -296,7 +296,11 @@ void FreeTap(VLAN *v)
return; return;
} }
close(v->fd); UnixCloseTapDevice(v->fd);
#ifdef UNIX_BSD
UnixDestroyBridgeTapDevice(v->InstanceName);
#endif
FreeVLan(v); FreeVLan(v);
} }
@@ -470,6 +474,20 @@ int UnixCreateTapDeviceEx(char *name, char *prefix, UCHAR *mac_address, bool cre
ioctl(s, SIOCSIFLLADDR, &ifr); ioctl(s, SIOCSIFLLADDR, &ifr);
} }
// Set interface description
#ifdef SIOCSIFDESCR
{
char desc[] = CEDAR_PRODUCT_STR " Virtual Network Adapter";
ifr.ifr_buffer.buffer = desc;
ifr.ifr_buffer.length = StrLen(desc) + 1;
ioctl(s, SIOCSIFDESCR, &ifr);
}
#endif
// Set interface group
UnixSetIfGroup(s, tap_name, CEDAR_PRODUCT_STR);
if (create_up) if (create_up)
{ {
Zero(&ifr, sizeof(ifr)); Zero(&ifr, sizeof(ifr));
@@ -554,7 +572,7 @@ int UnixCreateTapDeviceEx(char *name, char *prefix, UCHAR *mac_address, bool cre
} }
int UnixCreateTapDevice(char *name, UCHAR *mac_address, bool create_up) int UnixCreateTapDevice(char *name, UCHAR *mac_address, bool create_up)
{ {
return UnixCreateTapDeviceEx(name, "vpn", mac_address, create_up); return UnixCreateTapDeviceEx(name, UNIX_VLAN_CLIENT_IFACE_PREFIX, mac_address, create_up);
} }
// Close the tap device // Close the tap device
@@ -569,9 +587,77 @@ void UnixCloseTapDevice(int fd)
close(fd); close(fd);
} }
// Destroy the tap device (for FreeBSD)
// FreeBSD tap device is still plumbed after closing fd so need to destroy after close
void UnixDestroyTapDeviceEx(char *name, char *prefix)
{
#ifdef UNIX_BSD
struct ifreq ifr;
char eth_name[MAX_SIZE];
int s;
Zero(&ifr, sizeof(ifr));
GenerateTunName(name, prefix, eth_name, sizeof(eth_name));
StrCpy(ifr.ifr_name, sizeof(ifr.ifr_name), eth_name);
s = socket(AF_INET, SOCK_DGRAM, 0);
if (s == -1)
{
return;
}
ioctl(s, SIOCIFDESTROY, &ifr);
close(s);
#endif // UNIX_BSD
}
void UnixDestroyBridgeTapDevice(char *name)
{
#ifdef UNIX_BSD
UnixDestroyTapDeviceEx(name, UNIX_VLAN_BRIDGE_IFACE_PREFIX);
#endif // UNIX_BSD
}
void UnixDestroyClientTapDevice(char *name)
{
#ifdef UNIX_BSD
UnixDestroyTapDeviceEx(name, UNIX_VLAN_CLIENT_IFACE_PREFIX);
#endif // UNIX_BSD
}
void UnixSetIfGroup(int fd, const char *name, const char *group_name)
{
#ifdef SIOCAIFGROUP
struct ifgroupreq ifgr;
char *tmp;
tmp = CopyStr((char *)group_name);
StrLower(tmp);
Zero(&ifgr, sizeof(ifgr));
StrCpy(ifgr.ifgr_name, sizeof(ifgr.ifgr_name), (char *) name);
StrCpy(ifgr.ifgr_group, sizeof(ifgr.ifgr_group), tmp);
ioctl(fd, SIOCAIFGROUP, &ifgr);
Free(tmp);
#endif
}
#else // NO_VLAN #else // NO_VLAN
void UnixCloseTapDevice(int fd) void UnixCloseDevice(int fd)
{
}
void UnixDestroyTapDevice(char *name)
{
}
void UnixDestroyTapDeviceEx(char *name, char *prefix)
{
}
void UnixSetIfGroup()
{ {
} }
@@ -662,13 +748,13 @@ bool UnixVLanCreateEx(char *name, char *prefix, UCHAR *mac_address, bool create_
} }
bool UnixVLanCreate(char *name, UCHAR *mac_address, bool create_up) bool UnixVLanCreate(char *name, UCHAR *mac_address, bool create_up)
{ {
return UnixVLanCreateEx(name, "vpn", mac_address, create_up); return UnixVLanCreateEx(name, UNIX_VLAN_CLIENT_IFACE_PREFIX, mac_address, create_up);
} }
// Set a VLAN up/down // Set a VLAN up/down
bool UnixVLanSetState(char* name, bool state_up) bool UnixVLanSetState(char* name, bool state_up)
{ {
#ifdef UNIX_LINUX #if defined(UNIX_LINUX) || defined(UNIX_BSD)
UNIX_VLAN_LIST *t, tt; UNIX_VLAN_LIST *t, tt;
struct ifreq ifr; struct ifreq ifr;
int s; int s;
@@ -689,7 +775,7 @@ bool UnixVLanSetState(char* name, bool state_up)
return false; return false;
} }
GenerateTunName(name, "vpn", eth_name, sizeof(eth_name)); GenerateTunName(name, UNIX_VLAN_CLIENT_IFACE_PREFIX, eth_name, sizeof(eth_name));
Zero(&ifr, sizeof(ifr)); Zero(&ifr, sizeof(ifr));
StrCpy(ifr.ifr_name, sizeof(ifr.ifr_name), eth_name); StrCpy(ifr.ifr_name, sizeof(ifr.ifr_name), eth_name);
@@ -714,7 +800,7 @@ bool UnixVLanSetState(char* name, bool state_up)
close(s); close(s);
} }
UnlockList(unix_vlan); UnlockList(unix_vlan);
#endif // UNIX_LINUX #endif // UNIX_LINUX || UNIX_BSD
return true; return true;
} }
@@ -769,6 +855,9 @@ void UnixVLanDelete(char *name)
if (t != NULL) if (t != NULL)
{ {
UnixCloseTapDevice(t->fd); UnixCloseTapDevice(t->fd);
#ifdef UNIX_BSD
UnixDestroyClientTapDevice(t->Name);
#endif
Delete(unix_vlan, t); Delete(unix_vlan, t);
Free(t); Free(t);
} }
@@ -815,6 +904,9 @@ void UnixVLanFree()
UNIX_VLAN_LIST *t = LIST_DATA(unix_vlan, i); UNIX_VLAN_LIST *t = LIST_DATA(unix_vlan, i);
UnixCloseTapDevice(t->fd); UnixCloseTapDevice(t->fd);
#ifdef UNIX_BSD
UnixDestroyClientTapDevice(t->Name);
#endif
Free(t); Free(t);
} }
+5 -2
View File
@@ -31,9 +31,9 @@ struct VLAN
// Function prototype // Function prototype
VLAN *NewVLan(char *instance_name, VLAN_PARAM *param); VLAN *NewVLan(char *instance_name, VLAN_PARAM *param);
VLAN *NewTap(char *name, char *mac_address, bool create_up); VLAN *NewBridgeTap(char *name, char *mac_address, bool create_up);
void FreeVLan(VLAN *v); void FreeVLan(VLAN *v);
void FreeTap(VLAN *v); void FreeBridgeTap(VLAN *v);
CANCEL *VLanGetCancel(VLAN *v); CANCEL *VLanGetCancel(VLAN *v);
bool VLanGetNextPacket(VLAN *v, void **buf, UINT *size); bool VLanGetNextPacket(VLAN *v, void **buf, UINT *size);
bool VLanPutPacket(VLAN *v, void *buf, UINT size); bool VLanPutPacket(VLAN *v, void *buf, UINT size);
@@ -60,6 +60,9 @@ struct UNIX_VLAN_LIST
int UnixCreateTapDevice(char *name, UCHAR *mac_address, bool create_up); int UnixCreateTapDevice(char *name, UCHAR *mac_address, bool create_up);
int UnixCreateTapDeviceEx(char *name, char *prefix, UCHAR *mac_address, bool create_up); int UnixCreateTapDeviceEx(char *name, char *prefix, UCHAR *mac_address, bool create_up);
void UnixCloseTapDevice(int fd); void UnixCloseTapDevice(int fd);
void UnixDestroyBridgeTapDevice(char *name);
void UnixDestroyClientTapDevice(char *name);
void UnixSetIfGroup(int fd, const char *name, const char *group_name);
void UnixVLanInit(); void UnixVLanInit();
void UnixVLanFree(); void UnixVLanFree();
bool UnixVLanCreate(char *name, UCHAR *mac_address, bool create_up); bool UnixVLanCreate(char *name, UCHAR *mac_address, bool create_up);
+66 -57
View File
@@ -162,7 +162,6 @@ void RouteTrackingMain(SESSION *s)
char ip_str2[64]; char ip_str2[64];
Copy(&e->DestIP, &nat_t_ip, sizeof(IP)); Copy(&e->DestIP, &nat_t_ip, sizeof(IP));
e->Metric = e->OldIfMetric;
IPToStr(ip_str, sizeof(ip_str), &e->DestIP); IPToStr(ip_str, sizeof(ip_str), &e->DestIP);
IPToStr(ip_str2, sizeof(ip_str2), &e->GatewayIP); IPToStr(ip_str2, sizeof(ip_str2), &e->GatewayIP);
@@ -190,9 +189,12 @@ void RouteTrackingMain(SESSION *s)
{ {
UINT i; UINT i;
bool route_to_server_erased = true; bool route_to_server_erased = true;
bool is_vlan_want_to_be_default_gateway = false; bool is_vlan_want_to_be_default_gateway_v4 = false;
UINT vlan_default_gateway_metric = 0; bool is_vlan_want_to_be_default_gateway_v6 = false;
UINT other_if_default_gateway_metric_min = INFINITE; UINT vlan_default_gateway_metric_v4 = 0;
UINT vlan_default_gateway_metric_v6 = 0;
UINT other_if_default_gateway_metric_min_v4 = INFINITE;
UINT other_if_default_gateway_metric_min_v6 = INFINITE;
// Get whether the routing table have been changed // Get whether the routing table have been changed
if (t->LastRoutingTableHash != table->HashedValue) if (t->LastRoutingTableHash != table->HashedValue)
@@ -224,59 +226,77 @@ void RouteTrackingMain(SESSION *s)
} }
// Search for the default gateway // Search for the default gateway
if (IPToUINT(&e->DestIP) == 0 && if (IsZeroIP(&e->DestIP) && IsZeroIP(&e->DestMask))
IPToUINT(&e->DestMask) == 0)
{ {
Debug("e->InterfaceID = %u, t->VLanInterfaceId = %u\n", Debug("e->InterfaceID = %u, t->VLanInterfaceId = %u\n",
e->InterfaceID, t->VLanInterfaceId); e->InterfaceID, t->VLanInterfaceId);
if (e->InterfaceID == t->VLanInterfaceId) if (e->InterfaceID == t->VLanInterfaceId)
{ {
// The virtual LAN card think that he want to be a default gateway if (IsIP4(&e->DestIP))
is_vlan_want_to_be_default_gateway = true;
vlan_default_gateway_metric = e->Metric;
if (vlan_default_gateway_metric >= 2 &&
t->OldDefaultGatewayMetric == (vlan_default_gateway_metric - 1))
{ {
// Restore because the PPP server rewrites // The virtual LAN card think that he want to be a default gateway
// the routing table selfishly is_vlan_want_to_be_default_gateway_v4 = true;
DeleteRouteEntry(e); vlan_default_gateway_metric_v4 = e->Metric;
e->Metric--;
AddRouteEntry(e);
Debug("** Restore metric destroyed by PPP.\n");
any_modified = true; // PPP route fix
if (vlan_default_gateway_metric_v4 >= 2 &&
t->OldDefaultGatewayMetric == (vlan_default_gateway_metric_v4 - 1))
{
// Restore because the PPP server rewrites
// the routing table selfishly
DeleteRouteEntry(e);
e->Metric--;
AddRouteEntry(e);
Debug("** Restore metric destroyed by PPP.\n");
any_modified = true;
}
// Keep this entry
if (t->DefaultGatewayByVLan != NULL)
{
// Delete if there is one added last time
FreeRouteEntry(t->DefaultGatewayByVLan);
}
t->DefaultGatewayByVLan = ZeroMalloc(sizeof(ROUTE_ENTRY));
Copy(t->DefaultGatewayByVLan, e, sizeof(ROUTE_ENTRY));
t->OldDefaultGatewayMetric = vlan_default_gateway_metric_v4;
} }
else
// Keep this entry
if (t->DefaultGatewayByVLan != NULL)
{ {
// Delete if there is one added last time is_vlan_want_to_be_default_gateway_v6 = true;
FreeRouteEntry(t->DefaultGatewayByVLan); vlan_default_gateway_metric_v6 = e->Metric;
} }
t->DefaultGatewayByVLan = ZeroMalloc(sizeof(ROUTE_ENTRY));
Copy(t->DefaultGatewayByVLan, e, sizeof(ROUTE_ENTRY));
t->OldDefaultGatewayMetric = vlan_default_gateway_metric;
} }
else else
{ {
// There are default gateway other than the virtual LAN card if (IsIP4(&e->DestIP))
// Save the metric value of the default gateway
if (other_if_default_gateway_metric_min > e->Metric)
{ {
// Ignore the metric value of all PPP connection in the case of Windows Vista // There are default gateway other than the virtual LAN card
if (e->PPPConnection == false) // Save the metric value of the default gateway
if (other_if_default_gateway_metric_min_v4 > e->Metric)
{ {
other_if_default_gateway_metric_min = e->Metric; // Ignore the metric value of all PPP connection in the case of Windows Vista
if (e->PPPConnection == false)
{
other_if_default_gateway_metric_min_v4 = e->Metric;
}
else
{
// a PPP is used to Connect to the network
// in using Windows Vista
t->VistaAndUsingPPP = true;
}
} }
else }
else
{
if (other_if_default_gateway_metric_min_v6 > e->Metric)
{ {
// a PPP is used to Connect to the network other_if_default_gateway_metric_min_v6 = e->Metric;
// in using Windows Vista
t->VistaAndUsingPPP = true;
} }
} }
} }
@@ -287,7 +307,7 @@ void RouteTrackingMain(SESSION *s)
{ {
if (t->DefaultGatewayByVLan != NULL) if (t->DefaultGatewayByVLan != NULL)
{ {
if (is_vlan_want_to_be_default_gateway) if (is_vlan_want_to_be_default_gateway_v4)
{ {
if (t->VistaOldDefaultGatewayByVLan == NULL || Cmp(t->VistaOldDefaultGatewayByVLan, t->DefaultGatewayByVLan, sizeof(ROUTE_ENTRY)) != 0) if (t->VistaOldDefaultGatewayByVLan == NULL || Cmp(t->VistaOldDefaultGatewayByVLan, t->DefaultGatewayByVLan, sizeof(ROUTE_ENTRY)) != 0)
{ {
@@ -362,8 +382,9 @@ void RouteTrackingMain(SESSION *s)
// to elect the virtual LAN card as the default gateway // to elect the virtual LAN card as the default gateway
// Debug("is_vlan_want_to_be_default_gateway = %u, rs = %u, route_to_server_erased = %u, other_if_default_gateway_metric_min = %u, vlan_default_gateway_metric = %u\n", // Debug("is_vlan_want_to_be_default_gateway = %u, rs = %u, route_to_server_erased = %u, other_if_default_gateway_metric_min = %u, vlan_default_gateway_metric = %u\n",
// is_vlan_want_to_be_default_gateway, rs, route_to_server_erased, other_if_default_gateway_metric_min, vlan_default_gateway_metric); // is_vlan_want_to_be_default_gateway, rs, route_to_server_erased, other_if_default_gateway_metric_min, vlan_default_gateway_metric);
if (is_vlan_want_to_be_default_gateway && (rs != NULL && route_to_server_erased == false) && if ((is_vlan_want_to_be_default_gateway_v4 && other_if_default_gateway_metric_min_v4 >= vlan_default_gateway_metric_v4 ||
other_if_default_gateway_metric_min >= vlan_default_gateway_metric) is_vlan_want_to_be_default_gateway_v6 && other_if_default_gateway_metric_min_v6 >= vlan_default_gateway_metric_v6)
&& rs != NULL && route_to_server_erased == false)
{ {
// Scan the routing table again // Scan the routing table again
for (i = 0;i < table->NumEntry;i++) for (i = 0;i < table->NumEntry;i++)
@@ -372,8 +393,7 @@ void RouteTrackingMain(SESSION *s)
if (e->InterfaceID != t->VLanInterfaceId) if (e->InterfaceID != t->VLanInterfaceId)
{ {
if (IPToUINT(&e->DestIP) == 0 && if (IsZeroIP(&e->DestIP) && IsZeroIP(&e->DestMask))
IPToUINT(&e->DestMask) == 0)
{ {
char str[64]; char str[64];
// Default gateway is found // Default gateway is found
@@ -486,8 +506,6 @@ void RouteTrackingStart(SESSION *s)
Debug("GetBestRouteEntry() Succeed. [Gateway: %s]\n", tmp); Debug("GetBestRouteEntry() Succeed. [Gateway: %s]\n", tmp);
// Add a route // Add a route
e->Metric = e->OldIfMetric;
if (AddRouteEntryEx(e, &already_exists) == false) if (AddRouteEntryEx(e, &already_exists) == false)
{ {
FreeRouteEntry(e); FreeRouteEntry(e);
@@ -549,8 +567,6 @@ void RouteTrackingStart(SESSION *s)
else else
{ {
// Add a route // Add a route
dns->Metric = dns->OldIfMetric;
if (AddRouteEntry(dns) == false) if (AddRouteEntry(dns) == false)
{ {
FreeRouteEntry(dns); FreeRouteEntry(dns);
@@ -569,8 +585,6 @@ void RouteTrackingStart(SESSION *s)
if (route_to_real_server_global != NULL) if (route_to_real_server_global != NULL)
{ {
route_to_real_server_global->Metric = route_to_real_server_global->OldIfMetric;
if (AddRouteEntry(route_to_real_server_global) == false) if (AddRouteEntry(route_to_real_server_global) == false)
{ {
FreeRouteEntry(route_to_real_server_global); FreeRouteEntry(route_to_real_server_global);
@@ -633,11 +647,6 @@ void RouteTrackingStart(SESSION *s)
MsFreeAdapter(a); MsFreeAdapter(a);
} }
} }
else
{
// For Win9x
Win32RenewDhcp9x(if_id);
}
// Clear the DNS cache // Clear the DNS cache
Win32FlushDnsCache(); Win32FlushDnsCache();
@@ -782,12 +791,12 @@ void RouteTrackingStop(SESSION *s, ROUTE_TRACKING *t)
// If the restoring routing entry is a default gateway and // If the restoring routing entry is a default gateway and
// the existing routing table contains another default gateway // the existing routing table contains another default gateway
// on the interface, give up restoring the entry // on the interface, give up restoring the entry
if (IPToUINT(&e->DestIP) == 0 && IPToUINT(&e->DestMask) == 0) if (IsZeroIP(&e->DestIP) && IsZeroIP(&e->DestMask))
{ {
for (i = 0;i < table->NumEntry;i++) for (i = 0;i < table->NumEntry;i++)
{ {
ROUTE_ENTRY *r = table->Entry[i]; ROUTE_ENTRY *r = table->Entry[i];
if (IPToUINT(&r->DestIP) == 0 && IPToUINT(&r->DestMask) == 0) if (IsZeroIP(&r->DestIP) && IsZeroIP(&r->DestMask))
{ {
if (r->InterfaceID == e->InterfaceID) if (r->InterfaceID == e->InterfaceID)
{ {
+1 -1
View File
@@ -4214,7 +4214,7 @@ bool NatTransactUdp(VH *v, NAT_ENTRY *n)
// Try to send data to the UDP socket // Try to send data to the UDP socket
while (block = GetNext(n->UdpSendQueue)) while (block = GetNext(n->UdpSendQueue))
{ {
UINT send_size; UINT send_size = 0;
bool is_nbtdgm = false; bool is_nbtdgm = false;
LIST *local_ip_list = NULL; LIST *local_ip_list = NULL;
+65 -8
View File
@@ -35,6 +35,9 @@
#include <shellapi.h> #include <shellapi.h>
#include <shlobj.h> #include <shlobj.h>
#include <openssl/evp.h>
#include <openssl/ec.h>
// Process name list of incompatible anti-virus software // Process name list of incompatible anti-virus software
static BAD_PROCESS bad_processes[] = static BAD_PROCESS bad_processes[] =
{ {
@@ -900,7 +903,10 @@ void ShowWizard(HWND hWndParent, WIZARD *w, UINT start_id)
h.phpage = (HPROPSHEETPAGE *)pages_array; h.phpage = (HPROPSHEETPAGE *)pages_array;
h.pszbmHeader = MAKEINTRESOURCEW(w->Bitmap); h.pszbmHeader = MAKEINTRESOURCEW(w->Bitmap);
h.pszCaption = w->Caption; h.pszCaption = w->Caption;
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
h.pfnCallback = WizardDlgProc; h.pfnCallback = WizardDlgProc;
#pragma clang diagnostic pop
start_page = GetWizardPage(w, start_id); start_page = GetWizardPage(w, start_id);
if (start_page != NULL) if (start_page != NULL)
@@ -1326,7 +1332,7 @@ void WinConnectDlgThread(THREAD *thread, void *param)
nat_t_svc_name = d->nat_t_svc_name; nat_t_svc_name = d->nat_t_svc_name;
} }
s = ConnectEx3(d->hostname, d->port, d->timeout, &d->cancel, nat_t_svc_name, &nat_t_error_code, d->try_start_ssl, false); s = ConnectEx5(d->hostname, d->port, d->timeout, &d->cancel, nat_t_svc_name, &nat_t_error_code, d->try_start_ssl, false, d->ssl_option, d->ssl_err, d->hint_str, NULL);
d->ret_sock = s; d->ret_sock = s;
d->nat_t_error_code = nat_t_error_code; d->nat_t_error_code = nat_t_error_code;
@@ -1395,6 +1401,10 @@ UINT WinConnectDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *
// TCP connection with showing the UI // TCP connection with showing the UI
SOCK *WinConnectEx3(HWND hWnd, char *server, UINT port, UINT timeout, UINT icon_id, wchar_t *caption, wchar_t *info, UINT *nat_t_error_code, char *nat_t_svc_name, bool try_start_ssl) SOCK *WinConnectEx3(HWND hWnd, char *server, UINT port, UINT timeout, UINT icon_id, wchar_t *caption, wchar_t *info, UINT *nat_t_error_code, char *nat_t_svc_name, bool try_start_ssl)
{
return WinConnectEx4(hWnd, server, port, timeout, icon_id, caption, info, nat_t_error_code, nat_t_svc_name, try_start_ssl, NULL, NULL, NULL);
}
SOCK *WinConnectEx4(HWND hWnd, char *server, UINT port, UINT timeout, UINT icon_id, wchar_t *caption, wchar_t *info, UINT *nat_t_error_code, char *nat_t_svc_name, bool try_start_ssl, SSL_VERIFY_OPTION *ssl_option, UINT *ssl_err, char *hint_str)
{ {
wchar_t tmp[MAX_SIZE]; wchar_t tmp[MAX_SIZE];
wchar_t tmp2[MAX_SIZE]; wchar_t tmp2[MAX_SIZE];
@@ -1437,6 +1447,9 @@ SOCK *WinConnectEx3(HWND hWnd, char *server, UINT port, UINT timeout, UINT icon_
d.timeout = timeout; d.timeout = timeout;
d.hostname = server; d.hostname = server;
d.port = port; d.port = port;
d.ssl_option = ssl_option;
d.ssl_err = ssl_err;
d.hint_str = hint_str;
StrCpy(d.nat_t_svc_name, sizeof(d.nat_t_svc_name), nat_t_svc_name); StrCpy(d.nat_t_svc_name, sizeof(d.nat_t_svc_name), nat_t_svc_name);
Dialog(hWnd, D_CONNECT, WinConnectDlgProc, &d); Dialog(hWnd, D_CONNECT, WinConnectDlgProc, &d);
@@ -3477,7 +3490,10 @@ HWND SearchWindow(wchar_t *caption)
p.caption = caption; p.caption = caption;
p.hWndFound = NULL; p.hWndFound = NULL;
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
EnumWindows(SearchWindowEnumProc, (LPARAM)&p); EnumWindows(SearchWindowEnumProc, (LPARAM)&p);
#pragma clang diagnostic pop
return p.hWndFound; return p.hWndFound;
} }
@@ -5566,17 +5582,58 @@ void PrintCertInfo(HWND hWnd, CERT_DLG *p)
GetDateTimeStrEx64(tmp, sizeof(tmp), SystemToLocal64(x->notAfter), NULL); GetDateTimeStrEx64(tmp, sizeof(tmp), SystemToLocal64(x->notAfter), NULL);
LvInsert(hWnd, L_CERTINFO, ICO_CERT, NULL, 2, _UU("CERT_NOT_AFTER"), tmp); LvInsert(hWnd, L_CERTINFO, ICO_CERT, NULL, 2, _UU("CERT_NOT_AFTER"), tmp);
// Number of bits
if (x->is_compatible_bit)
{
UniFormat(tmp, sizeof(tmp), _UU("CERT_BITS_FORMAT"), x->bits);
LvInsert(hWnd, L_CERTINFO, ICO_CERT, NULL, 2, _UU("CERT_BITS"), tmp);
}
// Public key // Public key
k = GetKFromX(x); k = GetKFromX(x);
if (k != NULL) if (k != NULL)
{ {
UINT type = EVP_PKEY_base_id(k->pkey);
switch (type)
{
case EVP_PKEY_RSA:
LvInsert(hWnd, L_CERTINFO, ICO_CERT, NULL, 2, _UU("CERT_KEY_ALGORITHM"), L"RSA");
UniFormat(tmp, sizeof(tmp), _UU("CERT_BITS_FORMAT"), x->bits);
LvInsert(hWnd, L_CERTINFO, ICO_CERT, NULL, 2, _UU("CERT_BITS"), tmp);
break;
case EVP_PKEY_EC:
LvInsert(hWnd, L_CERTINFO, ICO_CERT, NULL, 2, _UU("CERT_KEY_ALGORITHM"), L"ECDSA");
UniFormat(tmp, sizeof(tmp), _UU("CERT_BITS_FORMAT"), x->bits);
LvInsert(hWnd, L_CERTINFO, ICO_CERT, NULL, 2, _UU("CERT_BITS"), tmp);
# ifndef OPENSSL_NO_EC
EC_KEY *key = EVP_PKEY_get0_EC_KEY(k->pkey);
if (key == NULL)
{
break;
}
EC_GROUP *group = EC_KEY_get0_group(key);
if (group == NULL)
{
break;
}
int nid = EC_GROUP_get_curve_name(group);
if (nid == 0)
{
break;
}
if (StrToUni(tmp, sizeof(tmp), OBJ_nid2sn(nid)) > 0)
{
wchar_t *nname = CopyStrToUni(EC_curve_nid2nist(nid));
if (nname)
{
UniFormat(tmp, sizeof(tmp), L"%s (%s)", tmp, nname);
}
LvInsert(hWnd, L_CERTINFO, ICO_CERT, NULL, 2, _UU("CERT_KEY_PARAMETER"), tmp);
Free(nname);
}
# endif
break;
default:
break;
}
BUF *b = KToBuf(k, false, NULL); BUF *b = KToBuf(k, false, NULL);
s_tmp = CopyBinToStrEx(b->Buf, b->Size); s_tmp = CopyBinToStrEx(b->Buf, b->Size);
StrToUni(tmp, sizeof(tmp), s_tmp); StrToUni(tmp, sizeof(tmp), s_tmp);
+4
View File
@@ -331,6 +331,9 @@ typedef struct WINCONNECT_DLG_DATA
char nat_t_svc_name[MAX_SIZE]; char nat_t_svc_name[MAX_SIZE];
UINT nat_t_error_code; UINT nat_t_error_code;
bool try_start_ssl; bool try_start_ssl;
SSL_VERIFY_OPTION *ssl_option;
UINT *ssl_err;
char *hint_str;
} WINCONNECT_DLG_DATA; } WINCONNECT_DLG_DATA;
HBITMAP ResizeBitmap(HBITMAP hSrc, UINT src_x, UINT src_y, UINT dst_x, UINT dst_y); HBITMAP ResizeBitmap(HBITMAP hSrc, UINT src_x, UINT src_y, UINT dst_x, UINT dst_y);
@@ -694,6 +697,7 @@ HFONT GetMeiryoFontEx(UINT font_size);
HFONT GetMeiryoFontEx2(UINT font_size, bool bold); HFONT GetMeiryoFontEx2(UINT font_size, bool bold);
bool ShowWindowsNetworkConnectionDialog(); bool ShowWindowsNetworkConnectionDialog();
SOCK *WinConnectEx3(HWND hWnd, char *server, UINT port, UINT timeout, UINT icon_id, wchar_t *caption, wchar_t *info, UINT *nat_t_error_code, char *nat_t_svc_name, bool try_start_ssl); SOCK *WinConnectEx3(HWND hWnd, char *server, UINT port, UINT timeout, UINT icon_id, wchar_t *caption, wchar_t *info, UINT *nat_t_error_code, char *nat_t_svc_name, bool try_start_ssl);
SOCK *WinConnectEx4(HWND hWnd, char *server, UINT port, UINT timeout, UINT icon_id, wchar_t *caption, wchar_t *info, UINT *nat_t_error_code, char *nat_t_svc_name, bool try_start_ssl, SSL_VERIFY_OPTION *ssl_option, UINT *ssl_err, char *hint_str);
UINT WinConnectDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); UINT WinConnectDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param);
void WinConnectDlgThread(THREAD *thread, void *param); void WinConnectDlgThread(THREAD *thread, void *param);
void NicInfo(UI_NICINFO *info); void NicInfo(UI_NICINFO *info);
+36 -45
View File
@@ -11,6 +11,7 @@
#include "Protocol.h" #include "Protocol.h"
#include "Mayaqua/DNS.h" #include "Mayaqua/DNS.h"
#include "Mayaqua/Encoding.h"
#include "Mayaqua/Memory.h" #include "Mayaqua/Memory.h"
#include "Mayaqua/Microsoft.h" #include "Mayaqua/Microsoft.h"
#include "Mayaqua/Pack.h" #include "Mayaqua/Pack.h"
@@ -312,8 +313,16 @@ BUF *WpcDataEntryToBuf(WPC_ENTRY *e)
} }
data_size = e->Size + 4096; data_size = e->Size + 4096;
data = Malloc(data_size); data = ZeroMalloc(data_size);
size = DecodeSafe64(data, e->Data, e->Size);
if (e->Size >= 1)
{
size = DecodeSafe64(data, e->Data, e->Size);
}
else
{
size = 0;
}
b = NewBuf(); b = NewBuf();
WriteBuf(b, data, size); WriteBuf(b, data, size);
@@ -807,19 +816,14 @@ BUF *HttpRequestEx3(URL_DATA *data, INTERNET_SETTING *setting,
if (IsEmptyStr(setting->ProxyUsername) == false || IsEmptyStr(setting->ProxyPassword) == false) if (IsEmptyStr(setting->ProxyUsername) == false || IsEmptyStr(setting->ProxyPassword) == false)
{ {
char auth_tmp_str[MAX_SIZE], auth_b64_str[MAX_SIZE * 2]; char auth_str[MAX_SIZE * 2];
char basic_str[MAX_SIZE * 2]; Format(auth_str, sizeof(auth_str), "%s:%s", setting->ProxyUsername, setting->ProxyPassword);
// Generate the authentication string char *base64 = Base64FromBin(NULL, auth_str, StrLen(auth_str));
Format(auth_tmp_str, sizeof(auth_tmp_str), "%s:%s", Format(auth_str, sizeof(auth_str), "Basic %s", base64);
setting->ProxyUsername, setting->ProxyPassword); Free(base64);
// Base64 encode AddHttpValue(h, NewHttpValue("Proxy-Authorization", auth_str));
Zero(auth_b64_str, sizeof(auth_b64_str));
Encode64(auth_b64_str, auth_tmp_str);
Format(basic_str, sizeof(basic_str), "Basic %s", auth_b64_str);
AddHttpValue(h, NewHttpValue("Proxy-Authorization", basic_str));
} }
} }
@@ -1229,18 +1233,14 @@ bool ParseUrl(URL_DATA *data, char *str, bool is_post, char *referrer)
} }
// String replacement // String replacement
void Base64ToSafe64(char *str) void Base64ToSafe64(char *str, const UINT size)
{ {
UINT i, len; if (str == NULL || size == 0)
// Validate arguments
if (str == NULL)
{ {
return; return;
} }
len = StrLen(str); for (UINT i = 0; i < size; ++i)
for (i = 0;i < len;i++)
{ {
switch (str[i]) switch (str[i])
{ {
@@ -1258,18 +1258,14 @@ void Base64ToSafe64(char *str)
} }
} }
} }
void Safe64ToBase64(char *str) void Safe64ToBase64(char *str, const UINT size)
{ {
UINT i, len; if (str == NULL || size == 0)
// Validate arguments
if (str == NULL)
{ {
return; return;
} }
len = StrLen(str); for (UINT i = 0; i < size; ++i)
for (i = 0;i < len;i++)
{ {
switch (str[i]) switch (str[i])
{ {
@@ -1288,44 +1284,39 @@ void Safe64ToBase64(char *str)
} }
} }
// Decode from Safe64 // Decode from escaped Base64
UINT DecodeSafe64(void *dst, char *src, UINT src_strlen) UINT DecodeSafe64(void *dst, const char *src, UINT size)
{ {
char *tmp;
UINT ret;
if (dst == NULL || src == NULL) if (dst == NULL || src == NULL)
{ {
return 0; return 0;
} }
if (src_strlen == 0) if (size == 0)
{ {
src_strlen = StrLen(src); size = StrLen(src);
} }
tmp = Malloc(src_strlen + 1); char *tmp = Malloc(size + 1);
Copy(tmp, src, src_strlen); Copy(tmp, src, size);
tmp[src_strlen] = 0; tmp[size] = '\0';
Safe64ToBase64(tmp);
ret = B64_Decode(dst, tmp, src_strlen); Safe64ToBase64(tmp, size);
const UINT ret = Base64Decode(dst, tmp, size);
Free(tmp); Free(tmp);
return ret; return ret;
} }
// Encode to Safe64 // Encode to escaped Base64
void EncodeSafe64(char *dst, void *src, UINT src_size) void EncodeSafe64(char *dst, const void *src, const UINT size)
{ {
UINT size;
if (dst == NULL || src == NULL) if (dst == NULL || src == NULL)
{ {
return; return;
} }
size = B64_Encode(dst, src, src_size); const UINT ret = Base64Encode(dst, src, size);
dst[size] = 0;
Base64ToSafe64(dst); Base64ToSafe64(dst, ret);
} }
+6 -6
View File
@@ -32,7 +32,7 @@ struct WPC_CONNECT
UINT ProxyPort; // Proxy server port number UINT ProxyPort; // Proxy server port number
char ProxyUsername[MAX_USERNAME_LEN + 1]; // Proxy server user name char ProxyUsername[MAX_USERNAME_LEN + 1]; // Proxy server user name
char ProxyPassword[MAX_USERNAME_LEN + 1]; // Proxy server password char ProxyPassword[MAX_USERNAME_LEN + 1]; // Proxy server password
char CustomHttpHeader[HTTP_CUSTOM_HEADER_MAX_SIZE + 1]; // Custom HTTP header char CustomHttpHeader[HTTP_CUSTOM_HEADER_MAX_SIZE]; // Custom HTTP header
bool UseCompress; // Use of compression bool UseCompress; // Use of compression
bool DontCheckCert; // Do not check the certificate bool DontCheckCert; // Do not check the certificate
}; };
@@ -45,7 +45,7 @@ struct INTERNET_SETTING
UINT ProxyPort; // Proxy server port number UINT ProxyPort; // Proxy server port number
char ProxyUsername[MAX_USERNAME_LEN + 1]; // Proxy server user name char ProxyUsername[MAX_USERNAME_LEN + 1]; // Proxy server user name
char ProxyPassword[MAX_USERNAME_LEN + 1]; // Proxy server password char ProxyPassword[MAX_USERNAME_LEN + 1]; // Proxy server password
char CustomHttpHeader[HTTP_CUSTOM_HEADER_MAX_SIZE + 1]; // Custom HTTP header char CustomHttpHeader[HTTP_CUSTOM_HEADER_MAX_SIZE]; // Custom HTTP header
}; };
// URL // URL
@@ -84,10 +84,10 @@ struct WPC_PACKET
typedef bool (WPC_RECV_CALLBACK)(void *param, UINT total_size, UINT current_size, BUF *recv_buf); typedef bool (WPC_RECV_CALLBACK)(void *param, UINT total_size, UINT current_size, BUF *recv_buf);
// Function prototype // Function prototype
void EncodeSafe64(char *dst, void *src, UINT src_size); void Base64ToSafe64(char *str, const UINT size);
UINT DecodeSafe64(void *dst, char *src, UINT src_strlen); void Safe64ToBase64(char *str, const UINT size);
void Base64ToSafe64(char *str); UINT DecodeSafe64(void *dst, const char *src, UINT size);
void Safe64ToBase64(char *str); void EncodeSafe64(char *dst, const void *src, const UINT size);
bool ParseUrl(URL_DATA *data, char *str, bool is_post, char *referrer); bool ParseUrl(URL_DATA *data, char *str, bool is_post, char *referrer);
void CreateUrl(char *url, UINT url_size, URL_DATA *data); void CreateUrl(char *url, UINT url_size, URL_DATA *data);
void GetSystemInternetSetting(INTERNET_SETTING *setting); void GetSystemInternetSetting(INTERNET_SETTING *setting);
+35 -11
View File
@@ -1,5 +1,5 @@
file(GLOB SOURCES_MAYAQUA "*.c") file(GLOB SOURCES_MAYAQUA "*.c" "Crypto/*.c")
file(GLOB HEADERS_MAYAQUA "*.h") file(GLOB HEADERS_MAYAQUA "*.h" "Crypto/*.h")
if(WIN32) if(WIN32)
add_library(mayaqua STATIC ${SOURCES_MAYAQUA} ${HEADERS_MAYAQUA}) add_library(mayaqua STATIC ${SOURCES_MAYAQUA} ${HEADERS_MAYAQUA})
@@ -17,6 +17,29 @@ set_target_properties(mayaqua
) )
find_package(OpenSSL REQUIRED) find_package(OpenSSL REQUIRED)
include(CheckSymbolExists)
set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
set(CMAKE_REQUIRED_LIBRARIES OpenSSL::Crypto)
set(CMAKE_REQUIRED_LIBRARIES OpenSSL::SSL)
check_symbol_exists(EVP_PKEY_get_raw_public_key "openssl/evp.h" HAVE_EVP_PKEY_GET_RAW_PUBLIC_KEY)
check_symbol_exists(SSL_CTX_set_num_tickets "openssl/ssl.h" HAVE_SSL_CTX_SET_NUM_TICKETS)
unset(CMAKE_REQUIRED_INCLUDES)
unset(CMAKE_REQUIRED_LIBRARIES)
if(NOT HAVE_EVP_PKEY_GET_RAW_PUBLIC_KEY)
message(FATAL_ERROR "Required EVP_PKEY_get_raw_public_key() not found in OpenSSL library!")
endif()
if (HAVE_SSL_CTX_SET_NUM_TICKETS)
add_compile_definitions(HAVE_SSL_CTX_SET_NUM_TICKETS)
endif()
find_package(ZLIB REQUIRED) find_package(ZLIB REQUIRED)
# Required because we include <openssl/opensslv.h> in Encrypt.h. # Required because we include <openssl/opensslv.h> in Encrypt.h.
@@ -39,6 +62,7 @@ if(WIN32)
target_link_libraries(mayaqua target_link_libraries(mayaqua
PRIVATE PRIVATE
"crypt32.lib"
"DbgHelp.Lib" "DbgHelp.Lib"
"dwmapi.lib" "dwmapi.lib"
"iphlpapi.lib" "iphlpapi.lib"
@@ -47,6 +71,7 @@ if(WIN32)
"Secur32.Lib" "Secur32.Lib"
"setupapi.lib" "setupapi.lib"
"winmm.lib" "winmm.lib"
"ws2_32.lib"
"WtsApi32.Lib" "WtsApi32.Lib"
) )
endif() endif()
@@ -57,9 +82,16 @@ if(UNIX)
# In some cases libiconv is not included in libc # In some cases libiconv is not included in libc
find_library(LIB_ICONV iconv) find_library(LIB_ICONV iconv)
find_library(LIB_M m)
find_library(LIB_RT rt) find_library(LIB_RT rt)
target_link_libraries(mayaqua PRIVATE Threads::Threads) target_link_libraries(mayaqua
PRIVATE
Threads::Threads
$<$<BOOL:${LIB_ICONV}>:${LIB_ICONV}>
$<$<BOOL:${LIB_M}>:${LIB_M}>
$<$<BOOL:${LIB_RT}>:${LIB_RT}>
)
if (CMAKE_SYSTEM_PROCESSOR MATCHES "^(armv7l|aarch64|s390x)$" OR NOT HAVE_SYS_AUXV OR SKIP_CPU_FEATURES) if (CMAKE_SYSTEM_PROCESSOR MATCHES "^(armv7l|aarch64|s390x)$" OR NOT HAVE_SYS_AUXV OR SKIP_CPU_FEATURES)
add_definitions(-DSKIP_CPU_FEATURES) add_definitions(-DSKIP_CPU_FEATURES)
@@ -69,14 +101,6 @@ if(UNIX)
target_link_libraries(mayaqua PRIVATE cpu_features) target_link_libraries(mayaqua PRIVATE cpu_features)
endif() endif()
if(LIB_RT)
target_link_libraries(mayaqua PRIVATE rt)
endif()
if(LIB_ICONV)
target_link_libraries(mayaqua PRIVATE ${LIB_ICONV})
endif()
if(${CMAKE_SYSTEM_NAME} STREQUAL "SunOS") if(${CMAKE_SYSTEM_NAME} STREQUAL "SunOS")
target_link_libraries(mayaqua PRIVATE nsl socket) target_link_libraries(mayaqua PRIVATE nsl socket)
endif() endif()
+14 -9
View File
@@ -7,6 +7,7 @@
#include "Cfg.h" #include "Cfg.h"
#include "Encoding.h"
#include "FileIO.h" #include "FileIO.h"
#include "Internat.h" #include "Internat.h"
#include "Memory.h" #include "Memory.h"
@@ -746,12 +747,18 @@ bool CfgReadNextTextBUF(BUF *b, FOLDER *current)
if (!StrCmpi(token->Token[0], TAG_BYTE)) if (!StrCmpi(token->Token[0], TAG_BYTE))
{ {
// byte // byte
char *unescaped_b64 = CfgUnescape(data); char *base64 = CfgUnescape(data);
void *tmp = Malloc(StrLen(unescaped_b64) * 4 + 64); const UINT base64_size = StrLen(base64);
int size = B64_Decode(tmp, unescaped_b64, StrLen(unescaped_b64));
CfgAddByte(current, name, tmp, size); UINT bin_size;
Free(tmp); void *bin = Base64ToBin(&bin_size, base64, base64_size);
Free(unescaped_b64); if (bin != NULL)
{
CfgAddByte(current, name, bin, bin_size);
Free(bin);
}
Free(base64);
} }
Free(name); Free(name);
@@ -1162,9 +1169,7 @@ void CfgAddItemText(BUF *b, ITEM *t, UINT depth)
break; break;
case ITEM_TYPE_BYTE: case ITEM_TYPE_BYTE:
data = ZeroMalloc(t->size * 4 + 32); data = Base64FromBin(NULL, t->Buf, t->size);
len = B64_Encode(data, t->Buf, t->size);
data[len] = 0;
break; break;
case ITEM_TYPE_STRING: case ITEM_TYPE_STRING:
+225
View File
@@ -0,0 +1,225 @@
#include "Key.h"
#include "Encrypt.h"
#include "Memory.h"
#include "Str.h"
#include <openssl/evp.h>
static int CryptoKeyTypeToID(const CRYPTO_KEY_TYPE type)
{
switch (type)
{
case KEY_UNKNOWN:
break;
case KEY_X25519:
return EVP_PKEY_X25519;
#if defined(EVP_PKEY_X448)
case KEY_X448:
return EVP_PKEY_X448;
#endif
default:
Debug("CryptoKeyTypeToID(): Unhandled type %u!\n", type);
}
return EVP_PKEY_NONE;
}
UINT CryptoKeyTypeSize(const CRYPTO_KEY_TYPE type)
{
switch (type)
{
case KEY_UNKNOWN:
break;
case KEY_X25519:
return KEY_X25519_SIZE;
case KEY_X448:
return KEY_X448_SIZE;
default:
Debug("CryptoKeyTypeSize(): Unhandled type %u!\n", type);
}
return 0;
}
CRYPTO_KEY_RAW *CryptoKeyRawNew(const void *data, const UINT size, const CRYPTO_KEY_TYPE type)
{
if (size == 0 || size != CryptoKeyTypeSize(type))
{
return NULL;
}
CRYPTO_KEY_RAW *key = Malloc(sizeof(CRYPTO_KEY_RAW));
key->Data = MallocEx(size, true);
key->Size = size;
key->Type = type;
if (data == NULL)
{
Rand(key->Data, key->Size);
}
else
{
Copy(key->Data, data, key->Size);
}
return key;
}
void CryptoKeyRawFree(CRYPTO_KEY_RAW *key)
{
if (key == NULL)
{
return;
}
Free(key->Data);
Free(key);
}
CRYPTO_KEY_RAW *CryptoKeyRawPublic(const CRYPTO_KEY_RAW *private)
{
if (private == NULL)
{
return NULL;
}
void *opaque = CryptoKeyRawToOpaque(private, false);
if (opaque == NULL)
{
return NULL;
}
CRYPTO_KEY_RAW *public = NULL;
CryptoKeyOpaqueToRaw(opaque, NULL, &public);
CryptoKeyOpaqueFree(opaque);
return public;
}
void *CryptoKeyRawToOpaque(const CRYPTO_KEY_RAW *key, const bool public)
{
if (key == NULL)
{
return NULL;
}
const int id = CryptoKeyTypeToID(key->Type);
if (public)
{
return EVP_PKEY_new_raw_public_key(id, NULL, key->Data, key->Size);
}
else
{
return EVP_PKEY_new_raw_private_key(id, NULL, key->Data, key->Size);
}
}
void *CryptoKeyOpaqueNew(const CRYPTO_KEY_TYPE type)
{
EVP_PKEY_CTX *ctx = EVP_PKEY_CTX_new_id(CryptoKeyTypeToID(type), NULL);
if (ctx == NULL)
{
Debug("CryptoKeyOpaqueNew(): EVP_PKEY_CTX_new_id() returned NULL!\n");
return false;
}
EVP_PKEY *key = NULL;
int ret = EVP_PKEY_keygen_init(ctx);
if (ret != 1)
{
Debug("CryptoKeyOpaqueNew(): EVP_PKEY_keygen_init() returned %d!\n", ret);
goto FINAL;
}
ret = EVP_PKEY_keygen(ctx, &key);
if (ret != 1)
{
Debug("CryptoKeyOpaqueNew(): EVP_PKEY_keygen() returned %d!\n", ret);
}
FINAL:
EVP_PKEY_CTX_free(ctx);
return key;
}
void CryptoKeyOpaqueFree(void *key)
{
if (key != NULL)
{
EVP_PKEY_free(key);
}
}
bool CryptoKeyOpaqueToRaw(const void *opaque, CRYPTO_KEY_RAW **private, CRYPTO_KEY_RAW **public)
{
if (opaque == NULL || (private == NULL && public == NULL))
{
return false;
}
CRYPTO_KEY_TYPE type;
switch (EVP_PKEY_id(opaque))
{
case EVP_PKEY_X25519:
type = KEY_X25519;
break;
#if defined(EVP_PKEY_X448)
case EVP_PKEY_X448:
type = KEY_X448;
break;
#endif
default:
return false;
}
if (private != NULL)
{
size_t size;
int ret = EVP_PKEY_get_raw_private_key(opaque, NULL, &size);
if (ret != 1)
{
Debug("CryptoKeyOpaqueToRaw(): #1 EVP_PKEY_get_raw_private_key() returned %d!\n", ret);
return false;
}
CRYPTO_KEY_RAW *key = CryptoKeyRawNew(NULL, size, type);
ret = EVP_PKEY_get_raw_private_key(opaque, key->Data, &size);
if (ret != 1)
{
Debug("CryptoKeyOpaqueToRaw(): #2 EVP_PKEY_get_raw_private_key() returned %d!\n", ret);
CryptoKeyRawFree(key);
return false;
}
*private = key;
}
if (public != NULL)
{
size_t size;
int ret = EVP_PKEY_get_raw_public_key(opaque, NULL, &size);
if (ret != 1)
{
Debug("CryptoKeyOpaqueToRaw(): #1 EVP_PKEY_get_raw_public_key() returned %d!\n", ret);
return false;
}
CRYPTO_KEY_RAW *key = CryptoKeyRawNew(NULL, size, type);
ret = EVP_PKEY_get_raw_public_key(opaque, key->Data, &size);
if (ret != 1)
{
Debug("CryptoKeyOpaqueToRaw(): #2 EVP_PKEY_get_raw_public_key() returned %d!\n", ret);
CryptoKeyRawFree(key);
return false;
}
*public = key;
}
return true;
}
+36
View File
@@ -0,0 +1,36 @@
#ifndef CRYPTO_KEY_H
#define CRYPTO_KEY_H
#include "MayaType.h"
#define KEY_X25519_SIZE 32
#define KEY_X448_SIZE 56
enum CRYPTO_KEY_TYPE
{
KEY_UNKNOWN,
KEY_X25519,
KEY_X448
};
struct CRYPTO_KEY_RAW
{
BYTE *Data;
UINT Size;
CRYPTO_KEY_TYPE Type;
};
UINT CryptoKeyTypeSize(const CRYPTO_KEY_TYPE type);
CRYPTO_KEY_RAW *CryptoKeyRawNew(const void *data, const UINT size, const CRYPTO_KEY_TYPE type);
void CryptoKeyRawFree(CRYPTO_KEY_RAW *key);
CRYPTO_KEY_RAW *CryptoKeyRawPublic(const CRYPTO_KEY_RAW *private);
void *CryptoKeyRawToOpaque(const CRYPTO_KEY_RAW *key, const bool public);
void *CryptoKeyOpaqueNew(const CRYPTO_KEY_TYPE type);
void CryptoKeyOpaqueFree(void *key);
bool CryptoKeyOpaqueToRaw(const void *opaque, CRYPTO_KEY_RAW **private, CRYPTO_KEY_RAW **public);
#endif
+8
View File
@@ -0,0 +1,8 @@
#ifndef CRYPTO_TYPES_H
#define CRYPTO_TYPES_H
typedef enum CRYPTO_KEY_TYPE CRYPTO_KEY_TYPE;
typedef struct CRYPTO_KEY_RAW CRYPTO_KEY_RAW;
#endif
+204 -56
View File
@@ -75,6 +75,8 @@ void DnsFree()
{ {
DNS_CACHE *entry = LIST_DATA(cache, i); DNS_CACHE *entry = LIST_DATA(cache, i);
Free((void *)entry->Hostname); Free((void *)entry->Hostname);
FreeHostIPAddressList(entry->IPList_v6);
FreeHostIPAddressList(entry->IPList_v4);
Free(entry); Free(entry);
} }
} }
@@ -153,6 +155,35 @@ DNS_CACHE *DnsCacheUpdate(const char *hostname, const IP *ipv6, const IP *ipv4)
return NULL; return NULL;
} }
LIST *iplist_v6 = NULL;
LIST *iplist_v4 = NULL;
if (ipv6 != NULL)
{
iplist_v6 = NewListFast(NULL);
AddHostIPAddressToList(iplist_v6, ipv6);
}
if (ipv4 != NULL)
{
iplist_v4 = NewListFast(NULL);
AddHostIPAddressToList(iplist_v4, ipv4);
}
DNS_CACHE *ret = DnsCacheUpdateEx(hostname, iplist_v6, iplist_v4);
FreeHostIPAddressList(iplist_v6);
FreeHostIPAddressList(iplist_v4);
return ret;
}
DNS_CACHE *DnsCacheUpdateEx(const char *hostname, const LIST *iplist_v6, const LIST *iplist_v4)
{
if (DnsCacheIsEnabled() == false || IsEmptyStr(hostname))
{
return NULL;
}
DNS_CACHE *entry; DNS_CACHE *entry;
LockList(cache); LockList(cache);
@@ -161,11 +192,14 @@ DNS_CACHE *DnsCacheUpdate(const char *hostname, const IP *ipv6, const IP *ipv4)
t.Hostname = hostname; t.Hostname = hostname;
entry = Search(cache, &t); entry = Search(cache, &t);
if (ipv6 == NULL && ipv4 == NULL) if (iplist_v6 == NULL && iplist_v4 == NULL)
{ {
if (entry != NULL) if (entry != NULL)
{ {
Delete(cache, entry); Delete(cache, entry);
Free((void *)entry->Hostname);
FreeHostIPAddressList(entry->IPList_v6);
FreeHostIPAddressList(entry->IPList_v4);
Free(entry); Free(entry);
entry = NULL; entry = NULL;
} }
@@ -182,19 +216,25 @@ DNS_CACHE *DnsCacheUpdate(const char *hostname, const IP *ipv6, const IP *ipv4)
entry->Expiration = Tick64(); entry->Expiration = Tick64();
if (ipv6 != NULL) FreeHostIPAddressList(entry->IPList_v6);
FreeHostIPAddressList(entry->IPList_v4);
if (iplist_v6 != NULL)
{ {
if (CmpIpAddr(&entry->IPv6, ipv6) != 0) entry->IPList_v6 = CloneIPAddressList(iplist_v6);
{
Copy(&entry->IPv6, ipv6, sizeof(entry->IPv6));
}
} }
else else
{ {
if (CmpIpAddr(&entry->IPv4, ipv4) != 0) entry->IPList_v6 = NULL;
{ }
Copy(&entry->IPv4, ipv4, sizeof(entry->IPv4));
} if (iplist_v4 != NULL)
{
entry->IPList_v4 = CloneIPAddressList(iplist_v4);
}
else
{
entry->IPList_v4 = NULL;
} }
} }
} }
@@ -225,7 +265,7 @@ DNS_CACHE_REVERSE *DnsCacheReverseFind(const IP *ip)
DNS_CACHE_REVERSE *DnsCacheReverseUpdate(const IP *ip, const char *hostname) DNS_CACHE_REVERSE *DnsCacheReverseUpdate(const IP *ip, const char *hostname)
{ {
if (DnsCacheIsEnabled() == false || IsZeroIP(&ip)) if (DnsCacheIsEnabled() == false || IsZeroIP(ip))
{ {
return NULL; return NULL;
} }
@@ -278,10 +318,52 @@ bool DnsResolve(IP *ipv6, IP *ipv4, const char *hostname, UINT timeout, volatile
return false; return false;
} }
LIST *iplist_v6 = NULL;
LIST *iplist_v4 = NULL;
bool ret = DnsResolveEx(&iplist_v6, &iplist_v4, hostname, timeout, cancel_flag);
if (ipv6 != NULL && LIST_NUM(iplist_v6) > 0)
{
IP *ip = LIST_DATA(iplist_v6, 0);
Copy(ipv6, ip, sizeof(IP));
}
else
{
Zero(ipv6, sizeof(IP));
}
if (ipv4 != NULL && LIST_NUM(iplist_v4) > 0)
{
IP *ip = LIST_DATA(iplist_v4, 0);
Copy(ipv4, ip, sizeof(IP));
}
else
{
ZeroIP4(ipv4);
}
FreeHostIPAddressList(iplist_v6);
FreeHostIPAddressList(iplist_v4);
return ret;
}
bool DnsResolveEx(LIST **iplist_v6, LIST **iplist_v4, const char *hostname, UINT timeout, volatile const bool *cancel_flag)
{
if (iplist_v6 == NULL || iplist_v4 == NULL || IsEmptyStr(hostname))
{
return false;
}
if (StrCmpi(hostname, "localhost") == 0) if (StrCmpi(hostname, "localhost") == 0)
{ {
GetLocalHostIP6(ipv6); IP ipv6, ipv4;
GetLocalHostIP4(ipv4); GetLocalHostIP6(&ipv6);
GetLocalHostIP4(&ipv4);
*iplist_v6 = NewListFast(NULL);
*iplist_v4 = NewListFast(NULL);
AddHostIPAddressToList(*iplist_v6, &ipv6);
AddHostIPAddressToList(*iplist_v4, &ipv4);
return true; return true;
} }
@@ -290,21 +372,15 @@ bool DnsResolve(IP *ipv6, IP *ipv4, const char *hostname, UINT timeout, volatile
{ {
if (IsIP6(&ip)) if (IsIP6(&ip))
{ {
if (ipv6 != NULL) *iplist_v6 = NewListFast(NULL);
{ AddHostIPAddressToList(*iplist_v6, &ip);
ZeroIP4(ipv4); return true;
Copy(ipv6, &ip, sizeof(IP));
return true;
}
} }
else else
{ {
if (ipv4 != NULL) *iplist_v4 = NewListFast(NULL);
{ AddHostIPAddressToList(*iplist_v4, &ip);
Zero(ipv6, sizeof(IP)); return true;
Copy(ipv4, &ip, sizeof(IP));
return true;
}
} }
return false; return false;
@@ -330,12 +406,14 @@ bool DnsResolve(IP *ipv6, IP *ipv4, const char *hostname, UINT timeout, volatile
Inc(threads_counter); Inc(threads_counter);
DNS_RESOLVER resolver; DNS_RESOLVER *resolver;
Zero(&resolver, sizeof(resolver)); resolver = ZeroMalloc(sizeof(DNS_RESOLVER));
ZeroIP4(&resolver.IPv4); resolver->Ref = NewRef();
resolver.Hostname = hostname; resolver->IPList_v6 = NewListFast(NULL);
resolver->IPList_v4 = NewListFast(NULL);
resolver->Hostname = CopyStr(hostname);
THREAD *worker = NewThread(DnsResolver, &resolver); THREAD *worker = NewThread(DnsResolver, resolver);
WaitThreadInit(worker); WaitThreadInit(worker);
if (cancel_flag == NULL) if (cancel_flag == NULL)
@@ -366,15 +444,20 @@ bool DnsResolve(IP *ipv6, IP *ipv4, const char *hostname, UINT timeout, volatile
Dec(threads_counter); Dec(threads_counter);
if (resolver.OK) if (resolver->OK)
{ {
Copy(ipv6, &resolver.IPv6, sizeof(IP)); *iplist_v6 = resolver->IPList_v6;
Copy(ipv4, &resolver.IPv4, sizeof(IP)); *iplist_v4 = resolver->IPList_v4;
resolver->IPList_v6 = NULL;
DnsCacheUpdate(hostname, ipv6, ipv4); resolver->IPList_v4 = NULL;
DnsCacheUpdateEx(hostname, *iplist_v6, *iplist_v4);
ReleaseDnsResolver(resolver);
return true; return true;
} }
ReleaseDnsResolver(resolver);
CACHE: CACHE:
Debug("DnsResolve(): Could not resolve \"%s\". Searching for it in the cache...\n", hostname); Debug("DnsResolve(): Could not resolve \"%s\". Searching for it in the cache...\n", hostname);
@@ -384,8 +467,8 @@ CACHE:
return false; return false;
} }
Copy(ipv6, &cached->IPv6, sizeof(IP)); *iplist_v6 = CloneIPAddressList(cached->IPList_v6);
Copy(ipv4, &cached->IPv4, sizeof(IP)); *iplist_v4 = CloneIPAddressList(cached->IPList_v4);
return true; return true;
} }
@@ -399,14 +482,23 @@ void DnsResolver(THREAD *t, void *param)
DNS_RESOLVER *resolver = param; DNS_RESOLVER *resolver = param;
AddRef(resolver->Ref);
NoticeThreadInit(t); NoticeThreadInit(t);
AddWaitThread(t); AddWaitThread(t);
struct addrinfo hints; struct addrinfo hints;
Zero(&hints, sizeof(hints)); Zero(&hints, sizeof(hints));
hints.ai_family = AF_INET6; if (HasIPv6Address())
hints.ai_flags = AI_ALL | AI_ADDRCONFIG | AI_V4MAPPED; {
hints.ai_family = AF_INET6;
hints.ai_flags = AI_ALL | AI_ADDRCONFIG | AI_V4MAPPED;
}
else
{
hints.ai_family = AF_INET;
}
struct addrinfo *results; struct addrinfo *results;
const int ret = getaddrinfo(resolver->Hostname, NULL, &hints, &results); const int ret = getaddrinfo(resolver->Hostname, NULL, &hints, &results);
@@ -417,18 +509,31 @@ void DnsResolver(THREAD *t, void *param)
for (struct addrinfo *result = results; result != NULL; result = result->ai_next) for (struct addrinfo *result = results; result != NULL; result = result->ai_next)
{ {
IP ip; IP ip;
const struct sockaddr_in6 *in = (struct sockaddr_in6 *)result->ai_addr; if (hints.ai_family == AF_INET6)
InAddrToIP6(&ip, &in->sin6_addr);
if (IsIP6(&ip) && ipv6_ok == false)
{ {
Copy(&resolver->IPv6, &ip, sizeof(resolver->IPv6)); const struct sockaddr_in6 *in = (struct sockaddr_in6 *)result->ai_addr;
resolver->IPv6.ipv6_scope_id = in->sin6_scope_id; InAddrToIP6(&ip, &in->sin6_addr);
ipv6_ok = true; if (IsIP6(&ip))
{
ip.ipv6_scope_id = in->sin6_scope_id;
AddHostIPAddressToList(resolver->IPList_v6, &ip);
ipv6_ok = true;
}
else if (IsIP4(&ip))
{
AddHostIPAddressToList(resolver->IPList_v4, &ip);
ipv4_ok = true;
}
} }
else if (ipv4_ok == false) else
{ {
Copy(&resolver->IPv4, &ip, sizeof(resolver->IPv4)); const struct sockaddr_in *in = (struct sockaddr_in *)result->ai_addr;
ipv4_ok = true; InAddrToIP(&ip, &in->sin_addr);
if (IsIP4(&ip))
{
AddHostIPAddressToList(resolver->IPList_v4, &ip);
ipv4_ok = true;
}
} }
} }
@@ -441,6 +546,8 @@ void DnsResolver(THREAD *t, void *param)
Debug("DnsResolver(): getaddrinfo() failed with error %d!\n", ret); Debug("DnsResolver(): getaddrinfo() failed with error %d!\n", ret);
} }
ReleaseDnsResolver(resolver);
DelWaitThread(t); DelWaitThread(t);
} }
@@ -471,11 +578,12 @@ bool DnsResolveReverse(char *dst, const UINT size, const IP *ip, UINT timeout, v
Inc(threads_counter); Inc(threads_counter);
DNS_RESOLVER_REVERSE resolver; DNS_RESOLVER_REVERSE *resolver;
Zero(&resolver, sizeof(resolver)); resolver = ZeroMalloc(sizeof(DNS_RESOLVER_REVERSE));
Copy(&resolver.IP, ip, sizeof(resolver.IP)); resolver->Ref = NewRef();
Copy(&resolver->IP, ip, sizeof(resolver->IP));
THREAD *worker = NewThread(DnsResolverReverse, &resolver); THREAD *worker = NewThread(DnsResolverReverse, resolver);
WaitThreadInit(worker); WaitThreadInit(worker);
if (cancel_flag == NULL) if (cancel_flag == NULL)
@@ -506,15 +614,17 @@ bool DnsResolveReverse(char *dst, const UINT size, const IP *ip, UINT timeout, v
Dec(threads_counter); Dec(threads_counter);
if (resolver.OK) if (resolver->OK)
{ {
StrCpy(dst, size, resolver.Hostname); StrCpy(dst, size, resolver->Hostname);
Free(resolver.Hostname);
DnsCacheReverseUpdate(ip, dst); DnsCacheReverseUpdate(ip, dst);
ReleaseDnsResolverReverse(resolver);
return true; return true;
} }
ReleaseDnsResolverReverse(resolver);
CACHE: CACHE:
Debug("DnsResolveReverse(): Could not resolve \"%r\". Searching for it in the cache...\n", ip); Debug("DnsResolveReverse(): Could not resolve \"%r\". Searching for it in the cache...\n", ip);
@@ -538,6 +648,8 @@ void DnsResolverReverse(THREAD *t, void *param)
DNS_RESOLVER_REVERSE *resolver = param; DNS_RESOLVER_REVERSE *resolver = param;
AddRef(resolver->Ref);
NoticeThreadInit(t); NoticeThreadInit(t);
AddWaitThread(t); AddWaitThread(t);
@@ -558,6 +670,8 @@ void DnsResolverReverse(THREAD *t, void *param)
Debug("DnsResolverReverse(): getnameinfo() failed with error %d!\n", ret); Debug("DnsResolverReverse(): getnameinfo() failed with error %d!\n", ret);
} }
ReleaseDnsResolverReverse(resolver);
DelWaitThread(t); DelWaitThread(t);
} }
@@ -587,3 +701,37 @@ bool GetIPEx(IP *ip, const char *hostname, UINT timeout, volatile const bool *ca
return false; return false;
} }
// Release of the parameters of the DNS Resolver thread
void ReleaseDnsResolver(DNS_RESOLVER *p)
{
// Validate arguments
if (p == NULL)
{
return;
}
if (Release(p->Ref) == 0)
{
FreeHostIPAddressList(p->IPList_v6);
FreeHostIPAddressList(p->IPList_v4);
Free(p->Hostname);
Free(p);
}
}
// Release of the parameters of the DNS Resolver Reverse thread
void ReleaseDnsResolverReverse(DNS_RESOLVER_REVERSE *p)
{
// Validate arguments
if (p == NULL)
{
return;
}
if (Release(p->Ref) == 0)
{
Free(p->Hostname);
Free(p);
}
}
+11 -4
View File
@@ -24,8 +24,8 @@
struct DNS_CACHE struct DNS_CACHE
{ {
const char *Hostname; const char *Hostname;
IP IPv4; LIST *IPList_v4;
IP IPv6; LIST *IPList_v6;
UINT64 Expiration; UINT64 Expiration;
}; };
@@ -38,14 +38,16 @@ struct DNS_CACHE_REVERSE
struct DNS_RESOLVER struct DNS_RESOLVER
{ {
REF *Ref;
const char *Hostname; const char *Hostname;
IP IPv4; LIST *IPList_v4;
IP IPv6; LIST *IPList_v6;
bool OK; bool OK;
}; };
struct DNS_RESOLVER_REVERSE struct DNS_RESOLVER_REVERSE
{ {
REF *Ref;
IP IP; IP IP;
char *Hostname; char *Hostname;
bool OK; bool OK;
@@ -63,11 +65,13 @@ void DnsCacheToggle(const bool enabled);
DNS_CACHE *DnsCacheFind(const char *hostname); DNS_CACHE *DnsCacheFind(const char *hostname);
DNS_CACHE *DnsCacheUpdate(const char *hostname, const IP *ipv6, const IP *ipv4); DNS_CACHE *DnsCacheUpdate(const char *hostname, const IP *ipv6, const IP *ipv4);
DNS_CACHE *DnsCacheUpdateEx(const char *hostname, const LIST *iplist_v6, const LIST *iplist_v4);
DNS_CACHE_REVERSE *DnsCacheReverseFind(const IP *ip); DNS_CACHE_REVERSE *DnsCacheReverseFind(const IP *ip);
DNS_CACHE_REVERSE *DnsCacheReverseUpdate(const IP *ip, const char *hostname); DNS_CACHE_REVERSE *DnsCacheReverseUpdate(const IP *ip, const char *hostname);
bool DnsResolve(IP *ipv6, IP *ipv4, const char *hostname, UINT timeout, volatile const bool *cancel_flag); bool DnsResolve(IP *ipv6, IP *ipv4, const char *hostname, UINT timeout, volatile const bool *cancel_flag);
bool DnsResolveEx(LIST **iplist_v6, LIST **iplist_v4, const char *hostname, UINT timeout, volatile const bool *cancel_flag);
void DnsResolver(THREAD *t, void *param); void DnsResolver(THREAD *t, void *param);
bool DnsResolveReverse(char *dst, const UINT size, const IP *ip, UINT timeout, volatile const bool *cancel_flag); bool DnsResolveReverse(char *dst, const UINT size, const IP *ip, UINT timeout, volatile const bool *cancel_flag);
@@ -75,4 +79,7 @@ void DnsResolverReverse(THREAD *t, void *param);
bool GetIPEx(IP *ip, const char *hostname, UINT timeout, volatile const bool *cancel_flag); bool GetIPEx(IP *ip, const char *hostname, UINT timeout, volatile const bool *cancel_flag);
void ReleaseDnsResolver(DNS_RESOLVER *p);
void ReleaseDnsResolverReverse(DNS_RESOLVER_REVERSE *p);
#endif #endif
+64
View File
@@ -0,0 +1,64 @@
#include "Encoding.h"
#include <math.h>
#include <openssl/evp.h>
UINT Base64Decode(void *dst, const void *src, const UINT size)
{
if (dst == NULL)
{
// 4 input bytes = max. 3 output bytes.
//
// EVP_DecodeUpdate() ignores:
// - Leading/trailing whitespace.
// - Trailing newlines, carriage returns or EOF characters.
//
// EVP_DecodeFinal() fails if the input is not divisible by 4.
return size / 4 * 3;
}
// We don't use EVP_DecodeBlock() because it adds padding if the output is not divisible by 3.
EVP_ENCODE_CTX *ctx = EVP_ENCODE_CTX_new();
if (ctx == NULL)
{
return 0;
}
int ret = 0;
if (EVP_DecodeUpdate(ctx, dst, &ret, src, size) < 0)
{
goto FINAL;
}
int dummy;
if (EVP_DecodeFinal(ctx, dst, &dummy) < 0)
{
ret = 0;
}
FINAL:
EVP_ENCODE_CTX_free(ctx);
return ret;
}
UINT Base64Encode(void *dst, const void *src, const UINT size)
{
if (dst == NULL)
{
// 3 input bytes = 4 output bytes.
// +1 for the NUL terminator.
//
// EVP_EncodeBlock() adds padding when the input is not divisible by 3.
return ceilf((float)size / 3) * 4 + 1;
}
const int ret = EVP_EncodeBlock(dst, src, size);
if (ret > 0)
{
// EVP_EncodeBlock() returns the length of the string without the NUL terminator.
// We, instead, want to return the amount of bytes written into the output buffer.
return ret + 1;
}
return 0;
}
+9
View File
@@ -0,0 +1,9 @@
#ifndef ENCODING_H
#define ENCODING_H
#include "MayaType.h"
UINT Base64Decode(void *dst, const void *src, const UINT size);
UINT Base64Encode(void *dst, const void *src, const UINT size);
#endif
+204 -4
View File
@@ -38,6 +38,9 @@
#include <openssl/pem.h> #include <openssl/pem.h>
#include <openssl/conf.h> #include <openssl/conf.h>
#include <openssl/x509v3.h> #include <openssl/x509v3.h>
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
#include <openssl/provider.h>
#endif
#ifdef _MSC_VER #ifdef _MSC_VER
#include <intrin.h> // For __cpuid() #include <intrin.h> // For __cpuid()
@@ -82,6 +85,11 @@ LOCK *openssl_lock = NULL;
int ssl_clientcert_index = 0; int ssl_clientcert_index = 0;
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
static OSSL_PROVIDER *ossl_provider_legacy = NULL;
static OSSL_PROVIDER *ossl_provider_default = NULL;
#endif
LOCK **ssl_lock_obj = NULL; LOCK **ssl_lock_obj = NULL;
UINT ssl_lock_num; UINT ssl_lock_num;
static bool openssl_inited = false; static bool openssl_inited = false;
@@ -704,7 +712,8 @@ UINT RsaPublicSize(K *k)
// Hash a pointer to a 32-bit // Hash a pointer to a 32-bit
UINT HashPtrToUINT(void *p) UINT HashPtrToUINT(void *p)
{ {
UCHAR hash_data[MD5_SIZE]; UCHAR hash_data[SHA256_SIZE];
UCHAR hash_src[CANARY_RAND_SIZE + sizeof(void *)];
UINT ret; UINT ret;
// Validate arguments // Validate arguments
if (p == NULL) if (p == NULL)
@@ -712,7 +721,11 @@ UINT HashPtrToUINT(void *p)
return 0; return 0;
} }
Md5(hash_data, &p, sizeof(p)); Zero(hash_src, sizeof(hash_src));
Copy(hash_src + 0, GetCanaryRand(CANARY_RAND_ID_PTR_KEY_HASH), CANARY_RAND_SIZE);
Copy(hash_src + CANARY_RAND_SIZE, p, sizeof(void *));
Sha2_256(hash_data, hash_src, sizeof(hash_src));
Copy(&ret, hash_data, sizeof(ret)); Copy(&ret, hash_data, sizeof(ret));
@@ -1079,6 +1092,41 @@ X *CloneX(X *x)
return ret; return ret;
} }
// Clone of certificate chain
LIST *CloneXList(LIST *chain)
{
BUF *b;
X *x;
LIST *ret;
// Validate arguments
if (chain == NULL)
{
return NULL;
}
ret = NewList(NULL);
LockList(chain);
{
UINT i;
for (i = 0;i < LIST_NUM(chain);i++)
{
x = LIST_DATA(chain, i);
b = XToBuf(x, false);
if (b == NULL)
{
continue;
}
x = BufToX(b, false);
Add(ret, x);
FreeBuf(b);
}
}
UnlockList(chain);
return ret;
}
// Generate a P12 // Generate a P12
P12 *NewP12(X *x, K *k, char *password) P12 *NewP12(X *x, K *k, char *password)
{ {
@@ -1133,9 +1181,15 @@ bool IsEncryptedP12(P12 *p12)
// Extract the X and the K from the P12 // Extract the X and the K from the P12
bool ParseP12(P12 *p12, X **x, K **k, char *password) bool ParseP12(P12 *p12, X **x, K **k, char *password)
{
return ParseP12Ex(p12, x, k, NULL, password);
}
// Extract the X, the K and the chain from the P12
bool ParseP12Ex(P12 *p12, X **x, K **k, LIST **cc, char *password)
{ {
EVP_PKEY *pkey; EVP_PKEY *pkey;
X509 *x509; X509 *x509;
STACK_OF(X509) *sk = NULL;
// Validate arguments // Validate arguments
if (p12 == NULL || x == NULL || k == NULL) if (p12 == NULL || x == NULL || k == NULL)
{ {
@@ -1165,9 +1219,9 @@ bool ParseP12(P12 *p12, X **x, K **k, char *password)
// Extraction // Extraction
Lock(openssl_lock); Lock(openssl_lock);
{ {
if (PKCS12_parse(p12->pkcs12, password, &pkey, &x509, NULL) == false) if (PKCS12_parse(p12->pkcs12, password, &pkey, &x509, &sk) == false)
{ {
if (PKCS12_parse(p12->pkcs12, NULL, &pkey, &x509, NULL) == false) if (PKCS12_parse(p12->pkcs12, NULL, &pkey, &x509, &sk) == false)
{ {
Unlock(openssl_lock); Unlock(openssl_lock);
return false; return false;
@@ -1182,6 +1236,7 @@ bool ParseP12(P12 *p12, X **x, K **k, char *password)
if (*x == NULL) if (*x == NULL)
{ {
FreePKey(pkey); FreePKey(pkey);
sk_X509_free(sk);
return false; return false;
} }
@@ -1189,6 +1244,37 @@ bool ParseP12(P12 *p12, X **x, K **k, char *password)
(*k)->private_key = true; (*k)->private_key = true;
(*k)->pkey = pkey; (*k)->pkey = pkey;
if (sk == NULL || cc == NULL)
{
if (cc != NULL)
{
*cc = NULL;
}
if (sk != NULL)
{
sk_X509_free(sk);
}
return true;
}
LIST *chain = NewList(NULL);
X *x1;
while (sk_X509_num(sk)) {
x509 = sk_X509_shift(sk);
x1 = X509ToX(x509);
if (x1 != NULL)
{
Add(chain, x1);
}
else
{
X509_free(x509);
}
}
sk_X509_free(sk);
*cc = chain;
return true; return true;
} }
@@ -3128,6 +3214,7 @@ bool IsEncryptedK(BUF *b, bool private_key)
K *OpensslEngineToK(char *key_file_name, char *engine_name) K *OpensslEngineToK(char *key_file_name, char *engine_name)
{ {
#ifndef OPENSSL_NO_ENGINE
K *k; K *k;
#if OPENSSL_API_COMPAT < 0x10100000L #if OPENSSL_API_COMPAT < 0x10100000L
ENGINE_load_dynamic(); ENGINE_load_dynamic();
@@ -3140,6 +3227,9 @@ K *OpensslEngineToK(char *key_file_name, char *engine_name)
k->pkey = pkey; k->pkey = pkey;
k->private_key = true; k->private_key = true;
return k; return k;
#else
return NULL;
#endif
} }
// Convert the BUF to a K // Convert the BUF to a K
@@ -3365,6 +3455,29 @@ void FreeX(X *x)
Free(x); Free(x);
} }
// Release of an X chain
void FreeXList(LIST *chain)
{
// Validate arguments
if (chain == NULL)
{
return;
}
LockList(chain);
{
UINT i;
for (i = 0; i < LIST_NUM(chain); i++)
{
X *x = LIST_DATA(chain, i);
FreeX(x);
}
}
UnlockList(chain);
ReleaseList(chain);
}
// Release of the X509 // Release of the X509
void FreeX509(X509 *x509) void FreeX509(X509 *x509)
{ {
@@ -3406,6 +3519,31 @@ X *BufToX(BUF *b, bool text)
return x; return x;
} }
// Convert the BUF to X chain
LIST *BufToXList(BUF *b, bool text)
{
LIST *chain;
BIO *bio;
// Validate arguments
if (b == NULL)
{
return NULL;
}
bio = BufToBio(b);
if (bio == NULL)
{
FreeBuf(b);
return NULL;
}
chain = BioToXList(bio, text);
FreeBio(bio);
return chain;
}
// Get a digest of the X // Get a digest of the X
void GetXDigest(X *x, UCHAR *buf, bool sha1) void GetXDigest(X *x, UCHAR *buf, bool sha1)
{ {
@@ -3469,6 +3607,49 @@ X *BioToX(BIO *bio, bool text)
return x; return x;
} }
// Convert BIO to X chain
LIST *BioToXList(BIO *bio, bool text)
{
X *x;
STACK_OF(X509_INFO) *sk = NULL;
X509_INFO *xi;
LIST *chain;
// Validate arguments
if (bio == NULL || text == false)
{
return NULL;
}
Lock(openssl_lock);
{
sk = PEM_X509_INFO_read_bio(bio, NULL, NULL, NULL);
if (sk == NULL)
{
return NULL;
}
chain = NewList(NULL);
while (sk_X509_INFO_num(sk))
{
xi = sk_X509_INFO_shift(sk);
x = X509ToX(xi->x509);
if (x != NULL)
{
Add(chain, x);
xi->x509 = NULL;
}
X509_INFO_free(xi);
}
sk_X509_INFO_free(sk);
}
Unlock(openssl_lock);
return chain;
}
// Convert the X509 to X // Convert the X509 to X
X *X509ToX(X509 *x509) X *X509ToX(X509 *x509)
{ {
@@ -3780,6 +3961,20 @@ void FreeCryptLibrary()
SSL_COMP_free_compression_methods(); SSL_COMP_free_compression_methods();
#endif #endif
#endif #endif
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
if (ossl_provider_default != NULL)
{
OSSL_PROVIDER_unload(ossl_provider_default);
ossl_provider_default = NULL;
}
if (ossl_provider_legacy != NULL)
{
OSSL_PROVIDER_unload(ossl_provider_legacy);
ossl_provider_legacy = NULL;
}
#endif
} }
// Initialize the Crypt library // Initialize the Crypt library
@@ -3798,6 +3993,11 @@ void InitCryptLibrary()
SSL_load_error_strings(); SSL_load_error_strings();
#endif #endif
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
ossl_provider_default = OSSL_PROVIDER_load(NULL, "legacy");
ossl_provider_legacy = OSSL_PROVIDER_load(NULL, "default");
#endif
ssl_clientcert_index = SSL_get_ex_new_index(0, "struct SslClientCertInfo *", NULL, NULL, NULL); ssl_clientcert_index = SSL_get_ex_new_index(0, "struct SslClientCertInfo *", NULL, NULL, NULL);
#ifdef OS_UNIX #ifdef OS_UNIX
+5
View File
@@ -293,9 +293,12 @@ BUF *BioToBuf(BIO *bio);
BIO *NewBio(); BIO *NewBio();
void FreeBio(BIO *bio); void FreeBio(BIO *bio);
X *BioToX(BIO *bio, bool text); X *BioToX(BIO *bio, bool text);
LIST *BioToXList(BIO *bio, bool text);
X *BufToX(BUF *b, bool text); X *BufToX(BUF *b, bool text);
LIST *BufToXList(BUF *b, bool text);
void FreeX509(X509 *x509); void FreeX509(X509 *x509);
void FreeX(X *x); void FreeX(X *x);
void FreeXList(LIST *chain);
BIO *XToBio(X *x, bool text); BIO *XToBio(X *x, bool text);
BUF *XToBuf(X *x, bool text); BUF *XToBuf(X *x, bool text);
K *BioToK(BIO *bio, bool private_key, bool text, char *password); K *BioToK(BIO *bio, bool private_key, bool text, char *password);
@@ -357,9 +360,11 @@ void FreePKCS12(PKCS12 *pkcs12);
void FreeP12(P12 *p12); void FreeP12(P12 *p12);
bool P12ToFileW(P12 *p12, wchar_t *filename); bool P12ToFileW(P12 *p12, wchar_t *filename);
bool ParseP12(P12 *p12, X **x, K **k, char *password); bool ParseP12(P12 *p12, X **x, K **k, char *password);
bool ParseP12Ex(P12 *p12, X **x, K **k, LIST **cc, char *password);
bool IsEncryptedP12(P12 *p12); bool IsEncryptedP12(P12 *p12);
P12 *NewP12(X *x, K *k, char *password); P12 *NewP12(X *x, K *k, char *password);
X *CloneX(X *x); X *CloneX(X *x);
LIST *CloneXList(LIST *chain);
K *CloneK(K *k); K *CloneK(K *k);
void FreeCryptLibrary(); void FreeCryptLibrary();
void GetPrintNameFromX(wchar_t *str, UINT size, X *x); void GetPrintNameFromX(wchar_t *str, UINT size, X *x);

Some files were not shown because too many files have changed in this diff Show More