Skip to content

Instantly share code, notes, and snippets.

@jyotty
Created July 29, 2014 22:38
Show Gist options
  • Save jyotty/e46a621d43b1ae538df0 to your computer and use it in GitHub Desktop.
Save jyotty/e46a621d43b1ae538df0 to your computer and use it in GitHub Desktop.
If for some sad reason you're stuck using perl+LWP 5.8 on RHEL 6, here's how to make HTTPS actually secure
# as far as I can tell the SSL_CERT_* environment variables are not
# respected, and the SSL_ca_path argument doesn't work at all. Yay.
sub lwp_58_extra_sock_opts {
# turn on peer verification without subclassing LWP::Protocol::https
use IO::Socket::SSL;
return (
SSL_verify_mode => IO::Socket::SSL::SSL_VERIFY_PEER,
SSL_ca_file => '/etc/pki/tls/certs/ca-bundle.crt',
SSL_version => 'TLSv1',
)
}
local *LWP::Protocol::https::_extra_sock_opts = \&lwp_58_extra_sock_opts
if $LWP::UserAgent::VERSION < 6;
my $ua = LWP::UserAgent->new; # &c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment