Asterisk
  1. Asterisk
  2. ASTERISK-4970

[patch] subscribe authentication fails with multiple peers on same client

    Details

    • Type: Bug Bug
    • Status: Closed
    • Severity: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Target Release Version/s: None
    • Labels:
      None
    • Mantis ID:
      5103
    • Regression:
      No

      Description

      Asterisk 1.0.9 (maybe also earlier versions?) contains a bug that effectively disables subscriptions for phones with multiple regististrations in place.

      When processing a "nonce response" as a result to an 407 authentication request Asterisk with SIP DEBUG reports "Found peer YYY" even though it should look at peer XXX to compare user credentials. Consequently a NOTICE is displayed with "Failed to authenticate user ... for SUBSCRIBE" (YYY and XXX share the same IP and port, only the user name differs).

      This bug is not present in 1.0.2 (for Asterisk 1.2 beta I cannot make a statement). Subscriptions worked fine with 1.0.2 (bristuffed), and failed after upgrade to 1.0.9 (bristuffed) without any changes to the config files or phones.

                • ADDITIONAL INFORMATION ******

      Both co723 and co724 are "lines" = users/peers on this SNOM 360 that have successfully registered (on the same port and with the same IP). In this case 1001 is a mailbox, but the same applies also to "normal" extensions that a subscribe is attempted for.

      Sip read:
      SUBSCRIBE sip:1001@myast.mynet.void SIP/2.0
      Via: SIP/2.0/UDP 192.168.63.23:5067;branch=z9hG4bK-026k96pd5zkl;rport
      From: <sip:co723@myast.mynet.void>;tag=afxno3l6f3
      To: <sip:1001@myast.mynet.void>
      Call-ID: 3c26700a57e4-264nwbc856zv@snom360
      CSeq: 530 SUBSCRIBE
      Max-Forwards: 70
      Contact: <sip:co723@192.168.63.23:5067;line=e2w48vym>
      Event: message-summary
      Accept: application/simple-message-summary
      Expires: 3600
      Content-Length: 0

      12 headers, 0 lines
      Using latest SUBSCRIBE request as basis request
      Sending to 192.168.63.23 : 5067 (non-NAT)
      Found peer 'co724'
      Transmitting (no NAT):
      SIP/2.0 407 Proxy Authentication Required
      Via: SIP/2.0/UDP 192.168.63.23:5067;branch=z9hG4bK-026k96pd5zkl
      From: <sip:co723@myast.mynet.void>;tag=afxno3l6f3
      To: <sip:1001@myast.mynet.void>;tag=as515351e8
      Call-ID: 3c26700a57e4-264nwbc856zv@snom360
      CSeq: 530 SUBSCRIBE
      User-Agent: Asterisk PBX
      Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER
      Contact: <sip:1001@192.168.63.2>
      Proxy-Authenticate: Digest realm="myast.mynet.void", nonce="14156710"
      Content-Length: 0

      to 192.168.63.23:5067
      Scheduling destruction of call '3c26700a57e4-264nwbc856zv@snom360' in 15000 ms
      myAst*CLI>

      Sip read:
      SUBSCRIBE sip:1001@myast.mynet.void SIP/2.0
      Via: SIP/2.0/UDP 192.168.63.23:5067;branch=z9hG4bK-xqvtge178i5o;rport
      From: <sip:co723@myast.mynet.void>;tag=afxno3l6f3
      To: <sip:1001@myast.mynet.void>
      Call-ID: 3c26700a57e4-264nwbc856zv@snom360
      CSeq: 531 SUBSCRIBE
      Max-Forwards: 70
      Contact: <sip:co723@192.168.63.23:5067;line=e2w48vym>
      Event: message-summary
      Accept: application/simple-message-summary
      Proxy-Authorization: Digest username="co723",realm="myast.mynet.void",nonce="14156710",uri="sip:1001@myast.mynet.void",response="5068d2749be71ec807e3ec41949e4e11",algorithm=md5
      Expires: 3600
      Content-Length: 0

      13 headers, 0 lines
      Using latest SUBSCRIBE request as basis request
      Sending to 192.168.63.23 : 5067 (non-NAT)
      Found peer 'co724'
      Sep 2 12:09:12 NOTICE[13986]: chan_sip.c:7654 handle_request: Failed to authenticate user <sip:co723@myast.mynet.void>;tag=afxno3l6f3 for SUBSCRIBE
      Destroying call '3c26700a57e4-264nwbc856zv@snom360'

        Activity

        Hide
        philipp2 added a comment -

        With beta1 I get: Hunk ASTERISK-2 FAILED at 9772. Apart from this it appears to be working nicely and certainly solves the issue.
        Applies cleanly to HEAD and works fine (I am surprised I can run HEAD with zaptel from beta1)

        Show
        philipp2 added a comment - With beta1 I get: Hunk ASTERISK-2 FAILED at 9772. Apart from this it appears to be working nicely and certainly solves the issue. Applies cleanly to HEAD and works fine (I am surprised I can run HEAD with zaptel from beta1)
        Hide
        Olle Johansson added a comment -

        Thank you for confirming the patch so quickly!!!!

        Ready for kpflemings detailed audit

        Show
        Olle Johansson added a comment - Thank you for confirming the patch so quickly!!!! Ready for kpflemings detailed audit
        Hide
        philipp2 added a comment -

        Let me return the compliment: Thanks a lot for the fix, this really did bug me!

        Show
        philipp2 added a comment - Let me return the compliment: Thanks a lot for the fix, this really did bug me!
        Hide
        Kevin P. Fleming (Inactive) added a comment -

        Committed to CVS HEAD, thanks!

        Show
        Kevin P. Fleming (Inactive) added a comment - Committed to CVS HEAD, thanks!
        Hide
        Digium Subversion added a comment -

        Repository: asterisk
        Revision: 6723

        U trunk/channels/chan_sip.c

        ------------------------------------------------------------------------
        r6723 | kpfleming | 2008-01-15 15:50:10 -0600 (Tue, 15 Jan 2008) | 2 lines

        handle peer matching for subscriptions by name instead of IP address (issue ASTERISK-4970)

        ------------------------------------------------------------------------

        http://svn.digium.com/view/asterisk?view=rev&revision=6723

        Show
        Digium Subversion added a comment - Repository: asterisk Revision: 6723 U trunk/channels/chan_sip.c ------------------------------------------------------------------------ r6723 | kpfleming | 2008-01-15 15:50:10 -0600 (Tue, 15 Jan 2008) | 2 lines handle peer matching for subscriptions by name instead of IP address (issue ASTERISK-4970 ) ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=6723

          People

          • Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development