Search code examples
rubyopensslinetd

Handle SSL connections from an inetd ruby script


I'd like to run a Ruby script that handles encrypted communications from inetd. As I need the certificate information for further processing, I can't "offload" the SSL to something like stunnel.

In order to do so, I'd have to somehow use STDIN and STDOUT with the Ruby SSL object. Unfortunately, the OpenSSL:SSL:SSLSocket only accepts an IO in its constructor. Is there a way to tie STDIN and STDOUT to an IO, so that it reads from standard input and writes to standard output?


Solution

  • $stdin and $stdout can be interchangeably used as IO objects. You may pass them to the SSLSocket. Does that help? Otherwise I'd need more code to help you out.