Virtual Machine Detection
Node-locking's essence lies in associating a distinct, often hardware-based, identifier with each device. This unique marker, frequently derived from hardware IDs, serves to correlate licenses to devices. However, complexities arise in virtualized and containerized setups.
In these scenarios, the apparent hardware isn't the physical device's, but that of the generating virtual machine.
Fortunately, LicenseSpring tackles this challenge adeptly through methods tailored for containers and virtualization. These methods effectively discern various virtual contexts, ensuring precise environment identification and steadfast license-to-device locking.
This tutorial will introduce you to LicenseSpring's sophisticated techniques for distinguishing virtual machine instances and how they can reinforce your software security.
- Initialized LicenseManager (or LicenseHandler) with your configuration using the appropriate settings.
- Created a LicenseID using either LicenseID::fromKey or LicenseID::fromUser function, depending on the activation method you prefer.
- Implemented basic license management, including license activations, deactivations, and both online and local license checks.
The LicenseSpring SDKs offer a distinctive feature: the capability to detect virtual machine environments.
VM name | Java | C++SDK | .Net SDK |
---|---|---|---|
Parallels Desktop |  |  |  |
QEMU |  |  |  |
VirtualBox |  |  |  |
Windows Virtual PC |  |  |  |
VMware |  |  |  |
Wine |  |  |  |
Xen Project |  |  |  |
Docker |  |  |  |
Microsoft Hyper-V |  |  |  |
Microsoft Azure |  |  |  |
bhyve |  |  |  |
FreeBSD Jail |  |  |  |
KVM |  |  |  |
LXC |  |  |  |
Lguest |  |  |  |
Linux-VServer |  |  |  |
OpenVZ |  |  |  |
Project ACRN |  |  |  |
Virtual Iron |  |  |  |
QNX Hypervisor |  |  |  |
This functionality, designed to enhance software security, can be activated manually within your program through the SDK as shown below.
Note: Virtual machine detection is disabled by default. This feature must be enabled to make use of any features mentioned throughout this tutorial.
We provide a separate DLL for VM detection in the C++ SDK package. Make sure you put this library with the LicenseSpring DLL. If it is not found, a VMDNotAvailableException will occur.
After the configuration has been initialized, developers are able to detect whether virtual machine detection is currently activated with:
Within the C++ SDK, this can also be checked through the ExtendedOptions object, as shown below:
The SDKs can also check for whether a specific user currently using the application is on a virtual machine by using:
Developers can get the name of the user's hypervisor with the following:
VMDNotAvailableException (Windows only): Thrown in the C++ and .NET SDK in the case that VM detection dll is not found, tempered or detection failed.
You can also prevent users from activating their licenses on virtual machines by adjusting the license settings. Simply access the license and select the "prevent virtual machine" option. This straightforward step ensures that your product remains exclusively operational on the intended devices, aligning with your software's specifications.
When this feature is checked off, any actions involving our license, will result in an error/exception, making the license unusable on a VM.
Within the SDK, developers can check for whether a license is allowed to work under virtual machine or not with:
VMIsNotAllowedException: Thrown on virtual machine when VM detection is enabled but product policy prohibits running on VM.