简体   繁体   English

码头工人。 使用基于主机 ID 的许可证运行软件

[英]Docker. Run software with license based on host id

I am developing a new product implemented in Java that requires a license to run.我正在开发一个用 Java 实现的新产品,需要许可证才能运行。 The license validation is based on the server ID.许可证验证基于服务器 ID。 If I run it directly in a linux server it is not a problem.如果我直接在 linux 服务器上运行它,那不是问题。

But, I would like to offer the option of running my software inside docker, but the problem is that I don't know how to get the host ID from the docker container.但是,我想提供在 docker 中运行我的软件的选项,但问题是我不知道如何从 docker 容器中获取主机 ID。 I don't want to use docker container ID, as the customer could require to recreate it (for instance for a software update), so I need to know the ID of the host server.我不想使用 docker 容器 ID,因为客户可能需要重新创建它(例如用于软件更新),所以我需要知道主机服务器的 ID。

I thought about using the MAC address, but it requires to run the container with the "--net=host" option and due to security reasons I would like to avoid to use that option.我考虑过使用 MAC 地址,但它需要使用“--net=host”选项运行容器,并且出于安全原因,我想避免使用该选项。

Maybe you should step back and look into alternative approaches, for example this system that works with two components:也许您应该退后一步,寻找替代方法,例如这个系统与两个组件一起工作:

  1. Your users have some sort of ID + private key which can be stored in the local file system您的用户拥有某种 ID + 私钥,可以存储在本地文件系统中
  2. Your application reads that file from disk;您的应用程序从磁盘读取该文件; and then contacts your "home server" to validate that this ID + key is actually "good", and if so, your application starts;然后联系你的“家庭服务器”来验证这个 ID + 密钥实际上是“好”的,如果是这样,你的应用程序就会启动; otherwise it stops否则它会停止

Such a solution would even allow people to include the licence file into their docker images.这样的解决方案甚至允许人们将许可证文件包含到他们的 docker 镜像中。

And for the record: any other solution that doesn't make your application talk to a central server might give you real headaches.郑重声明:任何其他不让您的应用程序与中央服务器通信的解决方案都可能让您真正头疼。

The same problem happens to me with Matlab license I solved it using freezing host id docker-compose or docker give you this good feature to the default set your host id我使用 Matlab 许可证遇到了同样的问题,我使用冻结主机 id docker-compose 或 docker 为您提供了这个很好的功能来默认设置您的主机 id

version: '3.7'
services:
flask:
  container_name: flask # Name can be anything
  restart: always
  build: ./xyz
  mac_address: 1c:45:c6:12:20:33

remember to see which host id added to your license of MatLab set that same up here.请记住在此处查看添加到您的 MatLab 许可证中的主机 ID。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM