Class MachineFingerprint

java.lang.Object
dev.demeng.sentinel.client.util.MachineFingerprint

public final class MachineFingerprint extends Object
Generates a stable, unique fingerprint for the current machine.

This is intended to be used as the server value in a ValidationRequest, allowing Sentinel to track which machine instances are using a license.

The fingerprint is resolved using the following strategy, in order:

  1. Platform-specific identifier:
    • Linux: /etc/machine-id (persistent per OS installation)
    • macOS: IOPlatformUUID (hardware UUID)
    • Windows: MachineGuid from the registry (persistent per OS installation)
    • FreeBSD: kern.hostuuid via sysctl
  2. Fallback: zero-configuration signals that remain available to unprivileged processes, prioritizing host-visible hardware or virtualization identifiers, supplemented by OS properties, hostname, and stable MAC addresses. In containers, locally administered (randomly assigned) MAC addresses are excluded to avoid fingerprint churn across restarts.

The result is always a 32-character lowercase hex string (SHA-256 truncated to 128 bits).

Limitation: Cloned VMs may share the same fingerprint as the source machine until the OS regenerates its platform identifier (e.g., /etc/machine-id on Linux). macOS and Windows do not automatically regenerate their identifiers after cloning.

  • Method Details

    • generate

      public static String generate()
      Generates a fingerprint for the current machine.
      Returns:
      a 32-character lowercase hex string