Skip to content

Commit 46a28ab

Browse files
committed
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
1 parent 8dfe0a0 commit 46a28ab

File tree

9 files changed

+247
-0
lines changed

9 files changed

+247
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[general]
2+
3+
[globals]
4+
5+
[iaxtest]
6+
7+
exten => 1000,1,Answer()
8+
exten => 1000,n,Echo()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
[general]
2+
3+
bindport=4570
4+
bindaddr=127.0.0.1
5+
6+
disallow=all
7+
allow=ulaw
8+
9+
jitterbuffer=no
10+
forcejitterbuffer=no
11+
12+
encryption=yes
13+
14+
[guest70]
15+
type=user
16+
context=iaxtest
17+
auth=md5
18+
secret=passw0rd
19+
forceencryption=yes
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[general]
2+
unanswered=yes
3+
[csv]
4+
usegmtime=yes ; log date/time in GMT. Default is "no"
5+
loguniqueid=yes ; log uniqueid. Default is "no"
6+
loguserfield=yes ; log user field. Default is "no"
7+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[general]
2+
3+
[globals]
4+
5+
[iaxtest]
6+
7+
exten => 1000,1,Answer()
8+
exten => 1000,n,Wait(1)
9+
exten => 1000,n,Hangup()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[general]
2+
3+
bindport=4569
4+
bindaddr=127.0.0.1
5+
6+
disallow=all
7+
allow=ulaw
8+
9+
encryption=yes
10+
11+
[guest69]
12+
type=user
13+
context=iaxtest
14+
auth=rsa
15+
secret=passw0rd
16+
forceencryption=yes
17+
inkeys=test
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
-----BEGIN RSA PRIVATE KEY-----
2+
MIICXQIBAAKBgQCeDuRnTJWkht1ssoxcaD62nNkgQDxn6AMObAuBMcDK8WJzdlgl
3+
lnsoyJqDFNl1i3TZ1JW8GQLjwNZyKREsGE7UDj4eKWYgqKhdGjkuM9L8EI0y5GTj
4+
QClUokKrkFa0L5rQwbyw0m4doQpae3myjlGtKQIKUFtv0r78sprSBh/WUQIDAQAB
5+
AoGABdpxVO3+ILCp5IucLRPjNqoKVGpskkCCVHdl2av5Asr7pWD9lK7E8tay+iW8
6+
g+DdO+/md6fJdpu+lU22CBcCXEMgpIFgaPbo+6tKcLi4fgO00GhFZl2d6YRXDY8C
7+
XdaEgnI1lO05LtLpwCO8neIWTXn8B5cafHEitziWoDrwFf0CQQDKPjTCRAL9gO9T
8+
b9ExsWqwXEnSGWtjTdcy3LYTF0G15HP0rY6e/U5O4YT8sevWgl84hLquh50kqpt2
9+
0mKzal5jAkEAyBIXz+JDto0n63tpiyCKf6RmKWpOg0aJv+zF6URrvKfPYchymOag
10+
REfx7GZaUNd48emvE9fhEK/R2qbpTdLMuwJBALuy8BQ8Ouo79+JgLK8KEhKMFJdB
11+
sEEBxXAXF4SwWPQPiu7TBULZpQvgkiRUnKUBao5x4TCJ/HZDQPYOXDxXxDECQALu
12+
QOsKpXNHHg6VADbJgz3baqOwqvXBUsM89Kk2F13sF12XUhZrSm21oBWWajxE68Cf
13+
a7EeuG1GJgzN5Rz+uYECQQDIXC3bHXapjYR4wog2ANnTuYuxvmo9Zos6tuyj98aE
14+
OdAmJ2tAUL5Vfaj9Ndp9rtxOMV6Kg+fSeBfgihJimFQm
15+
-----END RSA PRIVATE KEY-----
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
-----BEGIN PUBLIC KEY-----
2+
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCeDuRnTJWkht1ssoxcaD62nNkg
3+
QDxn6AMObAuBMcDK8WJzdlgllnsoyJqDFNl1i3TZ1JW8GQLjwNZyKREsGE7UDj4e
4+
KWYgqKhdGjkuM9L8EI0y5GTjQClUokKrkFa0L5rQwbyw0m4doQpae3myjlGtKQIK
5+
UFtv0r78sprSBh/WUQIDAQAB
6+
-----END PUBLIC KEY-----
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
testinfo:
2+
summary: 'Test a basic IAX2 call using RSA authentication with encryption'
3+
description: |
4+
'This test initiates an IAX2 call between 2 instances of Asterisk.
5+
The test only verifies that an IAX2 call is actually instantiated
6+
between the two Asterisk instances using RSA authentication with
7+
encryption and that proper records are generated.'
8+
9+
properties:
10+
dependencies:
11+
- python : 'twisted'
12+
- python : 'starpy'
13+
- asterisk : 'cdr_csv'
14+
tags:
15+
- iax2
16+
17+
test-modules:
18+
test-object:
19+
config-section: test-object-config
20+
typename: 'test_case.TestCaseModule'
21+
modules:
22+
-
23+
config-section: originator
24+
typename: 'pluggable_modules.Originator'
25+
-
26+
config-section: ami-config
27+
typename: 'ami.AMIEventModule'
28+
-
29+
config-section: hangup-monitor
30+
typename: 'pluggable_modules.HangupMonitor'
31+
-
32+
config-section: cdr-config
33+
typename: 'cdr.CDRModule'
34+
-
35+
config-section: 'cel-config'
36+
typename: 'ami.AMIEventModule'
37+
38+
39+
test-object-config:
40+
asterisk-instances: 2
41+
connect-ami: True
42+
43+
originator:
44+
trigger: 'ami_connect'
45+
id: '0'
46+
channel: 'IAX2/guest69:passw0rd:[test]@127.0.0.1:4569/1000'
47+
context: 'iaxtest'
48+
exten: '1000'
49+
priority: '1'
50+
async: 'True'
51+
52+
ami-config:
53+
-
54+
id: '0'
55+
type: 'headermatch'
56+
count: '1'
57+
conditions:
58+
match:
59+
Event: 'Newchannel'
60+
requirements:
61+
match:
62+
Channel: 'IAX2/.*'
63+
-
64+
id: '1'
65+
type: 'headermatch'
66+
count: '1'
67+
conditions:
68+
match:
69+
Event: 'Newchannel'
70+
requirements:
71+
match:
72+
Channel: 'IAX2/.*'
73+
-
74+
id: '0'
75+
type: 'headermatch'
76+
count: '1'
77+
conditions:
78+
match:
79+
Event: 'Hangup'
80+
requirements:
81+
match:
82+
Channel: 'IAX2/.*'
83+
-
84+
id: '1'
85+
type: 'headermatch'
86+
count: '1'
87+
conditions:
88+
match:
89+
Event: 'Hangup'
90+
requirements:
91+
match:
92+
Channel: 'IAX2/.*'
93+
94+
hangup-monitor:
95+
ids: '0'
96+
97+
cdr-config:
98+
-
99+
id: 0
100+
file: 'Master'
101+
lines:
102+
-
103+
destination: '1000'
104+
dcontext: 'iaxtest'
105+
channel: 'IAX2/.*'
106+
lastapp: 'Echo'
107+
disposition: 'ANSWERED'
108+
amaflags: 'DOCUMENTATION'
109+
-
110+
id: 1
111+
file: 'Master'
112+
lines:
113+
-
114+
destination: '1000'
115+
dcontext: 'iaxtest'
116+
channel: 'IAX2/.*'
117+
lastapp: 'Hangup'
118+
disposition: 'ANSWERED'
119+
amaflags: 'DOCUMENTATION'
120+
121+
cel-config:
122+
-
123+
id: '0'
124+
type: 'cel'
125+
conditions:
126+
match:
127+
Channel: 'IAX2/.*'
128+
requirements:
129+
-
130+
match:
131+
EventName: CHAN_START
132+
-
133+
match:
134+
EventName: ANSWER
135+
-
136+
match:
137+
EventName: HANGUP
138+
-
139+
match:
140+
EventName: CHAN_END
141+
-
142+
match:
143+
EventName: LINKEDID_END
144+
-
145+
id: '1'
146+
type: 'cel'
147+
conditions:
148+
match:
149+
Channel: 'IAX2/.*'
150+
requirements:
151+
-
152+
match:
153+
EventName: CHAN_START
154+
-
155+
match:
156+
EventName: ANSWER
157+
-
158+
match:
159+
EventName: HANGUP
160+
-
161+
match:
162+
EventName: CHAN_END
163+
-
164+
match:
165+
EventName: LINKEDID_END

tests/channels/iax2/encrypted-calls/tests.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
tests:
33
- test: 'md5'
44
- test: 'rsa'
5+
- test: 'rsa-dynamic'

0 commit comments

Comments
 (0)