ejabberd extauth通过python + mysql问题

时间:2018-09-13 09:36:34

标签: python mysql ejabberd

我试图在

中实施外部授权

ejabberd.x86_64 18.06-0

通过python + mysql https://github.com/rankenstein/ejabberd-auth-mysql并出现以下错误,请帮助我找出我想念的内容。如果没有mysql,通过python脚本进行的授权就可以正常工作,但是在我的情况下,出了点问题,我目前陷入困境。

客户端psi +

2018-09-13 08:20:18.911 [info] <0.348.0>@ejabberd_listener:accept:272 (<0.485.0>) Accepted connection ::ffff:x.x.x.x:59827 -> ::ffff:x.x.x.x:5222
2018-09-13 08:20:18.911 [debug] <0.485.0>@xmpp_socket:parse:374 (tcp|<0.485.0>) Received XML on stream = <<"<?xml version=\"1.0\"?>\n<stream:stream xmlns:stream=\"http://etherx.jabber.org/streams\" version=\"1.0\" xmlns=\"jabber:client\" to=\"chatstageejabberd.example.com\" xml:lang=\"ru\" xmlns:xml=\"http://www.w3.org/XML/1998/namespace\">\n">>
2018-09-13 08:20:18.912 [debug] <0.485.0>@xmpp_socket:send:224 (tcp|<0.485.0>) Send XML on stream = <<"<?xml version='1.0'?><stream:stream id='7822881988001039051' version='1.0' xml:lang='ru' xmlns:stream='http://etherx.jabber.org/streams' from='chatstageejabberd.example.com' xmlns='jabber:client'>">>
2018-09-13 08:20:18.912 [debug] <0.485.0>@xmpp_socket:send:224 (tcp|<0.485.0>) Send XML on stream = <<"<stream:features><starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'><required/></starttls></stream:features>">>
2018-09-13 08:20:18.953 [debug] <0.485.0>@xmpp_socket:parse:374 (tcp|<0.485.0>) Received XML on stream = <<"<starttls xmlns=\"urn:ietf:params:xml:ns:xmpp-tls\"/>">>
2018-09-13 08:20:18.953 [debug] <0.485.0>@shaper:update:144 MaxRate=1000, BurstSize=1000, AcquiredCredit=1000, Size=51, NewAcquiredCredit=990, Pause=0
2018-09-13 08:20:18.954 [debug] <0.485.0>@xmpp_socket:send:224 (tcp|<0.485.0>) Send XML on stream = <<"<proceed xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>">>
2018-09-13 08:20:19.099 [debug] <0.485.0>@xmpp_socket:parse:374 (tls|<0.485.0>) Received XML on stream = <<"<?xml version=\"1.0\"?>\n<stream:stream xmlns:stream=\"http://etherx.jabber.org/streams\" version=\"1.0\" xmlns=\"jabber:client\" to=\"chatstageejabberd.example.com\" xml:lang=\"ru\" xmlns:xml=\"http://www.w3.org/XML/1998/namespace\">\n">>
2018-09-13 08:20:19.099 [debug] <0.485.0>@shaper:update:144 MaxRate=1000, BurstSize=1000, AcquiredCredit=990, Size=225, NewAcquiredCredit=910, Pause=0
2018-09-13 08:20:19.099 [debug] <0.485.0>@xmpp_socket:send:224 (tls|<0.485.0>) Send XML on stream = <<"<?xml version='1.0'?><stream:stream id='13987711731833743230' version='1.0' xml:lang='ru' xmlns:stream='http://etherx.jabber.org/streams' from='chatstageejabberd.example.com' xmlns='jabber:client'>">>
2018-09-13 08:20:19.099 [debug] <0.485.0>@xmpp_socket:send:224 (tls|<0.485.0>) Send XML on stream = <<"<stream:features><mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><mechanism>PLAIN</mechanism></mechanisms><register xmlns='http://jabber.org/features/iq-register'/><auth xmlns='http://jabber.org/features/iq-auth'/></stream:features>">>
2018-09-13 08:20:19.142 [debug] <0.485.0>@xmpp_socket:parse:374 (tls|<0.485.0>) Received XML on stream = <<"<auth xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\" mechanism=\"PLAIN\">AG15dXNlcgB2bW1mY0h5SDB1bTA=</auth>">>
2018-09-13 08:20:19.142 [debug] <0.485.0>@shaper:update:144 MaxRate=1000, BurstSize=1000, AcquiredCredit=1000, Size=100, NewAcquiredCredit=942, Pause=0
2018-09-13 08:20:19.144 [debug] <0.467.0>@extauth:handle_call:119 Received response from external authentication program: [0,0]
2018-09-13 08:20:19.144 [info] <0.485.0>@ejabberd_c2s:handle_auth_failure:443 (tls|<0.485.0>) Failed c2s PLAIN authentication for myuser@chatstageejabberd.example.com from ::ffff:x.x.x.x: Invalid username or password
2018-09-13 08:20:19.144 [debug] <0.485.0>@xmpp_socket:send:224 (tls|<0.485.0>) Send XML on stream = <<"<failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><not-authorized/><text xml:lang='en'>Invalid username or password</text></failure>">>
2018-09-13 08:20:19.187 [debug] <0.485.0>@xmpp_socket:send:224 (tls|<0.485.0>) Send XML on stream = <<"</stream:stream>">>

