1

I have a website hosted on 2 servers. The website is SSL based.

I'd like to monitor (load the main page and look for a certain string) the website per server using a local Opsview. Meaning I need to go Opsview's HOSTS file and add "domain.com 10.10.10.33" and change it each time to match the right server. I obviously cant script this as the results are very likely to be skewed during the check.

Is there some sort of a crawler for Linux that's capable of taking an IP address, domain name and work them together? I tried both curl --proxy and wget --header to no avail.

4 Answers 4

0

Many SSL http servers don't care what Host: header is supplied, so simply requesting https://$ipaddress/foo should work, as long as you can convince the client (e.g. wget) to ignore the certificate CN mismatch.

Otherwise try something like:

(echo -e 'GET /foo HTTP/1.0\r\nHost: domain.com\r\n\r'; sleep 2) | openssl s_client -connect 10.10.10.33:443 | grep "a certain string"
1
  • Out of question. I much rather monitor the website as it's suppose to be as if a client logged in. If the certificate expires tomorrow, I wouldnt be able to tell because of this.
    – JustAGuy
    Sep 10, 2014 at 16:22
0

You don't need the hostname, you can connect by using the IP alone and pass the domain using curl.

curl -k -H "Host: your-domain-name" https://ip-of-server/someURL

The -k will make cURL ignore certificate errors, the -H will put the host, and curl download the result. You can pipe it over awk, grep or any other tool you have.

3
  • "-k" beats the purpose of having a certificate in the first place. I cannot use this solution I'm afraid. Thanks for your help though.
    – JustAGuy
    Sep 10, 2014 at 16:20
  • No, it does not defeats the certificate. It's only in place to avoid curl complaining that the certificate for www.yourserver.net was used by 10.20.30.40. If you only want to monitor the servers, it's fine.
    – ThoriumBR
    Sep 10, 2014 at 16:57
  • I want to monitor the website AND the certificate.
    – JustAGuy
    Sep 10, 2014 at 22:32
0

Have you tried using curl to connect to the IP address and overwriting the host?-

curl -H 'Host: domain.com' http://10.10.10.33/
1
  • Afraid that just wont cut it. I need SSL enabled.
    – JustAGuy
    Sep 10, 2014 at 16:38
0

I eventually found the solution without cancelling out the certification warnings and such.

This requires the latest CURL which is 7.37.1

The right syntax is:

curl --resolve yourdomain.com:443:se.rv.er.ip https://yourdomain.com

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .