test_ami_security_events.sh 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #!/bin/bash
  2. # manager.conf:
  3. #
  4. # [general]
  5. # ...
  6. # allowmultipleconnects=no
  7. # ...
  8. #
  9. # [russell]
  10. # secret=blah123
  11. # read = system,call,log,verbose,command,agent,user,config
  12. # write = system,call,log,verbose,command,agent,user,config
  13. # deny=0.0.0.0/0.0.0.0
  14. # permit=127.0.0.1/255.255.255.255
  15. #
  16. # [russell2]
  17. # secret=blah123
  18. # read = system,call,log,verbose,command,agent,user,config
  19. # write = system,call,log,verbose,command,agent,user,config
  20. # deny=127.0.0.1/255.255.255.255
  21. # Invalid User
  22. printf "Action: Login\r\nUsername: foo\r\nSecret: moo\r\n\r\n" | nc localhost 5038
  23. # Invalid Secret
  24. printf "Action: Login\r\nUsername: russell\r\nSecret: moo\r\n\r\n" | nc localhost 5038
  25. # Auth Success
  26. printf "Action: Login\r\nUsername: russell\r\nSecret: blah123\r\n\r\n" | nc -w 1 localhost 5038
  27. # Failed ACL
  28. printf "Action: Login\r\nUsername: russell2\r\nSecret: blah123\r\n\r\n" | nc -w 1 localhost 5038
  29. # Request Not Allowed
  30. printf "Action: Login\r\nUsername: russell\r\nSecret: blah123\r\n\r\nAction: Originate\r\n\r\n" | nc -w 1 localhost 5038
  31. # Request Bad Format
  32. printf "Action: Login\r\nUsername: russell\r\nSecret: blah123\r\n\r\nAction: FakeActionBLAH\r\n\r\n" | nc -w 1 localhost 5038
  33. # Failed Challenge Response
  34. 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
  35. # Session Limit
  36. printf "Action: Login\r\nUsername: russell\r\nSecret: blah123\r\n\r\n" | nc -w 5 localhost 5038 &
  37. printf "Action: Login\r\nUsername: russell\r\nSecret: blah123\r\n\r\n" | nc -w 1 localhost 5038