ejabberd.yml

loglevel: 5
log_rotate_size: 10485760
log_rotate_date: ""
log_rotate_count: 1
log_rate_limit: 100
hosts:
  - "chatstageejabberd.example.com"
certfiles:
  - "/opt/ejabberd/conf/server.pem"
ca_file: "/opt/ejabberd/conf/cacert.pem"
listen:
  -
    port: 5222
    ip: "::"
    module: ejabberd_c2s
    starttls: true
    starttls_required: true
    max_stanza_size: 65536
    shaper: c2s_shaper
    access: c2s
    certfile: "/opt/ejabberd/conf/server.pem"
  -
    port: 5269
    ip: "::"
    module: ejabberd_s2s_in
    max_stanza_size: 131072
    shaper: s2s_shaper
  -
    port: 5280
    ip: "::"
    module: ejabberd_http
    request_handlers:
      "/ws": ejabberd_http_ws
      "/bosh": mod_bosh
      "/oauth": ejabberd_oauth
      "/api": mod_http_api
    web_admin: true
    register: true
    captcha: false
  -
    port: 5281
    ip: "127.0.0.1"
    module: ejabberd_http
    request_handlers:
      "/api": mod_http_api
disable_sasl_mechanisms: 
  - "digest-md5"
  - "X-OAUTH2"
  - "SCRAM-SHA-1"
s2s_use_starttls: required
auth_password_format: plain
fqdn: "chatstageejabberd.example.com"
auth_method: external
extauth_program: "python /opt/ejabberd/auth.py"
extauth_pool_size: 3
auth_use_cache: false
shaper:
  normal: 1000
  fast: 50000
max_fsm_queue: 10000
acl:
  admin:
    user:
      - "admin1@chatstageejabberd.example.com"
      - "test4@chatstageejabberd.example.com"
  local:
    user_regexp: ""
  loopback:
    ip:
      - "127.0.0.0/8"
      - "::1/128"
      - "::FFFF:127.0.0.1/128"
shaper_rules:
  max_user_sessions: 10
  max_user_offline_messages:
    - 5000: admin
    - 100
  c2s_shaper:
    - none: admin
    - normal
  s2s_shaper: fast
access_rules:
  local:
    - allow: local
  c2s:
    - deny: blocked
    - allow
  announce:
    - allow: admin
  configure:
    - allow: admin
  muc_create:
    - allow: local
  pubsub_createnode:
    - allow: local
  register:
    - allow
  trusted_network:
    - allow: loopback
api_permissions:
  "console commands":
    from:
      - ejabberd_ctl
    who: all
    what: "*"
  "admin access":
    who:
      - access:
          - allow:
            - acl: loopback
            - acl: admin
      - oauth:
        - scope: "ejabberd:admin"
        - access:
          - allow:
            - acl: loopback
            - acl: admin
    what:
      - "*"
      - "!stop"
      - "!start"
  "public commands":
    who:
      - ip: "127.0.0.1/8"
    what:
      - "status"
      - "connected_users_number"
      - "register"
      - "*"
language: "en"
acme:
   contact: "mailto:admin@chatstageejabberd"
   ca_url: "https://acme-v01.api.letsencrypt.org"
modules:
  mod_adhoc: {}
  mod_admin_extra: {}
  mod_announce: # recommends mod_adhoc
    access: announce
  mod_blocking: {} # requires mod_privacy
  mod_caps: {}
  mod_carboncopy: {}
  mod_client_state: {}
  mod_configure: {} # requires mod_adhoc
  mod_disco: {}
  mod_bosh: {}
  mod_last: {}
  mod_muc:
    access:
      - allow
    access_admin:
      - allow: admin
    access_create: muc_create
    access_persistent: muc_create
    default_room_options:
      allow_subscription: true
  mod_muc_admin: {}
  mod_offline:
    access_max_user_messages: max_user_offline_messages
  mod_ping: {}
  mod_privacy: {}
  mod_private: {}
  mod_pubsub:
    access_createnode: pubsub_createnode
    ignore_pep_from_offline: true
    last_item_cache: false
    max_items_node: 10
    plugins:
      - "flat"
      - "pep" # pep requires mod_caps
    force_node_config:
      "eu.siacs.conversations.axolotl.*":
        access_model: whitelist
      "storage:bookmarks":
        access_model: whitelist
  mod_push: {}
  mod_push_keepalive: {}
  mod_register:
    welcome_message:
      subject: "Welcome!"
      body: |-
        Hi.
        Welcome to this XMPP server.
    ip_access: trusted_network
    access: register
  mod_roster: {}
  mod_shared_roster: {}
  mod_vcard:
    search: false
  mod_vcard_xupdate: {}
  mod_avatar: {}
  mod_version: {}
  mod_stream_mgmt: {}
  mod_legacy_auth: {}
  mod_s2s_dialback: {}
  mod_http_api: {}
  mod_fail2ban: {}
allow_contrib_modules: true

0 个答案:

没有答案