Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

enable unsafe legacy renegotiation

by danilo90 (Initiate)
on Mar 22, 2023 at 19:54 UTC ( #11151136=perlquestion: print w/replies, xml ) Need Help??

danilo90 has asked for the wisdom of the Perl Monks concerning the following question:

I am developing a little script to get web server information but with some server I got this error "SSL negotiation failed: error:0A000152:SSL routines::unsafe legacy renegotiation disabled"

Here is part of my code
my $browser = LWP::UserAgent->new( max_redirect => 1, env_proxy => 1, keep_alive => 1, timeout => 15, agent => "Mozilla/4.76 [en] (Win98; U) +", ssl_opts => { verify_hostname => 0 , SSL_verify_mode => 0});
I tried adding an SSL exception with the file sslv1.conf and environment variables:
[system_default_sect] Options = UnsafeLegacyRenegotiation

- Running the script

OPENSSL_CONF=sslv1.conf; perl

Replies are listed 'Best First'.
Re: enable unsafe legacy renegotiation
by cavac (Vicar) on Mar 23, 2023 at 07:19 UTC

    This may be a stupid question, but have you tried just switching to http in those cases? Most https servers also provide http (even if just to redirect to https).

    From your question, it seems you only want to know the "Server" header, which should be the same on the unencrypted connection.

    PerlMonks XP is useless? Not anymore: XPD - Do more with your PerlMonks XP
      Actually not a bad solution. Thanks
Re: enable unsafe legacy renegotiation
by Anonymous Monk on Mar 24, 2023 at 09:09 UTC
    Try this:
    use Net::SSLGlue::LWP; use IO::Socket::SSL; my $context = new IO::Socket::SSL::SSL_Context( SSL_version => 'tlsv1', # see +SL for other values SSL_verify_mode => Net::SSLeay::VERIFY_NONE(), ); IO::Socket::SSL::set_default_context($context); use LWP::UserAgent; ...

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://11151136]
Approved by marto
Front-paged by Corion
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (2)
As of 2023-06-04 20:52 GMT
Find Nodes?
    Voting Booth?
    How often do you go to conferences?

    Results (22 votes). Check out past polls.