Advertisement
Guest User

Untitled

a guest
Jan 31st, 2018
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.60 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. #Note - If you want to go through wcmesb[dev|test|qa], you will have to have your IP committed into the webuser-service.yml file in
  4. # the aem-services-config repository. This is becuase the netscaler there is configured to set the "client-ip" header
  5. # to your environment. Otherwise, go straight to the service and pretend your IP is "216.17.41.254" (which is what Hallmark plans to use).
  6.  
  7. #myIp="216.17.41.254"
  8. #myIp="98.178.166.155" #my real ip at the time I was testing this
  9. #host="http://wcmesbtest.pennwell.com"
  10. host="http://testaemservices01.pennwell.net:8126"
  11.  
  12. #wcmesb only
  13. if [ -z $myIp ]; then
  14. #Rename email billp@pennwell.com to billybob@bob.gov, then rename it back. Both of these requests should properly authenticate.
  15. echo "-----Doing Test 0-----"
  16. result=`curl -v "$host/services/hallmark/user/save?email=billp@pennwell.com&newEmail=billybob@bob.gov" 2>/dev/null`
  17. echo "$result" | perl -e 'while(<>){if($_ =~ /.*success.*/){print "test 0a passes\n";}else{print "test 1 fails\n"}}'
  18. result=`curl -v "$host/services/hallmark/user/save?newEmail=billp@pennwell.com&email=billybob@bob.gov" 2>/dev/null`
  19. echo "$result" | perl -e 'while(<>){if($_ =~ /.*success.*/){print "test 0b passes\n";}else{print "test 2 fails\n"}}'
  20. echo "----------"
  21. fi
  22.  
  23. #The following tests focus on playing around with different values of the client-ip header. These are to test various combinations
  24. # of values the "client-ip" header might have.
  25.  
  26. #Rename email billp@pennwell.com to billybob@bob.gov, then rename it back. Both of these requests should properly authenticate.
  27. result=`curl -v -H "client-ip:227.0.0.1 $myIp 32" "$host/services/hallmark/user/save?email=billp@pennwell.com&newEmail=billybob@bob.gov" 2>/dev/null`
  28. echo "$result" | perl -e 'while(<>){if($_ =~ /.*success.*/){print "test 1 passes\n";}else{print "test 1 fails\n"}}'
  29. result=`curl -v -H "client-ip:227.0.0.1 32 $myIp" "$host/services/hallmark/user/save?newEmail=billp@pennwell.com&email=billybob@bob.gov" 2>/dev/null`
  30. echo "$result" | perl -e 'while(<>){if($_ =~ /.*success.*/){print "test 2 passes\n";}else{print "test 2 fails\n"}}'
  31.  
  32. #Rename email billp@pennwell.com to billybob@bob.gov, then rename it back. Both of these requests should properly authenticate.
  33. result=`curl -v -H "client-ip:$myIp" "$host/services/hallmark/user/save?email=billp@pennwell.com&newEmail=billybob@bob.gov" 2>/dev/null`
  34. echo "$result" | perl -e 'while(<>){if($_ =~ /.*success.*/){print "test 3 passes\n";}else{print "test 3 fails\n"}}'
  35. result=`curl -v -H "client-ip:$myIp" "$host/services/hallmark/user/save?newEmail=billp@pennwell.com&email=billybob@bob.gov" 2>/dev/null`
  36. echo "$result" | perl -e 'while(<>){if($_ =~ /.*success.*/){print "test 4 passes\n";}else{print "test 4 fails\n"}}'
  37.  
  38. #Attempt to rename email billp@pennwell.com to billybob@bob.gov, then rename it back. Both of these requests should fail to authenticate.
  39. result=`curl -v -H "client-ip:227.0.0.1" "$host/services/hallmark/user/save?email=billp@pennwell.com&newEmail=billybob@bob.gov" 2>/dev/null`
  40. echo "$result" | perl -e 'while(<>){if($_ =~ /.*denied.*/){print "test 5 passes\n";}else{print "test 5 fails\n"}}'
  41. result=`curl -v -H "client-ip:227.0.0.1 23.23.23.23 2" "$host/services/hallmark/user/save?newEmail=billp@pennwell.com&email=billybob@bob.gov" 2>/dev/null`
  42. echo "$result" | perl -e 'while(<>){if($_ =~ /.*denied.*/){print "test 6 passes\n";}else{print "test 6 fails\n"}}'
  43.  
  44. #Attempt to rename email billp@pennwell.com to billybob@bob.gov, then rename it back. Both of these requests should fail to authenticate.
  45. result=`curl -v "$host/services/hallmark/user/save?email=billp@pennwell.com&newEmail=billybob@bob.gov" 2>/dev/null`
  46. echo "$result" | perl -e 'while(<>){if($_ =~ /.*denied.*/){print "test 7 passes\n";}else{print "test 7 fails\n"}}'
  47. result=`curl -v -H "client-ip:" "$host/services/hallmark/user/save?newEmail=billp@pennwell.com&email=billybob@bob.gov" 2>/dev/null`
  48. echo "$result" | perl -e 'while(<>){if($_ =~ /.*denied.*/){print "test 8 passes\n";}else{print "test 8 fails\n"}}'
  49.  
  50. #Attempt to rename email billp@pennwell.com to billybob@bob.gov. Request should fail to authenticate.
  51. result=`curl -v -H "client-ip: " "$host/services/hallmark/user/save?email=billp@pennwell.com&newEmail=billybob@bob.gov" 2>/dev/null`
  52. echo "$result" | perl -e 'while(<>){if($_ =~ /.*denied.*/){print "test 9 passes\n";}else{print "test 9 fails\n"}}'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement