summaryrefslogtreecommitdiff
path: root/tests/test_ami_security_events.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_ami_security_events.sh')
-rwxr-xr-xtests/test_ami_security_events.sh47
1 files changed, 47 insertions, 0 deletions
diff --git a/tests/test_ami_security_events.sh b/tests/test_ami_security_events.sh
new file mode 100755
index 000000000..6f125dc5a
--- /dev/null
+++ b/tests/test_ami_security_events.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+
+# manager.conf:
+#
+# [general]
+# ...
+# allowmultipleconnects=no
+# ...
+#
+# [russell]
+# secret=blah123
+# read = system,call,log,verbose,command,agent,user,config
+# write = system,call,log,verbose,command,agent,user,config
+# deny=0.0.0.0/0.0.0.0
+# permit=127.0.0.1/255.255.255.255
+#
+# [russell2]
+# secret=blah123
+# read = system,call,log,verbose,command,agent,user,config
+# write = system,call,log,verbose,command,agent,user,config
+# deny=127.0.0.1/255.255.255.255
+
+# Invalid User
+printf "Action: Login\r\nUsername: foo\r\nSecret: moo\r\n\r\n" | nc localhost 5038
+
+# Invalid Secret
+printf "Action: Login\r\nUsername: russell\r\nSecret: moo\r\n\r\n" | nc localhost 5038
+
+# Auth Success
+printf "Action: Login\r\nUsername: russell\r\nSecret: blah123\r\n\r\n" | nc -w 1 localhost 5038
+
+# Failed ACL
+printf "Action: Login\r\nUsername: russell2\r\nSecret: blah123\r\n\r\n" | nc -w 1 localhost 5038
+
+# Request Not Allowed
+printf "Action: Login\r\nUsername: russell\r\nSecret: blah123\r\n\r\nAction: Originate\r\n\r\n" | nc -w 1 localhost 5038
+
+# Request Bad Format
+printf "Action: Login\r\nUsername: russell\r\nSecret: blah123\r\n\r\nAction: FakeActionBLAH\r\n\r\n" | nc -w 1 localhost 5038
+
+# Failed Challenge Response
+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
+
+# Session Limit
+printf "Action: Login\r\nUsername: russell\r\nSecret: blah123\r\n\r\n" | nc -w 5 localhost 5038 &
+printf "Action: Login\r\nUsername: russell\r\nSecret: blah123\r\n\r\n" | nc -w 1 localhost 5038
+