[asterisk-commits] mmichelson: testsuite/asterisk/trunk r6254 - in /asterisk/trunk/tests/channel...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Jan 12 10:47:00 CST 2015
Author: mmichelson
Date: Mon Jan 12 10:46:52 2015
New Revision: 6254
URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=6254
Log:
Test that outbound registrations cannot result in an infinite auth loop.
This test ensures that if we attempt to send a registration with authentication
credentials and then receive another 401 response, we will consider our authentication
attempt to have failed and not immediately try to send another registration request.
The test works by setting auth rejection errors as permanent errors. Therefore, sending
any other requests after the reception of the 401 is a failure.
Review: https://reviewboard.asterisk.org/r/4274
Added:
asterisk/trunk/tests/channels/pjsip/registration/outbound/auth_loop/
asterisk/trunk/tests/channels/pjsip/registration/outbound/auth_loop/configs/
asterisk/trunk/tests/channels/pjsip/registration/outbound/auth_loop/configs/ast1/
asterisk/trunk/tests/channels/pjsip/registration/outbound/auth_loop/configs/ast1/pjsip.conf (with props)
asterisk/trunk/tests/channels/pjsip/registration/outbound/auth_loop/sipp/
asterisk/trunk/tests/channels/pjsip/registration/outbound/auth_loop/sipp/uas-reg-401.xml (with props)
asterisk/trunk/tests/channels/pjsip/registration/outbound/auth_loop/test-config.yaml (with props)
Modified:
asterisk/trunk/tests/channels/pjsip/registration/outbound/tests.yaml
Added: asterisk/trunk/tests/channels/pjsip/registration/outbound/auth_loop/configs/ast1/pjsip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/registration/outbound/auth_loop/configs/ast1/pjsip.conf?view=auto&rev=6254
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/registration/outbound/auth_loop/configs/ast1/pjsip.conf (added)
+++ asterisk/trunk/tests/channels/pjsip/registration/outbound/auth_loop/configs/ast1/pjsip.conf Mon Jan 12 10:46:52 2015
@@ -1,0 +1,20 @@
+[global]
+type = global
+debug = yes
+
+[trans]
+type = transport
+protocol = udp
+bind = 127.0.0.1:5060
+
+[outreg]
+type = registration
+server_uri = sip:them at 127.0.0.1:5061
+client_uri = sip:us at 127.0.0.1
+outbound_auth = regauth
+
+[regauth]
+type = auth
+auth_type = userpass
+username = this_doesnt
+password = matter_anyway
Propchange: asterisk/trunk/tests/channels/pjsip/registration/outbound/auth_loop/configs/ast1/pjsip.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/channels/pjsip/registration/outbound/auth_loop/configs/ast1/pjsip.conf
------------------------------------------------------------------------------
svn:keywords = 'Author Date Id Revision'
Propchange: asterisk/trunk/tests/channels/pjsip/registration/outbound/auth_loop/configs/ast1/pjsip.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/channels/pjsip/registration/outbound/auth_loop/sipp/uas-reg-401.xml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/registration/outbound/auth_loop/sipp/uas-reg-401.xml?view=auto&rev=6254
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/registration/outbound/auth_loop/sipp/uas-reg-401.xml (added)
+++ asterisk/trunk/tests/channels/pjsip/registration/outbound/auth_loop/sipp/uas-reg-401.xml Mon Jan 12 10:46:52 2015
@@ -1,0 +1,45 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Register rejecter">
+ <recv request="REGISTER" crlf="true">
+ </recv>
+
+ <send>
+ <![CDATA[
+
+ SIP/2.0 401 Unauthorized
+ [last_Via:]
+ [last_From:]
+ [last_To:];tag=[pid]SIPpTag01[call_number]
+ [last_Call-ID:]
+ [last_CSeq:]
+ Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+ WWW-Authenticate: Digest realm="asterisk", nonce="47ebe028cda119c35d4877b383027d28da013815"
+ Content-Length: 0
+
+ ]]>
+ </send>
+
+ <recv request="REGISTER" crlf="true">
+ </recv>
+
+ <send>
+ <![CDATA[
+
+ SIP/2.0 401 Unauthorized
+ [last_Via:]
+ [last_From:]
+ [last_To:];tag=[pid]SIPpTag01[call_number]
+ [last_Call-ID:]
+ [last_CSeq:]
+ Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+ WWW-Authenticate: Digest realm="asterisk", nonce="47ebe028cda3284789cda42390815234bcedf"
+ Content-Length: 0
+
+ ]]>
+ </send>
+
+ <!-- Keep the scenario going for a while to ensure that no further messages are sent -->
+ <timewait milliseconds="3000" />
+</scenario>
Propchange: asterisk/trunk/tests/channels/pjsip/registration/outbound/auth_loop/sipp/uas-reg-401.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/channels/pjsip/registration/outbound/auth_loop/sipp/uas-reg-401.xml
------------------------------------------------------------------------------
svn:keywords = 'Author Date Id Revision'
Propchange: asterisk/trunk/tests/channels/pjsip/registration/outbound/auth_loop/sipp/uas-reg-401.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: asterisk/trunk/tests/channels/pjsip/registration/outbound/auth_loop/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/registration/outbound/auth_loop/test-config.yaml?view=auto&rev=6254
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/registration/outbound/auth_loop/test-config.yaml (added)
+++ asterisk/trunk/tests/channels/pjsip/registration/outbound/auth_loop/test-config.yaml Mon Jan 12 10:46:52 2015
@@ -1,0 +1,53 @@
+testinfo:
+ summary: 'Ensure that Asterisk will not get caught in an infinite loop attempting registration authentication'
+ description: |
+ " * Asterisk will attempt to register with a server (a SIPp scenario).
+ * Asterisk will be challenged for authentication
+ * Asterisk will send the REGISTER a second time with auth credentials.
+ * Asterisk will again be challenged for authentication
+ * At this point, Asterisk should consider the registration to be rejected and not
+ re-attempt registration.
+
+ This tests Asterisk's ability to stop sending registrations after receiving consecutive
+ 401 responses."
+
+test-modules:
+ test-object:
+ config-section: sipp-config
+ typename: 'sipp.SIPpTestCase'
+ modules:
+ -
+ typename: 'ami.AMIEventModule'
+ config-section: ami-config
+
+sipp-config:
+ test-iterations:
+ -
+ scenarios:
+ - { 'key-args': { 'scenario': 'uas-reg-401.xml', '-p': '5061'} }
+
+ami-config:
+ -
+ type: 'headermatch'
+ conditions:
+ match:
+ Event: 'Registry'
+ ChannelType: 'PJSIP'
+ requirements:
+ match:
+ Username: 'sip:us at 127.0.0.1'
+ Domain: 'sip:them at 127.0.0.1:5061'
+ Status: 'Rejected'
+ count: '1'
+
+properties:
+ minversion: '13.2.0'
+ dependencies:
+ - python: 'starpy'
+ - sipp:
+ version: 'v3.1'
+ - asterisk: 'res_pjsip'
+ - asterisk: 'res_pjsip_outbound_authenticator_digest'
+ - asterisk: 'res_pjsip_outbound_registration'
+ tags:
+ - pjsip
Propchange: asterisk/trunk/tests/channels/pjsip/registration/outbound/auth_loop/test-config.yaml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/channels/pjsip/registration/outbound/auth_loop/test-config.yaml
------------------------------------------------------------------------------
svn:keywords = 'Author Date Id Revision'
Propchange: asterisk/trunk/tests/channels/pjsip/registration/outbound/auth_loop/test-config.yaml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: asterisk/trunk/tests/channels/pjsip/registration/outbound/tests.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/registration/outbound/tests.yaml?view=diff&rev=6254&r1=6253&r2=6254
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/registration/outbound/tests.yaml (original)
+++ asterisk/trunk/tests/channels/pjsip/registration/outbound/tests.yaml Mon Jan 12 10:46:52 2015
@@ -2,3 +2,4 @@
tests:
- test: 'forbidden_retry'
- dir: 'unregister'
+ - test: 'auth_loop'
More information about the asterisk-commits
mailing list