[Solved] OWA : Test availability of a user's mailbox

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
philippe
Posts: 5
Joined: Thu Mar 15, 2012 11:16 am

[Solved] OWA : Test availability of a user's mailbox

Post by philippe »

Hi,

I would like to perform, with a script :
- a logon to an address like this : https//<my_server>/owa with an existing user
- a check for a specific string on the displayed page
- a logout.

The exchange server is IIS 7.5 and it creates cookies marked 'HttpOnly'.

I've tested scripts with webinject, put the logon fails everytime.

Does anyone knows a script which does that ?
I've searched online but I've found nothing to do that ;-(

Thanks by advance !
Last edited by philippe on Mon Aug 20, 2012 2:56 am, edited 1 time in total.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: OWA : Test availability of a user's mailbox

Post by scottwilkerson »

You may be able to do this with check_http. There is some details on getting something similar running at
http://www.mail-archive.com/nagios-user ... 27318.html
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
philippe
Posts: 5
Joined: Thu Mar 15, 2012 11:16 am

Re: OWA : Test availability of a user's mailbox

Post by philippe »

thank you for your reply ;-)
I've tried your solution, but it doesn't work : I'm always redirecting to the login page.
I've also tried : check_basicauth2.pl, check_basicauth.pl, check_http_ntlm.pl, check_owa.php, owa.py, owa.sh unsuccesfully.
I'm always redirected to the login page.

Found on the net, this code is doing what I want (it displays the inbox of the user)

Code: Select all

<script>
function LoginToOWA (server,domain,username,password) {
  var url = "https://" + server + "/owa/auth/owaauth.dll";
  var p = {destination:'https://' + server + '/owa',flags:'0',forcedownlevel:'0',trusted:'0',isutf8:'1',username:domain + '\\' + username,password:password};
  var myForm = document.createElement("form");
  myForm.method="post" ;
  myForm.action = url ;
  for (var k in p) {
    var myInput = document.createElement("input") ;
    myInput.setAttribute("name", k) ;
    myInput.setAttribute("value", p[k]);
    myForm.appendChild(myInput) ;
  }
  document.body.appendChild(myForm) ;
  myForm.submit() ;
  document.body.removeChild(myForm) ;
  }

</script>

<body onload="javascript:LoginToOWA('MY_SERVER','DOMAIN\USERNAME','PASSWORD');">
   <h3>Please wait while redirecting to OWA...</h3>
</Body>
But my server has no graphical interface and I don't know how to transform it to a webinject script or how to use it with check_http or curl (I'm a newbee !)
yancy
Posts: 523
Joined: Thu Oct 06, 2011 10:12 am

Re: OWA : Test availability of a user's mailbox

Post by yancy »

philippe,

Do you know if your IIS configuration is using NTLM authentication?


-Yancy
philippe
Posts: 5
Joined: Thu Mar 15, 2012 11:16 am

Re: OWA : Test availability of a user's mailbox

Post by philippe »

yancy,

the server doesn't use the ntlm authentication

philippe
philippe
Posts: 5
Joined: Thu Mar 15, 2012 11:16 am

Re: OWA : Test availability of a user's mailbox

Post by philippe »

yancy,

I've tested the script check_owa by Chris Funderburg but it always returns OK even if I wrote a wrong password.
Finally I've used a curl command and I've written a shell script to detect strings when the user is connected to his mailbox.
Now all is OK !

Code: Select all

curl -q -k -d "destination=https://${SERVER}/owa&flags=0&username=${USERNAME}&password=${PASSWORD}&isutf8=1" \
https://${SERVER}/owa/auth/owaauth.dll -L -b cookies.txt
Thank you for your help :D
yancy
Posts: 523
Joined: Thu Oct 06, 2011 10:12 am

Re: [Solved] OWA : Test availability of a user's mailbox

Post by yancy »

philippe,

Great news!! Feel free to post your shell script on Nagios Exchange http://exchange.nagios.org/ for others to use :)


Regards,

-Yancy
Locked