【问题标题】:Failed to start external authentication program in Ejabberd 19.09.1无法在 Ejabberd 19.09.1 中启动外部身份验证程序
【发布时间】:2020-06-19 12:42:26
【问题描述】:

我正在尝试在 Ubuntu 18.04.3 上运行的 Ejabberd 19.09.1 中运行外部身份验证脚本,但遇到了问题。 在尝试并失败后,我尝试或多或少地直接从文档中复制示例:

我将 ejabberd.yml 文件设置为:

auth_method: [external]
extauth_program: /etc/ejabberd/pyAuth.py
extauth_instances: 3
auth_use_cache: false

我复制了示例 python 脚本:

#!/usr/bin/python

import sys
import struct

def read():
    (pkt_size,) = struct.unpack('>H', sys.stdin.read(2))
    pkt = sys.stdin.read(pkt_size)
    cmd = pkt.split(':')[0]
    if cmd == 'auth':
        u, s, p = pkt.split(':', 3)[1:]
        if u == "wrong":
            write(False)
        else:
            write(True)
    elif cmd == 'isuser':
        u, s = pkt.split(':', 2)[1:]
    elif cmd == 'setpass':
        u, s, p = pkt.split(':', 3)[1:]
        write(True)
    elif cmd == 'tryregister':
        u, s, p = pkt.split(':', 3)[1:]
        write(True)
    elif cmd == 'removeuser':
        u, s = pkt.split(':', 2)[1:]
        write(True)
    elif cmd == 'removeuser3':
        u, s, p = pkt.split(':', 3)[1:]
        write(True)
    else:
        write(False)
    read()

def write(result):
    if result:
        sys.stdout.write('\x00\x02\x00\x01')
    else:
        sys.stdout.write('\x00\x02\x00\x00')
    sys.stdout.flush()

if __name__ == "__main__":
    try:
        read()
    except struct.error:
        pass

这给了我这些错误消息:

2020-03-06 16:47:24.459 [error] <0.660.0>@extauth:handle_info:152 Failed to start external authentication program '../../../etc/ejabberd/pyAuthTest.py'
2020-03-06 16:47:24.459 [error] <0.656.0> Supervisor 'extauth_pool_xmpp.example.net' had child 'extauth_pool_xmpp.example.net_1' started with extauth:start_link('extauth_pool_xmpp.example.net_1', "../../../etc/ejabberd/pyAuthTest.py") at <0.660.0> exit with reason normal in context child_terminated

我注意到ejabberd论坛上的大部分cmet都非常老了,我也得到了这个

2020-03-06 16:47:21.909 [warning] <0.107.0>@ejabberd_config_transformer:warn_replaced_option:528 Option 'extauth_instances' is deprecated and was automatically replaced by 'extauth_pool_size'. Please adjust your configuration file accordingly. Hint: run `ejabberdctl dump-config` command to view current configuration as it is seen by ejabberd.

在 ejabberd.log 中,而文档说要使用 extauth_instances,所以我想知道是否某些文档可能已过时。

关于信息,我实际上并不了解python。我正在尝试运行 ac# 脚本,部分基于此处的 mark.p.jones 脚本https://www.ejabberd.im/node/1617/index.html,但我将其包括在内,因为我从两者都收到相同的错误消息,并且 python 脚本来自官方文档。

【问题讨论】:

  • 我安装了您的相同版本,复制了您的示例脚本并配置了您的选项。我收到有关已弃用选项的警告,但其他一切正常:没有错误,我可以正确登录...不知道出了什么问题,因为您收到的错误消息没有给出提示...
  • @Badlop 我不知道您是否会在这里找到更多信息,但是当我尝试从 auth_method 开始时,这里是完整的错误日志:[external] link 这是我的 yaml 文件:link
  • 您找到解决方案了吗?我有同样的问题,错误消息是无法执行:权限被拒绝。 ejabberd 和脚本都具有相同的用户权限

标签: python ubuntu ejabberd ejabberd-auth


【解决方案1】:

现在我用你的完整配置文件安装了 ejabberd 19.09.1(除了我必须适应的几行),你提供的 Python 脚本允许我登录。您提供的日志文件没有显示任何新信息,至少就我对 extauth 的有限经验而言。

假设:问题出在您的 python 安装中,无论出于何种原因,该脚本可能与您的 Python 安装不兼容。作为参考,我有 Python 2.7.16。

如何检查:不要使用 Python 脚本,而是尝试示例 Perl extauth 脚本 examples/extauth/check_pass_null.pl https://github.com/processone/ejabberd/tree/master/examples/extauth

【讨论】:

  • 我对此进行了测试并得到了同样的错误。从那以后,我也故意尝试了错误的路径,但我仍然遇到同样的错误,所以我认为它必须是别的东西。
猜你喜欢
  • 2023-03-19
  • 2015-06-04
  • 1970-01-01
  • 2013-12-20
  • 2019-08-09
  • 2015-10-03
  • 1970-01-01
  • 2015-07-29
  • 2023-03-22
相关资源
最近更新 更多