ejabberd - Comments for "net:jabber and &amp;quot;digest-uri seems invalid&amp;quot; / authentication problem" https://www.ejabberd.im/node/3545 en Fix https://www.ejabberd.im/node/3545#comment-54439 <p>The code above is part of the fix. But it still breaks if you are using srv records to point to a different host.<br /> I have fixed it on my system - I still need to double check what I had to change, but I will post the changes needed to get things working smoothly.</p> <p>Install all the needed modules from cpan. In my case I'm using Net::Jabber::Bot.<br /> Also, install Net::DNS::Resolver if you are using srv records.</p> <p>----------------------------------<br /> In Net/XMPP/Connection.pm around line 135, underneath "delete($self-&gt;{SESSION});" add:</p> <div class="codeblock"><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #HACK - makes sure componentname is defined<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (!defined($self-&gt;{SERVER}-&gt;{componentname})) {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $self-&gt;{SERVER}-&gt;{componentname} = $self-&gt;{SERVER}-&gt;{hostname};<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</code></div> <p>A few lines below that, in the Connect statement, under the ssl line, before the "(defined($self-&gt;{SERVER}-&gt;{componentname}", add:</p> <div class="codeblock"><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #HACK - allow defining srv to use srv records (you&#039;ll usually want to set this to &quot;_xmpp-client._tcp&quot;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (defined($self-&gt;{SERVER}-&gt;{srv}) ?<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (srv =&gt; $self-&gt;{SERVER}-&gt;{srv}) :<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ()<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ),</code></div> <p>-----------------------------------</p> <p>In XML/Stream.pm, around line 2123, change:<br /> "$self-&gt;{SIDS}-&gt;{$sid}-&gt;{sasl}-&gt;{client} = $sasl-&gt;client_new();"<br /> to</p> <div class="codeblock"><code>$self-&gt;{SIDS}-&gt;{$sid}-&gt;{sasl}-&gt;{client} = $sasl-&gt;client_new(&#039;xmpp&#039;,$self-&gt;{SIDS}-&gt;{$sid}-&gt;{to});</code></div> <p>I'm not sure if this is needed on all systems, but I had problems with "Undefined subroutine &amp;Net::DNS::Resolver", this fixes that. At line 284, underneath "import Net::DNS;" add:</p> <div class="codeblock"><code>use Net::DNS;</code></div> <p>----------------------------------------------------------------------------------</p> <p>When using Net:Jabber::Client Connect, be sure to specify in the connect parameters:</p> <div class="codeblock"><code>srv=&gt;&quot;_xmpp_client._tcp&quot;</code></div> <p>If you want to use srv records to find the correct jabber host.<br /> -------------------------------</p> <p>I hope someone else finds this helpful. I've spent the better part of two days trying to figure it out! If anyone knows how to get these changes added to the (apparently abandoned) Net::XMPP modules on cpan, please go ahead and do so. Otherwise, at least the next person who searches for this should find this post.</p> Wed, 08 Jul 2009 14:12:25 +0000 grant comment 54439 at https://www.ejabberd.im In my case, I was able to https://www.ejabberd.im/node/3545#comment-54352 <p>In my case, I was able to find a google page (translated) which pointed to a perl xmpp client library problem. </p> <p><noindex><a href="http://translate.google.com/translate?hl=en&amp;sl=pl&amp;u=http://forum.pld-linux.org/viewtopic.php%3Fp%3D32502&amp;ei=XLI2Sq3qNonYMZP9gI4K&amp;sa=X&amp;oi=translate&amp;resnum=4&amp;ct=result&amp;prev=/search%3Fq%3D%2522digest-uri%2Bseems%2Binvalid%2522%26hl%3Den%26client%3Dfirefox-a%26rls%3Dorg.mozilla:en-US:officia" title="http://translate.google.com/translate?hl=en&amp;sl=pl&amp;u=http://forum.pld-linux.org/viewtopic.php%3Fp%3D32502&amp;ei=XLI2Sq3qNonYMZP9gI4K&amp;sa=X&amp;oi=translate&amp;resnum=4&amp;ct=result&amp;prev=/search%3Fq%3D%2522digest-uri%2Bseems%2Binvalid%2522%26hl%3Den%26client%3Dfirefox-a%26rls%3Dorg.mozilla:en-US:officia" rel="nofollow" >http://translate.google.com/translate?hl=en&amp;sl=pl&amp;u=http://forum.pld-lin...</a></noindex><br /> l%26hs%3Driy</p> <p>I made the code change to the stream.pm module (as suggested) and it fixed my problem. Note that the translation gets confused on the perl curly braces and paranthesis, so you'll need to tweak what's shown in the translation when you patch the stream.pm code.</p> <p>I think I had seen another post where they had said they had the same issue and retrying on a clean perl build worked-- maybe there's an official update to stream.pm that fixes this issue...</p> Tue, 16 Jun 2009 23:11:29 +0000 bergenpeak comment 54352 at https://www.ejabberd.im Fix the XMPP client. Temporary workaround. https://www.ejabberd.im/node/3545#comment-54351 <p>You will prefer to fix your XMPP client library. In any case, you can apply this temporary workaround:</p> <pre> --- cyrsasl_digest.erl +++ cyrsasl_digest.erl @@ -65,11 +65,7 @@ mech_step(#state{step = 3, nonce = Nonce} = State, ClientIn) -&gt; DigestURI = xml:get_attr_s("digest-uri", KeyVals), UserName = xml:get_attr_s("username", KeyVals), case is_digesturi_valid(DigestURI, State#state.host) of - false -&gt; - ?DEBUG("User login not authorized because digest-uri " - "seems invalid: ~p", [DigestURI]), - {error, "not-authorized", UserName}; - true -&gt; + _ -&gt; AuthzId = xml:get_attr_s("authzid", KeyVals), case (State#state.get_password)(UserName) of {false, _} -&gt; </pre> Tue, 16 Jun 2009 16:41:02 +0000 mfoss comment 54351 at https://www.ejabberd.im > # Change ejabberd to not https://www.ejabberd.im/node/3545#comment-54350 <p>&gt; # Change ejabberd to not verify digest-uri.</p> <p>Could you explain, how i do this?<br /> I've the same Problem</p> Tue, 16 Jun 2009 11:41:24 +0000 masterd01 comment 54350 at https://www.ejabberd.im If client uses SASL Digest, must provide proper digest-uri https://www.ejabberd.im/node/3545#comment-54349 <p>ejabberd 2.0.3 and higher implements digest-uri verification, as recommended by XMPP-Core, see <noindex><a href="https://support.process-one.net/browse/EJAB-569" rel="nofollow" >EJAB-569</a></noindex>.</p> <p>This means that the XMPP/Jabber server of domain example.com (in this case ejabberd) expects that a client that is authenticating using SASL Digest will provide something like:</p> <pre>digest-uri="xmpp/example.com"</pre><p> But it seems your client sends this:</p> <pre>digest-uri="/"</pre><p> You have several solutions:</p> <ul> <li>Improve your XMPP client library to provide a proper digest-uri in the SASL Digest. </li><li>Change your client or library to not use SASL Digest. </li><li>Change ejabberd to not verify digest-uri. </li><li>Use an older version of ejabberd that didn't yet implement this verification. </li></ul> Tue, 16 Jun 2009 08:56:16 +0000 mfoss comment 54349 at https://www.ejabberd.im