[Asterisk-code-review] chan_iax2: Add tests for ad hoc dialing with RSA authentication (testsuite[18])
Friendly Automation
asteriskteam at digium.com
Tue Nov 9 13:24:41 CST 2021
Friendly Automation has submitted this change. ( https://gerrit.asterisk.org/c/testsuite/+/17343 )
Change subject: chan_iax2: Add tests for ad hoc dialing with RSA authentication
......................................................................
chan_iax2: Add tests for ad hoc dialing with RSA authentication
Previously, the use of RSA authentication was mutually exclusive
with the use of a secret for AES-128 encryption in IAX2. This is
no longer the case.
This adds a test for the updated Dial syntax for IAX2 to allow a
secret and an outkey to be specified at the same time.
Change-Id: I6e0218f96993d157096d0052f0e987d8026a233c
---
A tests/channels/iax2/encrypted-calls/rsa-dynamic/configs/ast1/extensions.conf
A tests/channels/iax2/encrypted-calls/rsa-dynamic/configs/ast1/iax.conf
A tests/channels/iax2/encrypted-calls/rsa-dynamic/configs/ast2/cdr.conf
A tests/channels/iax2/encrypted-calls/rsa-dynamic/configs/ast2/extensions.conf
A tests/channels/iax2/encrypted-calls/rsa-dynamic/configs/ast2/iax.conf
A tests/channels/iax2/encrypted-calls/rsa-dynamic/files/ast1/astvarlibdir/keys/test.key
A tests/channels/iax2/encrypted-calls/rsa-dynamic/files/ast2/astvarlibdir/keys/test.pub
A tests/channels/iax2/encrypted-calls/rsa-dynamic/test-config.yaml
M tests/channels/iax2/encrypted-calls/tests.yaml
9 files changed, 247 insertions(+), 0 deletions(-)
Approvals:
George Joseph: Looks good to me, approved
Friendly Automation: Approved for Submit
diff --git a/tests/channels/iax2/encrypted-calls/rsa-dynamic/configs/ast1/extensions.conf b/tests/channels/iax2/encrypted-calls/rsa-dynamic/configs/ast1/extensions.conf
new file mode 100644
index 0000000..6c995e9
--- /dev/null
+++ b/tests/channels/iax2/encrypted-calls/rsa-dynamic/configs/ast1/extensions.conf
@@ -0,0 +1,8 @@
+[general]
+
+[globals]
+
+[iaxtest]
+
+exten => 1000,1,Answer()
+exten => 1000,n,Echo()
\ No newline at end of file
diff --git a/tests/channels/iax2/encrypted-calls/rsa-dynamic/configs/ast1/iax.conf b/tests/channels/iax2/encrypted-calls/rsa-dynamic/configs/ast1/iax.conf
new file mode 100644
index 0000000..11ef13c
--- /dev/null
+++ b/tests/channels/iax2/encrypted-calls/rsa-dynamic/configs/ast1/iax.conf
@@ -0,0 +1,19 @@
+[general]
+
+bindport=4570
+bindaddr=127.0.0.1
+
+disallow=all
+allow=ulaw
+
+jitterbuffer=no
+forcejitterbuffer=no
+
+encryption=yes
+
+[guest70]
+type=user
+context=iaxtest
+auth=md5
+secret=passw0rd
+forceencryption=yes
diff --git a/tests/channels/iax2/encrypted-calls/rsa-dynamic/configs/ast2/cdr.conf b/tests/channels/iax2/encrypted-calls/rsa-dynamic/configs/ast2/cdr.conf
new file mode 100644
index 0000000..921793c
--- /dev/null
+++ b/tests/channels/iax2/encrypted-calls/rsa-dynamic/configs/ast2/cdr.conf
@@ -0,0 +1,7 @@
+[general]
+unanswered=yes
+[csv]
+usegmtime=yes ; log date/time in GMT. Default is "no"
+loguniqueid=yes ; log uniqueid. Default is "no"
+loguserfield=yes ; log user field. Default is "no"
+
diff --git a/tests/channels/iax2/encrypted-calls/rsa-dynamic/configs/ast2/extensions.conf b/tests/channels/iax2/encrypted-calls/rsa-dynamic/configs/ast2/extensions.conf
new file mode 100644
index 0000000..c3939af
--- /dev/null
+++ b/tests/channels/iax2/encrypted-calls/rsa-dynamic/configs/ast2/extensions.conf
@@ -0,0 +1,9 @@
+[general]
+
+[globals]
+
+[iaxtest]
+
+exten => 1000,1,Answer()
+exten => 1000,n,Wait(1)
+exten => 1000,n,Hangup()
diff --git a/tests/channels/iax2/encrypted-calls/rsa-dynamic/configs/ast2/iax.conf b/tests/channels/iax2/encrypted-calls/rsa-dynamic/configs/ast2/iax.conf
new file mode 100644
index 0000000..9fdbfdb
--- /dev/null
+++ b/tests/channels/iax2/encrypted-calls/rsa-dynamic/configs/ast2/iax.conf
@@ -0,0 +1,17 @@
+[general]
+
+bindport=4569
+bindaddr=127.0.0.1
+
+disallow=all
+allow=ulaw
+
+encryption=yes
+
+[guest69]
+type=user
+context=iaxtest
+auth=rsa
+secret=passw0rd
+forceencryption=yes
+inkeys=test
diff --git a/tests/channels/iax2/encrypted-calls/rsa-dynamic/files/ast1/astvarlibdir/keys/test.key b/tests/channels/iax2/encrypted-calls/rsa-dynamic/files/ast1/astvarlibdir/keys/test.key
new file mode 100644
index 0000000..417ef16
--- /dev/null
+++ b/tests/channels/iax2/encrypted-calls/rsa-dynamic/files/ast1/astvarlibdir/keys/test.key
@@ -0,0 +1,15 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIICXQIBAAKBgQCeDuRnTJWkht1ssoxcaD62nNkgQDxn6AMObAuBMcDK8WJzdlgl
+lnsoyJqDFNl1i3TZ1JW8GQLjwNZyKREsGE7UDj4eKWYgqKhdGjkuM9L8EI0y5GTj
+QClUokKrkFa0L5rQwbyw0m4doQpae3myjlGtKQIKUFtv0r78sprSBh/WUQIDAQAB
+AoGABdpxVO3+ILCp5IucLRPjNqoKVGpskkCCVHdl2av5Asr7pWD9lK7E8tay+iW8
+g+DdO+/md6fJdpu+lU22CBcCXEMgpIFgaPbo+6tKcLi4fgO00GhFZl2d6YRXDY8C
+XdaEgnI1lO05LtLpwCO8neIWTXn8B5cafHEitziWoDrwFf0CQQDKPjTCRAL9gO9T
+b9ExsWqwXEnSGWtjTdcy3LYTF0G15HP0rY6e/U5O4YT8sevWgl84hLquh50kqpt2
+0mKzal5jAkEAyBIXz+JDto0n63tpiyCKf6RmKWpOg0aJv+zF6URrvKfPYchymOag
+REfx7GZaUNd48emvE9fhEK/R2qbpTdLMuwJBALuy8BQ8Ouo79+JgLK8KEhKMFJdB
+sEEBxXAXF4SwWPQPiu7TBULZpQvgkiRUnKUBao5x4TCJ/HZDQPYOXDxXxDECQALu
+QOsKpXNHHg6VADbJgz3baqOwqvXBUsM89Kk2F13sF12XUhZrSm21oBWWajxE68Cf
+a7EeuG1GJgzN5Rz+uYECQQDIXC3bHXapjYR4wog2ANnTuYuxvmo9Zos6tuyj98aE
+OdAmJ2tAUL5Vfaj9Ndp9rtxOMV6Kg+fSeBfgihJimFQm
+-----END RSA PRIVATE KEY-----
diff --git a/tests/channels/iax2/encrypted-calls/rsa-dynamic/files/ast2/astvarlibdir/keys/test.pub b/tests/channels/iax2/encrypted-calls/rsa-dynamic/files/ast2/astvarlibdir/keys/test.pub
new file mode 100644
index 0000000..088fe33
--- /dev/null
+++ b/tests/channels/iax2/encrypted-calls/rsa-dynamic/files/ast2/astvarlibdir/keys/test.pub
@@ -0,0 +1,6 @@
+-----BEGIN PUBLIC KEY-----
+MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCeDuRnTJWkht1ssoxcaD62nNkg
+QDxn6AMObAuBMcDK8WJzdlgllnsoyJqDFNl1i3TZ1JW8GQLjwNZyKREsGE7UDj4e
+KWYgqKhdGjkuM9L8EI0y5GTjQClUokKrkFa0L5rQwbyw0m4doQpae3myjlGtKQIK
+UFtv0r78sprSBh/WUQIDAQAB
+-----END PUBLIC KEY-----
diff --git a/tests/channels/iax2/encrypted-calls/rsa-dynamic/test-config.yaml b/tests/channels/iax2/encrypted-calls/rsa-dynamic/test-config.yaml
new file mode 100644
index 0000000..926eff7
--- /dev/null
+++ b/tests/channels/iax2/encrypted-calls/rsa-dynamic/test-config.yaml
@@ -0,0 +1,165 @@
+testinfo:
+ summary: 'Test a basic IAX2 call using RSA authentication with encryption'
+ description: |
+ 'This test initiates an IAX2 call between 2 instances of Asterisk.
+ The test only verifies that an IAX2 call is actually instantiated
+ between the two Asterisk instances using RSA authentication with
+ encryption and that proper records are generated.'
+
+properties:
+ dependencies:
+ - python : 'twisted'
+ - python : 'starpy'
+ - asterisk : 'cdr_csv'
+ tags:
+ - iax2
+
+test-modules:
+ test-object:
+ config-section: test-object-config
+ typename: 'test_case.TestCaseModule'
+ modules:
+ -
+ config-section: originator
+ typename: 'pluggable_modules.Originator'
+ -
+ config-section: ami-config
+ typename: 'ami.AMIEventModule'
+ -
+ config-section: hangup-monitor
+ typename: 'pluggable_modules.HangupMonitor'
+ -
+ config-section: cdr-config
+ typename: 'cdr.CDRModule'
+ -
+ config-section: 'cel-config'
+ typename: 'ami.AMIEventModule'
+
+
+test-object-config:
+ asterisk-instances: 2
+ connect-ami: True
+
+originator:
+ trigger: 'ami_connect'
+ id: '0'
+ channel: 'IAX2/guest69:passw0rd:[test]@127.0.0.1:4569/1000'
+ context: 'iaxtest'
+ exten: '1000'
+ priority: '1'
+ async: 'True'
+
+ami-config:
+ -
+ id: '0'
+ type: 'headermatch'
+ count: '1'
+ conditions:
+ match:
+ Event: 'Newchannel'
+ requirements:
+ match:
+ Channel: 'IAX2/.*'
+ -
+ id: '1'
+ type: 'headermatch'
+ count: '1'
+ conditions:
+ match:
+ Event: 'Newchannel'
+ requirements:
+ match:
+ Channel: 'IAX2/.*'
+ -
+ id: '0'
+ type: 'headermatch'
+ count: '1'
+ conditions:
+ match:
+ Event: 'Hangup'
+ requirements:
+ match:
+ Channel: 'IAX2/.*'
+ -
+ id: '1'
+ type: 'headermatch'
+ count: '1'
+ conditions:
+ match:
+ Event: 'Hangup'
+ requirements:
+ match:
+ Channel: 'IAX2/.*'
+
+hangup-monitor:
+ ids: '0'
+
+cdr-config:
+ -
+ id: 0
+ file: 'Master'
+ lines:
+ -
+ destination: '1000'
+ dcontext: 'iaxtest'
+ channel: 'IAX2/.*'
+ lastapp: 'Echo'
+ disposition: 'ANSWERED'
+ amaflags: 'DOCUMENTATION'
+ -
+ id: 1
+ file: 'Master'
+ lines:
+ -
+ destination: '1000'
+ dcontext: 'iaxtest'
+ channel: 'IAX2/.*'
+ lastapp: 'Hangup'
+ disposition: 'ANSWERED'
+ amaflags: 'DOCUMENTATION'
+
+cel-config:
+ -
+ id: '0'
+ type: 'cel'
+ conditions:
+ match:
+ Channel: 'IAX2/.*'
+ requirements:
+ -
+ match:
+ EventName: CHAN_START
+ -
+ match:
+ EventName: ANSWER
+ -
+ match:
+ EventName: HANGUP
+ -
+ match:
+ EventName: CHAN_END
+ -
+ match:
+ EventName: LINKEDID_END
+ -
+ id: '1'
+ type: 'cel'
+ conditions:
+ match:
+ Channel: 'IAX2/.*'
+ requirements:
+ -
+ match:
+ EventName: CHAN_START
+ -
+ match:
+ EventName: ANSWER
+ -
+ match:
+ EventName: HANGUP
+ -
+ match:
+ EventName: CHAN_END
+ -
+ match:
+ EventName: LINKEDID_END
diff --git a/tests/channels/iax2/encrypted-calls/tests.yaml b/tests/channels/iax2/encrypted-calls/tests.yaml
index ac9491e..3d1246b 100644
--- a/tests/channels/iax2/encrypted-calls/tests.yaml
+++ b/tests/channels/iax2/encrypted-calls/tests.yaml
@@ -2,3 +2,4 @@
tests:
- test: 'md5'
- test: 'rsa'
+ - test: 'rsa-dynamic'
--
To view, visit https://gerrit.asterisk.org/c/testsuite/+/17343
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: testsuite
Gerrit-Branch: 18
Gerrit-Change-Id: I6e0218f96993d157096d0052f0e987d8026a233c
Gerrit-Change-Number: 17343
Gerrit-PatchSet: 1
Gerrit-Owner: N A <mail at interlinked.x10host.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20211109/32de579f/attachment-0001.html>
More information about the asterisk-code-review
mailing list