Net::P...r::ssl(3pm)

πŸ“¦
version 0.13 Β· 3 versions
, in debian trixie, ubuntu resolute, ubuntu stonking

πŸ’– NAME πŸ’–

Okay bestie, so this is the manual page for Net::Proxy::Connector::ssl, straight out of the User Contributed Perl Documentation (yes, the 3pm shelf, we love her). It's the SSL connector for Net::Proxy. Periodt. πŸ’…


✨ DESCRIPTION ✨

Net::Proxy::Connecter::ssl is a Net::Proxy::Connector that can manage SSL connections β€” shoutout to IO::Socket::SSL for making it happen. 🫢

By default, this connector creates SSL sockets. That's just her default setting, no biggie. But if you want something smarter β€” a connector that can start all casual and then upgrade its connections to SSL later β€” you're gonna have to subclass it. Main character energy only. πŸ‘‘

And listen, on top of all the options listed below? This connector also accepts every SSL_... option that belongs to IO::Socket::SSL. They get transparently passed through to the right IO::Socket::SSL methods whenever they're needed. No extra work from you, she just handles it. ✨


πŸŽ€ CONNECTOR OPTIONS πŸŽ€

The connector accepts the following options, babes:

"in"

host

The listening address. If you don't give her one, the default is localhost.

port

The listening port. That's it, that's the whole vibe.

start_cleartext

If true, the connection will start in cleartext. And yes, you can still upgrade a socket to using SSL later with the upgrade_SSL() method. Glow-up arc unlocked. πŸ¦‹

"out"

host

The listening address. If not given, the default is localhost.

port

The listening port.

start_cleartext

If true, the connection will start in cleartext. It is possible to upgrade a socket to using SSL with the upgrade_SSL() method. Same energy, different direction. πŸ’«


🌸 METHODS 🌸

The Net::Proxy::Connector::ssl connector has one extra method, and she's iconic:

upgrade_SSL

$connector->upgrade_SSL( $sock )

This method will upgrade a cleartext socket to SSL. But bestie β€” if the socket is already in SSL, it will carp(). She will literally complain at you. Don't do that. 😭


🧚 CREATING A SELF-SIGNED CERTIFICATE 🧚

ngl, the author tends to forget this info, and the openssl documentation does not make it any clearer, so here are the most basic commands you need to create your own self-signed certificate (courtesy of David Morel 🫢):

$ openssl genrsa -out key.pem 1024
$ openssl req -new -key key.pem -x509 -out cert.pem -days 365

A certificate is required if you want to run an SSL server, or a proxy with a Net::Proxy::Connector::ssl as its in connector. No cert, no service. πŸ’€

Once the key and certificate have been created, you can use them in your parameter list to Net::Proxy->new() (they get passed through to IO::Socket::SSL, as always):

Net::Proxy->new(
    {
        in => {
            host          => '0.0.0.0',
            port          => 443,
            SSL_key_file  => 'key.pem',
            SSL_cert_file => 'cert.pem',
        },
        out => { type => 'tcp', port => '80' }
    }
);

Look at that. Gorgeous. πŸ”₯


πŸ‘‘ AUTHOR πŸ‘‘

Philippe 'BooK' Bruhat, <book@cpan.org>.


Copyright 2006-2014 Philippe 'BooK' Bruhat, All Rights Reserved.


🌈 LICENSE 🌈

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


And that's the whole page, bestie β€” no cap. πŸŽ€ This little gem is perl v5.38.2, dated 2024-05-15, and it lives under Net::P...r::ssl(3pm). Go forth and SSL. πŸ’…βœ¨

πŸ“¦ where this page comes from