Forum Discussion
Dbow_21284
Nimbostratus
Apr 02, 2010Mulitple CuRL Statements - How and do you think this will help?
Hello All,
I have used cURL statements in the external monitors successfully in the past, but I have a scenario with a SharePoint website that requires HTTP basic authentication where the std curl statement is not working for some reason. I think I need an additional request/statement to maybe make this work right ...
SCENARIO: Sharepoint 2007 - Accessing ASPX page that runs test and returns a string = 1-UP
When I access the home page on the site in question, there is an embedded credentials box in the web page (not NTLM). I have tried to have my curl statement go directly to a page after the login page with the credentials in the CURL statement like this below:
curl -L -v --user 'something:pswd' http://${IP}:${PORT}/_layouts/ACCApplications/CommonLogin/login.aspx?ReturnUrl=%2fwhatsup.aspx -H "Host:domain.somewhere.org" | grep -i "1-UP" 2>&1 > /dev/null
I get a 200 OK when I do this, but its not actually going past the initial page that prompts for the login. I am thinking maybe I need to embed another CURL statement to achieve this. Thus, my theory is that I just need to get to the home page first, then add additional CURL statement to direct URL for my whatsup.aspx monitor file that will then authenticate with the credentials.
So the full code I might need is:
curl -L -v http://${IP}:${PORT}/ -H "Host:domain.somewhere.org" | grep -i "Welcome" 2>&1 > /dev/null
mark node UP if expected response was received
if [ $? -eq 0 ]
then nest IF somehow for another curl statement - dont know syntax
Put another curl statement here with credentials -- curl -L -v --user 'uname:pswd' http://${IP}:${PORT}/whatsup.aspx -H "Host:domain.somewhere.org" | grep -i "1-UP" 2>&1 > /dev/null
then
echo "UP"
fi
rm -f $PIDFILE
exit
Again, I dont know the syntax or if this will even work? Suggestions are welcome ... I might be going down the wrong path on this. I cant seem to do just an HTTP monitor from GUI because of this issue where it seems I have to make the initial request to get to the site then make another one to get to next page using credentials.
Thanks everyone.
MRDBOW
- Dbow_21284
Nimbostratus
OK, I have figured out how to nest the if statement. It was easy, guess I just need to try. However, I still don't know if its the most efficient way.
curl -L -v http://${IP}:${PORT}/_layouts/ACCApplications/CommonLogin/login.aspx?ReturnUrl=%2fwhatsup.aspx -H "Host:members.acc.org" | grep -i "Welcome" 2>&1 > /dev/null mark node UP if expected response was received if [ $? -eq 0 ] then curl -L -v --user 'username:somepswd' http://${IP}:${PORT}/whatsup.aspx -H "Host:members.acc.org" | grep -i "1-UP" 2>&1 > /dev/null if [ $? -eq 0 ] then echo "UP" fi fi rm -f $PIDFILE exit
[admin@dmzlb1:Active] monitors sh -x /usr/bin/monitors/AUTH_Members2 10.10.185.39 80 ++ echo 10.10.185.39 ++ sed s/::ffff:// + IP=10.10.185.39 + PORT=80 ++ basename /usr/bin/monitors/AUTH_Members2 + PIDFILE=/var/run/AUTH_Members2.10.10.185.39_80.pid + '[' -f /var/run/AUTH_Members2.10.10.185.39_80.pid ']' + echo 9974 + curl -L -v 'http://10.10.185.39:80/_layouts/ACCApplications/CommonLogin/login.aspx?ReturnUrl=%2fwhatsup.aspx' -H Host:members.acc.org * About to connect() to 10.10.185.39 port 80 * Trying 10.10.185.39... + grep -i Welcome connected * Connected to 10.10.185.39 (10.10.185.39) port 80 > GET /_layouts/ACCApplications/CommonLogin/login.aspx?ReturnUrl=%2fwhatsup.aspx HTTP/1.1 > User-Agent: curl/7.15.3 (i686-redhat-linux-gnu) libcurl/7.15.3 OpenSSL/0.9.7l zlib/1.1.4 > Accept: */* > Host:members.acc.org > < HTTP/1.1 200 OK < Date: Tue, 06 Apr 2010 16:03:03 GMT < Server: Microsoft-IIS/6.0 < MicrosoftSharePointTeamServices: 12.0.0.6510 < X-Powered-By: ASP.NET < XBOX: W5 < X-AspNet-Version: 2.0.50727 < Cache-Control: private < Content-Type: text/html; charset=utf-8 < Content-Length: 21385 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 21385 100 21385 0 0 1039k 0 --:--:-- --:--:-- --:--:-- 4581k* Connection 0 to host 10.10.185.39 left intact * Closing connection 0 + '[' 0 -eq 0 ']' + curl -L -v --user username:somepswd http://10.10.185.39:80/whatsup.aspx -H Host:members.acc.org * About to connect() to 10.10.185.39 port 80 * Trying 10.10.185.39... + grep -i 1-UP connected * Connected to 10.10.185.39 (10.10.185.39) port 80 * Server auth using Basic with user 'testes' > GET /whatsup.aspx HTTP/1.1 > Authorization: Basic ZGRlbmJvdzpiYWJ5cmVuMQ== > User-Agent: curl/7.15.3 (i686-redhat-linux-gnu) libcurl/7.15.3 OpenSSL/0.9.7l zlib/1.1.4 > Accept: */* > Host:members.acc.org > < HTTP/1.1 403 Forbidden < Date: Tue, 06 Apr 2010 16:03:03 GMT < Server: Microsoft-IIS/6.0 < MicrosoftSharePointTeamServices: 12.0.0.6510 < X-Powered-By: ASP.NET < XBOX: W5 < X-AspNet-Version: 2.0.50727 < Cache-Control: private < Content-Type: text/html; charset=utf-8 < Content-Length: 13 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 13 0 13 0 0 547 0 --:--:-- --:--:-- --:--:-- 0Connection 0 to host 10.10.185.39 left intact * Closing connection 0 + '[' 1 -eq 0 ']' + rm -f /var/run/AUTH_Members2.10.10.185.39_80.pid + exit
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects