Calculate a unique host ID for license management?

When using the license server, I ran into a problem to identify the server on which the software is running with a unique host identifier. The server can be any Windows or Linux. A virtual machine is also possible. Going to the MAC address of the network card will allow you to copy the virtual machine without changing the host ID.

Any ideas how to calculate the host id? Preferably possible with Java.

+4
source share
3 answers

I had to do this once and ended up using the UUID inside SMBios.

In my case, I used C in unix, not Java, but you might be interested in reading the SMBios specification and take a picture while reading the UUID, which should be slightly better than reading the MAC serial numbers, hard drives, etc. , because the user can replace them more often than bios.

EDIT : Updated to add what we discussed in the comments (just to have everything together in one place).

On virtual machines (VMWare, that is), the UUID is generated from the UUID of the physical machine and the path to where vm "lives" (see http://www.vmware.com/support/ws55/doc/ws_move_uuid_format.html )

For Java, I know there javax.realtime.RawMemoryAccess , which allows you to read and write memory. I have never tried this, but it seems like the right way to do this with Java (if anyone has experience with this, please comment!)

Otherwise, there is a non-portable solution: JNI , which means C ++. As I said, my only experience was on unix systems, and in my particular case, I found the dmidecode source quite useful. For windows, you can try this SO question , which may be helpful.

Yes, I know that at first it might seem like a lot of research is needed :) But I assume that by reading the specification and (if necessary) looking at the source of dmidecode, you can do it and will (in my experience) give better results " in the field "than hash serial numbers from disks or network cards.

+1
source

A MAC address may not be the best way to do this, as MAC addresses are relatively easy to spoof. Starting with Java 5, there is a UUID class that can be used to create unique identifiers. I am not sure what you are shooting, so I hope this is what you are looking for.

0
source

Unfortunately, UUID SMBIOS is not unique to all systems. It should be, but it is not.

This is not due to a failure in the SMBIOS UUID specification, but because many manufacturers do not follow the specification when creating this UUID.

For more information on how this happens in practice, see this Intel blog http://software.intel.com/en-us/blogs/2007/06/08/are-uuids-enterprise-worthy , and the following The instructive story contains some really terrible real-world examples: http://howtowriteaprogram.blogspot.nl/2012/06/smbios-uuid-fail.html .

By the way, there is another informative topic about stackoverflow about creating a unique machine identifier in Creating a unique machine identifier

0
source

Source: https://habr.com/ru/post/1415461/


All Articles