-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
receive '401 Unauthorized', without 'WWW-Authenticate' header #1779
Comments
Do you have auth-messages set on your sofia profile? |
Check to see the uptime of FreeSWITCH. I crashed FreesSWITCH in the process of replicating the issue
|
I'm sorry to dig out this old issue, but I have the exact same problem with Snom desk phones, both with MESSAGE and SUBSCRIBE. I'm currently using Freeswitch version 1.10.10-release-24-4cb05e7f4a and I think I found out what happens. Analyzing the SIP trace, I noticed that the WWW-Authenticate header is missing in the 401 response:
In the SUBSCRIBE request, the client re-uses the nonce from the initial authentication during REGISTER, indicated by a non-zero nonce counter
I think Freeswitch does not handle this correctly and simply replies with a 401 response, not including any authentication related response headers. As a workaround, I could configure the phones not to send another digest authentication preemtively (by setting cache_sip_authorization to off). As a result, the phones send an unauthenticated request at first and Freeswitch responds with a 407 including WWW-Authenticate as expected. I think there are two possible solutions to this problem:
What do you think? Regards, |
I have forgotten this issue.Sorry
На вт, 21.11.2023 г. в 15:23 ч. Andreas Bruckner ***@***.***>
написа:
… I'm sorry to dig out this old issue, but I have the exact same problem
with Snom desk phones, both with MESSAGE and SUBSCRIBE. I'm currently using
Freeswitch version 1.10.10-release-24-4cb05e7f4a and I think I found out
what happens.
Analyzing the SIP trace, I noticed that the WWW-Authenticate header is
missing in the 401 response:
Sent to Udp:172.22.210.3:5060 from Udp:172.22.210.153:5060 at Nov 21 11:28:35.878 (685 bytes):
SUBSCRIBE ***@***.***:5060 SIP/2.0
Via: SIP/2.0/UDP 172.22.210.153:5060;branch=z9hG4bK-jyhxsogbec4d;rport
From: ***@***.***>;tag=z0kw85uxgt
To: ***@***.***>;tag=qiK2RIRcAd9E
Call-ID: c8755c65dbcf-inmkmv2eaxxs
CSeq: 76 SUBSCRIBE
Max-Forwards: 70
User-Agent: snomD345/10.1.159.12
Contact: ***@***.***:5060>;reg-id=1
Event: dialog
Accept: application/dialog-info+xml
Authorization: Digest ***@***.***:5060",qop=auth,nc=00000009,cnonce="102b01ae",response="88605665b71bdd4074d41d4203915676",algorithm=MD5
Expires: 3600
Content-Length: 0
Received from Udp:172.22.210.3:5060 on Udp:172.22.210.153:5060 at Nov 21 11:28:35.880 (655 bytes):
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 172.22.210.153:5060;branch=z9hG4bK-jyhxsogbec4d;rport=5060
From: ***@***.***>;tag=z0kw85uxgt
To: ***@***.***>;tag=qiK2RIRcAd9E
Call-ID: c8755c65dbcf-inmkmv2eaxxs
CSeq: 76 SUBSCRIBE
User-Agent: FreeSWITCH-mod_sofia/1.10.10-release-24-4cb05e7f4a~64bit
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE
Supported: timer, path, replaces
Allow-Events: talk, hold, conference, presence, as-feature-event, dialog, line-seize, call-info, sla, include-session-description, presence.winfo, message-summary, refer
Content-Length: 0
In the SUBSCRIBE request, the client re-uses the nonce from the initial
authentication during REGISTER, indicated by a non-zero nonce counter
nc=00000009. This mechanism is specified in RFC 2617, section 3.3
<https://datatracker.ietf.org/doc/html/rfc2617#section-3.3>:
A client should remember the username, password, nonce, nonce count and
opaque values associated with an authentication session to use to
construct the Authorization header in future requests within that
protection space. The Authorization header may be included
preemptively; doing so improves server efficiency and avoids extra
round trips for authentication challenges. The server may choose to
accept the old Authorization header information, even though the
nonce value included might not be fresh. Alternatively, the server
may return a 401 response with a new nonce value, causing the client
to retry the request; by specifying stale=TRUE with this response,
the server tells the client to retry with the new nonce, but without
prompting for a new username and password.
I think Freeswitch does not handle this correctly and simply replies with
a 401 response, not including any authentication related response headers.
As a workaround, I could configure the phones not to send another digest
authentication preemtively. As a result, the phones send an unauthenticated
request at first and Freeswitch responds with a 401 including
WWW-Authenticate as expected.
I think there are two possible solutions to this problem:
- implement this aspect of digest authentication correctly
- do not accept re-used nonce values and reply with a WWW-Authenticate
header
What do you think?
Regards,
Andreas
—
Reply to this email directly, view it on GitHub
<#1779 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AEWLQJAPXBQNUAGZ43QF3DTYFSTOTAVCNFSM575BG7QKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOBSGA4TEMBSGQ3A>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
I am experiencing this issue currently with a few different phone models. What I am seeing is that the first SUBSCRIBE has a
In the above example from a13r, The subsequent 401 does not have a Proxy-Authenticate or WWW-Authenticate header. In my configuration, I have |
The 401 for a SUBSCRIBE renewal is happening because the renewal comes after the Sofia |
I fixed this bug #2648 |
I can confirm that #2648 patches the mentioned issue |
Describe the bug
When I'm trying to send a MESSAGE to the FreeSWITCH after more 1min from SMS session starting,
I receive 401 without WWW-Authenticate . This MESSAGE is not received by other subscriber.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
In a normally case, the FreeSWITCH uses 407. If it uses 401,it has to send WWW-Authenticate
Package version or git hash
20220725T232850Z6bed9e1~64bit (git 6bed9e1 2022-07-25 23:28:50Z 64bit)Trace logs
In this case, there aren't anything in the log.
debug.log
The text was updated successfully, but these errors were encountered: