ejabberd - Comments for "External auth problems." https://www.ejabberd.im/node/3243 en Published in Contributions page https://www.ejabberd.im/node/3243#comment-53685 <p>To help people find your script, I created a page for it in Contributions -&gt; Authentication Scripts -&gt; <noindex><a href="/auth-script-filter-py" rel="nofollow" >Authentication Intercept script</a></noindex>. You are author of that page, so you can edit it to change the name or content if you want.</p> Mon, 27 Oct 2008 11:23:39 +0000 mfoss comment 53685 at https://www.ejabberd.im A possible work-around https://www.ejabberd.im/node/3243#comment-53670 <p>Something like the following filter.py can be used as the auth script by ejabberd. This calls the "real" auth script and logs all traffic in between the two. It also tries to detect garbage and protect ejabberd from stuff that doesn't match the protocol. I don't think this script would be so great for long-term production, but as a development and debugging tool, it is quite handy. Should be fairly straight-forward for someone to modify.</p> <p>I grant permission that this (or some derived work) could be used in a more official capacity by ejabberd. Acknowledgement would be appreciated, but officially this is public domain.</p> <pre> #!/usr/bin/python import sys, os, fcntl from struct import * from subprocess import * # auth_script = "/path/to/real/auth/script" auth_script = "/etc/ejabberd/auth.py" def from_ejabberd(): input_length = sys.stdin.read(2) (size,) = unpack('&gt;h', input_length) return sys.stdin.read(size) def to_ejabberd(answer): token = pack('&gt;hh', 2, answer) sys.stdout.write(token) sys.stdout.flush() child = Popen([auth_script], stdin=PIPE, stdout=PIPE) childout = child.stdout.fileno() fcntl.fcntl(childout, fcntl.F_SETFL, os.O_NONBLOCK) log = open("/var/log/ejabberd/auth-filter.log",'a+b',0) while True: request = from_ejabberd() size = pack('&gt;h', len(request)) child.stdin.write(size) child.stdin.write(request) child.stdin.flush() log.write("Request: ") log.write(request) log.write('\n') result = 0 response_start = "" while response_start == "": try: response_start = os.read(childout, 2) except OSError, err: pass (size,) = unpack('&gt;h', response_start) log.write("Response: ") if size == 2: response_rest = os.read(childout, 2) (result,) = unpack('&gt;h', response_rest) log.write( "%d" % result ) else: done = False log.write(response_start) response_rest = "" while not done: try: char = os.read(childout, 1) response_rest += char except OSError, err: done = True log.write(response_rest) log.write('\n') log.flush() to_ejabberd(result) </pre> Fri, 17 Oct 2008 17:11:46 +0000 jcornez comment 53670 at https://www.ejabberd.im It seems ejabberd doesn't get the response from Erlang https://www.ejabberd.im/node/3243#comment-53667 <p>The extauth script is connected to ejabberd using a port, that is created with the argument {packet, 2}. It seems Erlang will not route any response that does not meet the requirements. So there's nothing in ejabberd code that can be done to receive those strange messages that don't meet the requirement.</p> Fri, 17 Oct 2008 10:36:01 +0000 mfoss comment 53667 at https://www.ejabberd.im