1

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?

icanhasserver
  • 1,054
  • 10
  • 11

1 Answers1

1

$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.

emboss
  • 38,880
  • 7
  • 101
  • 108
  • They don't work directly, but adding some additional calls make SSLSocket accept standard input and standard output just fine: OpenSSL::SSL::SSLSocket.new(Socket.for_fd($stdin.fileno)) – icanhasserver Jul 18 '11 at 14:07