ejabberd - Comments for "failed long-term STUN authentication" https://www.ejabberd.im/node/24717 en Hi, I've face the same issue https://www.ejabberd.im/node/24717#comment-65929 <p>Hi,<br /> I've face the same issue with external authentication.</p> <p>If you browse the code of the stun app used by ejabberd you will see that they use a function [auth_fun] to get a password for the user (<noindex><a href="https://github.com/processone/stun/blob/master/src/stun.erl#L235" title="https://github.com/processone/stun/blob/master/src/stun.erl#L235" rel="nofollow" >https://github.com/processone/stun/blob/master/src/stun.erl#L235</a></noindex>). They do that because the STUN protocol requires it for the long-term STUN authentication (your STUN client doesn't send the password but an hash of it <noindex><a href="https://tools.ietf.org/html/rfc5389#page-35" title="https://tools.ietf.org/html/rfc5389#page-35" rel="nofollow" >https://tools.ietf.org/html/rfc5389#page-35</a></noindex>).</p> <p>That function is set up as get_password_s by the stun ejabberd module (<noindex><a href="https://github.com/processone/ejabberd/blob/66310788848ef185f3831648b2abf67ab6ded7fa/src/ejabberd_stun.erl#L76" title="https://github.com/processone/ejabberd/blob/66310788848ef185f3831648b2abf67ab6ded7fa/src/ejabberd_stun.erl#L76" rel="nofollow" >https://github.com/processone/ejabberd/blob/66310788848ef185f3831648b2ab...</a></noindex>) .</p> <p>Usually the external_auth mechanisms check the password but don't save the password anywhere so get_password_s behavior is "usually" (in the next lines, you will see why I just said usually) the same of a trivial function which returns null (probably also for your LDAP auth, check it in your code).</p> <p>Fortunately, I wasn't the first to face the issue of a missing get_password_s because other modules need it, so someone clever implemented a cache for externally authenticated user (<noindex><a href="https://support.process-one.net/browse/EJAB-641" title="https://support.process-one.net/browse/EJAB-641" rel="nofollow" >https://support.process-one.net/browse/EJAB-641</a></noindex>). If the cache is enabled the get_password_s returns correctly the password.</p> <p>So, at the end, the solution is to enable the cache and set the timeout to 0 -&gt; extauth_cache: 0 </p> <p>Remember that you need mod_last enabled, further information about ext cache is here -&gt; <a href="https://docs.ejabberd.im/admin/guide/configuration/#external-script" title="https://docs.ejabberd.im/admin/guide/configuration/#external-script">https://docs.ejabberd.im/admin/guide/configuration/#external-script</a>.</p> <p>The last thing, I setup cache timeout to 0 because I need the user password only if the user is logged in and not use this feature to reduce the number of calls to my ext auth system (which is a great feature too).</p> <p>Let me know if you managed to solve your issue.</p> Fri, 10 Jul 2015 14:22:51 +0000 ebonassi comment 65929 at https://www.ejabberd.im