By http://man7.org/linux/man-pages/man5/machine-id.5.html
$machineId = trim(shell_exec('cat /etc/machine-id 2>/dev/null'));
EDIT for Tito:
[ ekerner@ **** ~]$ ls -l /etc/machine-id -r--r--r--. 1 root root 33 Jul 8 2016 /etc/machine-id
EDIT 2 for Tito: some things to consider and scenarios:
Is the user allowed to receive a new machine? Guess yes. Or run on multiple devices? It seems that the car may not be relevant in your case?
If only its user (without restrictions on the machine), then Id goes to the licensing service (depending on the network). There are many services for this: Google Play (for Android applications) is a good example: https://developer.android.com/google/play/licensing/index.html MS and Apple have similar services. However, simply search the Internet for the term “Software Licensing Service” or “Cloud Computing Software Licensing Service”.
If its user + one device, then you will need to transfer the device identifier to any service that you use or do , then allow the machine identifier to be updated, but not allow id to return to the previous machine (it will mean several devices). However, the services mentioned will provide you with a client code that should take care of this if necessary.
Two scenarios from experience: 1: A user on any device: we just created an API in the cloud (on a website) and an application login screen when a user authenticated via the API and saved a token, and whenever the device was connected to on the network, the application will request the API and update the login and / or token. Alternatively, you can use the login screen (for example, perhaps they have already entered the site for purchase), generate a key, pack it or associate it with it in the application.
2: User plus machine: The same, except when an API is requested, the machine identifier is transmitted. The machine ID can change as many times as the user updates their device, but we saved the machine ID record and forbade the rule: if we saw the old (previously used) machine ID, then a certain amount of time should have passed. Thus, the user can break his car and pull out the old one.
Also, to consider how you do this, how do you stop the application? Ppl is pretty smart, it needs to be compiled.
However, everyone says that the various licensing services are professional and can satisfy most needs. Plus, in their experience, they have already overcome the pitfalls of security. The identifier of the name that I like, except for its search to search.
It’s nice if you can return with positive or negative results from your paths.