Linux – Redirect HTTPS traffic without changing the HOSTS file

bashcurlhttpslinux

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.

Best Answer

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"