Linux 中获取机器序列号的系统调用
我知道这个可能性不大,但是有什么方法可以在 Linux 上获取序列号或唯一标识信息吗?
如果可以的话,如何将其编写成Java程序呢?
在上下文中,我需要构建一个锁定一台机器的许可证验证器。如果您还有其他建议,欢迎提出。
I know this is a long shot but is there any way of getting the serial number or a uniquely identifying piece of information on Linux?
If so, how can this be programmed into a Java program?
In context, I need to build a license validator that locks down to one machine. If you have any other suggestions they are welcome.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
以下摘录自 Lennart Poettering 发表的有关 ID 的博客文章。它与唯一 ID 相关,不一定与安全相关的唯一 ID 相关:
因此,
/sys/class/dmi/id/product_uuid
似乎是验证守护进程的良好候选者,但这意味着您的验证代码需要以特权用户身份运行。完整的博客文章确实值得一读!Here is an excerpt of a blog post by Lennart Poettering about IDs in general. It is about unique IDs, not necessarily about unique IDs in relation with security:
So
/sys/class/dmi/id/product_uuid
seems like a good candidate for your validation daemon but means that your validation code needs to be run as a privileged user. The full blog post is really a valuable read!除非您实际上可以为用户计算机提供硬件加密狗,否则您无法设计出无法规避的复制保护设置。
如果您只是想告诉用户“嘿,您已经在网络上的另一台计算机上运行此许可证,请获取另一个许可证”,那么一个好方法是进行网络广播,以便他们可以找到彼此。最可靠的方法可能是使用 Zeroconf 和 jmdns 库。
如果您想确定该程序仅在具有给定序列号的一个位置运行,则使用通用 PC 执行此操作的唯一方法是让程序通过互联网调用中央母舰在运行时并在使用它的地方进行注册。然后,母舰返回一个包含需要运行的重要代码的片段。您很可能使用 Java WebStart 来实现这一点。
Unless you can actually get a hardware dongle to the users machine, you cannot devise a copy protection setting that cannot be circumvented.
If you just want to tell the user that "hey, you are already running this license on another machine on your network, get another license", then a good way is to do network broadcasts so they can find one another. The simplest way to do reliably is probably using Zeroconf with the jmdns library.
If you want to be certain that the program is only being run at one place with a given serial number, the only way to do so with generic PC's is to have the program call a central mothership over the internet while being run and register where it is being used. The mothership then returns a snippet containing important code needing it to be run. You could most likely implement this using Java WebStart.
我使用 MAC 地址作为唯一 ID。
I use the MAC-Adress as an unique id.
Mac地址可以更改。检查此。此外,Mac 地址与接口(以太网/无线/HPNA 等)绑定。因此,聪明的用户可以轻松地对此进行调整。 stackoverflow 上也讨论了类似的问题。检查此。
Mac address can be changed. Check this. Also, Mac-Address is tied to an interface (Ethernet/Wireless/HPNA etc). So a smart user can easily tweak this up. There is a similar problem discussed on stackoverflow. Check this.
MAC 地址不是一个好的选择,因为它在某些系统上可以更改。如果您想继续使用本机 Java,那么逻辑系统参数(例如机器 ID 和用户登录帐户)是您唯一的选择。在某些情况下,机器名称足够安全,因为一个网络上不可能有两台机器具有相同的名称。
The MAC address is not a good choice, as it can be changed on some systems. If you want to stay in native Java then logical system parameters such as the machine ID and user log-in account are your only options. For some cases machine name is adequately secure as there can't be two machines on the one network with the same name.