<div dir="ltr"><div>Hello,</div><div>I am not sure if this option is actually implemented according to the specs. iirc, stale=true should be set when the server checks the username and password and all is ok, but the nonce is expired. afaik, the check for nonce expiration is done before hiting the database to fetch the password and check the response. In UA side the stale=true would just make the app rebuild the response without prompting for password again, because the server said that with the expired nonce all was ok, from user/password point of view.</div><div><br></div><div>But if we hit the database for every expired nonce, then we expose the server to kind of a DoS processing.</div><div><br></div><div>Moreover, the latest recommendations in security is to disclose as less as possible what was not "correct", avoiding responses like "invalid user id" or "invalid password".</div><div><br></div><div>The lack of stale=true means that the UA should build again the authorization header from scratch with all the attributes.</div><div><br></div><div>I won't be against enabling this option if it would be for a "trusted" endpoint, but for servers exposed to the wild world, it may create some security concerns.</div><div><br></div><div>Therefore for the moment I would suggest to wait for more feedback from community, along with checking if the stale=true is implemented as per spec or is half brewed option.</div><div><br></div><div>Cheers,<br></div><div>Daniel<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jul 2, 2019 at 6:48 PM Henning Westerholt <<a href="mailto:hw@skalatan.de">hw@skalatan.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hello Juha,<br>
<br>
sounds like a good idea to me, we should integrate it to the default cfg.<br>
<br>
Just a small comment, I think this would be match the current behaviour <br>
more closely (only return stale=true, don't use qop=auth).<br>
<br>
!                       case -4:<br>
!                               auth_challenge("$fd", 16);<br>
!                               exit;<br>
<br>
<br>
Cheers,<br>
<br>
Henning<br>
<br>
Am 02.07.19 um 17:15 schrieb Juha Heinanen:<br>
<br>
> Several people are complaining on baresip git that Kamailio is among<br>
> those SIP servers that don't handle stale nonce properly, i.e., don't<br>
> include stale=true flag in WWW-Authenticate header of 401 response.<br>
><br>
> I have tried to tell that Kamailio does what it has been configured to<br>
> do, but the response is that "by default" Kamailio works incorrectly.  "By<br>
> default" I guess refers to the example Kamailio kamailio.cfg in etc dir.<br>
><br>
> How about adding stale nonce handling to the example config, for<br>
> example, like in below?<br>
><br>
> -- Juha<br>
><br>
> *** kamailio.cfg      2019-06-13 17:17:17.182148989 +0300<br>
> --- /tmp/kamailio.cfg 2019-07-02 18:02:02.947183503 +0300<br>
> ***************<br>
> *** 745,753 ****<br>
>    <br>
>       if (is_method("REGISTER") || from_uri==myself) {<br>
>               # authenticate requests<br>
> !             if (!auth_check("$fd", "subscriber", "1")) {<br>
> !                     auth_challenge("$fd", "0");<br>
> !                     exit;<br>
>               }<br>
>               # user authenticated - remove auth header<br>
>               if(!is_method("REGISTER|PUBLISH"))<br>
> --- 745,759 ----<br>
>    <br>
>       if (is_method("REGISTER") || from_uri==myself) {<br>
>               # authenticate requests<br>
> !             switch (auth_check("$fd", "subscriber", "1")) {<br>
> !                     case 1:<br>
> !                             break;<br>
> !                     case -4:<br>
> !                             auth_challenge("$fd", 17);<br>
> !                             exit;<br>
> !                     default:<br>
> !                             auth_challenge("$fd", "0");<br>
> !                             exit;<br>
>               }<br>
>               # user authenticated - remove auth header<br>
>               if(!is_method("REGISTER|PUBLISH"))<br>
><br>
> _______________________________________________<br>
> Kamailio (SER) - Users Mailing List<br>
> <a href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a><br>
> <a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer" target="_blank">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><br>
<br>
-- <br>
Henning Westerholt - <a href="https://skalatan.de/blog/" rel="noreferrer" target="_blank">https://skalatan.de/blog/</a><br>
Kamailio services - <a href="https://skalatan.de/services" rel="noreferrer" target="_blank">https://skalatan.de/services</a><br>
<br>
_______________________________________________<br>
Kamailio (SER) - Users Mailing List<br>
<a href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a><br>
<a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer" target="_blank">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><br>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>Daniel-Constantin Mierla - <a href="http://www.asipto.com" target="_blank">http://www.asipto.com</a></div><div><a href="http://twitter.com/#!/miconda" target="_blank">http://twitter.com/#!/miconda</a> - <a href="http://www.linkedin.com/in/miconda" target="_blank">http://www.linkedin.com/in/miconda</a></div></div></div></div></div>