Merge "ari: Implement 'debug all' and request/response logging"
[asterisk/asterisk.git] / tests / test_ami_security_events.sh
1 #!/bin/bash
2
3 # manager.conf:
4 #
5 # [general]
6 # ...
7 # allowmultipleconnects=no
8 # ...
9 #
10 # [russell]
11 # secret=blah123
12 # read = system,call,log,verbose,command,agent,user,config
13 # write = system,call,log,verbose,command,agent,user,config
14 # deny=0.0.0.0/0.0.0.0
15 # permit=127.0.0.1/255.255.255.255
16 #
17 # [russell2]
18 # secret=blah123
19 # read = system,call,log,verbose,command,agent,user,config
20 # write = system,call,log,verbose,command,agent,user,config
21 # deny=127.0.0.1/255.255.255.255
22
23 # Invalid User
24 printf "Action: Login\r\nUsername: foo\r\nSecret: moo\r\n\r\n" | nc localhost 5038
25
26 # Invalid Secret
27 printf "Action: Login\r\nUsername: russell\r\nSecret: moo\r\n\r\n" | nc localhost 5038
28
29 # Auth Success
30 printf "Action: Login\r\nUsername: russell\r\nSecret: blah123\r\n\r\n" | nc -w 1 localhost 5038
31
32 # Failed ACL
33 printf "Action: Login\r\nUsername: russell2\r\nSecret: blah123\r\n\r\n" | nc -w 1 localhost 5038
34
35 # Request Not Allowed
36 printf "Action: Login\r\nUsername: russell\r\nSecret: blah123\r\n\r\nAction: Originate\r\n\r\n" | nc -w 1 localhost 5038
37
38 # Request Bad Format
39 printf "Action: Login\r\nUsername: russell\r\nSecret: blah123\r\n\r\nAction: FakeActionBLAH\r\n\r\n" | nc -w 1 localhost 5038
40
41 # Failed Challenge Response
42 printf "Action: Challenge\r\nUsername: russell\r\nAuthType: MD5\r\n\r\nAction: Login\r\nUsername: russell\r\nAuthType: MD5\r\nKey: 00000000\r\n\r\n" | nc localhost 5038
43
44 # Session Limit
45 printf "Action: Login\r\nUsername: russell\r\nSecret: blah123\r\n\r\n" | nc -w 5 localhost 5038 &
46 printf "Action: Login\r\nUsername: russell\r\nSecret: blah123\r\n\r\n" | nc -w 1 localhost 5038
47