http://www.perlmonks.org?node_id=1203286

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

Hello Monks, I am pretty new to perl. Coming from the python world but want to learn this language. I am trying to get info on setting up a simple HTTPS server. All I want to do is setup a simple HTTPS server that will allow a client to connect and using the Net::SSLeay module, I would like to pull out the SNI host value in order to assign the proper certs to the connection. Ideally I am setting up a multi-host SSL server. Single IP address but with the ability to connect to multiple hostnames (on the same server, and will assign certs as needed). I have been reading a bit and someone told me to utilize Net::SSLeay but I am getting lost using IO::Socket::SSL and Net::SSLeay and how to connect things to pull the get_servername call from Net::SSLeay. Any and all help is greatly appreciated. I think I should have started in perl with easier test projects. Thanks. -R1n0ck

Replies are listed 'Best First'.
Re: IO::Socket::SSL and Net::SSLeay
by noxxi (Pilgrim) on Nov 14, 2017 at 06:15 UTC
    You don't need to extract the server name yourself. IO::Socket::SSL lets you setup SSL_cert* and SSL_key* as hash and thus can choose the appropriate certificates automagically. There is even example code in the documentation of IO::Socket::SSL for it.
Re: IO::Socket::SSL and Net::SSLeay
by 1nickt (Canon) on Nov 13, 2017 at 21:00 UTC

    Hi, welcome,

    Yep, do yourself a favor and start simple. Install a modern Perl web application framework such as Dancer2 , which can have you up and running with a server in one file or a skeleton application structure, in 15 minutes. Then check out the plugins for extras like HTTPS.

    Hope this helps!


    The way forward always starts with a minimal test.