mirror of
https://github.com/Wind4/vlmcsd.git
synced 2025-07-03 09:17:57 +08:00
Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
5a29226593 | |||
c5e1a0a591 | |||
af593fc11b |
@ -198,6 +198,7 @@ help:
|
||||
@echo " -DNO_SOCKETS Don't support standalone operation. Requires an internet superserver to start $(BASE_PROGRAM_NAME)."
|
||||
@echo " -DSIMPLE_SOCKETS Compile $(BASE_PROGRAM_NAME) with basic socket support only. Removes -L option."
|
||||
@echo " -DSIMPLE_RPC Don't support RPC with NDR64 and BTFN in $(BASE_PROGRAM_NAME) (but do in $(BASE_CLIENT_NAME)). Makes emulator detection easy."
|
||||
@echo " -DNO_TAP Compile $(BASE_PROGRAM_NAME) without VPN support (Windows and Cygwin only)."
|
||||
@echo " -DNO_CL_PIDS Don't support specifying ePIDs and HwId from the command line in $(BASE_PROGRAM_NAME)."
|
||||
@echo " -DNO_LIMIT Don't support limiting concurrent clients in $(BASE_PROGRAM_NAME)."
|
||||
@echo " -DNO_SIGHUP Don't support SIGHUP handling in $(BASE_PROGRAM_NAME)."
|
||||
|
@ -306,9 +306,11 @@
|
||||
<ClInclude Include="..\..\src\output.h" />
|
||||
<ClInclude Include="..\..\src\rpc.h" />
|
||||
<ClInclude Include="..\..\src\shared_globals.h" />
|
||||
<ClInclude Include="..\..\src\tap-windows.h" />
|
||||
<ClInclude Include="..\..\src\types.h" />
|
||||
<ClInclude Include="..\..\src\vlmcsd.h" />
|
||||
<ClInclude Include="..\..\src\wingetopt.h" />
|
||||
<ClInclude Include="..\..\src\wintap.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\src\crypto.c" />
|
||||
@ -324,6 +326,7 @@
|
||||
<ClCompile Include="..\..\src\shared_globals.c" />
|
||||
<ClCompile Include="..\..\src\vlmcsd.c" />
|
||||
<ClCompile Include="..\..\src\wingetopt.c" />
|
||||
<ClCompile Include="..\..\src\wintap.c" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
|
@ -63,6 +63,12 @@
|
||||
<ClInclude Include="..\..\src\kmsdata.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\tap-windows.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\wintap.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\src\crypto.c">
|
||||
@ -104,5 +110,8 @@
|
||||
<ClCompile Include="..\..\src\kmsdata.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\wintap.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -292,6 +292,7 @@
|
||||
<ClCompile Include="..\..\src\vlmcsd.c" />
|
||||
<ClCompile Include="..\..\src\vlmcsdmulti.c" />
|
||||
<ClCompile Include="..\..\src\wingetopt.c" />
|
||||
<ClCompile Include="..\..\src\wintap.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\src\config.h" />
|
||||
@ -307,10 +308,12 @@
|
||||
<ClInclude Include="..\..\src\output.h" />
|
||||
<ClInclude Include="..\..\src\rpc.h" />
|
||||
<ClInclude Include="..\..\src\shared_globals.h" />
|
||||
<ClInclude Include="..\..\src\tap-windows.h" />
|
||||
<ClInclude Include="..\..\src\types.h" />
|
||||
<ClInclude Include="..\..\src\vlmcs.h" />
|
||||
<ClInclude Include="..\..\src\vlmcsd.h" />
|
||||
<ClInclude Include="..\..\src\wingetopt.h" />
|
||||
<ClInclude Include="..\..\src\wintap.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
|
@ -63,6 +63,9 @@
|
||||
<ClCompile Include="..\..\src\kmsdata-full.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\wintap.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\src\config.h">
|
||||
@ -116,5 +119,11 @@
|
||||
<ClInclude Include="..\..\src\kmsdata.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\tap-windows.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\wintap.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -23,6 +23,12 @@
|
||||
# Set ePID/HwId for Office 2016 (including Visio and Project) explicitly
|
||||
;Office2016 = 06401-00206-437-444444-03-1033-9600.0000-3622014 / 01 02 03 04 05 06 07 08
|
||||
|
||||
# Use a compatible VPN device to create a hidden local IPv4 address
|
||||
# Command line: -O
|
||||
# VPN = <VPN adapter name>[=<IPv4 address>][/<CIDR mask>][:<DHCP lease duration>]
|
||||
# Use VPN adapter "KMS Mirror" give it IP address 192.168.123.100 with a lease duration of one day and make entire 192.168.128.x a hidden local IPv4 address.
|
||||
;VPN = KMS Mirror=192.168.123.100/24:1d
|
||||
|
||||
# Use custom TCP port
|
||||
# Command line: -P
|
||||
# ***The Port directive only works if vlmcsd was compiled to use MS RPC or simple sockets
|
||||
@ -110,6 +116,12 @@
|
||||
# Command line: -R
|
||||
;RenewalInterval = 7d
|
||||
|
||||
# Exit vlmcsd if warning of certain level has been reached
|
||||
# Command line: -x
|
||||
# 0 = Never
|
||||
# 1 = Exit, if any listening socket could not be established or TAP error occurs
|
||||
;ExitLevel = 0
|
||||
|
||||
# Run program as user vlmcsduser
|
||||
# Command line: -u
|
||||
;user = vlmcsduser
|
||||
|
Binary file not shown.
@ -711,7 +711,7 @@ export PROGRAM_NAME=../binaries/Android/intel/bionic/vlmcsd-android23-x86
|
||||
export MULTI_NAME=../binaries/Android/intel/static/vlmcsdmulti-android23-x86
|
||||
export CC=/opt/toolchains/x86-android-9/bin/i686-linux-android-gcc
|
||||
export CFLAGS="$SMALLCC"
|
||||
export PLATFORMFLAGS="-flto=16 -fwhole-program -march=atom -m32"
|
||||
export PLATFORMFLAGS="-flto=16 -fwhole-program -march=i386 -m32"
|
||||
export THREADS=1
|
||||
export LDFLAGS="$SMALLLD"
|
||||
|
||||
@ -745,7 +745,7 @@ export PROGRAM_NAME=../binaries/Android/intel/bionic/vlmcsd-android41-x86
|
||||
export MULTI_NAME=../binaries/Android/intel/bionic/vlmcsdmulti-android41-x86
|
||||
export CC=/opt/toolchains/x86-android-16/bin/i686-linux-android-gcc
|
||||
export CFLAGS="$SMALLCC"
|
||||
export PLATFORMFLAGS="-flto=16 -fwhole-program -march=atom -m32 -fPIE -pie"
|
||||
export PLATFORMFLAGS="-flto=16 -fwhole-program -march=i386 -m32 -fPIE -pie"
|
||||
export THREADS=1
|
||||
export LDFLAGS="$SMALLLD"
|
||||
|
||||
@ -797,7 +797,7 @@ export PROGRAM_NAME=../binaries/Android/intel/bionic/vlmcsd-android50-x64
|
||||
export MULTI_NAME=../binaries/Android/intel/bionic/vlmcsdmulti-android50-x64
|
||||
export CC=/opt/toolchains/x86_64-android-21/bin/x86_64-linux-android-gcc
|
||||
export CFLAGS="$SMALLCC"
|
||||
export PLATFORMFLAGS="-flto=16 -fwhole-program -march=atom -m64 -fPIE -pie"
|
||||
export PLATFORMFLAGS="-flto=16 -fwhole-program -m64 -fPIE -pie"
|
||||
export THREADS=0
|
||||
export LDFLAGS="$SMALLLD"
|
||||
|
||||
@ -819,7 +819,7 @@ export PROGRAM_NAME=../binaries/Android/intel/static/vlmcsd-android50-x64-static
|
||||
export MULTI_NAME=../binaries/Android/intel/static/vlmcsdmulti-android50-x64-static
|
||||
export CC=/opt/toolchains/x86_64-android-21/bin/x86_64-linux-android-gcc
|
||||
export CFLAGS="$SMALLCC"
|
||||
export PLATFORMFLAGS="-flto=16 -fwhole-program -march=nocona -m64"
|
||||
export PLATFORMFLAGS="-flto=16 -fwhole-program -m64"
|
||||
export THREADS=0
|
||||
export LDFLAGS="$SMALLLD -static"
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!-- Creator : groff version 1.22.3 -->
|
||||
<!-- CreationDate: Mon Nov 28 01:28:23 2016 -->
|
||||
<!-- CreationDate: Thu Jan 19 21:29:26 2017 -->
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
||||
"http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
|
BIN
man/vlmcs.1.pdf
BIN
man/vlmcs.1.pdf
Binary file not shown.
@ -1,5 +1,5 @@
|
||||
<!-- Creator : groff version 1.22.3 -->
|
||||
<!-- CreationDate: Mon Nov 28 01:28:23 2016 -->
|
||||
<!-- CreationDate: Thu Jan 19 21:29:26 2017 -->
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
||||
"http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
|
Binary file not shown.
@ -1,5 +1,5 @@
|
||||
<!-- Creator : groff version 1.22.3 -->
|
||||
<!-- CreationDate: Mon Nov 28 01:28:23 2016 -->
|
||||
<!-- CreationDate: Thu Jan 19 21:29:26 2017 -->
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
||||
"http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
|
BIN
man/vlmcsd.7.pdf
BIN
man/vlmcsd.7.pdf
Binary file not shown.
41
man/vlmcsd.8
41
man/vlmcsd.8
@ -1,5 +1,5 @@
|
||||
.mso www.tmac
|
||||
.TH VLMCSD 8 "November 2016" "Hotbird64" "KMS Activation Manual"
|
||||
.TH VLMCSD 8 "January 2017" "Hotbird64" "KMS Activation Manual"
|
||||
.LO 8
|
||||
|
||||
.SH NAME
|
||||
@ -76,10 +76,45 @@ in the 32-bit ABI of the 64-bit kernel. If you have a 64-bit FreeBSD kernel, you
|
||||
If vlmcsd was started by an internet superserver or was compiled to use Microsoft RPC (Windows only) or simple sockets, \fB-o1\fR and \fB-o3\fR are not available by design.
|
||||
.RE
|
||||
|
||||
.IP "\fB-P\fR \fIport"
|
||||
.IP "\fB-P\fR \fIport\fR"
|
||||
Use TCP \fIport\fR for all subsequent \fB-L\fR statements that do not include an optional port. If you use \fB-P\fR and \fB-L\fR, \fB-P\fR must be specified before \fB-L\fR.
|
||||
|
||||
.IP "\fB-F0\fR and \fB-F1\fR
|
||||
.IP "\fB-O\fR \fIvpn-adapter-name\fR[=\fIipv4-address\fR][/\fIcidr-mask\fR][:\fIdhcp-lease-duration\fR]"
|
||||
Enables a compatible VPN adapter to create additional local IPv4 addresses (like 127.0.0.1) that appear as remote IPv4 addresses to the system. This allows product activation using a local instance of vlmcsd. This feature is only available in Windows and Cygwin builds of vlmcsd since it is not of any use on other operating systems. Compatible VPN adapters are Tap-windows version 8.2 or higher (from OpenVPN) and the TeamViewer VPN adapter. There are two special \fIvpn-adapter-name\fRs. A single period (.) instructs vlmcsd to use the first available compatible VPN adapter. A single dash (\-) disables the use of a VPN adapter if one has been configured in \fBvlmcsd.ini\fR(5). The \fIvpn-adapter-name\fR is \fBnot\fR case-sensitive. If the \fIvpn-adapter-name\fR contains spaces (e.g. Ethernet 3), you must enclose it in quotes.
|
||||
|
||||
The default \fIipv4-address\fR is 10.10.10.9 and the default \fIcidr-mask\fR is 30. If you are using the default values, your VPN adapter uses an IPv4 address of 10.10.10.9 and you can set your activation client to use the easy to remember address 10.10.10.10 (e.g. slmgr /skms 10.10.10.10 or cscript ospp.vbs /sethst:10.10.10.10).
|
||||
|
||||
The \fIdhcp-lease-duration\fR is a number optionally followed by s, m, h, d or w to indicate seconds, minutes, hours, days or weeks. The default \fIdhcp-lease-duration\fR is 1d (one day). It is normally not required to change this value.
|
||||
|
||||
It is advised not to manually configure your OpenVPN TAP or TeamViewer VPN adapter in "Network Connections". If you set the IPv4 configuration manually anyway, the IPv4 address and the subnet mask must match the \fB-O\fR parameter. It is safe leave the IPv4 configuration to automatic (DHCP). vlmcsd will wait up to four seconds for the DHCP configuration to complete before binding to and listenin on any interfaces.
|
||||
|
||||
You should be aware that only one program can use a VPN adapter at a time. If you use the TeamViewer VPN adapter for example, you will not be able to use the VPN feature of TeamViewer as long as vlmcsd is running. The same applies to OpenVPN TAP adapters that are in use by other programs (for example OpenVPN, QEMU, Ratiborus VM, aiccu, etc.). The best way to avoid conflicts is to install Tap-Windows from OpenVPN, cd to C:\\Program Files\\TAP-Windows\\bin and run addtap.bat to install an additional TAP adapter. Go to "Network Connections" and rename the new adapter to "vlmcsd" and specify \fB-O vlmcsd\fR to use it.
|
||||
|
||||
Example: \fB-O "Ethernet 7"=192.168.123.1/24\fR (uses VPN adapter Ethernet 7 with IPv4 address 192.168.123.1 and have 192.168.123.2 to 192.168.123.254 as additional local (but apparently remote) IPv4 addresses.
|
||||
|
||||
.IP "\fB-x0\fR and \fB-x1\fR"
|
||||
Controls under what circumstances vlmcsd will exit. Using the default of \fB-x0\fR vlmcsd stays active as long as it can perform some useful operations. If vlmcsd is run by any form of a watchdog, e.g. NT service manager (Windows), systemd (Linux) or launchd (Mac OS / iOS), it may be desirable to end vlmcsd and let the watchdog restart it. This is especially true if some pre-requisites are not yet met but will be some time later, e.g. network is not yet fully setup.
|
||||
|
||||
By using \fB-x0\fR vlmcsd will
|
||||
|
||||
.RS 12
|
||||
exit if none of the listening sockets specified with \fB-L\fR can be used. It continues if at least one socket can be setup for listening.
|
||||
|
||||
exit any TAP mirror thread (Windows version only) if there is an error condition while reading or writing from or to the VPN adapter but continue to work without utilizing a VPN adapter.
|
||||
.RE
|
||||
.IP
|
||||
By using \fB-x1\fR vlmcsd will
|
||||
|
||||
.RS 12
|
||||
exit if not all listening sockets specified with \fB-L\fR can be used.
|
||||
|
||||
exit completely if there is a problem with a VPN adapter it is using. This can happen for instance if the VPN adapter has been disabled using "Control Panel - Network - Adapter Settings" while vlmcsd is using it.
|
||||
|
||||
.RE
|
||||
.IP
|
||||
Please note that \fB-x1\fR is kind of a workaround option. While it may help under some circumstances, it is better to solve the problem at its origin, e.g. properly implementing dependencies in your startup script to ensure all network interfaces and the VPN adapter you will use are completely setup before you start vlmcsd.
|
||||
|
||||
.IP "\fB-F0\fR and \fB-F1\fR"
|
||||
Allow (\fB-F1\fR) or disallow (\fB-F0\fR) binding to IP addresses that are currently not configured on your system. The default is \fB-F0\fR. \fB-F1\fR allows you to bind to an IP address that may be configured after you started \fBvlmcsd\fR. \fBvlmcsd\fR will listen on that address as soon as it becomes available. This feature is only available under Linux (IPv4 and IPv6) and FreeBSD (IPv4 only). FreeBSD allows this feature only for the root user (more correctly: processes that have the PRIV_NETINET_BINDANY privilege). Linux does not require a capability for this.
|
||||
|
||||
.IP "\fB-t\fR \fIseconds\fR"
|
||||
|
@ -172,49 +172,141 @@ OPTIONS
|
||||
ified before -L.
|
||||
|
||||
|
||||
-O vpn-adapter-name[=ipv4-address][/cidr-mask][:dhcp-lease-duration]
|
||||
Enables a compatible VPN adapter to create additional local IPv4
|
||||
addresses (like 127.0.0.1) that appear as remote IPv4 addresses
|
||||
to the system. This allows product activation using a local
|
||||
instance of vlmcsd. This feature is only available in Windows
|
||||
and Cygwin builds of vlmcsd since it is not of any use on other
|
||||
operating systems. Compatible VPN adapters are Tap-windows ver‐
|
||||
sion 8.2 or higher (from OpenVPN) and the TeamViewer VPN
|
||||
adapter. There are two special vpn-adapter-names. A single
|
||||
period (.) instructs vlmcsd to use the first available compati‐
|
||||
ble VPN adapter. A single dash (-) disables the use of a VPN
|
||||
adapter if one has been configured in vlmcsd.ini(5). The vpn-
|
||||
adapter-name is not case-sensitive. If the vpn-adapter-name con‐
|
||||
tains spaces (e.g. Ethernet 3), you must enclose it in quotes.
|
||||
|
||||
The default ipv4-address is 10.10.10.9 and the default cidr-mask
|
||||
is 30. If you are using the default values, your VPN adapter
|
||||
uses an IPv4 address of 10.10.10.9 and you can set your activa‐
|
||||
tion client to use the easy to remember address 10.10.10.10
|
||||
(e.g. slmgr /skms 10.10.10.10 or cscript ospp.vbs
|
||||
/sethst:10.10.10.10).
|
||||
|
||||
The dhcp-lease-duration is a number optionally followed by s, m,
|
||||
h, d or w to indicate seconds, minutes, hours, days or weeks.
|
||||
The default dhcp-lease-duration is 1d (one day). It is normally
|
||||
not required to change this value.
|
||||
|
||||
It is advised not to manually configure your OpenVPN TAP or
|
||||
TeamViewer VPN adapter in "Network Connections". If you set the
|
||||
IPv4 configuration manually anyway, the IPv4 address and the
|
||||
subnet mask must match the -O parameter. It is safe leave the
|
||||
IPv4 configuration to automatic (DHCP). vlmcsd will wait up to
|
||||
four seconds for the DHCP configuration to complete before bind‐
|
||||
ing to and listenin on any interfaces.
|
||||
|
||||
You should be aware that only one program can use a VPN adapter
|
||||
at a time. If you use the TeamViewer VPN adapter for example,
|
||||
you will not be able to use the VPN feature of TeamViewer as
|
||||
long as vlmcsd is running. The same applies to OpenVPN TAP
|
||||
adapters that are in use by other programs (for example OpenVPN,
|
||||
QEMU, Ratiborus VM, aiccu, etc.). The best way to avoid con‐
|
||||
flicts is to install Tap-Windows from OpenVPN, cd to C:\Program
|
||||
Files\TAP-Windows\bin and run addtap.bat to install an addi‐
|
||||
tional TAP adapter. Go to "Network Connections" and rename the
|
||||
new adapter to "vlmcsd" and specify -O vlmcsd to use it.
|
||||
|
||||
Example: -O "Ethernet 7"=192.168.123.1/24 (uses VPN adapter Eth‐
|
||||
ernet 7 with IPv4 address 192.168.123.1 and have 192.168.123.2
|
||||
to 192.168.123.254 as additional local (but apparently remote)
|
||||
IPv4 addresses.
|
||||
|
||||
|
||||
-x0 and -x1
|
||||
Controls under what circumstances vlmcsd will exit. Using the
|
||||
default of -x0 vlmcsd stays active as long as it can perform
|
||||
some useful operations. If vlmcsd is run by any form of a watch‐
|
||||
dog, e.g. NT service manager (Windows), systemd (Linux) or
|
||||
launchd (Mac OS / iOS), it may be desirable to end vlmcsd and
|
||||
let the watchdog restart it. This is especially true if some
|
||||
pre-requisites are not yet met but will be some time later, e.g.
|
||||
network is not yet fully setup.
|
||||
|
||||
By using -x0 vlmcsd will
|
||||
|
||||
exit if none of the listening sockets specified with -L can
|
||||
be used. It continues if at least one socket can be setup
|
||||
for listening.
|
||||
|
||||
exit any TAP mirror thread (Windows version only) if there
|
||||
is an error condition while reading or writing from or to
|
||||
the VPN adapter but continue to work without utilizing a
|
||||
VPN adapter.
|
||||
|
||||
By using -x1 vlmcsd will
|
||||
|
||||
exit if not all listening sockets specified with -L can be
|
||||
used.
|
||||
|
||||
exit completely if there is a problem with a VPN adapter it
|
||||
is using. This can happen for instance if the VPN adapter
|
||||
has been disabled using "Control Panel - Network - Adapter
|
||||
Settings" while vlmcsd is using it.
|
||||
|
||||
|
||||
Please note that -x1 is kind of a workaround option. While it
|
||||
may help under some circumstances, it is better to solve the
|
||||
problem at its origin, e.g. properly implementing dependencies
|
||||
in your startup script to ensure all network interfaces and the
|
||||
VPN adapter you will use are completely setup before you start
|
||||
vlmcsd.
|
||||
|
||||
|
||||
-F0 and -F1
|
||||
Allow (-F1) or disallow (-F0) binding to IP addresses that are
|
||||
Allow (-F1) or disallow (-F0) binding to IP addresses that are
|
||||
currently not configured on your system. The default is -F0. -F1
|
||||
allows you to bind to an IP address that may be configured after
|
||||
you started vlmcsd. vlmcsd will listen on that address as soon
|
||||
as it becomes available. This feature is only available under
|
||||
Linux (IPv4 and IPv6) and FreeBSD (IPv4 only). FreeBSD allows
|
||||
this feature only for the root user (more correctly: processes
|
||||
that have the PRIV_NETINET_BINDANY privilege). Linux does not
|
||||
you started vlmcsd. vlmcsd will listen on that address as soon
|
||||
as it becomes available. This feature is only available under
|
||||
Linux (IPv4 and IPv6) and FreeBSD (IPv4 only). FreeBSD allows
|
||||
this feature only for the root user (more correctly: processes
|
||||
that have the PRIV_NETINET_BINDANY privilege). Linux does not
|
||||
require a capability for this.
|
||||
|
||||
|
||||
-t seconds
|
||||
Timeout the TCP connection with the client after seconds sec‐
|
||||
onds. After sending an activation request. RPC keeps the TCP
|
||||
Timeout the TCP connection with the client after seconds sec‐
|
||||
onds. After sending an activation request. RPC keeps the TCP
|
||||
connection for a while. The default is 30 seconds. You may spec‐
|
||||
ify a shorter period to free ressources on your device faster.
|
||||
This is useful for devices with limited main memory or if you
|
||||
ify a shorter period to free ressources on your device faster.
|
||||
This is useful for devices with limited main memory or if you
|
||||
used -m to limit the concurrent clients that may request activa‐
|
||||
tion. Microsoft RPC clients disconnect after 30 seconds by
|
||||
default. Setting seconds to a greater value does not make much
|
||||
tion. Microsoft RPC clients disconnect after 30 seconds by
|
||||
default. Setting seconds to a greater value does not make much
|
||||
sense.
|
||||
|
||||
|
||||
-m concurrent-clients
|
||||
Limit the number of clients that will be handled concurrently.
|
||||
Limit the number of clients that will be handled concurrently.
|
||||
This is useful for devices with limited ressources or if you are
|
||||
experiencing DoS attacks that spawn thousands of threads or
|
||||
forked processes. If additional clients connect to vlmcsd, they
|
||||
need to wait until another client disconnects. If you set con‐
|
||||
experiencing DoS attacks that spawn thousands of threads or
|
||||
forked processes. If additional clients connect to vlmcsd, they
|
||||
need to wait until another client disconnects. If you set con‐
|
||||
current-clients to a small value ( <10 ), you should also select
|
||||
a reasonable timeout of 2 or 3 seconds with -t. The default is
|
||||
a reasonable timeout of 2 or 3 seconds with -t. The default is
|
||||
no limit.
|
||||
|
||||
|
||||
-d Disconnect each client after processing one activation request.
|
||||
This is a direct violation of DCE RPC but may help if you
|
||||
receive malicous fake RPC requests that block your threads or
|
||||
forked processes. Some other KMS emulators (e.g. py-kms) behave
|
||||
-d Disconnect each client after processing one activation request.
|
||||
This is a direct violation of DCE RPC but may help if you
|
||||
receive malicous fake RPC requests that block your threads or
|
||||
forked processes. Some other KMS emulators (e.g. py-kms) behave
|
||||
this way.
|
||||
|
||||
|
||||
-k Do not disconnect clients after processing an activation
|
||||
-k Do not disconnect clients after processing an activation
|
||||
request. This selects the default behavior. -k is useful only if
|
||||
you used an ini file (see vlmcsd.ini(5) and -i). If the ini file
|
||||
contains the line "DisconnectClientsImmediately = true", you can
|
||||
@ -222,135 +314,135 @@ OPTIONS
|
||||
|
||||
|
||||
-N0 and -N1
|
||||
Disables (-N0) or enables (-N1) the use of the NDR64 transfer
|
||||
syntax in the RPC protocol. Unlike Microsoft vlmcsd supports
|
||||
Disables (-N0) or enables (-N1) the use of the NDR64 transfer
|
||||
syntax in the RPC protocol. Unlike Microsoft vlmcsd supports
|
||||
NDR64 on 32-bit operating systems. Microsoft introduced NDR64 in
|
||||
Windows Vista but their KMS servers started using it with Win‐
|
||||
dows 8. Thus if you choose random ePIDs, vlmcsd will select
|
||||
ePIDs with build numbers 9200 and 9600 if you enable NDR64 and
|
||||
Windows Vista but their KMS servers started using it with Win‐
|
||||
dows 8. Thus if you choose random ePIDs, vlmcsd will select
|
||||
ePIDs with build numbers 9200 and 9600 if you enable NDR64 and
|
||||
build numbers 6002 and 7601 if you disable NDR64. The default is
|
||||
to enable NDR64.
|
||||
|
||||
|
||||
-B0 and -B1
|
||||
Disables (-B0) or enables (-B1) bind time feature negotiation
|
||||
Disables (-B0) or enables (-B1) bind time feature negotiation
|
||||
(BTFN) in the RPC protocol. All Windows operating systems start‐
|
||||
ing with Vista support BTFN and try to negotiate it when initi‐
|
||||
ing with Vista support BTFN and try to negotiate it when initi‐
|
||||
ating an RPC connection. Thus consider turning it off as a debug
|
||||
/ troubleshooting feature only. Some older firewalls that selec‐
|
||||
tively block or redirect RPC traffic may get confused when they
|
||||
tively block or redirect RPC traffic may get confused when they
|
||||
detect NDR64 or BTFN.
|
||||
|
||||
|
||||
-l filename
|
||||
Use filename as a log file. The log file records all activations
|
||||
with IP address, Windows workstation name (no reverse DNS
|
||||
lookup), activated product, KMS protocol, time and date. If you
|
||||
with IP address, Windows workstation name (no reverse DNS
|
||||
lookup), activated product, KMS protocol, time and date. If you
|
||||
do not specify a log file, no log is created. For a live view of
|
||||
the log file type tail -f file.
|
||||
|
||||
If you use the special filename "syslog", vlmcsd uses syslog(3)
|
||||
for logging. If your system has no syslog service (/dev/log)
|
||||
installed, logging output will go to /dev/console. Syslog log‐
|
||||
ging is not available in the native Windows version. The Cygwin
|
||||
If you use the special filename "syslog", vlmcsd uses syslog(3)
|
||||
for logging. If your system has no syslog service (/dev/log)
|
||||
installed, logging output will go to /dev/console. Syslog log‐
|
||||
ging is not available in the native Windows version. The Cygwin
|
||||
version does support syslog logging.
|
||||
|
||||
|
||||
-T0 and -T1
|
||||
Disable (-T0) or enable (-T1) the inclusion of date and time in
|
||||
each line of the log. The default is -T1. -T0 is useful if you
|
||||
log to stdout(3) which is redirected to another logging mecha‐
|
||||
nism that already includes date and time in its output, for
|
||||
instance systemd-journald(8). If you log to syslog(3), -T1 is
|
||||
ignored and date and time will never be included in the output
|
||||
Disable (-T0) or enable (-T1) the inclusion of date and time in
|
||||
each line of the log. The default is -T1. -T0 is useful if you
|
||||
log to stdout(3) which is redirected to another logging mecha‐
|
||||
nism that already includes date and time in its output, for
|
||||
instance systemd-journald(8). If you log to syslog(3), -T1 is
|
||||
ignored and date and time will never be included in the output
|
||||
sent to syslog(3).
|
||||
|
||||
|
||||
-D Normally vlmcsd daemonizes and runs in background (except the
|
||||
native Windows version). If -D is specified, vlmcsd does not
|
||||
-D Normally vlmcsd daemonizes and runs in background (except the
|
||||
native Windows version). If -D is specified, vlmcsd does not
|
||||
daemonize and runs in foreground. This is useful for testing and
|
||||
allows you to simply press <Ctrl-C> to exit vlmcsd.
|
||||
|
||||
The native Windows version never daemonizes and always behaves
|
||||
The native Windows version never daemonizes and always behaves
|
||||
as if -D had been specified. You may want to install vlmcsd as a
|
||||
service instead. See -s.
|
||||
|
||||
|
||||
-e If specified, vlmcsd ignores -l and writes all logging output to
|
||||
stdout(3). This is mainly useful for testing and debugging and
|
||||
stdout(3). This is mainly useful for testing and debugging and
|
||||
often combined with -D.
|
||||
|
||||
|
||||
-v Use verbose logging. Logs every parameter of the base request
|
||||
and the base response. It also logs the HWID of the KMS server
|
||||
if KMS protocol version 6 is used. This option is mainly for
|
||||
debugging purposes. It only has an effect if some form of log‐
|
||||
ging is used. Thus -v does not make sense if not used with -l,
|
||||
-v Use verbose logging. Logs every parameter of the base request
|
||||
and the base response. It also logs the HWID of the KMS server
|
||||
if KMS protocol version 6 is used. This option is mainly for
|
||||
debugging purposes. It only has an effect if some form of log‐
|
||||
ging is used. Thus -v does not make sense if not used with -l,
|
||||
-e or -f.
|
||||
|
||||
|
||||
-q Do not use verbose logging. This is actually the default behav‐
|
||||
-q Do not use verbose logging. This is actually the default behav‐
|
||||
ior. It only makes sense if you use vlmcsd with an ini file (see
|
||||
-i and vlmcsd.ini(5)). If the ini file contains the line
|
||||
-i and vlmcsd.ini(5)). If the ini file contains the line
|
||||
"LogVerbose = true" you can use -q to restore the default behav‐
|
||||
ior.
|
||||
|
||||
|
||||
-p filename
|
||||
Create pid file filename. This has nothing to do with KMS ePIDs.
|
||||
A pid file is a file where vlmcsd writes its own process id.
|
||||
This is used by standard init scripts (typically found in
|
||||
A pid file is a file where vlmcsd writes its own process id.
|
||||
This is used by standard init scripts (typically found in
|
||||
/etc/init.d). The default is not to write a pid file.
|
||||
|
||||
|
||||
-u user and -g group
|
||||
Causes vlmcsd to run in the specified user and group security
|
||||
context. The main purpose for this is to drop root privileges
|
||||
after it has been started from the root account. To use this
|
||||
feature from cygwin you must run cyglsa-config and the account
|
||||
from which vlmcsd is started must have the rights "Act as part
|
||||
of the operating system" and "Replace a process level token".
|
||||
Causes vlmcsd to run in the specified user and group security
|
||||
context. The main purpose for this is to drop root privileges
|
||||
after it has been started from the root account. To use this
|
||||
feature from cygwin you must run cyglsa-config and the account
|
||||
from which vlmcsd is started must have the rights "Act as part
|
||||
of the operating system" and "Replace a process level token".
|
||||
The native Windows version does not support these options.
|
||||
|
||||
The actual security context switch is performed after the TCP
|
||||
sockets have been created. This allows you to use privileged
|
||||
The actual security context switch is performed after the TCP
|
||||
sockets have been created. This allows you to use privileged
|
||||
ports (< 1024) when you start vlmcsd from the root account.
|
||||
|
||||
However if you use an ini, pid or log file, you must ensure that
|
||||
the unprivileged user has access to these files. You can always
|
||||
log to syslog(3) from an unprivileged account on most platforms
|
||||
the unprivileged user has access to these files. You can always
|
||||
log to syslog(3) from an unprivileged account on most platforms
|
||||
(see -l).
|
||||
|
||||
|
||||
-w ePID
|
||||
Use ePID as Windows ePID. If specified, -r is disregarded for
|
||||
Use ePID as Windows ePID. If specified, -r is disregarded for
|
||||
Windows.
|
||||
|
||||
|
||||
-0 ePID
|
||||
Use ePID as Office 2010 ePID (including Project and Visio). If
|
||||
Use ePID as Office 2010 ePID (including Project and Visio). If
|
||||
specified, -r is disregarded for Office 2010.
|
||||
|
||||
|
||||
-3 ePID
|
||||
Use ePID as Office 2013 ePID (including Project and Visio). If
|
||||
Use ePID as Office 2013 ePID (including Project and Visio). If
|
||||
specified, -r is disregarded for Office 2013.
|
||||
|
||||
|
||||
-6 ePID
|
||||
Use ePID as Office 2016 ePID (including Project and Visio). If
|
||||
Use ePID as Office 2016 ePID (including Project and Visio). If
|
||||
specified, -r is disregarded for Office 2016.
|
||||
|
||||
|
||||
-H HwId
|
||||
Use HwId for all products. All HWIDs in the ini file (see -i)
|
||||
Use HwId for all products. All HWIDs in the ini file (see -i)
|
||||
will not be used. In an ini file you can specify a seperate HWID
|
||||
for each application-guid. This is not possible when entering a
|
||||
for each application-guid. This is not possible when entering a
|
||||
HWID from the command line.
|
||||
|
||||
HwId must be specified as 16 hex digits that are interpreted as
|
||||
a series of 8 bytes (big endian). Any character that is not a
|
||||
hex digit will be ignored. This is for better readability. The
|
||||
HwId must be specified as 16 hex digits that are interpreted as
|
||||
a series of 8 bytes (big endian). Any character that is not a
|
||||
hex digit will be ignored. This is for better readability. The
|
||||
following commands are identical:
|
||||
|
||||
vlmcsd -H 0123456789ABCDEF
|
||||
@ -359,26 +451,26 @@ OPTIONS
|
||||
|
||||
|
||||
-i filename
|
||||
Use configuration file (aka ini file) filename. Most configura‐
|
||||
Use configuration file (aka ini file) filename. Most configura‐
|
||||
tion parameters can be set either via the command line or an ini
|
||||
file. The command line always has precedence over configuration
|
||||
items in the ini file. See vlmcsd.ini(5) for the format of the
|
||||
file. The command line always has precedence over configuration
|
||||
items in the ini file. See vlmcsd.ini(5) for the format of the
|
||||
configuration file.
|
||||
|
||||
If vlmcsd has been compiled to use a default configuration file
|
||||
(often /etc/vlmcsd.ini), you may use -i- to ignore the default
|
||||
If vlmcsd has been compiled to use a default configuration file
|
||||
(often /etc/vlmcsd.ini), you may use -i- to ignore the default
|
||||
configuration file.
|
||||
|
||||
|
||||
-j filename
|
||||
Use KMS data file filename. By default vlmcsd only contains the
|
||||
minimum product data that is required to perform all operations
|
||||
correctly. You may use a more complete KMS data file that con‐
|
||||
tains all detailed product names. This is especially useful if
|
||||
Use KMS data file filename. By default vlmcsd only contains the
|
||||
minimum product data that is required to perform all operations
|
||||
correctly. You may use a more complete KMS data file that con‐
|
||||
tains all detailed product names. This is especially useful if
|
||||
you are logging KMS requests. If you don't log, there is no need
|
||||
to load an external KMS data file.
|
||||
|
||||
If vlmcsd has been compiled to use a default KMS data file, you
|
||||
If vlmcsd has been compiled to use a default KMS data file, you
|
||||
may use -j- to ignore the default configuration file.
|
||||
|
||||
|
||||
@ -388,112 +480,112 @@ OPTIONS
|
||||
- you did not sprecify an ePID in the command line and
|
||||
- you haven't used -i or
|
||||
- the file specified by -i cannot be opened or
|
||||
- the file specified by -i does not contain an ePID for the KMS
|
||||
- the file specified by -i does not contain an ePID for the KMS
|
||||
request
|
||||
|
||||
-r0 means there are no random ePIDs. vlmcsd simply issues
|
||||
default ePIDs that are built into the binary at compile time.
|
||||
Pro: behaves like real KMS server that also always issues the
|
||||
same ePID. Con: Microsoft may start blacklisting again and the
|
||||
-r0 means there are no random ePIDs. vlmcsd simply issues
|
||||
default ePIDs that are built into the binary at compile time.
|
||||
Pro: behaves like real KMS server that also always issues the
|
||||
same ePID. Con: Microsoft may start blacklisting again and the
|
||||
default ePID may not work any longer.
|
||||
|
||||
-r1 instructs vlmcsd to generate random ePIDs when the program
|
||||
-r1 instructs vlmcsd to generate random ePIDs when the program
|
||||
starts or receives a SIGHUP signal and uses these ePIDs until it
|
||||
is stopped or receives another SIGHUP. Most other KMS emulators
|
||||
generate a new ePID on every KMS request. This is easily
|
||||
is stopped or receives another SIGHUP. Most other KMS emulators
|
||||
generate a new ePID on every KMS request. This is easily
|
||||
detectable. Microsoft could just modify sppsvc.exe in a way that
|
||||
it always sends two identical KMS requests in two RPC requests
|
||||
but over the same TCP connection. If both KMS responses contain
|
||||
the different ePIDs, the KMS server is not genuine. -r1 is the
|
||||
default mode. -r1 also ensures that all three ePIDs (Windows,
|
||||
Office 2010 and Office 2013) use the same OS build number and
|
||||
it always sends two identical KMS requests in two RPC requests
|
||||
but over the same TCP connection. If both KMS responses contain
|
||||
the different ePIDs, the KMS server is not genuine. -r1 is the
|
||||
default mode. -r1 also ensures that all three ePIDs (Windows,
|
||||
Office 2010 and Office 2013) use the same OS build number and
|
||||
LCID (language id).
|
||||
|
||||
If vlmcsd has been started by an internet superserver, -r1 works
|
||||
almost identically to -r2. The only exception occurs if you send
|
||||
more than one activation request over the same TCP connection.
|
||||
This is simply due to the fact that vlmcsd is started upon a
|
||||
more than one activation request over the same TCP connection.
|
||||
This is simply due to the fact that vlmcsd is started upon a
|
||||
connection request and does not stay in memory after servicing a
|
||||
KMS request. Consider using -r0 or -w, -0, -3 and -6 when start‐
|
||||
ing vlmcsd by an internet superserver.
|
||||
|
||||
-r2 behaves like most other KMS server emulators with random
|
||||
support and generates a new random ePID on every request. -r2
|
||||
should be treated as debugging option only because it allows
|
||||
-r2 behaves like most other KMS server emulators with random
|
||||
support and generates a new random ePID on every request. -r2
|
||||
should be treated as debugging option only because it allows
|
||||
very easy emulator detection.
|
||||
|
||||
|
||||
-C LCID
|
||||
Do not randomize the locale id part of the ePID and use LCID
|
||||
instead. The LCID must be specified as a decimal number, e.g.
|
||||
1049 for "Russian - Russia". This option has no effect if the
|
||||
ePID is not randomized at all, e.g. if it is selected from the
|
||||
Do not randomize the locale id part of the ePID and use LCID
|
||||
instead. The LCID must be specified as a decimal number, e.g.
|
||||
1049 for "Russian - Russia". This option has no effect if the
|
||||
ePID is not randomized at all, e.g. if it is selected from the
|
||||
command line or an ini file.
|
||||
|
||||
By default vlmcsd generates a valid locale id that is recognized
|
||||
by .NET Framework 4.0. This may lead to a locale id which is
|
||||
by .NET Framework 4.0. This may lead to a locale id which is
|
||||
unlikely to occur in your country, for instance 2155 for "Quecha
|
||||
- Ecuador". You may want to select the locale id of your country
|
||||
instead. See MSDN ⟨http://msdn.microsoft.com/en-us/goglobal/
|
||||
bb964664.aspx⟩ for a list of valid LCIDs. Please note that some
|
||||
bb964664.aspx⟩ for a list of valid LCIDs. Please note that some
|
||||
of them are not recognized by .NET Framework 4.0.
|
||||
|
||||
Most other KMS emulators use a fixed LCID of 1033 (English -
|
||||
Most other KMS emulators use a fixed LCID of 1033 (English -
|
||||
US). To achive the same behavior in vlmcsd use -C 1033.
|
||||
|
||||
|
||||
-K0, -K1, -K2 and -K3
|
||||
Sets the whitelisting level to determine which products vlmcsd
|
||||
Sets the whitelisting level to determine which products vlmcsd
|
||||
activates or refuses. The default is -K0.
|
||||
|
||||
-K0: activate all products with an unknown, retail or
|
||||
-K0: activate all products with an unknown, retail or
|
||||
beta/preview KMS ID.
|
||||
-K1: activate products with a retail or beta/preview KMS ID
|
||||
but refuse to activate products with an unknown KMS ID.
|
||||
-K2: activate products with an unknown KMS ID but refuse
|
||||
-K2: activate products with an unknown KMS ID but refuse
|
||||
products with a retail or beta/preview KMS ID.
|
||||
-K3: activate only products with a known volume license RTM
|
||||
KMS ID and refuse all others.
|
||||
|
||||
|
||||
The SKU ID is not checked. Like a genuine KMS server vlmcsd
|
||||
activates a product that has a random or unknown SKU ID. If you
|
||||
select -K1 or -K3, vlmcsd also checks the Application ID for
|
||||
correctness. If Microsoft introduces a new KMS ID for a new
|
||||
product, you cannot activate it if you used -K1 or -K3 until a
|
||||
The SKU ID is not checked. Like a genuine KMS server vlmcsd
|
||||
activates a product that has a random or unknown SKU ID. If you
|
||||
select -K1 or -K3, vlmcsd also checks the Application ID for
|
||||
correctness. If Microsoft introduces a new KMS ID for a new
|
||||
product, you cannot activate it if you used -K1 or -K3 until a
|
||||
new version of vlmcsd is available.
|
||||
|
||||
|
||||
-c0 and -c1
|
||||
-c1 causes vlmcsd to check if the client time differs no more
|
||||
-c1 causes vlmcsd to check if the client time differs no more
|
||||
than four hours from the system time. -c0 (the default) disables
|
||||
this check. -c1 is useful to prevent emulator detection. A
|
||||
client that tries to detect an emulator could simply send two
|
||||
subsequent request with two time stamps that differ more than
|
||||
this check. -c1 is useful to prevent emulator detection. A
|
||||
client that tries to detect an emulator could simply send two
|
||||
subsequent request with two time stamps that differ more than
|
||||
four hours from each other. If both requests succeed, the server
|
||||
is an emulator. If you specify -c1 on a system with no reliable
|
||||
time source, activations will fail. It is ok to set the correct
|
||||
is an emulator. If you specify -c1 on a system with no reliable
|
||||
time source, activations will fail. It is ok to set the correct
|
||||
system time after you started vlmcsd.
|
||||
|
||||
|
||||
-M0 and -M1
|
||||
Disables (-M0) or enables (-M1) maintaining a list of client
|
||||
machine IDs (CMIDs). The default is -M0. -M1 is useful to pre‐
|
||||
vent emulator detection. By maintaing a CMID list, vlmcsd
|
||||
Disables (-M0) or enables (-M1) maintaining a list of client
|
||||
machine IDs (CMIDs). The default is -M0. -M1 is useful to pre‐
|
||||
vent emulator detection. By maintaing a CMID list, vlmcsd
|
||||
reports current active clients exactly like a genuine KMS emula‐
|
||||
tor. This includes bug compatibility to the extent that you can
|
||||
permanently kill a genuine KMS emulator by sending an "over‐
|
||||
charge request" with a required client count of 376 or more and
|
||||
then request activation for 671 clients. vlmcsd can be reset
|
||||
from this condition by restarting it. If -M0 is used, vlmcsd
|
||||
tor. This includes bug compatibility to the extent that you can
|
||||
permanently kill a genuine KMS emulator by sending an "over‐
|
||||
charge request" with a required client count of 376 or more and
|
||||
then request activation for 671 clients. vlmcsd can be reset
|
||||
from this condition by restarting it. If -M0 is used, vlmcsd
|
||||
reports current active clients as good as possible. If no client
|
||||
sends an "overcharge request", it is not possible to detect vlm‐
|
||||
csd as an emulator with -M0. -M1 requires the allocation of a
|
||||
buffer that is about 50 kB in size. On hardware with few memory
|
||||
csd as an emulator with -M0. -M1 requires the allocation of a
|
||||
buffer that is about 50 kB in size. On hardware with few memory
|
||||
resources use it only if you really need it.
|
||||
|
||||
If you start vlmcsd from an internet superserver, -M1 cannot be
|
||||
used. Since vlmcsd exits after each activation, it cannot main‐
|
||||
If you start vlmcsd from an internet superserver, -M1 cannot be
|
||||
used. Since vlmcsd exits after each activation, it cannot main‐
|
||||
tain any state in memory.
|
||||
|
||||
|
||||
@ -501,82 +593,82 @@ OPTIONS
|
||||
These options are ignored if you do not also specify -M1. If you
|
||||
use -E0 (the default), vlmcsd starts up as a fully "charged" KMS
|
||||
server. Clients activate immediately. -E1 lets you start up vlm‐
|
||||
csd with an empty CMID list. Activation will start when the
|
||||
required minimum clients (25 for Windows Client OSses, 5 for
|
||||
Windows Server OSses and Office) have registered with the KMS
|
||||
server. As long as the minimum client count has not been
|
||||
csd with an empty CMID list. Activation will start when the
|
||||
required minimum clients (25 for Windows Client OSses, 5 for
|
||||
Windows Server OSses and Office) have registered with the KMS
|
||||
server. As long as the minimum client count has not been
|
||||
reached, clients end up in HRESULT 0xC004F038 "The count
|
||||
reported by your Key Management Service (KMS) is insufficient.
|
||||
Please contact your system administrator". You may use vlmcs(1)
|
||||
or another KMS client emulator to "charge" vlmcsd. -E1 does not
|
||||
improve emulator detection prevention. It's primary purpose is
|
||||
to help developers of KMS clients to test "charging" a KMS
|
||||
reported by your Key Management Service (KMS) is insufficient.
|
||||
Please contact your system administrator". You may use vlmcs(1)
|
||||
or another KMS client emulator to "charge" vlmcsd. -E1 does not
|
||||
improve emulator detection prevention. It's primary purpose is
|
||||
to help developers of KMS clients to test "charging" a KMS
|
||||
server.
|
||||
|
||||
|
||||
-R renewal-interval
|
||||
Instructs clients to renew activation every renewal-interval.
|
||||
Instructs clients to renew activation every renewal-interval.
|
||||
The renewal-interval is a number optionally immediately followed
|
||||
by a letter indicating the unit. Valid unit letters are s (sec‐
|
||||
by a letter indicating the unit. Valid unit letters are s (sec‐
|
||||
onds), m (minutes), h (hours), d (days) and w (weeks). If you do
|
||||
not specify a letter, minutes is assumed.
|
||||
|
||||
-R3d for instance instructs clients to renew activation every 3
|
||||
-R3d for instance instructs clients to renew activation every 3
|
||||
days. The default renewal-interval is 10080 (identical to 7d and
|
||||
1w).
|
||||
|
||||
Due to poor implementation of Microsofts KMS Client it cannot be
|
||||
guaranteed that activation is renewed on time as specfied by the
|
||||
-R option. Don't care about that. Renewal will happen well
|
||||
-R option. Don't care about that. Renewal will happen well
|
||||
before your activation expires (usually 180 days).
|
||||
|
||||
Even though you can specify seconds, the granularity of this
|
||||
option is 1 minute. Seconds are rounded down to the next multi‐
|
||||
Even though you can specify seconds, the granularity of this
|
||||
option is 1 minute. Seconds are rounded down to the next multi‐
|
||||
ple of 60.
|
||||
|
||||
|
||||
-A activation-interval
|
||||
Instructs clients to retry activation every activation-interval
|
||||
if it was unsuccessful, e.g. because it could not reach the
|
||||
server. The default is 120 (identical to 2h). activation-inter‐
|
||||
val follows the same syntax as renewal-interval in the -R
|
||||
Instructs clients to retry activation every activation-interval
|
||||
if it was unsuccessful, e.g. because it could not reach the
|
||||
server. The default is 120 (identical to 2h). activation-inter‐
|
||||
val follows the same syntax as renewal-interval in the -R
|
||||
option.
|
||||
|
||||
|
||||
-s Installs vlmcsd as a Windows service. This option only works
|
||||
with the native Windows version and Cygwin. Combine -s with
|
||||
other command line options. These will be in effect when you
|
||||
start the service. The service automatically starts when you
|
||||
reboot your machine. To start it manually, type "net start vlm‐
|
||||
-s Installs vlmcsd as a Windows service. This option only works
|
||||
with the native Windows version and Cygwin. Combine -s with
|
||||
other command line options. These will be in effect when you
|
||||
start the service. The service automatically starts when you
|
||||
reboot your machine. To start it manually, type "net start vlm‐
|
||||
csd".
|
||||
|
||||
If you use Cygwin, you must include your Cygwin system DLL
|
||||
directory (usually C:\Cygwin\bin or C:\Cygwin64\bin) into the
|
||||
If you use Cygwin, you must include your Cygwin system DLL
|
||||
directory (usually C:\Cygwin\bin or C:\Cygwin64\bin) into the
|
||||
PATH environment variable or the service will not start.
|
||||
|
||||
You can reinstall the service anytime using vlmcsd -s again,
|
||||
e.g. with a different command line. If the service is running,
|
||||
You can reinstall the service anytime using vlmcsd -s again,
|
||||
e.g. with a different command line. If the service is running,
|
||||
it will be restarted with the new command line.
|
||||
|
||||
When using -s the command line is checked for basic syntax
|
||||
When using -s the command line is checked for basic syntax
|
||||
errors only. For example "vlmcsd -s -L 1.2.3.4" reports no error
|
||||
but the service will not start if 1.2.3.4 is not an IP address
|
||||
but the service will not start if 1.2.3.4 is not an IP address
|
||||
on your system.
|
||||
|
||||
|
||||
-S Uninstalls the vlmcsd service. Works only with the native Win‐
|
||||
dows version and Cygwin. All other options will be ignored if
|
||||
-S Uninstalls the vlmcsd service. Works only with the native Win‐
|
||||
dows version and Cygwin. All other options will be ignored if
|
||||
you include -S in the command line.
|
||||
|
||||
|
||||
-U [domain\]username
|
||||
Can only be used together with -s. Starts the service as a dif‐
|
||||
ferent user than the local SYSTEM account. This is used to run
|
||||
the service under an account with low privileges. If you omit
|
||||
Can only be used together with -s. Starts the service as a dif‐
|
||||
ferent user than the local SYSTEM account. This is used to run
|
||||
the service under an account with low privileges. If you omit
|
||||
the domain, an account from the local computer will be used.
|
||||
|
||||
You may use "NT AUTHORITY\NetworkService". This is a pseudo user
|
||||
with low privileges. You may also use "NT AUTHORITY\LocalSer‐
|
||||
with low privileges. You may also use "NT AUTHORITY\LocalSer‐
|
||||
vice" which has more privileges but these are of no use for run‐
|
||||
ning vlmcsd.
|
||||
|
||||
@ -584,20 +676,20 @@ OPTIONS
|
||||
sion for your executable. "NT AUTHORITY\NetworkService" normally
|
||||
has no permission to run binaries from your home directory.
|
||||
|
||||
For your convenience you can use the special username "/l" as a
|
||||
For your convenience you can use the special username "/l" as a
|
||||
shortcut for "NT AUTHORITY\LocalService" and "/n" for "NT
|
||||
AUTHORITY\NetworkService". "vlmcsd -s -U /n" installs the ser‐
|
||||
AUTHORITY\NetworkService". "vlmcsd -s -U /n" installs the ser‐
|
||||
vice to run as "NT AUTHORITY\NetworkService".
|
||||
|
||||
|
||||
-W password
|
||||
Can only be used together with -s. Specifies a password for the
|
||||
corresponding username you use with -U. SYSTEM, "NT AUTHOR‐
|
||||
ITY\NetworkService", "NT AUTHORITY\LocalService" do not require
|
||||
Can only be used together with -s. Specifies a password for the
|
||||
corresponding username you use with -U. SYSTEM, "NT AUTHOR‐
|
||||
ITY\NetworkService", "NT AUTHORITY\LocalService" do not require
|
||||
a password.
|
||||
|
||||
If you specify a user with even lower privileges than "NT
|
||||
AUTHORITY\NetworkService", you must specify its password. You
|
||||
If you specify a user with even lower privileges than "NT
|
||||
AUTHORITY\NetworkService", you must specify its password. You
|
||||
also have to grant the "Log on as a service" right to that user.
|
||||
|
||||
|
||||
@ -606,53 +698,53 @@ SIGNALS
|
||||
|
||||
|
||||
SIGTERM, SIGINT
|
||||
These signals cause vlmcsd to exit gracefully. All global sema‐
|
||||
phores and shared memory pages will be released, the pid file
|
||||
will be unlinked (deleted) and a shutdown message will be
|
||||
These signals cause vlmcsd to exit gracefully. All global sema‐
|
||||
phores and shared memory pages will be released, the pid file
|
||||
will be unlinked (deleted) and a shutdown message will be
|
||||
logged.
|
||||
|
||||
|
||||
SIGHUP Causes vlmcsd to be restarted completely. This is useful if you
|
||||
started vlmcsd with an ini file. You can modify the ini file
|
||||
while vlmcsd is running and then sending SIGHUP, e.g. by typing
|
||||
"killall -SIGHUP vlmcsd" or "kill -SIGHUP `cat /var/run/vlm‐
|
||||
SIGHUP Causes vlmcsd to be restarted completely. This is useful if you
|
||||
started vlmcsd with an ini file. You can modify the ini file
|
||||
while vlmcsd is running and then sending SIGHUP, e.g. by typing
|
||||
"killall -SIGHUP vlmcsd" or "kill -SIGHUP `cat /var/run/vlm‐
|
||||
csd.pid`".
|
||||
|
||||
The SIGHUP handler has been implemented relatively simple. It is
|
||||
virtually the same as stopping vlmcsd and starting it again
|
||||
virtually the same as stopping vlmcsd and starting it again
|
||||
immediately with the following exceptions:
|
||||
|
||||
|
||||
— The new process does not get a new process id.
|
||||
|
||||
— If you used a pid file, it is not deleted and recreated
|
||||
— If you used a pid file, it is not deleted and recreated
|
||||
because the process id stays the same.
|
||||
|
||||
— If you used the 'user' and/or 'group' directive in an ini
|
||||
file these are ignored. This is because once you switched to
|
||||
— If you used the 'user' and/or 'group' directive in an ini
|
||||
file these are ignored. This is because once you switched to
|
||||
lower privileged users and groups, there is no way back. Any‐
|
||||
thing else would be a severe security flaw in the OS.
|
||||
|
||||
Signaling is not available in the native Windows version and in the
|
||||
Signaling is not available in the native Windows version and in the
|
||||
Cygwin version when it runs as Windows service.
|
||||
|
||||
|
||||
SUPPORTED OPERATING SYSTEMS
|
||||
vlmcsd compiles and runs on Linux, Windows (no Cygwin required but
|
||||
explicitly supported), Mac OS X, FreeBSD, NetBSD, OpenBSD, Dragonfly
|
||||
BSD, Minix, Solaris, OpenIndiana, Android and iOS. Other POSIX or
|
||||
unixoid OSses may work with unmodified sources or may require minor
|
||||
vlmcsd compiles and runs on Linux, Windows (no Cygwin required but
|
||||
explicitly supported), Mac OS X, FreeBSD, NetBSD, OpenBSD, Dragonfly
|
||||
BSD, Minix, Solaris, OpenIndiana, Android and iOS. Other POSIX or
|
||||
unixoid OSses may work with unmodified sources or may require minor
|
||||
porting efforts.
|
||||
|
||||
|
||||
SUPPORTED PRODUCTS
|
||||
vlmcsd can answer activation requests for the following products: Win‐
|
||||
vlmcsd can answer activation requests for the following products: Win‐
|
||||
dows Vista, Windows 7, Windows 8, Windows 8.1, Windows 10 (up to 1607),
|
||||
Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, Win‐
|
||||
dows Server 2012 R2, Windows Server 2016, Office 2010, Project 2010,
|
||||
Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, Win‐
|
||||
dows Server 2012 R2, Windows Server 2016, Office 2010, Project 2010,
|
||||
Visio 2010, Office 2013, Project 2013, Visio 2013, Office 2016, Project
|
||||
2016, Visio 2016. Newer version may work as long as the KMS protocol
|
||||
does not change. A complete list of fully supported products can be
|
||||
2016, Visio 2016. Newer version may work as long as the KMS protocol
|
||||
does not change. A complete list of fully supported products can be
|
||||
obtained using the -x option of vlmcs(1).
|
||||
|
||||
Office, Project and Visio must be volume license versions.
|
||||
@ -664,24 +756,24 @@ FILES
|
||||
|
||||
EXAMPLES
|
||||
vlmcsd -De
|
||||
Starts vlmcsd in foreground. Useful if you use it for the first
|
||||
time and want to see what's happening when a client requests
|
||||
Starts vlmcsd in foreground. Useful if you use it for the first
|
||||
time and want to see what's happening when a client requests
|
||||
activation.
|
||||
|
||||
|
||||
vlmcsd -l /var/log/vlmcsd.log
|
||||
Starts vlmcsd as a daemon and logs everything to /var/log/vlm‐
|
||||
Starts vlmcsd as a daemon and logs everything to /var/log/vlm‐
|
||||
csd.log.
|
||||
|
||||
|
||||
vlmcsd -L 192.168.1.17
|
||||
Starts vlmcsd as a daemon and listens on IP address 192.168.1.17
|
||||
only. This is useful for routers that have a public and a pri‐
|
||||
only. This is useful for routers that have a public and a pri‐
|
||||
vate IP address to prevent your KMS server from becoming public.
|
||||
|
||||
|
||||
vlmcsd -s -U /n -l C:\logs\vlmcsd.log
|
||||
Installs vlmcsd as a Windows service with low privileges and
|
||||
Installs vlmcsd as a Windows service with low privileges and
|
||||
logs everything to C:\logs\vlmcsd.log when the service is
|
||||
started with "net start vlmcsd".
|
||||
|
||||
@ -691,12 +783,12 @@ BUGS
|
||||
|
||||
|
||||
AUTHOR
|
||||
Written by crony12, Hotbird64 and vityan666. With contributions from
|
||||
Written by crony12, Hotbird64 and vityan666. With contributions from
|
||||
DougQaid.
|
||||
|
||||
|
||||
CREDITS
|
||||
Thanks to CODYQX4, deagles, eIcn, mikmik38, nosferati87, qad, Rati‐
|
||||
Thanks to CODYQX4, deagles, eIcn, mikmik38, nosferati87, qad, Rati‐
|
||||
borus, ...
|
||||
|
||||
|
||||
@ -705,4 +797,4 @@ SEE ALSO
|
||||
|
||||
|
||||
|
||||
Hotbird64 November 2016 VLMCSD(8)
|
||||
Hotbird64 January 2017 VLMCSD(8)
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!-- Creator : groff version 1.22.3 -->
|
||||
<!-- CreationDate: Mon Nov 28 01:28:23 2016 -->
|
||||
<!-- CreationDate: Thu Jan 19 21:29:26 2017 -->
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
||||
"http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
@ -273,6 +273,116 @@ subsequent <b>-L</b> statements that do not include an
|
||||
optional port. If you use <b>-P</b> and <b>-L</b>, <b>-P</b>
|
||||
must be specified before <b>-L</b>.</p>
|
||||
|
||||
<p style="margin-left:11%;"><b>-O</b>
|
||||
<i>vpn-adapter-name</i>[=<i>ipv4-address</i>][/<i>cidr-mask</i>][:<i>dhcp-lease-duration</i>]</p>
|
||||
|
||||
<p style="margin-left:22%;">Enables a compatible VPN
|
||||
adapter to create additional local IPv4 addresses (like
|
||||
127.0.0.1) that appear as remote IPv4 addresses to the
|
||||
system. This allows product activation using a local
|
||||
instance of vlmcsd. This feature is only available in
|
||||
Windows and Cygwin builds of vlmcsd since it is not of any
|
||||
use on other operating systems. Compatible VPN adapters are
|
||||
Tap-windows version 8.2 or higher (from OpenVPN) and the
|
||||
TeamViewer VPN adapter. There are two special
|
||||
<i>vpn-adapter-name</i>s. A single period (.) instructs
|
||||
vlmcsd to use the first available compatible VPN adapter. A
|
||||
single dash (-) disables the use of a VPN adapter if one has
|
||||
been configured in <b>vlmcsd.ini</b>(5). The
|
||||
<i>vpn-adapter-name</i> is <b>not</b> case-sensitive. If the
|
||||
<i>vpn-adapter-name</i> contains spaces (e.g. Ethernet 3),
|
||||
you must enclose it in quotes.</p>
|
||||
|
||||
<p style="margin-left:22%; margin-top: 1em">The default
|
||||
<i>ipv4-address</i> is 10.10.10.9 and the default
|
||||
<i>cidr-mask</i> is 30. If you are using the default values,
|
||||
your VPN adapter uses an IPv4 address of 10.10.10.9 and you
|
||||
can set your activation client to use the easy to remember
|
||||
address 10.10.10.10 (e.g. slmgr /skms 10.10.10.10 or cscript
|
||||
ospp.vbs /sethst:10.10.10.10).</p>
|
||||
|
||||
<p style="margin-left:22%; margin-top: 1em">The
|
||||
<i>dhcp-lease-duration</i> is a number optionally followed
|
||||
by s, m, h, d or w to indicate seconds, minutes, hours, days
|
||||
or weeks. The default <i>dhcp-lease-duration</i> is 1d (one
|
||||
day). It is normally not required to change this value.</p>
|
||||
|
||||
<p style="margin-left:22%; margin-top: 1em">It is advised
|
||||
not to manually configure your OpenVPN TAP or TeamViewer VPN
|
||||
adapter in "Network Connections". If you set the
|
||||
IPv4 configuration manually anyway, the IPv4 address and the
|
||||
subnet mask must match the <b>-O</b> parameter. It is safe
|
||||
leave the IPv4 configuration to automatic (DHCP). vlmcsd
|
||||
will wait up to four seconds for the DHCP configuration to
|
||||
complete before binding to and listenin on any
|
||||
interfaces.</p>
|
||||
|
||||
<p style="margin-left:22%; margin-top: 1em">You should be
|
||||
aware that only one program can use a VPN adapter at a time.
|
||||
If you use the TeamViewer VPN adapter for example, you will
|
||||
not be able to use the VPN feature of TeamViewer as long as
|
||||
vlmcsd is running. The same applies to OpenVPN TAP adapters
|
||||
that are in use by other programs (for example OpenVPN,
|
||||
QEMU, Ratiborus VM, aiccu, etc.). The best way to avoid
|
||||
conflicts is to install Tap-Windows from OpenVPN, cd to
|
||||
C:\Program Files\TAP-Windows\bin and run addtap.bat to
|
||||
install an additional TAP adapter. Go to "Network
|
||||
Connections" and rename the new adapter to
|
||||
"vlmcsd" and specify <b>-O vlmcsd</b> to use
|
||||
it.</p>
|
||||
|
||||
<p style="margin-left:22%; margin-top: 1em">Example: <b>-O
|
||||
"Ethernet 7"=192.168.123.1/24</b> (uses VPN
|
||||
adapter Ethernet 7 with IPv4 address 192.168.123.1 and have
|
||||
192.168.123.2 to 192.168.123.254 as additional local (but
|
||||
apparently remote) IPv4 addresses.</p>
|
||||
|
||||
<p style="margin-left:11%;"><b>-x0</b> and <b>-x1</b></p>
|
||||
|
||||
<p style="margin-left:22%;">Controls under what
|
||||
circumstances vlmcsd will exit. Using the default of
|
||||
<b>-x0</b> vlmcsd stays active as long as it can perform
|
||||
some useful operations. If vlmcsd is run by any form of a
|
||||
watchdog, e.g. NT service manager (Windows), systemd (Linux)
|
||||
or launchd (Mac OS / iOS), it may be desirable to end vlmcsd
|
||||
and let the watchdog restart it. This is especially true if
|
||||
some pre-requisites are not yet met but will be some time
|
||||
later, e.g. network is not yet fully setup.</p>
|
||||
|
||||
<p style="margin-left:22%; margin-top: 1em">By using
|
||||
<b>-x0</b> vlmcsd will</p>
|
||||
|
||||
<p style="margin-left:29%; margin-top: 1em">exit if none of
|
||||
the listening sockets specified with <b>-L</b> can be used.
|
||||
It continues if at least one socket can be setup for
|
||||
listening.</p>
|
||||
|
||||
<p style="margin-left:29%; margin-top: 1em">exit any TAP
|
||||
mirror thread (Windows version only) if there is an error
|
||||
condition while reading or writing from or to the VPN
|
||||
adapter but continue to work without utilizing a VPN
|
||||
adapter.</p>
|
||||
|
||||
<p style="margin-left:22%; margin-top: 1em">By using
|
||||
<b>-x1</b> vlmcsd will</p>
|
||||
|
||||
<p style="margin-left:29%; margin-top: 1em">exit if not all
|
||||
listening sockets specified with <b>-L</b> can be used.</p>
|
||||
|
||||
<p style="margin-left:29%; margin-top: 1em">exit completely
|
||||
if there is a problem with a VPN adapter it is using. This
|
||||
can happen for instance if the VPN adapter has been disabled
|
||||
using "Control Panel - Network - Adapter Settings"
|
||||
while vlmcsd is using it.</p>
|
||||
|
||||
<p style="margin-left:22%; margin-top: 1em">Please note
|
||||
that <b>-x1</b> is kind of a workaround option. While it may
|
||||
help under some circumstances, it is better to solve the
|
||||
problem at its origin, e.g. properly implementing
|
||||
dependencies in your startup script to ensure all network
|
||||
interfaces and the VPN adapter you will use are completely
|
||||
setup before you start vlmcsd.</p>
|
||||
|
||||
<p style="margin-left:11%;"><b>-F0</b> and <b>-F1</b></p>
|
||||
|
||||
<p style="margin-left:22%;">Allow (<b>-F1</b>) or disallow
|
||||
|
BIN
man/vlmcsd.8.pdf
BIN
man/vlmcsd.8.pdf
Binary file not shown.
@ -172,49 +172,141 @@ OPTIONS
|
||||
ified before -L.
|
||||
|
||||
|
||||
-O vpn-adapter-name[=ipv4-address][/cidr-mask][:dhcp-lease-duration]
|
||||
Enables a compatible VPN adapter to create additional local IPv4
|
||||
addresses (like 127.0.0.1) that appear as remote IPv4 addresses
|
||||
to the system. This allows product activation using a local
|
||||
instance of vlmcsd. This feature is only available in Windows
|
||||
and Cygwin builds of vlmcsd since it is not of any use on other
|
||||
operating systems. Compatible VPN adapters are Tap-windows ver‐
|
||||
sion 8.2 or higher (from OpenVPN) and the TeamViewer VPN
|
||||
adapter. There are two special vpn-adapter-names. A single
|
||||
period (.) instructs vlmcsd to use the first available compati‐
|
||||
ble VPN adapter. A single dash (-) disables the use of a VPN
|
||||
adapter if one has been configured in vlmcsd.ini(5). The vpn-
|
||||
adapter-name is not case-sensitive. If the vpn-adapter-name con‐
|
||||
tains spaces (e.g. Ethernet 3), you must enclose it in quotes.
|
||||
|
||||
The default ipv4-address is 10.10.10.9 and the default cidr-mask
|
||||
is 30. If you are using the default values, your VPN adapter
|
||||
uses an IPv4 address of 10.10.10.9 and you can set your activa‐
|
||||
tion client to use the easy to remember address 10.10.10.10
|
||||
(e.g. slmgr /skms 10.10.10.10 or cscript ospp.vbs
|
||||
/sethst:10.10.10.10).
|
||||
|
||||
The dhcp-lease-duration is a number optionally followed by s, m,
|
||||
h, d or w to indicate seconds, minutes, hours, days or weeks.
|
||||
The default dhcp-lease-duration is 1d (one day). It is normally
|
||||
not required to change this value.
|
||||
|
||||
It is advised not to manually configure your OpenVPN TAP or
|
||||
TeamViewer VPN adapter in "Network Connections". If you set the
|
||||
IPv4 configuration manually anyway, the IPv4 address and the
|
||||
subnet mask must match the -O parameter. It is safe leave the
|
||||
IPv4 configuration to automatic (DHCP). vlmcsd will wait up to
|
||||
four seconds for the DHCP configuration to complete before bind‐
|
||||
ing to and listenin on any interfaces.
|
||||
|
||||
You should be aware that only one program can use a VPN adapter
|
||||
at a time. If you use the TeamViewer VPN adapter for example,
|
||||
you will not be able to use the VPN feature of TeamViewer as
|
||||
long as vlmcsd is running. The same applies to OpenVPN TAP
|
||||
adapters that are in use by other programs (for example OpenVPN,
|
||||
QEMU, Ratiborus VM, aiccu, etc.). The best way to avoid con‐
|
||||
flicts is to install Tap-Windows from OpenVPN, cd to C:\Program
|
||||
Files\TAP-Windows\bin and run addtap.bat to install an addi‐
|
||||
tional TAP adapter. Go to "Network Connections" and rename the
|
||||
new adapter to "vlmcsd" and specify -O vlmcsd to use it.
|
||||
|
||||
Example: -O "Ethernet 7"=192.168.123.1/24 (uses VPN adapter Eth‐
|
||||
ernet 7 with IPv4 address 192.168.123.1 and have 192.168.123.2
|
||||
to 192.168.123.254 as additional local (but apparently remote)
|
||||
IPv4 addresses.
|
||||
|
||||
|
||||
-x0 and -x1
|
||||
Controls under what circumstances vlmcsd will exit. Using the
|
||||
default of -x0 vlmcsd stays active as long as it can perform
|
||||
some useful operations. If vlmcsd is run by any form of a watch‐
|
||||
dog, e.g. NT service manager (Windows), systemd (Linux) or
|
||||
launchd (Mac OS / iOS), it may be desirable to end vlmcsd and
|
||||
let the watchdog restart it. This is especially true if some
|
||||
pre-requisites are not yet met but will be some time later, e.g.
|
||||
network is not yet fully setup.
|
||||
|
||||
By using -x0 vlmcsd will
|
||||
|
||||
exit if none of the listening sockets specified with -L can
|
||||
be used. It continues if at least one socket can be setup
|
||||
for listening.
|
||||
|
||||
exit any TAP mirror thread (Windows version only) if there
|
||||
is an error condition while reading or writing from or to
|
||||
the VPN adapter but continue to work without utilizing a
|
||||
VPN adapter.
|
||||
|
||||
By using -x1 vlmcsd will
|
||||
|
||||
exit if not all listening sockets specified with -L can be
|
||||
used.
|
||||
|
||||
exit completely if there is a problem with a VPN adapter it
|
||||
is using. This can happen for instance if the VPN adapter
|
||||
has been disabled using "Control Panel - Network - Adapter
|
||||
Settings" while vlmcsd is using it.
|
||||
|
||||
|
||||
Please note that -x1 is kind of a workaround option. While it
|
||||
may help under some circumstances, it is better to solve the
|
||||
problem at its origin, e.g. properly implementing dependencies
|
||||
in your startup script to ensure all network interfaces and the
|
||||
VPN adapter you will use are completely setup before you start
|
||||
vlmcsd.
|
||||
|
||||
|
||||
-F0 and -F1
|
||||
Allow (-F1) or disallow (-F0) binding to IP addresses that are
|
||||
Allow (-F1) or disallow (-F0) binding to IP addresses that are
|
||||
currently not configured on your system. The default is -F0. -F1
|
||||
allows you to bind to an IP address that may be configured after
|
||||
you started vlmcsd. vlmcsd will listen on that address as soon
|
||||
as it becomes available. This feature is only available under
|
||||
Linux (IPv4 and IPv6) and FreeBSD (IPv4 only). FreeBSD allows
|
||||
this feature only for the root user (more correctly: processes
|
||||
that have the PRIV_NETINET_BINDANY privilege). Linux does not
|
||||
you started vlmcsd. vlmcsd will listen on that address as soon
|
||||
as it becomes available. This feature is only available under
|
||||
Linux (IPv4 and IPv6) and FreeBSD (IPv4 only). FreeBSD allows
|
||||
this feature only for the root user (more correctly: processes
|
||||
that have the PRIV_NETINET_BINDANY privilege). Linux does not
|
||||
require a capability for this.
|
||||
|
||||
|
||||
-t seconds
|
||||
Timeout the TCP connection with the client after seconds sec‐
|
||||
onds. After sending an activation request. RPC keeps the TCP
|
||||
Timeout the TCP connection with the client after seconds sec‐
|
||||
onds. After sending an activation request. RPC keeps the TCP
|
||||
connection for a while. The default is 30 seconds. You may spec‐
|
||||
ify a shorter period to free ressources on your device faster.
|
||||
This is useful for devices with limited main memory or if you
|
||||
ify a shorter period to free ressources on your device faster.
|
||||
This is useful for devices with limited main memory or if you
|
||||
used -m to limit the concurrent clients that may request activa‐
|
||||
tion. Microsoft RPC clients disconnect after 30 seconds by
|
||||
default. Setting seconds to a greater value does not make much
|
||||
tion. Microsoft RPC clients disconnect after 30 seconds by
|
||||
default. Setting seconds to a greater value does not make much
|
||||
sense.
|
||||
|
||||
|
||||
-m concurrent-clients
|
||||
Limit the number of clients that will be handled concurrently.
|
||||
Limit the number of clients that will be handled concurrently.
|
||||
This is useful for devices with limited ressources or if you are
|
||||
experiencing DoS attacks that spawn thousands of threads or
|
||||
forked processes. If additional clients connect to vlmcsd, they
|
||||
need to wait until another client disconnects. If you set con‐
|
||||
experiencing DoS attacks that spawn thousands of threads or
|
||||
forked processes. If additional clients connect to vlmcsd, they
|
||||
need to wait until another client disconnects. If you set con‐
|
||||
current-clients to a small value ( <10 ), you should also select
|
||||
a reasonable timeout of 2 or 3 seconds with -t. The default is
|
||||
a reasonable timeout of 2 or 3 seconds with -t. The default is
|
||||
no limit.
|
||||
|
||||
|
||||
-d Disconnect each client after processing one activation request.
|
||||
This is a direct violation of DCE RPC but may help if you
|
||||
receive malicous fake RPC requests that block your threads or
|
||||
forked processes. Some other KMS emulators (e.g. py-kms) behave
|
||||
-d Disconnect each client after processing one activation request.
|
||||
This is a direct violation of DCE RPC but may help if you
|
||||
receive malicous fake RPC requests that block your threads or
|
||||
forked processes. Some other KMS emulators (e.g. py-kms) behave
|
||||
this way.
|
||||
|
||||
|
||||
-k Do not disconnect clients after processing an activation
|
||||
-k Do not disconnect clients after processing an activation
|
||||
request. This selects the default behavior. -k is useful only if
|
||||
you used an ini file (see vlmcsd.ini(5) and -i). If the ini file
|
||||
contains the line "DisconnectClientsImmediately = true", you can
|
||||
@ -222,135 +314,135 @@ OPTIONS
|
||||
|
||||
|
||||
-N0 and -N1
|
||||
Disables (-N0) or enables (-N1) the use of the NDR64 transfer
|
||||
syntax in the RPC protocol. Unlike Microsoft vlmcsd supports
|
||||
Disables (-N0) or enables (-N1) the use of the NDR64 transfer
|
||||
syntax in the RPC protocol. Unlike Microsoft vlmcsd supports
|
||||
NDR64 on 32-bit operating systems. Microsoft introduced NDR64 in
|
||||
Windows Vista but their KMS servers started using it with Win‐
|
||||
dows 8. Thus if you choose random ePIDs, vlmcsd will select
|
||||
ePIDs with build numbers 9200 and 9600 if you enable NDR64 and
|
||||
Windows Vista but their KMS servers started using it with Win‐
|
||||
dows 8. Thus if you choose random ePIDs, vlmcsd will select
|
||||
ePIDs with build numbers 9200 and 9600 if you enable NDR64 and
|
||||
build numbers 6002 and 7601 if you disable NDR64. The default is
|
||||
to enable NDR64.
|
||||
|
||||
|
||||
-B0 and -B1
|
||||
Disables (-B0) or enables (-B1) bind time feature negotiation
|
||||
Disables (-B0) or enables (-B1) bind time feature negotiation
|
||||
(BTFN) in the RPC protocol. All Windows operating systems start‐
|
||||
ing with Vista support BTFN and try to negotiate it when initi‐
|
||||
ing with Vista support BTFN and try to negotiate it when initi‐
|
||||
ating an RPC connection. Thus consider turning it off as a debug
|
||||
/ troubleshooting feature only. Some older firewalls that selec‐
|
||||
tively block or redirect RPC traffic may get confused when they
|
||||
tively block or redirect RPC traffic may get confused when they
|
||||
detect NDR64 or BTFN.
|
||||
|
||||
|
||||
-l filename
|
||||
Use filename as a log file. The log file records all activations
|
||||
with IP address, Windows workstation name (no reverse DNS
|
||||
lookup), activated product, KMS protocol, time and date. If you
|
||||
with IP address, Windows workstation name (no reverse DNS
|
||||
lookup), activated product, KMS protocol, time and date. If you
|
||||
do not specify a log file, no log is created. For a live view of
|
||||
the log file type tail -f file.
|
||||
|
||||
If you use the special filename "syslog", vlmcsd uses syslog(3)
|
||||
for logging. If your system has no syslog service (/dev/log)
|
||||
installed, logging output will go to /dev/console. Syslog log‐
|
||||
ging is not available in the native Windows version. The Cygwin
|
||||
If you use the special filename "syslog", vlmcsd uses syslog(3)
|
||||
for logging. If your system has no syslog service (/dev/log)
|
||||
installed, logging output will go to /dev/console. Syslog log‐
|
||||
ging is not available in the native Windows version. The Cygwin
|
||||
version does support syslog logging.
|
||||
|
||||
|
||||
-T0 and -T1
|
||||
Disable (-T0) or enable (-T1) the inclusion of date and time in
|
||||
each line of the log. The default is -T1. -T0 is useful if you
|
||||
log to stdout(3) which is redirected to another logging mecha‐
|
||||
nism that already includes date and time in its output, for
|
||||
instance systemd-journald(8). If you log to syslog(3), -T1 is
|
||||
ignored and date and time will never be included in the output
|
||||
Disable (-T0) or enable (-T1) the inclusion of date and time in
|
||||
each line of the log. The default is -T1. -T0 is useful if you
|
||||
log to stdout(3) which is redirected to another logging mecha‐
|
||||
nism that already includes date and time in its output, for
|
||||
instance systemd-journald(8). If you log to syslog(3), -T1 is
|
||||
ignored and date and time will never be included in the output
|
||||
sent to syslog(3).
|
||||
|
||||
|
||||
-D Normally vlmcsd daemonizes and runs in background (except the
|
||||
native Windows version). If -D is specified, vlmcsd does not
|
||||
-D Normally vlmcsd daemonizes and runs in background (except the
|
||||
native Windows version). If -D is specified, vlmcsd does not
|
||||
daemonize and runs in foreground. This is useful for testing and
|
||||
allows you to simply press <Ctrl-C> to exit vlmcsd.
|
||||
|
||||
The native Windows version never daemonizes and always behaves
|
||||
The native Windows version never daemonizes and always behaves
|
||||
as if -D had been specified. You may want to install vlmcsd as a
|
||||
service instead. See -s.
|
||||
|
||||
|
||||
-e If specified, vlmcsd ignores -l and writes all logging output to
|
||||
stdout(3). This is mainly useful for testing and debugging and
|
||||
stdout(3). This is mainly useful for testing and debugging and
|
||||
often combined with -D.
|
||||
|
||||
|
||||
-v Use verbose logging. Logs every parameter of the base request
|
||||
and the base response. It also logs the HWID of the KMS server
|
||||
if KMS protocol version 6 is used. This option is mainly for
|
||||
debugging purposes. It only has an effect if some form of log‐
|
||||
ging is used. Thus -v does not make sense if not used with -l,
|
||||
-v Use verbose logging. Logs every parameter of the base request
|
||||
and the base response. It also logs the HWID of the KMS server
|
||||
if KMS protocol version 6 is used. This option is mainly for
|
||||
debugging purposes. It only has an effect if some form of log‐
|
||||
ging is used. Thus -v does not make sense if not used with -l,
|
||||
-e or -f.
|
||||
|
||||
|
||||
-q Do not use verbose logging. This is actually the default behav‐
|
||||
-q Do not use verbose logging. This is actually the default behav‐
|
||||
ior. It only makes sense if you use vlmcsd with an ini file (see
|
||||
-i and vlmcsd.ini(5)). If the ini file contains the line
|
||||
-i and vlmcsd.ini(5)). If the ini file contains the line
|
||||
"LogVerbose = true" you can use -q to restore the default behav‐
|
||||
ior.
|
||||
|
||||
|
||||
-p filename
|
||||
Create pid file filename. This has nothing to do with KMS ePIDs.
|
||||
A pid file is a file where vlmcsd writes its own process id.
|
||||
This is used by standard init scripts (typically found in
|
||||
A pid file is a file where vlmcsd writes its own process id.
|
||||
This is used by standard init scripts (typically found in
|
||||
/etc/init.d). The default is not to write a pid file.
|
||||
|
||||
|
||||
-u user and -g group
|
||||
Causes vlmcsd to run in the specified user and group security
|
||||
context. The main purpose for this is to drop root privileges
|
||||
after it has been started from the root account. To use this
|
||||
feature from cygwin you must run cyglsa-config and the account
|
||||
from which vlmcsd is started must have the rights "Act as part
|
||||
of the operating system" and "Replace a process level token".
|
||||
Causes vlmcsd to run in the specified user and group security
|
||||
context. The main purpose for this is to drop root privileges
|
||||
after it has been started from the root account. To use this
|
||||
feature from cygwin you must run cyglsa-config and the account
|
||||
from which vlmcsd is started must have the rights "Act as part
|
||||
of the operating system" and "Replace a process level token".
|
||||
The native Windows version does not support these options.
|
||||
|
||||
The actual security context switch is performed after the TCP
|
||||
sockets have been created. This allows you to use privileged
|
||||
The actual security context switch is performed after the TCP
|
||||
sockets have been created. This allows you to use privileged
|
||||
ports (< 1024) when you start vlmcsd from the root account.
|
||||
|
||||
However if you use an ini, pid or log file, you must ensure that
|
||||
the unprivileged user has access to these files. You can always
|
||||
log to syslog(3) from an unprivileged account on most platforms
|
||||
the unprivileged user has access to these files. You can always
|
||||
log to syslog(3) from an unprivileged account on most platforms
|
||||
(see -l).
|
||||
|
||||
|
||||
-w ePID
|
||||
Use ePID as Windows ePID. If specified, -r is disregarded for
|
||||
Use ePID as Windows ePID. If specified, -r is disregarded for
|
||||
Windows.
|
||||
|
||||
|
||||
-0 ePID
|
||||
Use ePID as Office 2010 ePID (including Project and Visio). If
|
||||
Use ePID as Office 2010 ePID (including Project and Visio). If
|
||||
specified, -r is disregarded for Office 2010.
|
||||
|
||||
|
||||
-3 ePID
|
||||
Use ePID as Office 2013 ePID (including Project and Visio). If
|
||||
Use ePID as Office 2013 ePID (including Project and Visio). If
|
||||
specified, -r is disregarded for Office 2013.
|
||||
|
||||
|
||||
-6 ePID
|
||||
Use ePID as Office 2016 ePID (including Project and Visio). If
|
||||
Use ePID as Office 2016 ePID (including Project and Visio). If
|
||||
specified, -r is disregarded for Office 2016.
|
||||
|
||||
|
||||
-H HwId
|
||||
Use HwId for all products. All HWIDs in the ini file (see -i)
|
||||
Use HwId for all products. All HWIDs in the ini file (see -i)
|
||||
will not be used. In an ini file you can specify a seperate HWID
|
||||
for each application-guid. This is not possible when entering a
|
||||
for each application-guid. This is not possible when entering a
|
||||
HWID from the command line.
|
||||
|
||||
HwId must be specified as 16 hex digits that are interpreted as
|
||||
a series of 8 bytes (big endian). Any character that is not a
|
||||
hex digit will be ignored. This is for better readability. The
|
||||
HwId must be specified as 16 hex digits that are interpreted as
|
||||
a series of 8 bytes (big endian). Any character that is not a
|
||||
hex digit will be ignored. This is for better readability. The
|
||||
following commands are identical:
|
||||
|
||||
vlmcsd -H 0123456789ABCDEF
|
||||
@ -359,26 +451,26 @@ OPTIONS
|
||||
|
||||
|
||||
-i filename
|
||||
Use configuration file (aka ini file) filename. Most configura‐
|
||||
Use configuration file (aka ini file) filename. Most configura‐
|
||||
tion parameters can be set either via the command line or an ini
|
||||
file. The command line always has precedence over configuration
|
||||
items in the ini file. See vlmcsd.ini(5) for the format of the
|
||||
file. The command line always has precedence over configuration
|
||||
items in the ini file. See vlmcsd.ini(5) for the format of the
|
||||
configuration file.
|
||||
|
||||
If vlmcsd has been compiled to use a default configuration file
|
||||
(often /etc/vlmcsd.ini), you may use -i- to ignore the default
|
||||
If vlmcsd has been compiled to use a default configuration file
|
||||
(often /etc/vlmcsd.ini), you may use -i- to ignore the default
|
||||
configuration file.
|
||||
|
||||
|
||||
-j filename
|
||||
Use KMS data file filename. By default vlmcsd only contains the
|
||||
minimum product data that is required to perform all operations
|
||||
correctly. You may use a more complete KMS data file that con‐
|
||||
tains all detailed product names. This is especially useful if
|
||||
Use KMS data file filename. By default vlmcsd only contains the
|
||||
minimum product data that is required to perform all operations
|
||||
correctly. You may use a more complete KMS data file that con‐
|
||||
tains all detailed product names. This is especially useful if
|
||||
you are logging KMS requests. If you don't log, there is no need
|
||||
to load an external KMS data file.
|
||||
|
||||
If vlmcsd has been compiled to use a default KMS data file, you
|
||||
If vlmcsd has been compiled to use a default KMS data file, you
|
||||
may use -j- to ignore the default configuration file.
|
||||
|
||||
|
||||
@ -388,112 +480,112 @@ OPTIONS
|
||||
- you did not sprecify an ePID in the command line and
|
||||
- you haven't used -i or
|
||||
- the file specified by -i cannot be opened or
|
||||
- the file specified by -i does not contain an ePID for the KMS
|
||||
- the file specified by -i does not contain an ePID for the KMS
|
||||
request
|
||||
|
||||
-r0 means there are no random ePIDs. vlmcsd simply issues
|
||||
default ePIDs that are built into the binary at compile time.
|
||||
Pro: behaves like real KMS server that also always issues the
|
||||
same ePID. Con: Microsoft may start blacklisting again and the
|
||||
-r0 means there are no random ePIDs. vlmcsd simply issues
|
||||
default ePIDs that are built into the binary at compile time.
|
||||
Pro: behaves like real KMS server that also always issues the
|
||||
same ePID. Con: Microsoft may start blacklisting again and the
|
||||
default ePID may not work any longer.
|
||||
|
||||
-r1 instructs vlmcsd to generate random ePIDs when the program
|
||||
-r1 instructs vlmcsd to generate random ePIDs when the program
|
||||
starts or receives a SIGHUP signal and uses these ePIDs until it
|
||||
is stopped or receives another SIGHUP. Most other KMS emulators
|
||||
generate a new ePID on every KMS request. This is easily
|
||||
is stopped or receives another SIGHUP. Most other KMS emulators
|
||||
generate a new ePID on every KMS request. This is easily
|
||||
detectable. Microsoft could just modify sppsvc.exe in a way that
|
||||
it always sends two identical KMS requests in two RPC requests
|
||||
but over the same TCP connection. If both KMS responses contain
|
||||
the different ePIDs, the KMS server is not genuine. -r1 is the
|
||||
default mode. -r1 also ensures that all three ePIDs (Windows,
|
||||
Office 2010 and Office 2013) use the same OS build number and
|
||||
it always sends two identical KMS requests in two RPC requests
|
||||
but over the same TCP connection. If both KMS responses contain
|
||||
the different ePIDs, the KMS server is not genuine. -r1 is the
|
||||
default mode. -r1 also ensures that all three ePIDs (Windows,
|
||||
Office 2010 and Office 2013) use the same OS build number and
|
||||
LCID (language id).
|
||||
|
||||
If vlmcsd has been started by an internet superserver, -r1 works
|
||||
almost identically to -r2. The only exception occurs if you send
|
||||
more than one activation request over the same TCP connection.
|
||||
This is simply due to the fact that vlmcsd is started upon a
|
||||
more than one activation request over the same TCP connection.
|
||||
This is simply due to the fact that vlmcsd is started upon a
|
||||
connection request and does not stay in memory after servicing a
|
||||
KMS request. Consider using -r0 or -w, -0, -3 and -6 when start‐
|
||||
ing vlmcsd by an internet superserver.
|
||||
|
||||
-r2 behaves like most other KMS server emulators with random
|
||||
support and generates a new random ePID on every request. -r2
|
||||
should be treated as debugging option only because it allows
|
||||
-r2 behaves like most other KMS server emulators with random
|
||||
support and generates a new random ePID on every request. -r2
|
||||
should be treated as debugging option only because it allows
|
||||
very easy emulator detection.
|
||||
|
||||
|
||||
-C LCID
|
||||
Do not randomize the locale id part of the ePID and use LCID
|
||||
instead. The LCID must be specified as a decimal number, e.g.
|
||||
1049 for "Russian - Russia". This option has no effect if the
|
||||
ePID is not randomized at all, e.g. if it is selected from the
|
||||
Do not randomize the locale id part of the ePID and use LCID
|
||||
instead. The LCID must be specified as a decimal number, e.g.
|
||||
1049 for "Russian - Russia". This option has no effect if the
|
||||
ePID is not randomized at all, e.g. if it is selected from the
|
||||
command line or an ini file.
|
||||
|
||||
By default vlmcsd generates a valid locale id that is recognized
|
||||
by .NET Framework 4.0. This may lead to a locale id which is
|
||||
by .NET Framework 4.0. This may lead to a locale id which is
|
||||
unlikely to occur in your country, for instance 2155 for "Quecha
|
||||
- Ecuador". You may want to select the locale id of your country
|
||||
instead. See MSDN ⟨http://msdn.microsoft.com/en-us/goglobal/
|
||||
bb964664.aspx⟩ for a list of valid LCIDs. Please note that some
|
||||
bb964664.aspx⟩ for a list of valid LCIDs. Please note that some
|
||||
of them are not recognized by .NET Framework 4.0.
|
||||
|
||||
Most other KMS emulators use a fixed LCID of 1033 (English -
|
||||
Most other KMS emulators use a fixed LCID of 1033 (English -
|
||||
US). To achive the same behavior in vlmcsd use -C 1033.
|
||||
|
||||
|
||||
-K0, -K1, -K2 and -K3
|
||||
Sets the whitelisting level to determine which products vlmcsd
|
||||
Sets the whitelisting level to determine which products vlmcsd
|
||||
activates or refuses. The default is -K0.
|
||||
|
||||
-K0: activate all products with an unknown, retail or
|
||||
-K0: activate all products with an unknown, retail or
|
||||
beta/preview KMS ID.
|
||||
-K1: activate products with a retail or beta/preview KMS ID
|
||||
but refuse to activate products with an unknown KMS ID.
|
||||
-K2: activate products with an unknown KMS ID but refuse
|
||||
-K2: activate products with an unknown KMS ID but refuse
|
||||
products with a retail or beta/preview KMS ID.
|
||||
-K3: activate only products with a known volume license RTM
|
||||
KMS ID and refuse all others.
|
||||
|
||||
|
||||
The SKU ID is not checked. Like a genuine KMS server vlmcsd
|
||||
activates a product that has a random or unknown SKU ID. If you
|
||||
select -K1 or -K3, vlmcsd also checks the Application ID for
|
||||
correctness. If Microsoft introduces a new KMS ID for a new
|
||||
product, you cannot activate it if you used -K1 or -K3 until a
|
||||
The SKU ID is not checked. Like a genuine KMS server vlmcsd
|
||||
activates a product that has a random or unknown SKU ID. If you
|
||||
select -K1 or -K3, vlmcsd also checks the Application ID for
|
||||
correctness. If Microsoft introduces a new KMS ID for a new
|
||||
product, you cannot activate it if you used -K1 or -K3 until a
|
||||
new version of vlmcsd is available.
|
||||
|
||||
|
||||
-c0 and -c1
|
||||
-c1 causes vlmcsd to check if the client time differs no more
|
||||
-c1 causes vlmcsd to check if the client time differs no more
|
||||
than four hours from the system time. -c0 (the default) disables
|
||||
this check. -c1 is useful to prevent emulator detection. A
|
||||
client that tries to detect an emulator could simply send two
|
||||
subsequent request with two time stamps that differ more than
|
||||
this check. -c1 is useful to prevent emulator detection. A
|
||||
client that tries to detect an emulator could simply send two
|
||||
subsequent request with two time stamps that differ more than
|
||||
four hours from each other. If both requests succeed, the server
|
||||
is an emulator. If you specify -c1 on a system with no reliable
|
||||
time source, activations will fail. It is ok to set the correct
|
||||
is an emulator. If you specify -c1 on a system with no reliable
|
||||
time source, activations will fail. It is ok to set the correct
|
||||
system time after you started vlmcsd.
|
||||
|
||||
|
||||
-M0 and -M1
|
||||
Disables (-M0) or enables (-M1) maintaining a list of client
|
||||
machine IDs (CMIDs). The default is -M0. -M1 is useful to pre‐
|
||||
vent emulator detection. By maintaing a CMID list, vlmcsd
|
||||
Disables (-M0) or enables (-M1) maintaining a list of client
|
||||
machine IDs (CMIDs). The default is -M0. -M1 is useful to pre‐
|
||||
vent emulator detection. By maintaing a CMID list, vlmcsd
|
||||
reports current active clients exactly like a genuine KMS emula‐
|
||||
tor. This includes bug compatibility to the extent that you can
|
||||
permanently kill a genuine KMS emulator by sending an "over‐
|
||||
charge request" with a required client count of 376 or more and
|
||||
then request activation for 671 clients. vlmcsd can be reset
|
||||
from this condition by restarting it. If -M0 is used, vlmcsd
|
||||
tor. This includes bug compatibility to the extent that you can
|
||||
permanently kill a genuine KMS emulator by sending an "over‐
|
||||
charge request" with a required client count of 376 or more and
|
||||
then request activation for 671 clients. vlmcsd can be reset
|
||||
from this condition by restarting it. If -M0 is used, vlmcsd
|
||||
reports current active clients as good as possible. If no client
|
||||
sends an "overcharge request", it is not possible to detect vlm‐
|
||||
csd as an emulator with -M0. -M1 requires the allocation of a
|
||||
buffer that is about 50 kB in size. On hardware with few memory
|
||||
csd as an emulator with -M0. -M1 requires the allocation of a
|
||||
buffer that is about 50 kB in size. On hardware with few memory
|
||||
resources use it only if you really need it.
|
||||
|
||||
If you start vlmcsd from an internet superserver, -M1 cannot be
|
||||
used. Since vlmcsd exits after each activation, it cannot main‐
|
||||
If you start vlmcsd from an internet superserver, -M1 cannot be
|
||||
used. Since vlmcsd exits after each activation, it cannot main‐
|
||||
tain any state in memory.
|
||||
|
||||
|
||||
@ -501,82 +593,82 @@ OPTIONS
|
||||
These options are ignored if you do not also specify -M1. If you
|
||||
use -E0 (the default), vlmcsd starts up as a fully "charged" KMS
|
||||
server. Clients activate immediately. -E1 lets you start up vlm‐
|
||||
csd with an empty CMID list. Activation will start when the
|
||||
required minimum clients (25 for Windows Client OSses, 5 for
|
||||
Windows Server OSses and Office) have registered with the KMS
|
||||
server. As long as the minimum client count has not been
|
||||
csd with an empty CMID list. Activation will start when the
|
||||
required minimum clients (25 for Windows Client OSses, 5 for
|
||||
Windows Server OSses and Office) have registered with the KMS
|
||||
server. As long as the minimum client count has not been
|
||||
reached, clients end up in HRESULT 0xC004F038 "The count
|
||||
reported by your Key Management Service (KMS) is insufficient.
|
||||
Please contact your system administrator". You may use vlmcs(1)
|
||||
or another KMS client emulator to "charge" vlmcsd. -E1 does not
|
||||
improve emulator detection prevention. It's primary purpose is
|
||||
to help developers of KMS clients to test "charging" a KMS
|
||||
reported by your Key Management Service (KMS) is insufficient.
|
||||
Please contact your system administrator". You may use vlmcs(1)
|
||||
or another KMS client emulator to "charge" vlmcsd. -E1 does not
|
||||
improve emulator detection prevention. It's primary purpose is
|
||||
to help developers of KMS clients to test "charging" a KMS
|
||||
server.
|
||||
|
||||
|
||||
-R renewal-interval
|
||||
Instructs clients to renew activation every renewal-interval.
|
||||
Instructs clients to renew activation every renewal-interval.
|
||||
The renewal-interval is a number optionally immediately followed
|
||||
by a letter indicating the unit. Valid unit letters are s (sec‐
|
||||
by a letter indicating the unit. Valid unit letters are s (sec‐
|
||||
onds), m (minutes), h (hours), d (days) and w (weeks). If you do
|
||||
not specify a letter, minutes is assumed.
|
||||
|
||||
-R3d for instance instructs clients to renew activation every 3
|
||||
-R3d for instance instructs clients to renew activation every 3
|
||||
days. The default renewal-interval is 10080 (identical to 7d and
|
||||
1w).
|
||||
|
||||
Due to poor implementation of Microsofts KMS Client it cannot be
|
||||
guaranteed that activation is renewed on time as specfied by the
|
||||
-R option. Don't care about that. Renewal will happen well
|
||||
-R option. Don't care about that. Renewal will happen well
|
||||
before your activation expires (usually 180 days).
|
||||
|
||||
Even though you can specify seconds, the granularity of this
|
||||
option is 1 minute. Seconds are rounded down to the next multi‐
|
||||
Even though you can specify seconds, the granularity of this
|
||||
option is 1 minute. Seconds are rounded down to the next multi‐
|
||||
ple of 60.
|
||||
|
||||
|
||||
-A activation-interval
|
||||
Instructs clients to retry activation every activation-interval
|
||||
if it was unsuccessful, e.g. because it could not reach the
|
||||
server. The default is 120 (identical to 2h). activation-inter‐
|
||||
val follows the same syntax as renewal-interval in the -R
|
||||
Instructs clients to retry activation every activation-interval
|
||||
if it was unsuccessful, e.g. because it could not reach the
|
||||
server. The default is 120 (identical to 2h). activation-inter‐
|
||||
val follows the same syntax as renewal-interval in the -R
|
||||
option.
|
||||
|
||||
|
||||
-s Installs vlmcsd as a Windows service. This option only works
|
||||
with the native Windows version and Cygwin. Combine -s with
|
||||
other command line options. These will be in effect when you
|
||||
start the service. The service automatically starts when you
|
||||
reboot your machine. To start it manually, type "net start vlm‐
|
||||
-s Installs vlmcsd as a Windows service. This option only works
|
||||
with the native Windows version and Cygwin. Combine -s with
|
||||
other command line options. These will be in effect when you
|
||||
start the service. The service automatically starts when you
|
||||
reboot your machine. To start it manually, type "net start vlm‐
|
||||
csd".
|
||||
|
||||
If you use Cygwin, you must include your Cygwin system DLL
|
||||
directory (usually C:\Cygwin\bin or C:\Cygwin64\bin) into the
|
||||
If you use Cygwin, you must include your Cygwin system DLL
|
||||
directory (usually C:\Cygwin\bin or C:\Cygwin64\bin) into the
|
||||
PATH environment variable or the service will not start.
|
||||
|
||||
You can reinstall the service anytime using vlmcsd -s again,
|
||||
e.g. with a different command line. If the service is running,
|
||||
You can reinstall the service anytime using vlmcsd -s again,
|
||||
e.g. with a different command line. If the service is running,
|
||||
it will be restarted with the new command line.
|
||||
|
||||
When using -s the command line is checked for basic syntax
|
||||
When using -s the command line is checked for basic syntax
|
||||
errors only. For example "vlmcsd -s -L 1.2.3.4" reports no error
|
||||
but the service will not start if 1.2.3.4 is not an IP address
|
||||
but the service will not start if 1.2.3.4 is not an IP address
|
||||
on your system.
|
||||
|
||||
|
||||
-S Uninstalls the vlmcsd service. Works only with the native Win‐
|
||||
dows version and Cygwin. All other options will be ignored if
|
||||
-S Uninstalls the vlmcsd service. Works only with the native Win‐
|
||||
dows version and Cygwin. All other options will be ignored if
|
||||
you include -S in the command line.
|
||||
|
||||
|
||||
-U [domain\]username
|
||||
Can only be used together with -s. Starts the service as a dif‐
|
||||
ferent user than the local SYSTEM account. This is used to run
|
||||
the service under an account with low privileges. If you omit
|
||||
Can only be used together with -s. Starts the service as a dif‐
|
||||
ferent user than the local SYSTEM account. This is used to run
|
||||
the service under an account with low privileges. If you omit
|
||||
the domain, an account from the local computer will be used.
|
||||
|
||||
You may use "NT AUTHORITY\NetworkService". This is a pseudo user
|
||||
with low privileges. You may also use "NT AUTHORITY\LocalSer‐
|
||||
with low privileges. You may also use "NT AUTHORITY\LocalSer‐
|
||||
vice" which has more privileges but these are of no use for run‐
|
||||
ning vlmcsd.
|
||||
|
||||
@ -584,20 +676,20 @@ OPTIONS
|
||||
sion for your executable. "NT AUTHORITY\NetworkService" normally
|
||||
has no permission to run binaries from your home directory.
|
||||
|
||||
For your convenience you can use the special username "/l" as a
|
||||
For your convenience you can use the special username "/l" as a
|
||||
shortcut for "NT AUTHORITY\LocalService" and "/n" for "NT
|
||||
AUTHORITY\NetworkService". "vlmcsd -s -U /n" installs the ser‐
|
||||
AUTHORITY\NetworkService". "vlmcsd -s -U /n" installs the ser‐
|
||||
vice to run as "NT AUTHORITY\NetworkService".
|
||||
|
||||
|
||||
-W password
|
||||
Can only be used together with -s. Specifies a password for the
|
||||
corresponding username you use with -U. SYSTEM, "NT AUTHOR‐
|
||||
ITY\NetworkService", "NT AUTHORITY\LocalService" do not require
|
||||
Can only be used together with -s. Specifies a password for the
|
||||
corresponding username you use with -U. SYSTEM, "NT AUTHOR‐
|
||||
ITY\NetworkService", "NT AUTHORITY\LocalService" do not require
|
||||
a password.
|
||||
|
||||
If you specify a user with even lower privileges than "NT
|
||||
AUTHORITY\NetworkService", you must specify its password. You
|
||||
If you specify a user with even lower privileges than "NT
|
||||
AUTHORITY\NetworkService", you must specify its password. You
|
||||
also have to grant the "Log on as a service" right to that user.
|
||||
|
||||
|
||||
@ -606,53 +698,53 @@ SIGNALS
|
||||
|
||||
|
||||
SIGTERM, SIGINT
|
||||
These signals cause vlmcsd to exit gracefully. All global sema‐
|
||||
phores and shared memory pages will be released, the pid file
|
||||
will be unlinked (deleted) and a shutdown message will be
|
||||
These signals cause vlmcsd to exit gracefully. All global sema‐
|
||||
phores and shared memory pages will be released, the pid file
|
||||
will be unlinked (deleted) and a shutdown message will be
|
||||
logged.
|
||||
|
||||
|
||||
SIGHUP Causes vlmcsd to be restarted completely. This is useful if you
|
||||
started vlmcsd with an ini file. You can modify the ini file
|
||||
while vlmcsd is running and then sending SIGHUP, e.g. by typing
|
||||
"killall -SIGHUP vlmcsd" or "kill -SIGHUP `cat /var/run/vlm‐
|
||||
SIGHUP Causes vlmcsd to be restarted completely. This is useful if you
|
||||
started vlmcsd with an ini file. You can modify the ini file
|
||||
while vlmcsd is running and then sending SIGHUP, e.g. by typing
|
||||
"killall -SIGHUP vlmcsd" or "kill -SIGHUP `cat /var/run/vlm‐
|
||||
csd.pid`".
|
||||
|
||||
The SIGHUP handler has been implemented relatively simple. It is
|
||||
virtually the same as stopping vlmcsd and starting it again
|
||||
virtually the same as stopping vlmcsd and starting it again
|
||||
immediately with the following exceptions:
|
||||
|
||||
|
||||
— The new process does not get a new process id.
|
||||
|
||||
— If you used a pid file, it is not deleted and recreated
|
||||
— If you used a pid file, it is not deleted and recreated
|
||||
because the process id stays the same.
|
||||
|
||||
— If you used the 'user' and/or 'group' directive in an ini
|
||||
file these are ignored. This is because once you switched to
|
||||
— If you used the 'user' and/or 'group' directive in an ini
|
||||
file these are ignored. This is because once you switched to
|
||||
lower privileged users and groups, there is no way back. Any‐
|
||||
thing else would be a severe security flaw in the OS.
|
||||
|
||||
Signaling is not available in the native Windows version and in the
|
||||
Signaling is not available in the native Windows version and in the
|
||||
Cygwin version when it runs as Windows service.
|
||||
|
||||
|
||||
SUPPORTED OPERATING SYSTEMS
|
||||
vlmcsd compiles and runs on Linux, Windows (no Cygwin required but
|
||||
explicitly supported), Mac OS X, FreeBSD, NetBSD, OpenBSD, Dragonfly
|
||||
BSD, Minix, Solaris, OpenIndiana, Android and iOS. Other POSIX or
|
||||
unixoid OSses may work with unmodified sources or may require minor
|
||||
vlmcsd compiles and runs on Linux, Windows (no Cygwin required but
|
||||
explicitly supported), Mac OS X, FreeBSD, NetBSD, OpenBSD, Dragonfly
|
||||
BSD, Minix, Solaris, OpenIndiana, Android and iOS. Other POSIX or
|
||||
unixoid OSses may work with unmodified sources or may require minor
|
||||
porting efforts.
|
||||
|
||||
|
||||
SUPPORTED PRODUCTS
|
||||
vlmcsd can answer activation requests for the following products: Win‐
|
||||
vlmcsd can answer activation requests for the following products: Win‐
|
||||
dows Vista, Windows 7, Windows 8, Windows 8.1, Windows 10 (up to 1607),
|
||||
Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, Win‐
|
||||
dows Server 2012 R2, Windows Server 2016, Office 2010, Project 2010,
|
||||
Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, Win‐
|
||||
dows Server 2012 R2, Windows Server 2016, Office 2010, Project 2010,
|
||||
Visio 2010, Office 2013, Project 2013, Visio 2013, Office 2016, Project
|
||||
2016, Visio 2016. Newer version may work as long as the KMS protocol
|
||||
does not change. A complete list of fully supported products can be
|
||||
2016, Visio 2016. Newer version may work as long as the KMS protocol
|
||||
does not change. A complete list of fully supported products can be
|
||||
obtained using the -x option of vlmcs(1).
|
||||
|
||||
Office, Project and Visio must be volume license versions.
|
||||
@ -664,24 +756,24 @@ FILES
|
||||
|
||||
EXAMPLES
|
||||
vlmcsd -De
|
||||
Starts vlmcsd in foreground. Useful if you use it for the first
|
||||
time and want to see what's happening when a client requests
|
||||
Starts vlmcsd in foreground. Useful if you use it for the first
|
||||
time and want to see what's happening when a client requests
|
||||
activation.
|
||||
|
||||
|
||||
vlmcsd -l /var/log/vlmcsd.log
|
||||
Starts vlmcsd as a daemon and logs everything to /var/log/vlm‐
|
||||
Starts vlmcsd as a daemon and logs everything to /var/log/vlm‐
|
||||
csd.log.
|
||||
|
||||
|
||||
vlmcsd -L 192.168.1.17
|
||||
Starts vlmcsd as a daemon and listens on IP address 192.168.1.17
|
||||
only. This is useful for routers that have a public and a pri‐
|
||||
only. This is useful for routers that have a public and a pri‐
|
||||
vate IP address to prevent your KMS server from becoming public.
|
||||
|
||||
|
||||
vlmcsd -s -U /n -l C:\logs\vlmcsd.log
|
||||
Installs vlmcsd as a Windows service with low privileges and
|
||||
Installs vlmcsd as a Windows service with low privileges and
|
||||
logs everything to C:\logs\vlmcsd.log when the service is
|
||||
started with "net start vlmcsd".
|
||||
|
||||
@ -691,12 +783,12 @@ BUGS
|
||||
|
||||
|
||||
AUTHOR
|
||||
Written by crony12, Hotbird64 and vityan666. With contributions from
|
||||
Written by crony12, Hotbird64 and vityan666. With contributions from
|
||||
DougQaid.
|
||||
|
||||
|
||||
CREDITS
|
||||
Thanks to CODYQX4, deagles, eIcn, mikmik38, nosferati87, qad, Rati‐
|
||||
Thanks to CODYQX4, deagles, eIcn, mikmik38, nosferati87, qad, Rati‐
|
||||
borus, ...
|
||||
|
||||
|
||||
@ -705,4 +797,4 @@ SEE ALSO
|
||||
|
||||
|
||||
|
||||
Hotbird64 November 2016 VLMCSD(8)
|
||||
Hotbird64 January 2017 VLMCSD(8)
|
||||
|
@ -1,4 +1,4 @@
|
||||
.TH VLMCSD.INI 5 "November 2016" "Hotbird64" "KMS Activation Manual"
|
||||
.TH VLMCSD.INI 5 "January 2017" "Hotbird64" "KMS Activation Manual"
|
||||
.LO 8
|
||||
|
||||
.SH NAME
|
||||
@ -66,6 +66,41 @@ Set the level of protection against KMS activations from public IP addresses.
|
||||
|
||||
For details on public IP protection levels see \fBvlmcsd\fR(8) command line option \fB-o\fR.
|
||||
|
||||
.IP "\fBVPN\fR"
|
||||
Has to be in the form \fIvpn-adapter-name\fR[=\fIipv4-address\fR][/\fIcidr-mask\fR][:\fIdhcp-lease-duration\fR].
|
||||
|
||||
Enables a compatible VPN adapter to create additional local IPv4 addresses (like 127.0.0.1) that appear as remote IPv4 addresses to the system. This allows product activation using a local instance of vlmcsd. This feature is only available in Windows and Cygwin builds of vlmcsd since it is not of any use on other operating systems. Compatible VPN adapters are Tap-windows version 8.2 or higher (from OpenVPN) and the TeamViewer VPN adapter. There is a special \fIvpn-adapter-name\fR. A single period (.) instructs vlmcsd to use the first available compatible VPN adapter. The \fIvpn-adapter-name\fR is \fBnot\fR case-sensitive. If the \fIvpn-adapter-name\fR contains spaces (e.g. Ethernet 3), do \fBnot\fR enclose it in quotes.
|
||||
|
||||
The default \fIipv4-address\fR is 10.10.10.9 and the default \fIcidr-mask\fR is 30. If you are using the default values, your VPN adapter uses an IPv4 address of 10.10.10.9 and you can set your activation client to use the easy to remember address 10.10.10.10 (e.g. slmgr /skms 10.10.10.10 or cscript ospp.vbs /sethst:10.10.10.10).
|
||||
|
||||
The \fIdhcp-lease-duration\fR is a number optionally followed by s, m, h, d or w to indicate seconds, minutes, hours, days or weeks. The default \fIdhcp-lease-duration\fR is 1d (one day). It is normally not required to change this value.
|
||||
|
||||
It is advised not to manually configure your OpenVPN TAP or TeamViewer VPN adapter in "Network Connections". If you set the IPv4 configuration manually anyway, the IPv4 address and the subnet mask must match the \fBVPN=\fR directive. It is safe leave the IPv4 configuration to automatic (DHCP). vlmcsd will wait up to four seconds for the DHCP configuration to complete before binding to and listenin on any interfaces.
|
||||
|
||||
You should be aware that only one program can use a VPN adapter at a time. If you use the TeamViewer VPN adapter for example, you will not be able to use the VPN feature of TeamViewer as long as vlmcsd is running. The same applies to OpenVPN TAP adapters that are in use by other programs (for example OpenVPN, QEMU, Ratiborus VM, aiccu, etc.). The best way to avoid conflicts is to install Tap-Windows from OpenVPN, cd to C:\\Program Files\\TAP-Windows\\bin and run addtap.bat to install an additional TAP adapter. Go to "Network Connections" and rename the new adapter to "vlmcsd" and specify \fBVPN=vlmcsd\fR to use it.
|
||||
|
||||
.IP "\fBExitLevel"
|
||||
Can be either 0 (the default) or 1. Controls under what circumstances vlmcsd will exit. Using the default of \fB0\fR vlmcsd stays active as long as it can perform some useful operations. If vlmcsd is run by any form of a watchdog, e.g. NT service manager (Windows), systemd (Linux) or launchd (Mac OS / iOS), it may be desirable to end vlmcsd and let the watchdog restart it. This is especially true if some pre-requisites are not yet met but will be some time later, e.g. network is not yet fully setup.
|
||||
|
||||
By using \fBExitLevel = 0\fR vlmcsd will
|
||||
|
||||
.RS 12
|
||||
exit if none of the listening sockets specified with \fB-L\fR can be used. It continues if at least one socket can be setup for listening.
|
||||
|
||||
exit any TAP mirror thread (Windows version only) if there is an error condition while reading or writing from or to the VPN adapter but continue to work without utilizing a VPN adapter.
|
||||
.RE
|
||||
.IP
|
||||
By using \fBExitLevel = 1\fR vlmcsd will
|
||||
|
||||
.RS 12
|
||||
exit if not all listening sockets specified with \fB-L\fR can be used.
|
||||
|
||||
exit completely if there is a problem with a VPN adapter it is using. This may happen for instance if the VPN adapter has been disabled using "Control Panel - Network - Adapter Settings" while vlmcsd is using it.
|
||||
|
||||
.RE
|
||||
.IP
|
||||
Please note that \fBExitLevel = 1\fR is kind of a workaround option. While it may help under some circumstances, it is better to solve the problem at its origin, e.g. properly implementing dependencies in your startup script to ensure all network interfaces and the VPN adapter you will use are completely setup before you start vlmcsd.
|
||||
|
||||
.IP "\fBUseNDR64\fR"
|
||||
Can be TRUE or FALSE. Specifies whether you want to use the NDR64 transfer syntax. See options \fB-n0\fR and \fB-n1\fR in \fBvlmcsd\fR(8). The default is TRUE.
|
||||
|
||||
|
@ -123,6 +123,94 @@ KEYWORDS
|
||||
line option -o.
|
||||
|
||||
|
||||
VPN Has to be in the form vpn-adapter-name[=ipv4-address][/cidr-
|
||||
mask][:dhcp-lease-duration].
|
||||
|
||||
Enables a compatible VPN adapter to create additional local IPv4
|
||||
addresses (like 127.0.0.1) that appear as remote IPv4 addresses
|
||||
to the system. This allows product activation using a local
|
||||
instance of vlmcsd. This feature is only available in Windows
|
||||
and Cygwin builds of vlmcsd since it is not of any use on other
|
||||
operating systems. Compatible VPN adapters are Tap-windows ver‐
|
||||
sion 8.2 or higher (from OpenVPN) and the TeamViewer VPN
|
||||
adapter. There is a special vpn-adapter-name. A single period
|
||||
(.) instructs vlmcsd to use the first available compatible VPN
|
||||
adapter. The vpn-adapter-name is not case-sensitive. If the vpn-
|
||||
adapter-name contains spaces (e.g. Ethernet 3), do not enclose
|
||||
it in quotes.
|
||||
|
||||
The default ipv4-address is 10.10.10.9 and the default cidr-mask
|
||||
is 30. If you are using the default values, your VPN adapter
|
||||
uses an IPv4 address of 10.10.10.9 and you can set your activa‐
|
||||
tion client to use the easy to remember address 10.10.10.10
|
||||
(e.g. slmgr /skms 10.10.10.10 or cscript ospp.vbs
|
||||
/sethst:10.10.10.10).
|
||||
|
||||
The dhcp-lease-duration is a number optionally followed by s, m,
|
||||
h, d or w to indicate seconds, minutes, hours, days or weeks.
|
||||
The default dhcp-lease-duration is 1d (one day). It is normally
|
||||
not required to change this value.
|
||||
|
||||
It is advised not to manually configure your OpenVPN TAP or
|
||||
TeamViewer VPN adapter in "Network Connections". If you set the
|
||||
IPv4 configuration manually anyway, the IPv4 address and the
|
||||
subnet mask must match the VPN= directive. It is safe leave the
|
||||
IPv4 configuration to automatic (DHCP). vlmcsd will wait up to
|
||||
four seconds for the DHCP configuration to complete before bind‐
|
||||
ing to and listenin on any interfaces.
|
||||
|
||||
You should be aware that only one program can use a VPN adapter
|
||||
at a time. If you use the TeamViewer VPN adapter for example,
|
||||
you will not be able to use the VPN feature of TeamViewer as
|
||||
long as vlmcsd is running. The same applies to OpenVPN TAP
|
||||
adapters that are in use by other programs (for example OpenVPN,
|
||||
QEMU, Ratiborus VM, aiccu, etc.). The best way to avoid con‐
|
||||
flicts is to install Tap-Windows from OpenVPN, cd to C:\Program
|
||||
Files\TAP-Windows\bin and run addtap.bat to install an addi‐
|
||||
tional TAP adapter. Go to "Network Connections" and rename the
|
||||
new adapter to "vlmcsd" and specify VPN=vlmcsd to use it.
|
||||
|
||||
|
||||
ExitLevel
|
||||
Can be either 0 (the default) or 1. Controls under what circum‐
|
||||
stances vlmcsd will exit. Using the default of 0 vlmcsd stays
|
||||
active as long as it can perform some useful operations. If vlm‐
|
||||
csd is run by any form of a watchdog, e.g. NT service manager
|
||||
(Windows), systemd (Linux) or launchd (Mac OS / iOS), it may be
|
||||
desirable to end vlmcsd and let the watchdog restart it. This is
|
||||
especially true if some pre-requisites are not yet met but will
|
||||
be some time later, e.g. network is not yet fully setup.
|
||||
|
||||
By using ExitLevel = 0 vlmcsd will
|
||||
|
||||
exit if none of the listening sockets specified with -L can
|
||||
be used. It continues if at least one socket can be setup
|
||||
for listening.
|
||||
|
||||
exit any TAP mirror thread (Windows version only) if there
|
||||
is an error condition while reading or writing from or to
|
||||
the VPN adapter but continue to work without utilizing a
|
||||
VPN adapter.
|
||||
|
||||
By using ExitLevel = 1 vlmcsd will
|
||||
|
||||
exit if not all listening sockets specified with -L can be
|
||||
used.
|
||||
|
||||
exit completely if there is a problem with a VPN adapter it
|
||||
is using. This may happen for instance if the VPN adapter
|
||||
has been disabled using "Control Panel - Network - Adapter
|
||||
Settings" while vlmcsd is using it.
|
||||
|
||||
|
||||
Please note that ExitLevel = 1 is kind of a workaround option.
|
||||
While it may help under some circumstances, it is better to
|
||||
solve the problem at its origin, e.g. properly implementing
|
||||
dependencies in your startup script to ensure all network inter‐
|
||||
faces and the VPN adapter you will use are completely setup
|
||||
before you start vlmcsd.
|
||||
|
||||
|
||||
UseNDR64
|
||||
Can be TRUE or FALSE. Specifies whether you want to use the
|
||||
NDR64 transfer syntax. See options -n0 and -n1 in vlmcsd(8). The
|
||||
@ -400,4 +488,4 @@ SEE ALSO
|
||||
|
||||
|
||||
|
||||
Hotbird64 November 2016 VLMCSD.INI(5)
|
||||
Hotbird64 January 2017 VLMCSD.INI(5)
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!-- Creator : groff version 1.22.3 -->
|
||||
<!-- CreationDate: Mon Nov 28 01:28:23 2016 -->
|
||||
<!-- CreationDate: Thu Jan 19 21:29:26 2017 -->
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
||||
"http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
@ -227,6 +227,122 @@ without activating <br>
|
||||
public IP protection levels see <b>vlmcsd</b>(8) command
|
||||
line option <b>-o</b>.</p>
|
||||
|
||||
<table width="100%" border="0" rules="none" frame="void"
|
||||
cellspacing="0" cellpadding="0">
|
||||
<tr valign="top" align="left">
|
||||
<td width="11%"></td>
|
||||
<td width="4%">
|
||||
|
||||
|
||||
<p><b>VPN</b></p></td>
|
||||
<td width="7%"></td>
|
||||
<td width="78%">
|
||||
|
||||
|
||||
<p>Has to be in the form
|
||||
<i>vpn-adapter-name</i>[=<i>ipv4-address</i>][/<i>cidr-mask</i>][:<i>dhcp-lease-duration</i>].</p> </td></tr>
|
||||
</table>
|
||||
|
||||
<p style="margin-left:22%; margin-top: 1em">Enables a
|
||||
compatible VPN adapter to create additional local IPv4
|
||||
addresses (like 127.0.0.1) that appear as remote IPv4
|
||||
addresses to the system. This allows product activation
|
||||
using a local instance of vlmcsd. This feature is only
|
||||
available in Windows and Cygwin builds of vlmcsd since it is
|
||||
not of any use on other operating systems. Compatible VPN
|
||||
adapters are Tap-windows version 8.2 or higher (from
|
||||
OpenVPN) and the TeamViewer VPN adapter. There is a special
|
||||
<i>vpn-adapter-name</i>. A single period (.) instructs
|
||||
vlmcsd to use the first available compatible VPN adapter.
|
||||
The <i>vpn-adapter-name</i> is <b>not</b> case-sensitive. If
|
||||
the <i>vpn-adapter-name</i> contains spaces (e.g. Ethernet
|
||||
3), do <b>not</b> enclose it in quotes.</p>
|
||||
|
||||
<p style="margin-left:22%; margin-top: 1em">The default
|
||||
<i>ipv4-address</i> is 10.10.10.9 and the default
|
||||
<i>cidr-mask</i> is 30. If you are using the default values,
|
||||
your VPN adapter uses an IPv4 address of 10.10.10.9 and you
|
||||
can set your activation client to use the easy to remember
|
||||
address 10.10.10.10 (e.g. slmgr /skms 10.10.10.10 or cscript
|
||||
ospp.vbs /sethst:10.10.10.10).</p>
|
||||
|
||||
<p style="margin-left:22%; margin-top: 1em">The
|
||||
<i>dhcp-lease-duration</i> is a number optionally followed
|
||||
by s, m, h, d or w to indicate seconds, minutes, hours, days
|
||||
or weeks. The default <i>dhcp-lease-duration</i> is 1d (one
|
||||
day). It is normally not required to change this value.</p>
|
||||
|
||||
<p style="margin-left:22%; margin-top: 1em">It is advised
|
||||
not to manually configure your OpenVPN TAP or TeamViewer VPN
|
||||
adapter in "Network Connections". If you set the
|
||||
IPv4 configuration manually anyway, the IPv4 address and the
|
||||
subnet mask must match the <b>VPN=</b> directive. It is safe
|
||||
leave the IPv4 configuration to automatic (DHCP). vlmcsd
|
||||
will wait up to four seconds for the DHCP configuration to
|
||||
complete before binding to and listenin on any
|
||||
interfaces.</p>
|
||||
|
||||
<p style="margin-left:22%; margin-top: 1em">You should be
|
||||
aware that only one program can use a VPN adapter at a time.
|
||||
If you use the TeamViewer VPN adapter for example, you will
|
||||
not be able to use the VPN feature of TeamViewer as long as
|
||||
vlmcsd is running. The same applies to OpenVPN TAP adapters
|
||||
that are in use by other programs (for example OpenVPN,
|
||||
QEMU, Ratiborus VM, aiccu, etc.). The best way to avoid
|
||||
conflicts is to install Tap-Windows from OpenVPN, cd to
|
||||
C:\Program Files\TAP-Windows\bin and run addtap.bat to
|
||||
install an additional TAP adapter. Go to "Network
|
||||
Connections" and rename the new adapter to
|
||||
"vlmcsd" and specify <b>VPN=vlmcsd</b> to use
|
||||
it.</p>
|
||||
|
||||
<p style="margin-left:11%;"><b>ExitLevel</b></p>
|
||||
|
||||
<p style="margin-left:22%;">Can be either 0 (the default)
|
||||
or 1. Controls under what circumstances vlmcsd will exit.
|
||||
Using the default of <b>0</b> vlmcsd stays active as long as
|
||||
it can perform some useful operations. If vlmcsd is run by
|
||||
any form of a watchdog, e.g. NT service manager (Windows),
|
||||
systemd (Linux) or launchd (Mac OS / iOS), it may be
|
||||
desirable to end vlmcsd and let the watchdog restart it.
|
||||
This is especially true if some pre-requisites are not yet
|
||||
met but will be some time later, e.g. network is not yet
|
||||
fully setup.</p>
|
||||
|
||||
<p style="margin-left:22%; margin-top: 1em">By using
|
||||
<b>ExitLevel = 0</b> vlmcsd will</p>
|
||||
|
||||
<p style="margin-left:29%; margin-top: 1em">exit if none of
|
||||
the listening sockets specified with <b>-L</b> can be used.
|
||||
It continues if at least one socket can be setup for
|
||||
listening.</p>
|
||||
|
||||
<p style="margin-left:29%; margin-top: 1em">exit any TAP
|
||||
mirror thread (Windows version only) if there is an error
|
||||
condition while reading or writing from or to the VPN
|
||||
adapter but continue to work without utilizing a VPN
|
||||
adapter.</p>
|
||||
|
||||
<p style="margin-left:22%; margin-top: 1em">By using
|
||||
<b>ExitLevel = 1</b> vlmcsd will</p>
|
||||
|
||||
<p style="margin-left:29%; margin-top: 1em">exit if not all
|
||||
listening sockets specified with <b>-L</b> can be used.</p>
|
||||
|
||||
<p style="margin-left:29%; margin-top: 1em">exit completely
|
||||
if there is a problem with a VPN adapter it is using. This
|
||||
may happen for instance if the VPN adapter has been disabled
|
||||
using "Control Panel - Network - Adapter Settings"
|
||||
while vlmcsd is using it.</p>
|
||||
|
||||
<p style="margin-left:22%; margin-top: 1em">Please note
|
||||
that <b>ExitLevel = 1</b> is kind of a workaround option.
|
||||
While it may help under some circumstances, it is better to
|
||||
solve the problem at its origin, e.g. properly implementing
|
||||
dependencies in your startup script to ensure all network
|
||||
interfaces and the VPN adapter you will use are completely
|
||||
setup before you start vlmcsd.</p>
|
||||
|
||||
<p style="margin-left:11%;"><b>UseNDR64</b></p>
|
||||
|
||||
<p style="margin-left:22%;">Can be TRUE or FALSE. Specifies
|
||||
|
Binary file not shown.
@ -123,6 +123,94 @@ KEYWORDS
|
||||
line option -o.
|
||||
|
||||
|
||||
VPN Has to be in the form vpn-adapter-name[=ipv4-address][/cidr-
|
||||
mask][:dhcp-lease-duration].
|
||||
|
||||
Enables a compatible VPN adapter to create additional local IPv4
|
||||
addresses (like 127.0.0.1) that appear as remote IPv4 addresses
|
||||
to the system. This allows product activation using a local
|
||||
instance of vlmcsd. This feature is only available in Windows
|
||||
and Cygwin builds of vlmcsd since it is not of any use on other
|
||||
operating systems. Compatible VPN adapters are Tap-windows ver‐
|
||||
sion 8.2 or higher (from OpenVPN) and the TeamViewer VPN
|
||||
adapter. There is a special vpn-adapter-name. A single period
|
||||
(.) instructs vlmcsd to use the first available compatible VPN
|
||||
adapter. The vpn-adapter-name is not case-sensitive. If the vpn-
|
||||
adapter-name contains spaces (e.g. Ethernet 3), do not enclose
|
||||
it in quotes.
|
||||
|
||||
The default ipv4-address is 10.10.10.9 and the default cidr-mask
|
||||
is 30. If you are using the default values, your VPN adapter
|
||||
uses an IPv4 address of 10.10.10.9 and you can set your activa‐
|
||||
tion client to use the easy to remember address 10.10.10.10
|
||||
(e.g. slmgr /skms 10.10.10.10 or cscript ospp.vbs
|
||||
/sethst:10.10.10.10).
|
||||
|
||||
The dhcp-lease-duration is a number optionally followed by s, m,
|
||||
h, d or w to indicate seconds, minutes, hours, days or weeks.
|
||||
The default dhcp-lease-duration is 1d (one day). It is normally
|
||||
not required to change this value.
|
||||
|
||||
It is advised not to manually configure your OpenVPN TAP or
|
||||
TeamViewer VPN adapter in "Network Connections". If you set the
|
||||
IPv4 configuration manually anyway, the IPv4 address and the
|
||||
subnet mask must match the VPN= directive. It is safe leave the
|
||||
IPv4 configuration to automatic (DHCP). vlmcsd will wait up to
|
||||
four seconds for the DHCP configuration to complete before bind‐
|
||||
ing to and listenin on any interfaces.
|
||||
|
||||
You should be aware that only one program can use a VPN adapter
|
||||
at a time. If you use the TeamViewer VPN adapter for example,
|
||||
you will not be able to use the VPN feature of TeamViewer as
|
||||
long as vlmcsd is running. The same applies to OpenVPN TAP
|
||||
adapters that are in use by other programs (for example OpenVPN,
|
||||
QEMU, Ratiborus VM, aiccu, etc.). The best way to avoid con‐
|
||||
flicts is to install Tap-Windows from OpenVPN, cd to C:\Program
|
||||
Files\TAP-Windows\bin and run addtap.bat to install an addi‐
|
||||
tional TAP adapter. Go to "Network Connections" and rename the
|
||||
new adapter to "vlmcsd" and specify VPN=vlmcsd to use it.
|
||||
|
||||
|
||||
ExitLevel
|
||||
Can be either 0 (the default) or 1. Controls under what circum‐
|
||||
stances vlmcsd will exit. Using the default of 0 vlmcsd stays
|
||||
active as long as it can perform some useful operations. If vlm‐
|
||||
csd is run by any form of a watchdog, e.g. NT service manager
|
||||
(Windows), systemd (Linux) or launchd (Mac OS / iOS), it may be
|
||||
desirable to end vlmcsd and let the watchdog restart it. This is
|
||||
especially true if some pre-requisites are not yet met but will
|
||||
be some time later, e.g. network is not yet fully setup.
|
||||
|
||||
By using ExitLevel = 0 vlmcsd will
|
||||
|
||||
exit if none of the listening sockets specified with -L can
|
||||
be used. It continues if at least one socket can be setup
|
||||
for listening.
|
||||
|
||||
exit any TAP mirror thread (Windows version only) if there
|
||||
is an error condition while reading or writing from or to
|
||||
the VPN adapter but continue to work without utilizing a
|
||||
VPN adapter.
|
||||
|
||||
By using ExitLevel = 1 vlmcsd will
|
||||
|
||||
exit if not all listening sockets specified with -L can be
|
||||
used.
|
||||
|
||||
exit completely if there is a problem with a VPN adapter it
|
||||
is using. This may happen for instance if the VPN adapter
|
||||
has been disabled using "Control Panel - Network - Adapter
|
||||
Settings" while vlmcsd is using it.
|
||||
|
||||
|
||||
Please note that ExitLevel = 1 is kind of a workaround option.
|
||||
While it may help under some circumstances, it is better to
|
||||
solve the problem at its origin, e.g. properly implementing
|
||||
dependencies in your startup script to ensure all network inter‐
|
||||
faces and the VPN adapter you will use are completely setup
|
||||
before you start vlmcsd.
|
||||
|
||||
|
||||
UseNDR64
|
||||
Can be TRUE or FALSE. Specifies whether you want to use the
|
||||
NDR64 transfer syntax. See options -n0 and -n1 in vlmcsd(8). The
|
||||
@ -400,4 +488,4 @@ SEE ALSO
|
||||
|
||||
|
||||
|
||||
Hotbird64 November 2016 VLMCSD.INI(5)
|
||||
Hotbird64 January 2017 VLMCSD.INI(5)
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!-- Creator : groff version 1.22.3 -->
|
||||
<!-- CreationDate: Mon Nov 28 01:28:23 2016 -->
|
||||
<!-- CreationDate: Thu Jan 19 21:29:26 2017 -->
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
||||
"http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
|
Binary file not shown.
@ -192,6 +192,12 @@ ifneq ($(NOLIBS),1)
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq ($(NOLIBS),1)
|
||||
ifeq ($(CYGWIN),1)
|
||||
BASELDFLAGS += -liphlpapi
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq ($(NO_DNS),1)
|
||||
ifneq ($(ANDROID),1)
|
||||
ifneq ($(NOLRESOLV),1)
|
||||
@ -251,14 +257,14 @@ else
|
||||
STRIPFLAGS += -s
|
||||
endif
|
||||
|
||||
LIBRARY_CFLAGS = -DSIMPLE_SOCKETS -DNO_TIMEOUT -DNO_SIGHUP -DNO_CL_PIDS -DNO_LOG -DNO_RANDOM_EPID -DNO_INI_FILE -DNO_HELP -DNO_CUSTOM_INTERVALS -DNO_PID_FILE -DNO_USER_SWITCH -DNO_VERBOSE_LOG -DNO_LIMIT -DNO_VERSION_INFORMATION -DNO_PRIVATE_IP_DETECT -DNO_STRICT_MODES -DNO_CLIENT_LIST -UNO_SOCKETS -USIMPLE_RPC
|
||||
LIBRARY_CFLAGS = -DSIMPLE_SOCKETS -DNO_TIMEOUT -DNO_SIGHUP -DNO_CL_PIDS -DNO_LOG -DNO_RANDOM_EPID -DNO_INI_FILE -DNO_HELP -DNO_CUSTOM_INTERVALS -DNO_PID_FILE -DNO_USER_SWITCH -DNO_VERBOSE_LOG -DNO_LIMIT -DNO_VERSION_INFORMATION -DNO_PRIVATE_IP_DETECT -DNO_STRICT_MODES -DNO_CLIENT_LIST -DNO_TAP -UNO_SOCKETS -USIMPLE_RPC
|
||||
|
||||
ifeq ($(FEATURES), embedded)
|
||||
BASECFLAGS += -DNO_HELP -DNO_USER_SWITCH -DNO_CUSTOM_INTERVALS -DNO_PID_FILE -DNO_VERBOSE_LOG -DNO_VERSION_INFORMATION
|
||||
else ifeq ($(FEATURES), autostart)
|
||||
BASECFLAGS += -DNO_HELP -DNO_VERSION_INFORMATION
|
||||
else ifeq ($(FEATURES), minimum)
|
||||
BASECFLAGS += -DSIMPLE_RPC -DSIMPLE_SOCKETS -DNO_TIMEOUT -DNO_SIGHUP -DNO_CL_PIDS -DNO_LOG -DNO_RANDOM_EPID -DNO_INI_FILE -DNO_HELP -DNO_CUSTOM_INTERVALS -DNO_PID_FILE -DNO_USER_SWITCH -DNO_VERBOSE_LOG -DNO_LIMIT -DNO_VERSION_INFORMATION -DNO_PRIVATE_IP_DETECT -DSMALL_AES -DNO_STRICT_MODES -DNO_CLIENT_LIST -DUNSAFE_DATA_LOAD -DNO_EXTERNAL_DATA -UFULL_INTERNAL_DATA -U_PEDANTIC
|
||||
BASECFLAGS += -DSIMPLE_RPC -DSIMPLE_SOCKETS -DNO_TIMEOUT -DNO_SIGHUP -DNO_CL_PIDS -DNO_LOG -DNO_RANDOM_EPID -DNO_INI_FILE -DNO_HELP -DNO_CUSTOM_INTERVALS -DNO_PID_FILE -DNO_USER_SWITCH -DNO_VERBOSE_LOG -DNO_LIMIT -DNO_VERSION_INFORMATION -DNO_PRIVATE_IP_DETECT -DSMALL_AES -DNO_STRICT_MODES -DNO_TAP -DNO_CLIENT_LIST -DUNSAFE_DATA_LOAD -DNO_EXTERNAL_DATA -UFULL_INTERNAL_DATA -U_PEDANTIC
|
||||
else ifeq ($(FEATURES), most)
|
||||
BASECFLAGS += -DNO_SIGHUP -DNO_PID_FILE -DNO_LIMIT
|
||||
else ifeq ($(FEATURES), inetd)
|
||||
@ -441,9 +447,9 @@ endif
|
||||
endif
|
||||
|
||||
ifeq "$(WIN)" "1"
|
||||
VLMCSD_SRCS += ntservice.c
|
||||
MULTI_SRCS += ntservice.c
|
||||
../build/MULTI_OBJS += ntservice.o
|
||||
VLMCSD_SRCS += ntservice.c wintap.c
|
||||
MULTI_SRCS += ntservice.c wintap.c
|
||||
MULTI_OBJS += ../build/ntservice.o ../build/wintap.o
|
||||
endif
|
||||
|
||||
ifeq ($(CRYPTO), openssl_with_aes)
|
||||
|
66
src/config.h
66
src/config.h
@ -31,26 +31,6 @@
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Define default ePIDs and HWID here. Preferrably grab ePIDs and HWID
|
||||
* from a real KMS server.
|
||||
*/
|
||||
|
||||
//#ifndef EPID_WINDOWS
|
||||
//#define EPID_WINDOWS "03612-00206-471-452343-03-1033-14393.0000-2932016"
|
||||
//#endif
|
||||
//
|
||||
//#ifndef EPID_OFFICE2010
|
||||
//#define EPID_OFFICE2010 "03612-00096-199-303490-03-1033-14393.0000-2932016"
|
||||
//#endif
|
||||
//
|
||||
//#ifndef EPID_OFFICE2013
|
||||
//#define EPID_OFFICE2013 "03612-00206-234-394838-03-1033-14393.0000-2932016"
|
||||
//#endif
|
||||
//
|
||||
//#ifndef EPID_OFFICE2016
|
||||
//#define EPID_OFFICE2016 "03612-00206-437-938923-03-1033-14393.0000-2932016"
|
||||
//#endif
|
||||
|
||||
#ifndef HWID // HwId from the Ratiborus VM
|
||||
#define HWID 0x3A, 0x1C, 0x04, 0x96, 0x00, 0xB6, 0x00, 0x76
|
||||
@ -67,21 +47,21 @@
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* -------------------------------
|
||||
* Defaults
|
||||
* -------------------------------
|
||||
*/
|
||||
/*
|
||||
* -------------------------------
|
||||
* Defaults
|
||||
* -------------------------------
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef INI_FILE
|
||||
/*
|
||||
* Uncomment and customize the following line if you want vlmcsd to look for an ini file
|
||||
* at a default location.
|
||||
*/
|
||||
/*
|
||||
* Uncomment and customize the following line if you want vlmcsd to look for an ini file
|
||||
* at a default location.
|
||||
*/
|
||||
|
||||
//#define INI_FILE "/etc/vlmcsd.ini"
|
||||
//#define INI_FILE "/etc/vlmcsd.ini"
|
||||
|
||||
#endif // INI_FILE
|
||||
|
||||
@ -95,7 +75,7 @@
|
||||
* at a custom default location.
|
||||
*/
|
||||
|
||||
//#define DATA_FILE "/etc/vlmcsd.kmd"
|
||||
//#define DATA_FILE "/etc/vlmcsd.kmd"
|
||||
|
||||
#endif // DATA_FILE
|
||||
|
||||
@ -353,7 +333,7 @@
|
||||
* Includes the full database in vlmcsd.
|
||||
*/
|
||||
|
||||
//#define FULL_INTERNAL_DATA
|
||||
//#define FULL_INTERNAL_DATA
|
||||
#endif // FULL_INTERNAL_DATA
|
||||
|
||||
|
||||
@ -374,13 +354,25 @@
|
||||
* your system.
|
||||
*/
|
||||
|
||||
//#define NO_FREEBIND
|
||||
//#define NO_FREEBIND
|
||||
|
||||
#endif // NO_FREEBIND
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef NO_TAP
|
||||
/*
|
||||
* Do not compile support for using a VPN adapter under Windows. Disables -O command line option.
|
||||
*/
|
||||
|
||||
//#define NO_TAP
|
||||
|
||||
#endif // NO_TAP
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef NO_VERSION_INFORMATION
|
||||
/*
|
||||
* Removes the -V option from vlmcsd and vlmcs that displays the version information
|
||||
@ -493,7 +485,7 @@
|
||||
* and ini file parameter KmsData. Implies UNSAFE_DATA_LOAD.
|
||||
*/
|
||||
|
||||
//#define NO_EXTERNAL_DATA
|
||||
//#define NO_EXTERNAL_DATA
|
||||
|
||||
#endif // NO_EXTERNAL_DATA
|
||||
|
||||
@ -507,7 +499,7 @@
|
||||
* the program exits with an error message.
|
||||
*/
|
||||
|
||||
//#define NO_INTERNAL_DATA
|
||||
//#define NO_INTERNAL_DATA
|
||||
|
||||
#endif // NO_INTERNAL_DATA
|
||||
|
||||
@ -658,7 +650,7 @@
|
||||
* smaller binaries but makes emulator detection easier.
|
||||
*/
|
||||
|
||||
//#define SIMPLE_RPC
|
||||
//#define SIMPLE_RPC
|
||||
#endif // !SIMPLE_RPC
|
||||
|
||||
|
||||
@ -670,7 +662,7 @@
|
||||
* It still supports IPv4 and IPv6.
|
||||
*/
|
||||
|
||||
//#define SIMPLE_SOCKETS
|
||||
//#define SIMPLE_SOCKETS
|
||||
|
||||
#endif // SIMPLE_SOCKETS
|
||||
|
||||
|
@ -230,6 +230,35 @@ int_fast8_t string2UuidLE(const char *const restrict input, GUID *const restrict
|
||||
}
|
||||
|
||||
|
||||
__pure DWORD timeSpanString2Seconds(const char *const restrict argument)
|
||||
{
|
||||
char *unitId;
|
||||
|
||||
long long val = vlmcsd_strtoll(argument, &unitId, 10);
|
||||
|
||||
switch (toupper((int)*unitId))
|
||||
{
|
||||
case 'W':
|
||||
val *= 7;
|
||||
case 'D':
|
||||
val *= 24;
|
||||
case 'H':
|
||||
val *= 60;
|
||||
case 0:
|
||||
case 'M':
|
||||
val *= 60;
|
||||
case 'S':
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (*unitId && unitId[1]) return 0;
|
||||
if (val < 1) val = 1;
|
||||
return (DWORD)(val & UINT_MAX);
|
||||
}
|
||||
|
||||
|
||||
#if !IS_LIBRARY
|
||||
//Checks a command line argument if it is numeric and between min and max. Returns the numeric value or exits on error
|
||||
__pure unsigned int getOptionArgumentInt(const char o, const unsigned int min, const unsigned int max)
|
||||
@ -261,7 +290,7 @@ void optReset(void)
|
||||
}
|
||||
#endif // !IS_LIBRARY
|
||||
|
||||
#if defined(_WIN32) || defined(USE_MSRPC)
|
||||
#if _WIN32 || __CYGWIN__
|
||||
|
||||
// Returns a static message buffer containing text for a given Win32 error. Not thread safe (same as strerror)
|
||||
char* win_strerror(const int message)
|
||||
@ -273,7 +302,7 @@ char* win_strerror(const int message)
|
||||
return buffer;
|
||||
}
|
||||
|
||||
#endif // defined(_WIN32) || defined(USE_MSRPC)
|
||||
#endif // _WIN32 || __CYGWIN__
|
||||
|
||||
|
||||
/*
|
||||
@ -426,7 +455,7 @@ void getExeName()
|
||||
|
||||
fn_exe = (char*)getauxval(AT_EXECFN);
|
||||
|
||||
# elif __UCLIBC__ && __UCLIBC_MAJOR__ < 1 && !defined(NO_PROCFS) // Workaround for older uclibc
|
||||
# elif (__ANDROID__ && __ANDROID_API__ < 16) || (__UCLIBC__ && __UCLIBC_MAJOR__ < 1 && !defined(NO_PROCFS)) // Workaround for older uclibc
|
||||
|
||||
char temp[PATH_MAX + 1];
|
||||
|
||||
@ -493,11 +522,11 @@ void getExeName()
|
||||
#ifdef _WIN32
|
||||
static void getDefaultDataFile()
|
||||
{
|
||||
char fileName[512];
|
||||
char fileName[MAX_PATH];
|
||||
getExeName();
|
||||
strcpy(fileName, fn_exe);
|
||||
strncpy(fileName, fn_exe, MAX_PATH);
|
||||
PathRemoveFileSpec(fileName);
|
||||
strncat(fileName, "\\vlmcsd.kmd", 512);
|
||||
strncat(fileName, "\\vlmcsd.kmd", MAX_PATH);
|
||||
fn_data = vlmcsd_strdup(fileName);
|
||||
}
|
||||
#else // !_WIN32
|
||||
@ -645,7 +674,20 @@ void loadKmsData()
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef NO_SOCKETS
|
||||
void exitOnWarningLevel(const int_fast8_t level)
|
||||
{
|
||||
if (ExitLevel >= level)
|
||||
{
|
||||
printerrorf("Fatal: Exiting on warning level %i or greater\n", (int)ExitLevel);
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
#endif // !NO_SOCKETS
|
||||
|
||||
#endif // IS_LIBRARY
|
||||
|
||||
|
||||
#if __ANDROID__ && !defined(USE_THREADS) // Bionic does not wrap these syscalls (intentionally because Google fears, developers don't know how to use it)
|
||||
|
||||
#ifdef __NR_shmget
|
||||
|
@ -20,6 +20,8 @@
|
||||
BOOL stringToInt(const char *const szValue, const unsigned int min, const unsigned int max, unsigned int *const value);
|
||||
unsigned int getOptionArgumentInt(const char o, const unsigned int min, const unsigned int max);
|
||||
void optReset(void);
|
||||
__pure DWORD timeSpanString2Seconds(const char *const restrict argument);
|
||||
#define timeSpanString2Minutes(x) (timeSpanString2Seconds(x) / 60)
|
||||
char* win_strerror(const int message);
|
||||
int ucs2_to_utf8_char (const WCHAR ucs2_le, char *utf8);
|
||||
size_t utf8_to_ucs2(WCHAR* const ucs2_le, const char* const utf8, const size_t maxucs2, const size_t maxutf8);
|
||||
@ -38,6 +40,13 @@ void getExeName();
|
||||
__pure BOOL getArgumentBool(int_fast8_t *result, const char *const argument);
|
||||
char* vlmcsd_strdup(const char* src);
|
||||
|
||||
#if defined(NO_SOCKETS) || IS_LIBRARY
|
||||
#define exitOnWarningLevel(x)
|
||||
#else // !NO_SOCKETS
|
||||
void exitOnWarningLevel(const int_fast8_t level);
|
||||
#endif // !NO_SOCKETS
|
||||
|
||||
|
||||
#if __ANDROID__ && !defined(USE_THREADS) // Bionic does not wrap these syscalls (intentionally because Google fears, developers don't know how to use it)
|
||||
int shmget(key_t key, size_t size, int shmflg);
|
||||
void *shmat(int shmid, const void *shmaddr, int shmflg);
|
||||
|
@ -301,7 +301,7 @@ static void generateRandomPid(int index, char *const szPid, int serverType, int1
|
||||
time(&maxTime);
|
||||
|
||||
# ifndef BUILD_TIME
|
||||
# define BUILD_TIME 1479938320
|
||||
# define BUILD_TIME 1481079869
|
||||
# endif
|
||||
|
||||
if (maxTime < (time_t)BUILD_TIME) // Just in case the system time is < 10/17/2013 1:00 pm
|
||||
|
@ -763,36 +763,36 @@ uint8_t DefaultKmsData[] =
|
||||
|
||||
uint8_t DefaultKmsData[] =
|
||||
{
|
||||
0x4B, 0x4D, 0x44, 0x00, 0x02, 0x00, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x10, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xCE, 0x00, 0x00, 0x00, 0xC0, 0xE3, 0x12, 0x1C,
|
||||
0xBF, 0x6A, 0xA6, 0x1F, 0x32, 0x00, 0x00, 0x00, 0x42, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x60, 0x00, 0x00, 0x00, 0xC0, 0x7F, 0xDC, 0x0B, 0x7F, 0x6A, 0xFE, 0x0C, 0x0A, 0x00, 0x00, 0x00,
|
||||
0x74, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xCE, 0x00, 0x00, 0x00, 0x80, 0x8E, 0xF2, 0x0D,
|
||||
0xFF, 0x3F, 0x42, 0x0F, 0x0A, 0x00, 0x00, 0x00, 0xA6, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0xCE, 0x00, 0x00, 0x00, 0x40, 0x17, 0x0C, 0x1A, 0xBF, 0xC8, 0x5B, 0x1B, 0x0A, 0x00, 0x00, 0x00,
|
||||
0x46, 0xF9, 0x5A, 0xE8, 0x25, 0x2E, 0xB7, 0x47, 0x83, 0xE1, 0xBE, 0xBC, 0xEB, 0xEA, 0xC6, 0x11,
|
||||
0xD8, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x05, 0x00, 0x00, 0x01, 0x00,
|
||||
0xBF, 0xF1, 0xA6, 0xE6, 0x40, 0x9D, 0xC3, 0x40, 0xAA, 0x9F, 0xC7, 0x7B, 0xA2, 0x15, 0x78, 0xC0,
|
||||
0xD8, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x05, 0x00, 0x00, 0x02, 0x00,
|
||||
0x68, 0x79, 0x4C, 0xAA, 0xDA, 0xB9, 0x80, 0x46, 0x92, 0xB6, 0xAC, 0xB2, 0x5E, 0x2F, 0x86, 0x6C,
|
||||
0xD8, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x05, 0x00, 0x01, 0x02, 0x00,
|
||||
0x1B, 0xF6, 0xB5, 0x85, 0x0B, 0x32, 0xE3, 0x4B, 0x81, 0x4A, 0xB7, 0x6B, 0x2B, 0xFA, 0xFC, 0x82,
|
||||
0xD8, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x05, 0x00, 0x00, 0x03, 0x00,
|
||||
0x30, 0x33, 0x36, 0x31, 0x32, 0x2D, 0x30, 0x30, 0x32, 0x30, 0x36, 0x2D, 0x34, 0x37, 0x31, 0x2D,
|
||||
0x31, 0x30, 0x34, 0x33, 0x39, 0x35, 0x2D, 0x30, 0x33, 0x2D, 0x31, 0x30, 0x33, 0x33, 0x2D, 0x31,
|
||||
0x34, 0x33, 0x39, 0x33, 0x2E, 0x30, 0x30, 0x30, 0x30, 0x2D, 0x32, 0x39, 0x33, 0x32, 0x30, 0x31,
|
||||
0x36, 0x00, 0x30, 0x33, 0x36, 0x31, 0x32, 0x2D, 0x30, 0x30, 0x30, 0x39, 0x36, 0x2D, 0x31, 0x39,
|
||||
0x39, 0x2D, 0x31, 0x39, 0x34, 0x38, 0x39, 0x33, 0x2D, 0x30, 0x33, 0x2D, 0x31, 0x30, 0x33, 0x33,
|
||||
0x2D, 0x31, 0x34, 0x33, 0x39, 0x33, 0x2E, 0x30, 0x30, 0x30, 0x30, 0x2D, 0x32, 0x39, 0x33, 0x32,
|
||||
0x30, 0x31, 0x36, 0x00, 0x30, 0x33, 0x36, 0x31, 0x32, 0x2D, 0x30, 0x30, 0x32, 0x30, 0x36, 0x2D,
|
||||
0x32, 0x33, 0x34, 0x2D, 0x31, 0x30, 0x39, 0x34, 0x38, 0x33, 0x2D, 0x30, 0x33, 0x2D, 0x31, 0x30,
|
||||
0x33, 0x33, 0x2D, 0x31, 0x34, 0x33, 0x39, 0x33, 0x2E, 0x30, 0x30, 0x30, 0x30, 0x2D, 0x32, 0x39,
|
||||
0x33, 0x32, 0x30, 0x31, 0x36, 0x00, 0x30, 0x33, 0x36, 0x31, 0x32, 0x2D, 0x30, 0x30, 0x32, 0x30,
|
||||
0x36, 0x2D, 0x34, 0x33, 0x37, 0x2D, 0x31, 0x38, 0x34, 0x37, 0x33, 0x34, 0x2D, 0x30, 0x33, 0x2D,
|
||||
0x31, 0x30, 0x33, 0x33, 0x2D, 0x31, 0x34, 0x33, 0x39, 0x33, 0x2E, 0x30, 0x30, 0x30, 0x30, 0x2D,
|
||||
0x32, 0x39, 0x33, 0x32, 0x30, 0x31, 0x36, 0x00, 0x55, 0x6E, 0x6B, 0x6E, 0x6F, 0x77, 0x6E, 0x00,
|
||||
0x4B, 0x4D, 0x44, 0x00, 0x02, 0x00, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x10, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xCE, 0x00, 0x00, 0x00, 0xC0, 0xE3, 0x12, 0x1C,
|
||||
0xBF, 0x6A, 0xA6, 0x1F, 0x32, 0x00, 0x00, 0x00, 0x42, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x60, 0x00, 0x00, 0x00, 0xC0, 0x7F, 0xDC, 0x0B, 0x7F, 0x6A, 0xFE, 0x0C, 0x0A, 0x00, 0x00, 0x00,
|
||||
0x74, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xCE, 0x00, 0x00, 0x00, 0x80, 0x8E, 0xF2, 0x0D,
|
||||
0xFF, 0x3F, 0x42, 0x0F, 0x0A, 0x00, 0x00, 0x00, 0xA6, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0xCE, 0x00, 0x00, 0x00, 0x40, 0x17, 0x0C, 0x1A, 0xBF, 0xC8, 0x5B, 0x1B, 0x0A, 0x00, 0x00, 0x00,
|
||||
0x46, 0xF9, 0x5A, 0xE8, 0x25, 0x2E, 0xB7, 0x47, 0x83, 0xE1, 0xBE, 0xBC, 0xEB, 0xEA, 0xC6, 0x11,
|
||||
0xD8, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x05, 0x00, 0x00, 0x01, 0x00,
|
||||
0xBF, 0xF1, 0xA6, 0xE6, 0x40, 0x9D, 0xC3, 0x40, 0xAA, 0x9F, 0xC7, 0x7B, 0xA2, 0x15, 0x78, 0xC0,
|
||||
0xD8, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x05, 0x00, 0x00, 0x02, 0x00,
|
||||
0x68, 0x79, 0x4C, 0xAA, 0xDA, 0xB9, 0x80, 0x46, 0x92, 0xB6, 0xAC, 0xB2, 0x5E, 0x2F, 0x86, 0x6C,
|
||||
0xD8, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x05, 0x00, 0x01, 0x02, 0x00,
|
||||
0x1B, 0xF6, 0xB5, 0x85, 0x0B, 0x32, 0xE3, 0x4B, 0x81, 0x4A, 0xB7, 0x6B, 0x2B, 0xFA, 0xFC, 0x82,
|
||||
0xD8, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x05, 0x00, 0x00, 0x03, 0x00,
|
||||
0x30, 0x33, 0x36, 0x31, 0x32, 0x2D, 0x30, 0x30, 0x32, 0x30, 0x36, 0x2D, 0x34, 0x37, 0x31, 0x2D,
|
||||
0x31, 0x30, 0x34, 0x33, 0x39, 0x35, 0x2D, 0x30, 0x33, 0x2D, 0x31, 0x30, 0x33, 0x33, 0x2D, 0x31,
|
||||
0x34, 0x33, 0x39, 0x33, 0x2E, 0x30, 0x30, 0x30, 0x30, 0x2D, 0x32, 0x39, 0x33, 0x32, 0x30, 0x31,
|
||||
0x36, 0x00, 0x30, 0x33, 0x36, 0x31, 0x32, 0x2D, 0x30, 0x30, 0x30, 0x39, 0x36, 0x2D, 0x31, 0x39,
|
||||
0x39, 0x2D, 0x31, 0x39, 0x34, 0x38, 0x39, 0x33, 0x2D, 0x30, 0x33, 0x2D, 0x31, 0x30, 0x33, 0x33,
|
||||
0x2D, 0x31, 0x34, 0x33, 0x39, 0x33, 0x2E, 0x30, 0x30, 0x30, 0x30, 0x2D, 0x32, 0x39, 0x33, 0x32,
|
||||
0x30, 0x31, 0x36, 0x00, 0x30, 0x33, 0x36, 0x31, 0x32, 0x2D, 0x30, 0x30, 0x32, 0x30, 0x36, 0x2D,
|
||||
0x32, 0x33, 0x34, 0x2D, 0x31, 0x30, 0x39, 0x34, 0x38, 0x33, 0x2D, 0x30, 0x33, 0x2D, 0x31, 0x30,
|
||||
0x33, 0x33, 0x2D, 0x31, 0x34, 0x33, 0x39, 0x33, 0x2E, 0x30, 0x30, 0x30, 0x30, 0x2D, 0x32, 0x39,
|
||||
0x33, 0x32, 0x30, 0x31, 0x36, 0x00, 0x30, 0x33, 0x36, 0x31, 0x32, 0x2D, 0x30, 0x30, 0x32, 0x30,
|
||||
0x36, 0x2D, 0x34, 0x33, 0x37, 0x2D, 0x31, 0x38, 0x34, 0x37, 0x33, 0x34, 0x2D, 0x30, 0x33, 0x2D,
|
||||
0x31, 0x30, 0x33, 0x33, 0x2D, 0x31, 0x34, 0x33, 0x39, 0x33, 0x2E, 0x30, 0x30, 0x30, 0x30, 0x2D,
|
||||
0x32, 0x39, 0x33, 0x32, 0x30, 0x31, 0x36, 0x00, 0x55, 0x6E, 0x6B, 0x6E, 0x6F, 0x77, 0x6E, 0x00,
|
||||
};
|
||||
|
||||
#else // !defined(NO_STRICT_MODES)
|
||||
|
@ -294,7 +294,6 @@ SOCKET connectToAddress(const char *const addr, const int AddressFamily, int_fas
|
||||
|
||||
|
||||
#ifndef NO_SOCKETS
|
||||
#ifdef SIMPLE_SOCKETS
|
||||
|
||||
static int_fast8_t allowSocketReuse(SOCKET s)
|
||||
{
|
||||
@ -322,6 +321,8 @@ static int_fast8_t allowSocketReuse(SOCKET s)
|
||||
}
|
||||
|
||||
|
||||
#ifdef SIMPLE_SOCKETS
|
||||
|
||||
int listenOnAllAddresses()
|
||||
{
|
||||
uint32_t port_listen;
|
||||
@ -569,20 +570,17 @@ static int listenOnAddress(const struct addrinfo *const ai, SOCKET *s)
|
||||
# if defined(_WIN32) || defined(__CYGWIN__)
|
||||
// if (IsWindowsVistaOrGreater()) //Doesn't work with older version of MingW32-w64 toolchain
|
||||
if ((GetVersion() & 0xff) > 5)
|
||||
{
|
||||
# endif // _WIN32
|
||||
printerrorf("Warning: %s does not support socket option IPV6_V6ONLY: %s\n", ipstr, vlmcsd_strerror(socket_errno));
|
||||
# if defined(_WIN32) || defined(__CYGWIN__)
|
||||
}
|
||||
# endif // _WIN32
|
||||
# endif // _PEDANTIC
|
||||
}
|
||||
# endif
|
||||
|
||||
# if !_WIN32 && !__CYGWIN__
|
||||
if (setsockopt(*s, SOL_SOCKET, SO_REUSEADDR, (sockopt_t)&socketOption, sizeof(socketOption)))
|
||||
{
|
||||
# ifdef _PEDANTIC
|
||||
printerrorf("Warning: %s does not support socket option SO_REUSEADDR: %s\n", ipstr, vlmcsd_strerror(socket_errno));
|
||||
# endif // _PEDANTIC
|
||||
}
|
||||
# endif // !_WIN32 && !__CYGWIN__
|
||||
allowSocketReuse(*s);
|
||||
|
||||
# if HAVE_FREEBIND
|
||||
# if (defined(IP_NONLOCALOK) || __FreeBSD_kernel__ || __FreeBSD__) && !defined(IPV6_BINDANY)
|
||||
@ -667,6 +665,10 @@ BOOL addListeningSocket(const char *const addr)
|
||||
numsockets++;
|
||||
result = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
exitOnWarningLevel(1);
|
||||
}
|
||||
}
|
||||
|
||||
freeaddrinfo(aiList);
|
||||
|
343
src/ntservice.c
343
src/ntservice.c
@ -16,115 +16,108 @@ SERVICE_STATUS_HANDLE gSvcStatusHandle;
|
||||
|
||||
VOID WINAPI ServiceCtrlHandler(DWORD dwCtrl)
|
||||
{
|
||||
// Handle the requested control code.
|
||||
// Handle the requested control code.
|
||||
|
||||
switch(dwCtrl)
|
||||
switch (dwCtrl)
|
||||
{
|
||||
case SERVICE_CONTROL_STOP:
|
||||
case SERVICE_CONTROL_SHUTDOWN:
|
||||
case SERVICE_CONTROL_STOP:
|
||||
case SERVICE_CONTROL_SHUTDOWN:
|
||||
|
||||
ServiceShutdown = TRUE;
|
||||
ReportServiceStatus(SERVICE_STOP_PENDING, NO_ERROR, 0);
|
||||
ServiceShutdown = TRUE;
|
||||
ReportServiceStatus(SERVICE_STOP_PENDING, NO_ERROR, 0);
|
||||
|
||||
// Remove PID file and free ressources
|
||||
cleanup();
|
||||
# ifdef USE_MSRPC
|
||||
ReportServiceStatus(SERVICE_STOPPED, NO_ERROR, 0);
|
||||
# endif // !USE_MSRPC
|
||||
return;
|
||||
// Remove PID file and free ressources
|
||||
cleanup();
|
||||
# if __CYGWIN__ || defined(USE_MSRPC)
|
||||
ReportServiceStatus(SERVICE_STOPPED, NO_ERROR, 0);
|
||||
# endif // __CYGWIN__
|
||||
|
||||
default:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static VOID WINAPI ServiceMain(const int argc_unused, CARGV argv_unused)
|
||||
{
|
||||
// Register the handler function for the service
|
||||
// Register the handler function for the service
|
||||
|
||||
gSvcStatusHandle = RegisterServiceCtrlHandler(
|
||||
NT_SERVICE_NAME,
|
||||
ServiceCtrlHandler
|
||||
);
|
||||
if (!((gSvcStatusHandle = RegisterServiceCtrlHandler(NT_SERVICE_NAME, ServiceCtrlHandler))))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(!gSvcStatusHandle)
|
||||
{
|
||||
//ServiceReportEvent(RegisterServiceCtrlHandler);
|
||||
return;
|
||||
}
|
||||
// These SERVICE_STATUS members remain as set here
|
||||
|
||||
// These SERVICE_STATUS members remain as set here
|
||||
gSvcStatus.dwServiceType = SERVICE_WIN32_OWN_PROCESS;
|
||||
gSvcStatus.dwServiceSpecificExitCode = 0;
|
||||
|
||||
gSvcStatus.dwServiceType = SERVICE_WIN32_OWN_PROCESS;
|
||||
gSvcStatus.dwServiceSpecificExitCode = 0;
|
||||
|
||||
// Run the actual program
|
||||
ReportServiceStatus(SERVICE_STOPPED, newmain(), 3000);
|
||||
// Run the actual program
|
||||
ReportServiceStatus(SERVICE_STOPPED, newmain(), 3000);
|
||||
}
|
||||
|
||||
SERVICE_TABLE_ENTRY NTServiceDispatchTable[] = {
|
||||
{
|
||||
(LPSTR)NT_SERVICE_NAME,
|
||||
(LPSERVICE_MAIN_FUNCTION) ServiceMain
|
||||
},
|
||||
{
|
||||
NULL,
|
||||
NULL
|
||||
}
|
||||
{
|
||||
(LPSTR)NT_SERVICE_NAME,
|
||||
(LPSERVICE_MAIN_FUNCTION)ServiceMain
|
||||
},
|
||||
{
|
||||
NULL,
|
||||
NULL
|
||||
}
|
||||
};
|
||||
|
||||
VOID ReportServiceStatus(const DWORD dwCurrentState, const DWORD dwWin32ExitCode, const DWORD dwWaitHint)
|
||||
{
|
||||
static DWORD dwCheckPoint = 1;
|
||||
static DWORD dwCheckPoint = 1;
|
||||
|
||||
// Fill in the SERVICE_STATUS structure.
|
||||
// Fill in the SERVICE_STATUS structure.
|
||||
|
||||
gSvcStatus.dwCurrentState = dwCurrentState;
|
||||
gSvcStatus.dwWin32ExitCode = dwWin32ExitCode;
|
||||
gSvcStatus.dwWaitHint = dwWaitHint;
|
||||
gSvcStatus.dwCurrentState = dwCurrentState;
|
||||
gSvcStatus.dwWin32ExitCode = dwWin32ExitCode;
|
||||
gSvcStatus.dwWaitHint = dwWaitHint;
|
||||
|
||||
if (dwCurrentState == SERVICE_START_PENDING)
|
||||
gSvcStatus.dwControlsAccepted = 0;
|
||||
else
|
||||
gSvcStatus.dwControlsAccepted = SERVICE_ACCEPT_STOP;
|
||||
if (dwCurrentState == SERVICE_START_PENDING)
|
||||
gSvcStatus.dwControlsAccepted = 0;
|
||||
else
|
||||
gSvcStatus.dwControlsAccepted = SERVICE_ACCEPT_STOP;
|
||||
|
||||
if ( (dwCurrentState == SERVICE_RUNNING) ||
|
||||
(dwCurrentState == SERVICE_STOPPED) )
|
||||
gSvcStatus.dwCheckPoint = 0;
|
||||
else
|
||||
gSvcStatus.dwCheckPoint = dwCheckPoint++;
|
||||
if ((dwCurrentState == SERVICE_RUNNING) ||
|
||||
(dwCurrentState == SERVICE_STOPPED))
|
||||
gSvcStatus.dwCheckPoint = 0;
|
||||
else
|
||||
gSvcStatus.dwCheckPoint = dwCheckPoint++;
|
||||
|
||||
// Report the status of the service to the SCM.
|
||||
SetServiceStatus(gSvcStatusHandle, &gSvcStatus);
|
||||
// Report the status of the service to the SCM.
|
||||
SetServiceStatus(gSvcStatusHandle, &gSvcStatus);
|
||||
}
|
||||
|
||||
/*VOID ServiceReportEvent(char *szFunction)
|
||||
{
|
||||
HANDLE hEventSource;
|
||||
const char *eventStrings[2];
|
||||
TCHAR Buffer[80];
|
||||
HANDLE hEventSource;
|
||||
const char *eventStrings[2];
|
||||
TCHAR Buffer[80];
|
||||
|
||||
hEventSource = RegisterEventSource(NULL, NT_SERVICE_NAME);
|
||||
hEventSource = RegisterEventSource(NULL, NT_SERVICE_NAME);
|
||||
|
||||
if (hEventSource)
|
||||
{
|
||||
snprintf(Buffer, 80, "%s failed with %d", szFunction, GetLastError());
|
||||
if (hEventSource)
|
||||
{
|
||||
snprintf(Buffer, 80, "%s failed with %d", szFunction, GetLastError());
|
||||
|
||||
eventStrings[0] = NT_SERVICE_NAME;
|
||||
eventStrings[1] = Buffer;
|
||||
eventStrings[0] = NT_SERVICE_NAME;
|
||||
eventStrings[1] = Buffer;
|
||||
|
||||
ReportEvent(hEventSource, // event log handle
|
||||
EVENTLOG_ERROR_TYPE, // event type
|
||||
0, // event category
|
||||
00, // event identifier
|
||||
NULL, // no security identifier
|
||||
2, // size of lpszStrings array
|
||||
0, // no binary data
|
||||
eventStrings, // array of strings
|
||||
NULL); // no binary data
|
||||
ReportEvent(hEventSource, // event log handle
|
||||
EVENTLOG_ERROR_TYPE, // event type
|
||||
0, // event category
|
||||
00, // event identifier
|
||||
NULL, // no security identifier
|
||||
2, // size of lpszStrings array
|
||||
0, // no binary data
|
||||
eventStrings, // array of strings
|
||||
NULL); // no binary data
|
||||
|
||||
DeregisterEventSource(hEventSource);
|
||||
}
|
||||
DeregisterEventSource(hEventSource);
|
||||
}
|
||||
}*/
|
||||
|
||||
//Returns 0=Error, 1=Success, 2=Doesn't exist
|
||||
@ -146,12 +139,12 @@ static uint_fast8_t OpenAndRemoveService(DWORD *dwPreviousState, SC_HANDLE *schS
|
||||
closeManager = TRUE;
|
||||
}
|
||||
|
||||
*schSCManager = OpenSCManager(
|
||||
NULL, // local computer
|
||||
NULL, // ServicesActive database
|
||||
SC_MANAGER_ALL_ACCESS); // full access rights
|
||||
*schSCManager = OpenSCManager(
|
||||
NULL, // local computer
|
||||
NULL, // ServicesActive database
|
||||
SC_MANAGER_ALL_ACCESS); // full access rights
|
||||
|
||||
if (!*schSCManager) return 0;
|
||||
if (!*schSCManager) return 0;
|
||||
|
||||
if (!((installedService = OpenService(*schSCManager, NT_SERVICE_NAME, SERVICE_ALL_ACCESS))))
|
||||
{
|
||||
@ -182,86 +175,86 @@ static uint_fast8_t OpenAndRemoveService(DWORD *dwPreviousState, SC_HANDLE *schS
|
||||
|
||||
static VOID ServiceInstaller(const char *restrict ServiceUser, const char *const ServicePassword)
|
||||
{
|
||||
SC_HANDLE schSCManager;
|
||||
SC_HANDLE schService;
|
||||
char szPath[MAX_PATH] = "\"";
|
||||
SC_HANDLE schSCManager;
|
||||
SC_HANDLE schService;
|
||||
char szPath[MAX_PATH] = "\"";
|
||||
|
||||
if (!GetModuleFileName(NULL, szPath + sizeof(char), MAX_PATH - 1))
|
||||
{
|
||||
errorout("Cannot install service (%d)\n", (uint32_t)GetLastError());
|
||||
return;
|
||||
}
|
||||
if (!GetModuleFileName(NULL, szPath + sizeof(char), MAX_PATH - 1))
|
||||
{
|
||||
errorout("Cannot install service (%d)\n", (uint32_t)GetLastError());
|
||||
return;
|
||||
}
|
||||
|
||||
strcat(szPath,"\"");
|
||||
strcat(szPath, "\"");
|
||||
|
||||
int i;
|
||||
for (i = 1; i < global_argc; i ++)
|
||||
{
|
||||
// Strip unneccessary parameters, especially the password
|
||||
if (!strcmp(global_argv[i], "-s")) continue;
|
||||
int i;
|
||||
for (i = 1; i < global_argc; i++)
|
||||
{
|
||||
// Strip unneccessary parameters, especially the password
|
||||
if (!strcmp(global_argv[i], "-s")) continue;
|
||||
|
||||
if (!strcmp(global_argv[i], "-W") ||
|
||||
!strcmp(global_argv[i], "-U"))
|
||||
{
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
if (!strcmp(global_argv[i], "-W") ||
|
||||
!strcmp(global_argv[i], "-U"))
|
||||
{
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
|
||||
strcat(szPath, " ");
|
||||
strcat(szPath, " ");
|
||||
|
||||
if (strchr(global_argv[i], ' '))
|
||||
{
|
||||
strcat(szPath, "\"");
|
||||
strcat(szPath, global_argv[i]);
|
||||
strcat(szPath, "\"");
|
||||
}
|
||||
else
|
||||
strcat(szPath, global_argv[i]);
|
||||
}
|
||||
if (strchr(global_argv[i], ' '))
|
||||
{
|
||||
strcat(szPath, "\"");
|
||||
strcat(szPath, global_argv[i]);
|
||||
strcat(szPath, "\"");
|
||||
}
|
||||
else
|
||||
strcat(szPath, global_argv[i]);
|
||||
}
|
||||
|
||||
// Get a handle to the SCM database.
|
||||
// Get a handle to the SCM database.
|
||||
|
||||
SERVICE_STATUS status;
|
||||
DWORD dwPreviousState;
|
||||
|
||||
if (!OpenAndRemoveService(&dwPreviousState, &schSCManager))
|
||||
{
|
||||
errorout("Service removal failed (%d)\n", (uint32_t)GetLastError());
|
||||
return;
|
||||
}
|
||||
if (!OpenAndRemoveService(&dwPreviousState, &schSCManager))
|
||||
{
|
||||
errorout("Service removal failed (%d)\n", (uint32_t)GetLastError());
|
||||
return;
|
||||
}
|
||||
|
||||
char *tempUser = NULL;
|
||||
|
||||
if (ServiceUser)
|
||||
{
|
||||
// Shortcuts for some well known users
|
||||
if (!strcasecmp(ServiceUser, "/l")) ServiceUser="NT AUTHORITY\\LocalService";
|
||||
if (!strcasecmp(ServiceUser, "/n")) ServiceUser="NT AUTHORITY\\NetworkService";
|
||||
{
|
||||
// Shortcuts for some well known users
|
||||
if (!strcasecmp(ServiceUser, "/l")) ServiceUser = "NT AUTHORITY\\LocalService";
|
||||
if (!strcasecmp(ServiceUser, "/n")) ServiceUser = "NT AUTHORITY\\NetworkService";
|
||||
|
||||
// Allow Local Users without .\ , e.g. "johndoe" instead of ".\johndoe"
|
||||
if (!strchr(ServiceUser, '\\'))
|
||||
{
|
||||
tempUser = (char*)vlmcsd_malloc(strlen(ServiceUser) + 3);
|
||||
strcpy(tempUser, ".\\");
|
||||
strcat(tempUser, ServiceUser);
|
||||
ServiceUser = tempUser;
|
||||
}
|
||||
}
|
||||
// Allow Local Users without .\ , e.g. "johndoe" instead of ".\johndoe"
|
||||
if (!strchr(ServiceUser, '\\'))
|
||||
{
|
||||
tempUser = (char*)vlmcsd_malloc(strlen(ServiceUser) + 3);
|
||||
strcpy(tempUser, ".\\");
|
||||
strcat(tempUser, ServiceUser);
|
||||
ServiceUser = tempUser;
|
||||
}
|
||||
}
|
||||
|
||||
schService = CreateService(
|
||||
schSCManager, // SCM database
|
||||
NT_SERVICE_NAME, // name of service
|
||||
NT_SERVICE_DISPLAY_NAME, // service name to display
|
||||
SERVICE_ALL_ACCESS, // desired access
|
||||
SERVICE_WIN32_OWN_PROCESS, // service type
|
||||
SERVICE_AUTO_START, // start type
|
||||
SERVICE_ERROR_NORMAL, // error control type
|
||||
szPath, // path to service's binary
|
||||
NULL, // no load ordering group
|
||||
NULL, // no tag identifier
|
||||
"tcpip\0", // depends on TCP/IP
|
||||
ServiceUser, // LocalSystem account
|
||||
ServicePassword); // no password
|
||||
schSCManager, // SCM database
|
||||
NT_SERVICE_NAME, // name of service
|
||||
NT_SERVICE_DISPLAY_NAME, // service name to display
|
||||
SERVICE_ALL_ACCESS, // desired access
|
||||
SERVICE_WIN32_OWN_PROCESS, // service type
|
||||
SERVICE_AUTO_START, // start type
|
||||
SERVICE_ERROR_NORMAL, // error control type
|
||||
szPath, // path to service's binary
|
||||
NULL, // no load ordering group
|
||||
NULL, // no tag identifier
|
||||
"tcpip\0", // depends on TCP/IP
|
||||
ServiceUser, // LocalSystem account
|
||||
ServicePassword); // no password
|
||||
|
||||
# if __clang__ && (__CYGWIN__ || __MINGW64__ )
|
||||
// Workaround for clang not understanding some GCC asm syntax used in <w32api/psdk_inc/intrin-impl.h>
|
||||
@ -271,43 +264,43 @@ static VOID ServiceInstaller(const char *restrict ServiceUser, const char *const
|
||||
# endif
|
||||
if (tempUser) free(tempUser);
|
||||
|
||||
if (schService == NULL)
|
||||
{
|
||||
errorout("CreateService failed (%u)\n", (uint32_t)GetLastError());
|
||||
CloseServiceHandle(schSCManager);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
errorout("Service installed successfully\n");
|
||||
if (schService == NULL)
|
||||
{
|
||||
errorout("CreateService failed (%u)\n", (uint32_t)GetLastError());
|
||||
CloseServiceHandle(schSCManager);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
errorout("Service installed successfully\n");
|
||||
|
||||
if (dwPreviousState == SERVICE_RUNNING)
|
||||
{
|
||||
printf("Restarting " NT_SERVICE_NAME " service => ");
|
||||
status.dwCurrentState = SERVICE_STOPPED;
|
||||
if (dwPreviousState == SERVICE_RUNNING)
|
||||
{
|
||||
printf("Restarting " NT_SERVICE_NAME " service => ");
|
||||
status.dwCurrentState = SERVICE_STOPPED;
|
||||
|
||||
if (StartService(schService, 0, NULL))
|
||||
{
|
||||
for (i = 0; i < 10; i++)
|
||||
{
|
||||
if (!QueryServiceStatus(schService, &status) || status.dwCurrentState != SERVICE_START_PENDING) break;
|
||||
Sleep(100);
|
||||
}
|
||||
if (StartService(schService, 0, NULL))
|
||||
{
|
||||
for (i = 0; i < 10; i++)
|
||||
{
|
||||
if (!QueryServiceStatus(schService, &status) || status.dwCurrentState != SERVICE_START_PENDING) break;
|
||||
Sleep(100);
|
||||
}
|
||||
|
||||
if (status.dwCurrentState == SERVICE_RUNNING)
|
||||
printf("Success\n");
|
||||
else if (status.dwCurrentState == SERVICE_START_PENDING)
|
||||
printf("Not ready within a second\n");
|
||||
else
|
||||
errorout("Error\n");
|
||||
}
|
||||
else
|
||||
errorout("Error %u\n", (uint32_t)GetLastError());
|
||||
}
|
||||
}
|
||||
if (status.dwCurrentState == SERVICE_RUNNING)
|
||||
printf("Success\n");
|
||||
else if (status.dwCurrentState == SERVICE_START_PENDING)
|
||||
printf("Not ready within a second\n");
|
||||
else
|
||||
errorout("Error\n");
|
||||
}
|
||||
else
|
||||
errorout("Error %u\n", (uint32_t)GetLastError());
|
||||
}
|
||||
}
|
||||
|
||||
CloseServiceHandle(schService);
|
||||
CloseServiceHandle(schSCManager);
|
||||
CloseServiceHandle(schService);
|
||||
CloseServiceHandle(schSCManager);
|
||||
}
|
||||
|
||||
int NtServiceInstallation(const int_fast8_t installService, const char *restrict ServiceUser, const char *const ServicePassword)
|
||||
@ -322,7 +315,7 @@ int NtServiceInstallation(const int_fast8_t installService, const char *restrict
|
||||
|
||||
if (installService == 2) // Remove
|
||||
{
|
||||
switch(OpenAndRemoveService(NULL, NULL))
|
||||
switch (OpenAndRemoveService(NULL, NULL))
|
||||
{
|
||||
case 0:
|
||||
errorout("Error removing service %s\n", NT_SERVICE_NAME);
|
||||
|
@ -643,6 +643,10 @@ void printServerFlags()
|
||||
" SUPPORT_WINE"
|
||||
# endif // (_WIN32 || __CYGWIN__) && (!defined(USE_MSRPC) || defined(SUPPORT_WINE))
|
||||
|
||||
# if (_WIN32 || __CYGWIN__) && defined(NO_TAP)
|
||||
" NO_TAP"
|
||||
# endif // (_WIN32 || __CYGWIN__) && defined(NO_TAP)
|
||||
|
||||
# if !HAVE_FREEBIND
|
||||
" NO_FREEBIND"
|
||||
# endif //!HAVE_FREEBIND
|
||||
|
@ -75,6 +75,8 @@ int_fast8_t logverbose = 0;
|
||||
#endif // NO_LOG
|
||||
|
||||
#ifndef NO_SOCKETS
|
||||
int_fast8_t ExitLevel = 0;
|
||||
|
||||
#ifndef _WIN32
|
||||
int_fast8_t nodaemon = 0;
|
||||
#endif // _WIN32
|
||||
@ -84,7 +86,7 @@ int_fast8_t InetdMode = 0;
|
||||
int_fast8_t nodaemon = 1;
|
||||
#endif // _WIN32
|
||||
int_fast8_t InetdMode = 1;
|
||||
#endif
|
||||
#endif // NO_SOCKETS
|
||||
|
||||
PVlmcsdHeader_t KmsData = NULL;
|
||||
#ifndef NO_EXTERNAL_DATA
|
||||
@ -104,7 +106,7 @@ int_fast8_t RandomizationLevel = 1;
|
||||
uint16_t Lcid = 0;
|
||||
#endif
|
||||
|
||||
#ifndef NO_SOCKETS
|
||||
#if !defined(NO_SOCKETS) && !defined(USE_MSRPC)
|
||||
#ifdef SIMPLE_SOCKETS
|
||||
SOCKET s_server;
|
||||
#else
|
||||
@ -120,7 +122,7 @@ HANDLE MaxTaskSemaphore;
|
||||
#endif // _WIN32
|
||||
|
||||
#endif // !defined(NO_LIMIT) && !__minix__
|
||||
#endif // NO_SOCKETS
|
||||
#endif // !defined(NO_SOCKETS) && !defined(USE_MSRPC)
|
||||
|
||||
#ifdef _NTSERVICE
|
||||
int_fast8_t IsNTService = TRUE;
|
||||
|
@ -133,6 +133,7 @@ extern int_fast8_t UseClientRpcBTFN;
|
||||
#endif // USE_MSRPC
|
||||
|
||||
#ifndef NO_SOCKETS
|
||||
extern int_fast8_t ExitLevel;
|
||||
extern char *defaultport;
|
||||
#endif // NO_SOCKETS
|
||||
|
||||
|
77
src/tap-windows.h
Normal file
77
src/tap-windows.h
Normal file
@ -0,0 +1,77 @@
|
||||
/*
|
||||
* TAP-Windows -- A kernel driver to provide virtual tap
|
||||
* device functionality on Windows.
|
||||
*
|
||||
* This code was inspired by the CIPE-Win32 driver by Damion K. Wilson.
|
||||
*
|
||||
* This source code is Copyright (C) 2002-2014 OpenVPN Technologies, Inc.,
|
||||
* and is released under the GPL version 2 (see below). This particular file
|
||||
* (tap-windows.h) is also licensed using the MIT license (see COPYRIGHT.MIT).
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program (see the file COPYING included with this
|
||||
* distribution); if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#ifndef __TAP_WIN_H
|
||||
#define __TAP_WIN_H
|
||||
|
||||
/*
|
||||
* =============
|
||||
* TAP IOCTLs
|
||||
* =============
|
||||
*/
|
||||
|
||||
#define TAP_WIN_CONTROL_CODE(request,method) \
|
||||
CTL_CODE (FILE_DEVICE_UNKNOWN, request, method, FILE_ANY_ACCESS)
|
||||
|
||||
/* Present in 8.1 */
|
||||
|
||||
#define TAP_WIN_IOCTL_GET_MAC TAP_WIN_CONTROL_CODE (1, METHOD_BUFFERED)
|
||||
#define TAP_WIN_IOCTL_GET_VERSION TAP_WIN_CONTROL_CODE (2, METHOD_BUFFERED)
|
||||
#define TAP_WIN_IOCTL_GET_MTU TAP_WIN_CONTROL_CODE (3, METHOD_BUFFERED)
|
||||
#define TAP_WIN_IOCTL_GET_INFO TAP_WIN_CONTROL_CODE (4, METHOD_BUFFERED)
|
||||
#define TAP_WIN_IOCTL_CONFIG_POINT_TO_POINT TAP_WIN_CONTROL_CODE (5, METHOD_BUFFERED)
|
||||
#define TAP_WIN_IOCTL_SET_MEDIA_STATUS TAP_WIN_CONTROL_CODE (6, METHOD_BUFFERED)
|
||||
#define TAP_WIN_IOCTL_CONFIG_DHCP_MASQ TAP_WIN_CONTROL_CODE (7, METHOD_BUFFERED)
|
||||
#define TAP_WIN_IOCTL_GET_LOG_LINE TAP_WIN_CONTROL_CODE (8, METHOD_BUFFERED)
|
||||
#define TAP_WIN_IOCTL_CONFIG_DHCP_SET_OPT TAP_WIN_CONTROL_CODE (9, METHOD_BUFFERED)
|
||||
|
||||
/* Added in 8.2 */
|
||||
|
||||
/* obsoletes TAP_WIN_IOCTL_CONFIG_POINT_TO_POINT */
|
||||
#define TAP_WIN_IOCTL_CONFIG_TUN TAP_WIN_CONTROL_CODE (10, METHOD_BUFFERED)
|
||||
|
||||
/*
|
||||
* =================
|
||||
* Registry keys
|
||||
* =================
|
||||
*/
|
||||
|
||||
#define ADAPTER_KEY "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002BE10318}"
|
||||
|
||||
#define NETWORK_CONNECTIONS_KEY "SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}"
|
||||
|
||||
/*
|
||||
* ======================
|
||||
* Filesystem prefixes
|
||||
* ======================
|
||||
*/
|
||||
|
||||
#define USERMODEDEVICEDIR "\\\\.\\Global\\"
|
||||
#define SYSDEVICEDIR "\\Device\\"
|
||||
#define USERDEVICEDIR "\\DosDevices\\Global\\"
|
||||
#define TAP_WIN_SUFFIX ".tap"
|
||||
|
||||
#endif // __TAP_WIN_H
|
||||
|
||||
|
@ -227,6 +227,10 @@ typedef struct __packed
|
||||
|
||||
#if (defined(_WIN32) || defined(__CYGWIN__)) && !defined(NO_SOCKETS)
|
||||
#define _NTSERVICE
|
||||
#else
|
||||
#ifndef NO_TAP
|
||||
#define NO_TAP
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if (defined(__CYGWIN__) || defined(_WIN32) || defined(NO_SOCKETS)) && !defined(NO_SIGHUP)
|
||||
|
@ -854,7 +854,7 @@ int SendActivationRequest(const RpcCtx sock, RESPONSE *baseResponse, REQUEST *ba
|
||||
else
|
||||
request = CreateRequestV6(&requestSize, baseRequest);
|
||||
|
||||
if (!(status = rpcSendRequest(sock, request, requestSize, &response, &responseSize)))
|
||||
if (!((status = rpcSendRequest(sock, request, requestSize, &response, &responseSize))))
|
||||
{
|
||||
if (LE16(((RESPONSE*)(response))->MajorVer) == 4)
|
||||
{
|
||||
|
116
src/vlmcsd.c
116
src/vlmcsd.c
@ -80,7 +80,11 @@
|
||||
#include "ntservice.h"
|
||||
#include "helpers.h"
|
||||
|
||||
static const char* const optstring = "N:B:m:t:w:0:3:6:H:A:R:u:g:L:p:i:P:l:r:U:W:C:c:F:o:T:K:E:M:j:SseDdVvqkZ";
|
||||
#ifndef NO_TAP
|
||||
#include "wintap.h"
|
||||
#endif
|
||||
|
||||
static const char* const optstring = "N:B:m:t:w:0:3:6:H:A:R:u:g:L:p:i:P:l:r:U:W:C:c:F:O:o:x:T:K:E:M:j:SseDdVvqkZ";
|
||||
|
||||
#if !defined(NO_SOCKETS) && !defined(USE_MSRPC) && !defined(SIMPLE_SOCKETS)
|
||||
static uint_fast8_t maxsockets = 0;
|
||||
@ -105,6 +109,10 @@ static const char *fn_ini = INI_FILE;
|
||||
static const char *fn_ini = NULL;
|
||||
#endif // !INI_FILE
|
||||
|
||||
#ifndef NO_TAP
|
||||
char* tapArgument = NULL;
|
||||
#endif // NO_TAP
|
||||
|
||||
static const char* IniFileErrorMessage = "";
|
||||
char* IniFileErrorBuffer = NULL;
|
||||
#define INIFILE_ERROR_BUFFERSIZE 256
|
||||
@ -115,6 +123,12 @@ static IniFileParameter_t IniFileParameterList[] =
|
||||
{ "Office2010", INI_PARAM_OFFICE2010 },
|
||||
{ "Office2013", INI_PARAM_OFFICE2013 },
|
||||
{ "Office2016", INI_PARAM_OFFICE2016 },
|
||||
# ifndef NO_SOCKETS
|
||||
{ "ExitLevel", INI_PARAM_EXIT_LEVEL },
|
||||
# endif // NO_SOCKETS
|
||||
# ifndef NO_TAP
|
||||
{ "VPN", INI_PARAM_VPN },
|
||||
# endif // NO_TAP
|
||||
# ifndef NO_EXTERNAL_DATA
|
||||
{ "KmsData", INI_PARAM_DATA_FILE },
|
||||
# endif // NO_EXTERNAL_DATA
|
||||
@ -281,7 +295,11 @@ static __noreturn void usage()
|
||||
# endif // USE_MSRPC
|
||||
# endif // !HAVE_GETIFADDR
|
||||
# endif // !defined(NO_PRIVATE_IP_DETECT)
|
||||
# ifndef NO_TAP
|
||||
" -O <v>[=<a>][/<c>]\tuse VPN adapter <v> with IPv4 address <a> and CIDR <c>\n"
|
||||
# endif
|
||||
# ifndef NO_SOCKETS
|
||||
" -x <level>\t\texit if warning <level> reached (default 0)\n"
|
||||
# if !defined(USE_MSRPC) && !defined(SIMPLE_SOCKETS)
|
||||
" -L <address>[:<port>]\tlisten on IP address <address> with optional <port>\n"
|
||||
" -P <port>\t\tset TCP port <port> for subsequent -L statements (default 1688)\n"
|
||||
@ -368,43 +386,8 @@ static __noreturn void usage()
|
||||
|
||||
|
||||
#ifndef NO_CUSTOM_INTERVALS
|
||||
|
||||
// Convert time span strings (e.g. "2h", "5w") to minutes
|
||||
__pure static DWORD timeSpanString2Minutes(const char *const restrict argument)
|
||||
{
|
||||
char *unitId;
|
||||
|
||||
long long val = vlmcsd_strtoll(argument, &unitId, 10);
|
||||
|
||||
switch (toupper((int)*unitId))
|
||||
{
|
||||
case 0:
|
||||
case 'M':
|
||||
break;
|
||||
case 'H':
|
||||
val *= 60;
|
||||
break;
|
||||
case 'D':
|
||||
val *= 60 * 24;
|
||||
break;
|
||||
case 'W':
|
||||
val *= 60 * 24 * 7;
|
||||
break;
|
||||
case 'S':
|
||||
val /= 60;
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (val < 1) val = 1;
|
||||
if (val > UINT_MAX) val = UINT_MAX;
|
||||
|
||||
return (DWORD)val;
|
||||
}
|
||||
|
||||
|
||||
#ifndef NO_INI_FILE
|
||||
|
||||
__pure static BOOL getTimeSpanFromIniFile(DWORD* result, const char *const restrict argument)
|
||||
{
|
||||
DWORD val = timeSpanString2Minutes(argument);
|
||||
@ -417,12 +400,13 @@ __pure static BOOL getTimeSpanFromIniFile(DWORD* result, const char *const restr
|
||||
*result = val;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#endif // NO_INI_FILE
|
||||
|
||||
|
||||
__pure static DWORD getTimeSpanFromCommandLine(const char *const restrict optarg, const char optchar)
|
||||
{
|
||||
long long val = timeSpanString2Minutes(optarg);
|
||||
DWORD val = timeSpanString2Minutes(optarg);
|
||||
|
||||
if (!val)
|
||||
{
|
||||
@ -430,7 +414,7 @@ __pure static DWORD getTimeSpanFromCommandLine(const char *const restrict optarg
|
||||
exit(VLMCSD_EINVAL);
|
||||
}
|
||||
|
||||
return (DWORD)val;
|
||||
return val;
|
||||
}
|
||||
|
||||
#endif // NO_CUSTOM_INTERVALS
|
||||
@ -569,6 +553,14 @@ static BOOL setIniFileParameter(uint_fast8_t id, const char *const iniarg)
|
||||
setHwIdFromIniFileLine(&s, EPID_INDEX_OFFICE2016);
|
||||
break;
|
||||
|
||||
# ifndef NO_TAP
|
||||
|
||||
case INI_PARAM_VPN:
|
||||
tapArgument = (char*)vlmcsd_strdup(iniarg);
|
||||
break;
|
||||
|
||||
# endif // NO_TAP
|
||||
|
||||
# if !defined(NO_USER_SWITCH) && !_WIN32
|
||||
|
||||
case INI_PARAM_GID:
|
||||
@ -737,6 +729,15 @@ static BOOL setIniFileParameter(uint_fast8_t id, const char *const iniarg)
|
||||
|
||||
# endif // USE_MSRPC
|
||||
|
||||
# ifndef NO_SOCKETS
|
||||
|
||||
case INI_PARAM_EXIT_LEVEL:
|
||||
success = getIniFileArgumentInt(&result, iniarg, 0, 1);
|
||||
if (success) ExitLevel = (int_fast8_t)result;
|
||||
break;
|
||||
|
||||
# endif // NO_SOCKETS
|
||||
|
||||
# if HAVE_FREEBIND
|
||||
|
||||
case INI_PARAM_FREEBIND:
|
||||
@ -1078,6 +1079,15 @@ static void parseGeneralArguments() {
|
||||
break;
|
||||
# endif // !defined(NO_SOCKETS) && !defined(NO_SIGHUP) && !defined(_WIN32)
|
||||
|
||||
# ifndef NO_TAP
|
||||
|
||||
case 'O':
|
||||
ignoreIniFileParameter(INI_PARAM_VPN);
|
||||
tapArgument = getCommandLineArg(optarg);
|
||||
break;
|
||||
|
||||
# endif // NO_TAP
|
||||
|
||||
# ifndef NO_CL_PIDS
|
||||
|
||||
case 'w':
|
||||
@ -1134,6 +1144,11 @@ static void parseGeneralArguments() {
|
||||
|
||||
# ifndef NO_SOCKETS
|
||||
|
||||
case 'x':
|
||||
ignoreIniFileParameter(INI_PARAM_EXIT_LEVEL);
|
||||
ExitLevel = getOptionArgumentInt((char)o, 0, 1);
|
||||
break;
|
||||
|
||||
case 'P':
|
||||
ignoreIniFileParameter(INI_PARAM_PORT);
|
||||
# if !defined(SIMPLE_SOCKETS) && !defined(USE_MSRPC)
|
||||
@ -1413,16 +1428,16 @@ static void writePidFile()
|
||||
|
||||
if (fn_pid && !InetdMode)
|
||||
{
|
||||
FILE *_f = fopen(fn_pid, "w");
|
||||
FILE *file = fopen(fn_pid, "w");
|
||||
|
||||
if (_f)
|
||||
if (file)
|
||||
{
|
||||
# if _MSC_VER
|
||||
fprintf(_f, "%u", (unsigned int)GetCurrentProcessId());
|
||||
fprintf(file, "%u", (unsigned int)GetCurrentProcessId());
|
||||
# else
|
||||
fprintf(_f, "%u", (unsigned int)getpid());
|
||||
fprintf(file, "%u", (unsigned int)getpid());
|
||||
# endif
|
||||
fclose(_f);
|
||||
fclose(file);
|
||||
}
|
||||
|
||||
# ifndef NO_LOG
|
||||
@ -1647,10 +1662,6 @@ int setupListeningSockets()
|
||||
|
||||
int server_main(int argc, CARGV argv)
|
||||
{
|
||||
# if !defined(NO_RANDOM_EPID) || !defined(NO_CL_PIDS) || !defined(NO_INI_FILE)
|
||||
KmsResponseParameters = (KmsResponseParam_t*)vlmcsd_malloc(sizeof(KmsResponseParam_t) * MIN_CSVLK);
|
||||
memset(KmsResponseParameters, 0, sizeof(KmsResponseParam_t) * MIN_CSVLK);
|
||||
# endif // !defined(NO_RANDOM_EPID) || !defined(NO_CL_PIDS) || !defined(NO_INI_FILE)
|
||||
global_argc = argc;
|
||||
global_argv = argv;
|
||||
|
||||
@ -1672,6 +1683,11 @@ int server_main(int argc, CARGV argv)
|
||||
|
||||
int newmain()
|
||||
{
|
||||
# if !defined(NO_RANDOM_EPID) || !defined(NO_CL_PIDS) || !defined(NO_INI_FILE)
|
||||
KmsResponseParameters = (KmsResponseParam_t*)vlmcsd_malloc(sizeof(KmsResponseParam_t) * MIN_CSVLK);
|
||||
memset(KmsResponseParameters, 0, sizeof(KmsResponseParam_t) * MIN_CSVLK);
|
||||
# endif // !defined(NO_RANDOM_EPID) || !defined(NO_CL_PIDS) || !defined(NO_INI_FILE)
|
||||
|
||||
// Initialize thread synchronization objects for Windows and Cygwin
|
||||
# ifdef USE_THREADS
|
||||
|
||||
@ -1769,6 +1785,10 @@ int newmain()
|
||||
return NtServiceInstallation(installService, ServiceUser, ServicePassword);
|
||||
# endif // _NTSERVICE
|
||||
|
||||
# ifndef NO_TAP
|
||||
if (tapArgument && !InetdMode) startTap(tapArgument);
|
||||
# endif // NO_TAP
|
||||
|
||||
# if !defined(NO_SOCKETS) && !defined(USE_MSRPC)
|
||||
if (!InetdMode)
|
||||
{
|
||||
|
@ -57,6 +57,8 @@ int server_main(int argc, CARGV argv);
|
||||
#define INI_PARAM_MAINTAIN_CLIENTS 26
|
||||
#define INI_PARAM_START_EMPTY 27
|
||||
#define INI_PARAM_DATA_FILE 28
|
||||
#define INI_PARAM_VPN 29
|
||||
#define INI_PARAM_EXIT_LEVEL 30
|
||||
|
||||
#define INI_FILE_PASS_1 1
|
||||
#define INI_FILE_PASS_2 2
|
||||
|
372
src/wintap.c
Normal file
372
src/wintap.c
Normal file
@ -0,0 +1,372 @@
|
||||
#ifndef _CRT_SECURE_NO_WARNINGS
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG
|
||||
#define CONFIG "config.h"
|
||||
#endif // CONFIG
|
||||
#include CONFIG
|
||||
#include "helpers.h"
|
||||
#include "wintap.h"
|
||||
|
||||
#ifndef NO_TAP
|
||||
|
||||
#include "types.h"
|
||||
#include "endian.h"
|
||||
#include "output.h"
|
||||
#include "tap-windows.h"
|
||||
#include <iphlpapi.h>
|
||||
|
||||
#if !_WIN32
|
||||
#include <arpa/inet.h>
|
||||
#endif // !_WIN32
|
||||
|
||||
static char* szIpAddress = "10.10.10.9";
|
||||
static char* szMask = "30";
|
||||
static char* szTapName;
|
||||
static char *ActiveTapName, *AdapterClass;
|
||||
static char* szLeaseDuration = "1d";
|
||||
static uint32_t IpAddress, Mask, Network, Broadcast, DhcpServer; // These are host-endian (=little-endian) for easier calculations
|
||||
static uint32_t Mtu;
|
||||
static uint_fast8_t Cidr;
|
||||
static HANDLE TapHandle;
|
||||
static TapDriverVersion_t DriverVersion;
|
||||
static IpPacket_t* IpPacket;
|
||||
static uint32_t DhcpLeaseDuration;
|
||||
|
||||
|
||||
static BOOL isAddressAssigned()
|
||||
{
|
||||
PMIB_IPADDRTABLE pIPAddrTable;
|
||||
DWORD dwSize = 0;
|
||||
BOOL result = FALSE;
|
||||
|
||||
pIPAddrTable = (PMIB_IPADDRTABLE)vlmcsd_malloc(sizeof(MIB_IPADDRTABLE));
|
||||
DWORD status = GetIpAddrTable(pIPAddrTable, &dwSize, 0);
|
||||
free(pIPAddrTable);
|
||||
|
||||
if (status != ERROR_INSUFFICIENT_BUFFER) return FALSE;
|
||||
pIPAddrTable = (MIB_IPADDRTABLE *)vlmcsd_malloc(dwSize);
|
||||
|
||||
if (GetIpAddrTable(pIPAddrTable, &dwSize, 0))
|
||||
{
|
||||
free(pIPAddrTable);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
PMIB_IPADDRROW row;
|
||||
for (row = pIPAddrTable->table; row < pIPAddrTable->table + pIPAddrTable->dwNumEntries; row++)
|
||||
{
|
||||
if (
|
||||
row->dwAddr == BE32(IpAddress) &&
|
||||
!(row->wType & (MIB_IPADDR_DELETED | MIB_IPADDR_DISCONNECTED | MIB_IPADDR_TRANSIENT))
|
||||
)
|
||||
{
|
||||
result = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
free(pIPAddrTable);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
static void parseTapArgument(char* argument)
|
||||
{
|
||||
char* equalsignPosition = strchr(argument, (int)'=');
|
||||
char* slashPosition = strchr(argument, (int)'/');
|
||||
char* colonPosition = strchr(argument, (int)':');
|
||||
|
||||
szTapName = argument;
|
||||
|
||||
if (equalsignPosition)
|
||||
{
|
||||
*equalsignPosition = 0;
|
||||
szIpAddress = equalsignPosition + 1;
|
||||
}
|
||||
|
||||
if (slashPosition)
|
||||
{
|
||||
*slashPosition = 0;
|
||||
szMask = slashPosition + 1;
|
||||
}
|
||||
|
||||
if (colonPosition)
|
||||
{
|
||||
*colonPosition = 0;
|
||||
szLeaseDuration = colonPosition + 1;
|
||||
}
|
||||
|
||||
IpAddress = BE32(inet_addr(szIpAddress));
|
||||
|
||||
if (IpAddress == BE32(INADDR_NONE))
|
||||
{
|
||||
printerrorf("Fatal: %s is not a valid IPv4 address\n", szIpAddress);
|
||||
exit(VLMCSD_EINVAL);
|
||||
}
|
||||
|
||||
char* next;
|
||||
Cidr = (uint8_t)strtol(szMask, &next, 10);
|
||||
|
||||
if (*next || Cidr < 8 || Cidr > 30)
|
||||
{
|
||||
printerrorf("Fatal: /%s is not a valid CIDR mask between /8 and /30\n", szMask);
|
||||
exit(VLMCSD_EINVAL);
|
||||
}
|
||||
|
||||
if (!((DhcpLeaseDuration = timeSpanString2Seconds(szLeaseDuration))))
|
||||
{
|
||||
printerrorf("Fatal: No valid time span specified in option -%c.\n", 'O');
|
||||
exit(VLMCSD_EINVAL);
|
||||
}
|
||||
|
||||
Mask = (uint32_t)~(0xffffffff >> Cidr);
|
||||
Network = IpAddress & Mask;
|
||||
Broadcast = IpAddress | ~Mask;
|
||||
DhcpServer = IpAddress + 1;
|
||||
|
||||
if (IpAddress <= Network || IpAddress + 1 >= Broadcast)
|
||||
{
|
||||
uint32_t lowerIpBE = BE32(Network + 1);
|
||||
uint32_t upperIpBE = BE32(Broadcast - 2);
|
||||
const char* szLower = vlmcsd_strdup(inet_ntoa(*(struct in_addr*)&lowerIpBE));
|
||||
const char* szUpper = vlmcsd_strdup(inet_ntoa(*(struct in_addr*)&upperIpBE));
|
||||
|
||||
printerrorf("Fatal: For this subnet the IPv4 address must be ");
|
||||
|
||||
if (lowerIpBE == upperIpBE)
|
||||
{
|
||||
printerrorf("%s\n", szLower);
|
||||
}
|
||||
else
|
||||
{
|
||||
printerrorf("between %s and %s\n", szLower, szUpper);
|
||||
}
|
||||
|
||||
exit(VLMCSD_EINVAL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
__noreturn static void WinErrorExit(DWORD error)
|
||||
{
|
||||
printerrorf("Registry read error: %s\n", win_strerror((int)error));
|
||||
exit(error);
|
||||
}
|
||||
|
||||
|
||||
static HANDLE OpenTapHandle()
|
||||
{
|
||||
HANDLE handle = INVALID_HANDLE_VALUE;
|
||||
HKEY regAdapterKey;
|
||||
DWORD regResult;
|
||||
if ((regResult = RegOpenKeyEx(HKEY_LOCAL_MACHINE, ADAPTER_KEY, 0, KEY_READ | KEY_WOW64_64KEY, ®AdapterKey)) != ERROR_SUCCESS)
|
||||
{
|
||||
WinErrorExit(regResult);
|
||||
}
|
||||
|
||||
char subkeyName[TAP_REGISTRY_DATA_SIZE];
|
||||
DWORD i, subKeySize = sizeof(subkeyName);
|
||||
|
||||
for (i = 0; (regResult = RegEnumKeyEx(regAdapterKey, i, subkeyName, &subKeySize, NULL, NULL, NULL, NULL)) != ERROR_NO_MORE_ITEMS; i++)
|
||||
{
|
||||
HKEY regSubKey;
|
||||
DWORD type, regDataSize;
|
||||
char regData[TAP_REGISTRY_DATA_SIZE];
|
||||
|
||||
if (regResult) WinErrorExit(regResult);
|
||||
|
||||
if ((regResult = RegOpenKeyEx(regAdapterKey, subkeyName, 0, KEY_READ | KEY_WOW64_64KEY, ®SubKey)) == ERROR_SUCCESS)
|
||||
{
|
||||
regDataSize = sizeof(regData);
|
||||
|
||||
if (RegQueryValueEx(regSubKey, "ComponentId", NULL, &type, (LPBYTE)regData, ®DataSize) == ERROR_SUCCESS)
|
||||
{
|
||||
if (
|
||||
type == REG_SZ &&
|
||||
(
|
||||
!strncmp(regData, "tap0801", sizeof(regData)) ||
|
||||
!strncmp(regData, "tap0901", sizeof(regData)) ||
|
||||
!strncmp(regData, "TEAMVIEWERVPN", sizeof(regData))
|
||||
)
|
||||
)
|
||||
{
|
||||
AdapterClass = vlmcsd_strdup(regData);
|
||||
regDataSize = sizeof(regData);
|
||||
|
||||
if (RegQueryValueEx(regSubKey, "NetCfgInstanceId", NULL, &type, (LPBYTE)regData, ®DataSize) == ERROR_SUCCESS && type == REG_SZ)
|
||||
{
|
||||
HKEY connectionKey;
|
||||
char connectionKeyName[TAP_REGISTRY_DATA_SIZE];
|
||||
|
||||
strncpy(connectionKeyName, NETWORK_CONNECTIONS_KEY "\\", sizeof(connectionKeyName));
|
||||
strncat(connectionKeyName, regData, sizeof(connectionKeyName));
|
||||
strncat(connectionKeyName, "\\Connection", sizeof(connectionKeyName));
|
||||
|
||||
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, connectionKeyName, 0, KEY_READ | KEY_WOW64_64KEY, &connectionKey) == ERROR_SUCCESS)
|
||||
{
|
||||
char deviceName[TAP_REGISTRY_DATA_SIZE];
|
||||
regDataSize = sizeof(deviceName);
|
||||
|
||||
if (RegQueryValueEx(connectionKey, "Name", NULL, &type, (LPBYTE)deviceName, ®DataSize) == ERROR_SUCCESS && type == REG_SZ)
|
||||
{
|
||||
if (!strcmp(szTapName, ".") || !strncasecmp(szTapName, deviceName, sizeof(deviceName)))
|
||||
{
|
||||
ActiveTapName = vlmcsd_strdup(deviceName);
|
||||
strncpy(deviceName, USERMODEDEVICEDIR, sizeof(deviceName));
|
||||
strncat(deviceName, regData, sizeof(deviceName));
|
||||
strncat(deviceName, strcmp(AdapterClass, "TEAMVIEWERVPN") ? TAP_WIN_SUFFIX : ".dgt", sizeof(deviceName));
|
||||
handle = CreateFile(deviceName, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_SYSTEM, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RegCloseKey(connectionKey);
|
||||
}
|
||||
|
||||
if (handle == INVALID_HANDLE_VALUE) free(AdapterClass);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RegCloseKey(regSubKey);
|
||||
subKeySize = sizeof(subkeyName);
|
||||
if (handle != INVALID_HANDLE_VALUE) break;
|
||||
}
|
||||
|
||||
RegCloseKey(regAdapterKey);
|
||||
|
||||
if (handle == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
printerrorf("Fatal: No compatible VPN adapter");
|
||||
|
||||
if (!strcmp(szTapName, "."))
|
||||
{
|
||||
printerrorf("s");
|
||||
}
|
||||
else
|
||||
{
|
||||
printerrorf(" with name \"%s\"", szTapName);
|
||||
}
|
||||
|
||||
printerrorf(" available for use\n");
|
||||
exit(ERROR_DEVICE_NOT_AVAILABLE);
|
||||
}
|
||||
|
||||
return handle;
|
||||
}
|
||||
|
||||
|
||||
static int DevCtl(DWORD code, void* data, DWORD len)
|
||||
{
|
||||
if (!DeviceIoControl(TapHandle, code, data, len, data, len, &len, NULL))
|
||||
{
|
||||
DWORD error = GetLastError();
|
||||
printerrorf("Fatal: VPN adapter error: %s\n", win_strerror(error));
|
||||
exit(error);
|
||||
}
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
|
||||
static DWORD WINAPI TapMirror(LPVOID data)
|
||||
{
|
||||
while (TRUE)
|
||||
{
|
||||
DWORD bytesRead, bytesWritten;
|
||||
if (!ReadFile(TapHandle, IpPacket, Mtu, &bytesRead, NULL)) break;
|
||||
|
||||
uint32_t temp = IpPacket->ip_src;
|
||||
IpPacket->ip_src = IpPacket->ip_dst;
|
||||
IpPacket->ip_dst = temp;
|
||||
|
||||
if (!WriteFile(TapHandle, IpPacket, bytesRead, &bytesWritten, NULL)) break;
|
||||
|
||||
# if !defined(NO_LOG) && defined(_PEDANTIC)
|
||||
if (bytesRead != bytesWritten) logger("Warning: VPN device \"%s\": %u bytes could not be written\n", ActiveTapName, bytesRead - bytesWritten);
|
||||
# endif // !defined(NO_LOG) && defined(_PEDANTIC)
|
||||
}
|
||||
|
||||
DWORD error = GetLastError();
|
||||
|
||||
# ifndef NO_LOG
|
||||
logger("Warning: VPN thread for device \"%s\" exiting: %s\n", ActiveTapName, win_strerror(error));
|
||||
# endif // NO_LOG
|
||||
|
||||
free(ActiveTapName);
|
||||
CloseHandle(TapHandle);
|
||||
exitOnWarningLevel(1);
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
void startTap(char* const argument)
|
||||
{
|
||||
if (!strcmp(argument, "-")) return;
|
||||
parseTapArgument(argument);
|
||||
|
||||
TapHandle = OpenTapHandle();
|
||||
|
||||
// Get MTU and driver version
|
||||
DevCtl(TAP_WIN_IOCTL_GET_MTU, &Mtu, sizeof(Mtu));
|
||||
DevCtl(TAP_WIN_IOCTL_GET_VERSION, &DriverVersion, sizeof(DriverVersion));
|
||||
|
||||
// Configure TUN mode
|
||||
TapConfigTun_t tapTunCfg;
|
||||
tapTunCfg.Address.s_addr = BE32(IpAddress);
|
||||
tapTunCfg.Network.s_addr = BE32(Network);
|
||||
tapTunCfg.Mask.s_addr = BE32(Mask);
|
||||
DevCtl(TAP_WIN_IOCTL_CONFIG_TUN, &tapTunCfg, sizeof(tapTunCfg));
|
||||
|
||||
// Setup the drivers internal DHCP server
|
||||
TapConfigDhcp_t tapDhcpCfg;
|
||||
tapDhcpCfg.Address.s_addr = BE32(IpAddress);
|
||||
tapDhcpCfg.Mask.s_addr = BE32(Mask);
|
||||
tapDhcpCfg.DhcpServer.s_addr = BE32(IpAddress + 1);
|
||||
tapDhcpCfg.LeaseDuration = DhcpLeaseDuration;
|
||||
DevCtl(TAP_WIN_IOCTL_CONFIG_DHCP_MASQ, &tapDhcpCfg, sizeof(tapDhcpCfg));
|
||||
|
||||
// Connect the virtual network cable
|
||||
BOOL isCableConnected = TRUE;
|
||||
DevCtl(TAP_WIN_IOCTL_SET_MEDIA_STATUS, &isCableConnected, sizeof(isCableConnected));
|
||||
|
||||
// Allocate buffer and start mirror thread
|
||||
IpPacket = (IpPacket_t*)vlmcsd_malloc(Mtu);
|
||||
HANDLE threadHandle = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)TapMirror, NULL, 0, NULL);
|
||||
|
||||
if (!threadHandle)
|
||||
{
|
||||
DWORD error = GetLastError();
|
||||
printerrorf("Fatal: Unable to start VPN thread: %s\n", win_strerror(error));
|
||||
exit(error);
|
||||
}
|
||||
|
||||
CloseHandle(threadHandle);
|
||||
|
||||
# ifndef NO_LOG
|
||||
logger("%s %u.%u.%u device \"%s\" started\n", AdapterClass, DriverVersion.Major, DriverVersion.Minor, DriverVersion.Build, ActiveTapName);
|
||||
# endif // NO_LOG
|
||||
|
||||
DWORD i;
|
||||
BOOL isAssigned;
|
||||
|
||||
// Wait up to 4 seconds until the IP address is up and running
|
||||
// so vlmcsd can actually bind to and listen on it
|
||||
for (i = 0; !((isAssigned = isAddressAssigned())) && i < 20; i++) Sleep(200);
|
||||
|
||||
if (!isAssigned)
|
||||
{
|
||||
printerrorf("Warning: IPv4 address %s not assigned\n", szIpAddress);
|
||||
}
|
||||
else
|
||||
{
|
||||
# ifndef NO_LOG
|
||||
logger("IPv4 address %s assigned\n", szIpAddress);
|
||||
# endif // NO_LOG
|
||||
}
|
||||
}
|
||||
|
||||
#endif // NO_TAP
|
||||
|
50
src/wintap.h
Normal file
50
src/wintap.h
Normal file
@ -0,0 +1,50 @@
|
||||
#ifndef __WINTAP_H
|
||||
#define __WINTAP_H
|
||||
|
||||
#define TAP_REGISTRY_DATA_SIZE 256
|
||||
|
||||
// Network-Endian (= Big-Endian)
|
||||
typedef struct TapConfigTun
|
||||
{
|
||||
struct in_addr Address;
|
||||
struct in_addr Network;
|
||||
struct in_addr Mask;
|
||||
} TapConfigTun_t, *PTapConfigTun_t;
|
||||
|
||||
// Network-Endian (= Big-Endian), except LeaseDuration
|
||||
typedef struct TapConfigDhcp
|
||||
{
|
||||
struct in_addr Address;
|
||||
struct in_addr Mask;
|
||||
struct in_addr DhcpServer;
|
||||
uint32_t LeaseDuration; // Host-Endian (=Little-Endian). Anything else is Big-Endian
|
||||
} TapConfigDhcp_t, *PTapConfigDhcp_t;
|
||||
|
||||
typedef struct TapDriverVersion
|
||||
{
|
||||
uint32_t Major;
|
||||
uint32_t Minor;
|
||||
uint32_t Build;
|
||||
uint32_t Revision;
|
||||
} TapDriverVersion_t, *PTapDriverVersion_t;
|
||||
|
||||
// Network-Endian (= Big-Endian)
|
||||
typedef struct IpPacket {
|
||||
uint8_t ip_hl : 4, /* header length */
|
||||
ip_v : 4; /* version */
|
||||
uint8_t ip_tos; /* type of service */
|
||||
int16_t ip_len; /* total length */
|
||||
uint16_t ip_id; /* identification */
|
||||
int16_t ip_off; /* fragment offset field */
|
||||
uint8_t ip_ttl; /* time to live */
|
||||
uint8_t ip_p; /* protocol */
|
||||
uint16_t ip_sum; /* checksum */
|
||||
uint32_t ip_src, ip_dst; /* source and dest address */
|
||||
uint8_t payload[0];
|
||||
} IpPacket_t, *PIpPacket_t;
|
||||
|
||||
void startTap(char* const argument);
|
||||
|
||||
#endif //__WINTAP_H
|
||||
|
||||
|
Reference in New Issue
Block a user