Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Is it possible to generate a unique ID based on server hardware/OS? I want to generate license keys for my PHP web app based on customer server, just like Atlassian JIRA does.

Thanks for your help.

share|improve this question
5  
I think your licensing model is Ass. Just sayin' –  Tom O'Connor Mar 17 '12 at 10:43

2 Answers 2

I don't know the final solution but if it's Linux I think you can use lshw tool to read serial numbers of disks, processor, motherboard and other hardware devices and make hash (checksum) from combination of these info.

share|improve this answer
    
And then someone who wants to get around your licence check puts in a customised version of lvhw that returns whatever values are necessary to pass the key check. –  womble Mar 17 '12 at 9:19
    
@womble - this is my checksum (You don't know how i made it), "09a366cc2ef30136d84804239d9b2875b68fd368", tell me what lshw should return... –  jamzed Mar 17 '12 at 9:26
2  
I rather think you miss womble's point, which is that once you've cut one legitimate license for a given lshw output, that license can be used on any number of other machines by suborning their lshw system calls. The same trick applies to using MAC addresses. –  MadHatter Mar 17 '12 at 9:31
    
lshw is only one part of the solution... I thought about something like that en.wikipedia.org/wiki/Windows_Genuine_Advantage#Data_collected –  jamzed Mar 17 '12 at 9:39
1  
Jamzed, in a closed-source operating system like Windows you can do that, and given trusted hardware, you can even rely on it. In a free operating system like Linux, you can't; free software is about doing what the platform owner wants, not what the software vendor wants, and it's usually quite good at it. –  MadHatter Mar 17 '12 at 11:09

I think a better way is to code an EXE in any other language that gets the HWID from the server, and then have your PHP script exec() the EXE, if the output from the EXE matches then you run the script... If not, you show an error.

You might want to use blenc_encrypt() in PHP at the very least so that you can prevent users from going in and changing "if (systemhwid == validhwid)" to "if (1 == 1)"

A better option for encryption is to use IonCube (I think it's Ioncube that encrypts PHP files) but unfortunately it costs lots of money.

Search PHP.net for the blenc_encrypt() function

share|improve this answer
    
In order to keep in line with the they want a straight answer, no BS statement you made, I edited out that paragraph as it's not relevant to the answer. –  gparent Feb 24 at 16:59

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.