check_phpfpm_status icon indicating copy to clipboard operation
check_phpfpm_status copied to clipboard

Use servername in SNI request when using SSL

Open prupert opened this issue 6 years ago • 2 comments

When using the plugin locally on a specific virtual host with SSL (when using -S explicitly or when the page is behind a redirect to HTTPS) we encounter a HTTP 400 in Apache.

How to reproduce:

./check_phpfpm_status.pl -H localhost -s example.org -u /phpfpm_status -S

Results in HTTP 400 Bad Request because of the following Apache httpd error:

[ssl:error] [pid 12345] AH02032: Hostname localhost provided via SNI and hostname example.org provided via HTTP are different

It appears the -s servername is not used correctly for the SSL request?

We are using CentOS 7's stock Apache (httpd-2.4.6-80.el7.centos.1.x86_64) with TLS 1.2.

prupert avatar Sep 10 '18 10:09 prupert

Thanks for reporting this. I do not have a lot of time currently, so this issue may be quite slow to be fixed. Do not hesitate to dig around in the code and make a fork/pull request.

regilero avatar Sep 17 '18 08:09 regilero

My Perl is pretty rusty, but it should work when using the SSL_hostname option in IO::Socket::SSL. It appears you are already doing that, see https://github.com/regilero/check_phpfpm_status/blob/45c0303c4fb7a9e1347d877963e0ec391a8ed089/check_phpfpm_status.pl#L391

Don't know why we are seeing errors then, I'll dig further and let you know.

prupert avatar Sep 17 '18 14:09 prupert