是否有 Erlang 命令可以从远程存储库读取 BEAM 文件?

发布于 2024-08-22 09:28:08 字数 509 浏览 3 评论 0原文

我需要向客户端分发一些封闭源代码的 Erlang 代码。我认为最简单的方法是简单地给出一个 Erlang shell 命令来从远程主机提取代码。远程主机将是一个 Erlang VM,它不与客户端共享相同的秘密 cookie。我该怎么做?

例如,如果我在 Erlang shell 中,我想要一些可以让我做的事情:

load_lib(mysql).
load_lib(postgres).

: 然后 Erlang 将下载并安装 BEAM 文件,并允许我从那时起使用 mysql: 和 postgres: Erlang 模块

更新: 1) 有人建议我使用 tarball,所以我想这种情况下的过程会是这样的:

Find Erlang lib directory and CD to it
wget tarball to the current directory

不像 gem install 那样好,但它是 Erlang 能做的最好的

I need to distribute some Erlang code which is closed source to a client. I think the easiest way would be to simply give an Erlang shell command to pull the code from a remote host. The remote host will be an Erlang VM which does not shared the same secret cookie as the client. How can I do this?

For example, if I am in the Erlang shell, I would like something thats lets me do:

load_lib(mysql).
load_lib(postgres).

: and then Erlang would download and install the BEAM files, and would allow me to use the mysql: and postgres: Erlang modules from that point on

Update:
1)
I have been suggested to use tarballs, so I guess the procedure in this case would be something like:

Find Erlang lib directory and CD to it
wget tarball to the current directory

Not as nice as gem install, but its the best that Erlang can do

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

坏尐絯 2024-08-29 09:28:08

你实际上无法在两个不受信任的 Erlang 节点之间完成此操作。该秘密 cookie 是节点之间存在的唯一安全措施。您将需要推出自己的协议,即使它只是简单的 HTTP。

从那时起,您可以做的就是通过网络发送 BEAM 文件,或者只发送其中包含的二进制数据。然后,您可以通过调用 code:load_file/1(对于 BEAM)或 code:load_binary/3(对于二进制数据)来加载模块。

不过,这对我来说听起来相对脆弱。 Roberto Aloi 建议的存储库可能是最好的主意。

You can't really have this done between two untrusted Erlang node. That secret cookie is the only security measure existing between nodes. You will need to roll out your own protocol, even if it's just straight HTTP.

What you could do from that point on is either send a BEAM file over the network, or just send the binary data contained inside one. You can then load the module by calling code:load_file/1 for the BEAM, or code:load_binary/3for the binary data.

This all sounds relatively brittle to me though. A repository, as suggested by Roberto Aloi would likely be the best idea.

你曾走过我的故事 2024-08-29 09:28:08

您不能简单地将代码上传到某个存储库并提供对客户端的访问吗?
您还可以提供一个脚本来自动加载新版本的代码,而无需停止实时系统......或者我错过了什么?

Couldn't you simply upload your code to some repository and provide access to the client?
You could also provide a script to automatically load the new versions of the code without stopping the live system... Or am I missing something?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文