windows 上 ejabberd 的外部身份验证模块

external auth module for ejabberd on windows

如何让 ejabberd 到 运行 windows 上的外部身份验证脚本?

到目前为止-我已经修改了文件

C:\Program Files\ejabberd-15.06\lib\ejabberd-15.06\priv\cfg\ejabberd.yml

注释掉现有的 auth_method 指令并添加如下:

auth_method: external
extauth_program: "D:\DROPBOX\Dropbox (Personal)\EJABBERD\auth\ejabberd-auth.exe"

但是,当我尝试连接到服务器时,我在日志中看不到任何内容表明试图 运行 脚本。我什至尝试将其更改为一个不存在的文件,看看是否会记录某种错误,但什么也没有。

我得到的只是 "Accepted connection" 类型的日志。

以防万一 - 开始时我确实遇到了几个 "unknown option" 错误,包括 "ejabberd_config:validate_opts:752 unknown option 'auth_method' will be likely ignored" - 然而这似乎是一个已知的,仅用于装饰的错误(参见:https://github.com/processone/ejabberd/issues/630 )

我不使用 Windows,但是,你应该尝试使用 Erlang open_port 命令:

 open_port({spawn, "YOURCOMMAND"}, [{packet, 2}]).

请注意 open_port Erlang 文档说:

For external programs, the PATH is searched (or an equivalent method is used to find programs, depending on operating system). This is done by invoking the shell on certain platforms. The first space separated token of the command will be considered as the name of the executable (or driver). This (among other things) makes this option unsuitable for running programs having spaces in file or directory names.

我看到你的路径有空格。仅此一项就应该确实无法调用您的命令。

也就是说,external_auth 命令从未在 Windows 上测试过。您可能需要修补 ejabberd 命令以通过外部进程进行身份验证。如果它按原样工作,我会感到惊讶。