Forum Discussion
Stefan_Klotz
Jun 16, 2014Cumulonimbus
Hi again,
please find below an extract from my external monitor script (sorry if the syntax is not optimal, I'm not a bash expert):
Make a request to the Logon Page to get the ASP-SessionID and Csrf-Token Cookie set
curl -kfNsg -c /config/monitors/sf-test_cookies.txt -X POST https://[${ip}]/Citrix/storeWeb/Home/Configuration -H "Host: 10.76.208.21" -H "X-Citrix-IsUsingHTTPS: Yes" -H "X-Requested-With: XMLHttpRequest" -H "Cookie: CtxsDeviceId=WR_GLofrvuW4jFhqo7B4" -H "Content-Length: 0" 2>&1 > /dev/null
Extract the two IDs from the Cookie file
asp_sessionid_line=$(sed -n '5{p;q;}' /config/monitors/sf-test_cookies.txt)
csrf_token_line=$(sed -n '6{p;q;}' /config/monitors/sf-test_cookies.txt)
asp_sessionid=$(echo "${asp_sessionid_line: -24}")
csrf_token=$(echo "${csrf_token_line: -32}")
Make the Logon request with the correct IDs
curl -kfNsg -X POST https://[${ip}]/Citrix/storeWeb/ExplicitAuth/LoginAttempt -H "Host: 10.76.208.21" -H "X-Citrix-IsUsingHTTPS: Yes" -H "X-Requested-With: XMLHttpRequest" -H "Csrf-Token: ${csrf_token}" -H "Cookie: CtxsDeviceId=WR_GLofrvuW4jFhqo7B4; CsrfToken=${csrf_token}; CtxsPluginAssistantState=Done; ASP.NET_SessionId=${asp_sessionid}" -H "Content-Length: 88" --data "username=domain\username&password=password&loginBtn=Log+On&StateContext="
But I'm getting this response:
fail
sessiontimeout
Any idea what's still missing or what I'm doing wrong?
Thank you!
Ciao Stefan 🙂