Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^5: Dynamic SNI certificates while upgrading to SSL

by FloydATC (Deacon)
on May 12, 2017 at 06:22 UTC ( [id://1190116]=note: print w/replies, xml ) Need Help??


in reply to Re^4: Dynamic SNI certificates while upgrading to SSL
in thread Dynamic SNI certificates while upgrading to SSL

I hope you don't mind me necroing this old topic but I solved the exact same problem successfully by forking the process this way:

my $pid = open(my $pipe, "-|");

In the child process I then upgrade the client socket to SSL, contact the server and relay data between the two. Whatever info I need to send back to the parent process I can just print to STDOUT. The parent process has a very tight main loop switching between accept()'ing new connections and using IO::Select to determine which $pipe sockets are ready for non-blocking reads.

In another project of mine (not SSL related) I went a little further and established a plain two-way socket between the two processes and used non-blocking/select based sysread/syswrite on those as well. Non-blocking sockets between forked processes are actually a lot of fun :-)

Admittedly, the forking model does have its limitations when it comes to scaling, but it's relatively simple to get up and running and I found it quite sufficient for doing simple traffic inspection.

-- FloydATC

I got 99 problems, most of them have to do with printers.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1190116]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (8)
As of 2024-04-19 08:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found