【问题标题】:Ejabberd - ejabberd_auth_external:failure:103 External authentication program failed when calling 'check_password'Ejabberd - ejabberd_auth_external:failure:103 调用“check_password”时外部身份验证程序失败
【发布时间】:2019-08-09 16:56:07
【问题描述】:

我已经有一个带有身份验证密钥的用户架构,并希望通过它进行身份验证。我尝试通过 sql 实现身份验证,但由于我的架构结构不同,我遇到了错误,所以我实现了外部身份验证方法。我的应用程序中使用的技术和操作系统是:

  • Node.JS
  • Ejabberd 作为 XMPP 服务器
  • MySQL 数据库
  • React-Native(前端)
  • 操作系统 - Ubuntu 18.04

我实现了https://docs.ejabberd.im/admin/configuration/#external-script中提到的外部认证配置,并以php脚本https://www.ejabberd.im/files/efiles/check_mysql.php.txt为例。但是我在 error.log 中收到了下面提到的错误。在 ejabberd.yml 我做了以下配置。

...

主机配置:
“example.org.co”:
auth_method:[外部]
extauth_program: "/usr/local/etc/ejabberd/JabberAuth.class.php"
auth_use_cache: false

...

另外,是否有任何外部 auth javascript 脚本?

下面是error.log和ejabberd.log

错误日志

2019-03-19 07:19:16.814 [错误] @ejabberd_auth_external:failure:103 外部认证 为 admin@example.org.co 调用“check_password”时程序失败: 断开连接

ejabberd.log

2019-03-19 07:19:16.811 [调试] @ejabberd_http:init:151 S: [{[>],mod_http_api},{[>],ejabberd_web_admin}]

2019-03-19 07:19:16.811 [调试] @ejabberd_http:process_header:307 (#Port) http 查询:'POST' >

2019-03-19 07:19:16.811 [调试] @ejabberd_http:process:394 [>,>] 匹配 [>]

2019-03-19 07:19:16.811 [信息] @ejabberd_listener:accept:238 () 接受连接 ::ffff:ip -> ::ffff:ip

2019-03-19 07:19:16.814 [信息] @mod_http_api:log:548 API 调用寄存器 [{>,>},{>,>},{>, >}] 来自 ::ffff:ip

2019-03-19 07:19:16.814 [错误] @ejabberd_auth_external:failure:103 外部认证 为 admin@example.org.co 调用“check_password”时程序失败: 断开连接

2019-03-19 07:19:16.814 [调试] @mod_http_api:extract_auth:171 验证数据无效: {error,invalid_auth}

我们将不胜感激有关此主题的任何帮助。

【问题讨论】:

    标签: xmpp ejabberd ejabberd-module ejabberd-auth


    【解决方案1】:

    1) 您关于 auth_method 的配置看起来不错。

    2) 这是我使用并升级的 python 脚本,用于为 ejabberd 进行外部身份验证。

    #!/usr/bin/python
    
    import sys
    from struct import *
    import os
    
    def openAuth(args):
        (user, server, password) = args
        # Implement your interactions with your service / database
        # Return True or False
        return True
    
    def openIsuser(args):
        (user, server) = args
        # Implement your interactions with your service / database
        # Return True or False
        return True
    
    
    def loop():
        switcher = {
            "auth": openAuth,
            "isuser": openIsuser,
            "setpass": lambda(none): True,
            "tryregister": lambda(none): False,
            "removeuser": lambda(none): False,
            "removeuser3": lambda(none): False,
        }
    
        data = from_ejabberd()
        to_ejabberd(switcher.get(data[0], lambda(none): False)(data[1:]))
        loop()
    
    def from_ejabberd():
        input_length = sys.stdin.read(2)
        (size,) = unpack('>h', input_length)
        return sys.stdin.read(size).split(':')
    
    def to_ejabberd(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:
            loop()
        except error:
            pass
    

    我没有创建与 Ejabberd from_ejabberd()to_ejabberd() 的通信,很遗憾找不到源。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-06-04
      • 1970-01-01
      • 2020-06-19
      • 1970-01-01
      • 1970-01-01
      • 2023-03-22
      • 2015-10-03
      • 2018-11-02
      相关资源
      最近更新 更多