Ruby的替代TLS绑定

时间:2012-03-17 19:47:12

标签: ruby linux openssl ssl

自从我上次在我的服务器上更新OpenSSL和Ruby以来,我运行多年的Ruby TLS服务停止了工作。可能不是那些破坏它的特定更新,但我认为它们是最有可能的候选者。起初我经常会得到“无效的MAC”异常,断开客户端,然后服务器会像这样发生段错误:

/usr/lib/ruby/1.9.1/openssl/buffering.rb:318: [BUG] Segmentation fault
ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-linux]

-- Control frame information -----------------------------------------------
c:0016 p:---- s:0081 b:0081 l:000080 d:000080 CFUNC  :syswrite
c:0015 p:0181 s:0077 b:0077 l:000076 d:000076 METHOD /usr/lib/ruby/1.9.1/openssl/buffering.rb:318
c:0014 p:0030 s:0068 b:0068 l:000067 d:000067 METHOD /usr/lib/ruby/1.9.1/openssl/buffering.rb:415
c:0013 p:0046 s:0063 b:0063 l:000062 d:000062 METHOD /usr/lib/ruby/1.9.1/nil/communication.rb:87
c:0012 p:0011 s:0057 b:0057 l:000051 d:000056 BLOCK  /home/void/code/warehouse/notification/NotificationClient.rb:29
c:0011 p:0019 s:0055 b:0055 l:000054 d:000054 METHOD <internal:prelude>:10
c:0010 p:0013 s:0052 b:0052 l:000051 d:000051 METHOD /home/void/code/warehouse/notification/NotificationClient.rb:29
c:0009 p:0088 s:0048 b:0048 l:000047 d:000047 METHOD /home/void/code/warehouse/notification/NotificationServer.rb:200
c:0008 p:---- s:0039 b:0039 l:000038 d:000038 FINISH
c:0007 p:---- s:0037 b:0037 l:000036 d:000036 CFUNC  :call
c:0006 p:0218 s:0032 b:0032 l:000031 d:000031 METHOD /home/void/code/warehouse/notification    /NotificationServer.rb:185
c:0005 p:0146 s:0023 b:0023 l:000022 d:000022 METHOD /home/void/code/warehouse/notification    /NotificationServer.rb:162
c:0004 p:0171 s:0014 b:0014 l:000013 d:000013 METHOD /home/void/code/warehouse/notification    /NotificationServer.rb:139
c:0003 p:0012 s:0006 b:0006 l:000118 d:000005 BLOCK  /home/void/code/warehouse/notification    /NotificationServer.rb:102
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:---- s:0002 b:0002 l:000001 d:000001 TOP

-- Ruby level backtrace information ----------------------------------------
/home/void/code/warehouse/notification/NotificationServer.rb:102:in `block in runServer'
/home/void/code/warehouse/notification/NotificationServer.rb:139:in `handleClient'
/home/void/code/warehouse/notification/NotificationServer.rb:162:in     `processClientCommunication'
/home/void/code/warehouse/notification/NotificationServer.rb:185:in `processClientInput'
/home/void/code/warehouse/notification/NotificationServer.rb:185:in `call'
/home/void/code/warehouse/notification/NotificationServer.rb:200:in `rpcHandler'
/home/void/code/warehouse/notification/NotificationClient.rb:29:in `sendData'
<internal:prelude>:10:in `synchronize'
/home/void/code/warehouse/notification/NotificationClient.rb:29:in `block in sendData'
/usr/lib/ruby/1.9.1/nil/communication.rb:87:in `sendData'
/usr/lib/ruby/1.9.1/openssl/buffering.rb:415:in `print'
/usr/lib/ruby/1.9.1/openssl/buffering.rb:318:in `do_write'
/usr/lib/ruby/1.9.1/openssl/buffering.rb:318:in `syswrite'

-- C level backtrace information -------------------------------------------
/usr/lib/libruby.so.1.9(+0x158ee9) [0x7f3aa715fee9]
/usr/lib/libruby.so.1.9(+0x59f99) [0x7f3aa7060f99]
/usr/lib/libruby.so.1.9(rb_bug+0xb7) [0x7f3aa70619c7]
/usr/lib/libruby.so.1.9(+0xf945f) [0x7f3aa710045f]
/lib/libc.so.6(+0x349f0) [0x7f3aa6c9a9f0]
/usr/lib/libcrypto.so.1.0.0(RC4+0x431) [0x7f3aa4db6c31]

我认为我不太可能弄清楚那里出了什么问题,所以我只需要等待随机解决这个问题的新软件包版本,或者我可以继续进行另一个实现。

顺便说一句,我在Linux服务器上的C#应用​​程序中也遇到了一些奇怪的TLS问题,即使它在具有相同版本的Mono等版本的相同发行版(Arch Linux)的其他服务器上运行良好。

[编辑:我刚发现Mono有自己的TLS堆栈,所以这是无关的。]

用于Linux的最广泛使用的TLS库似乎是OpenSSL和GnuTLS(如果我错了,请纠正我)。我在Google上寻找过针对Ruby的GnuTLS绑定,但我找不到任何东西。您是否知道除了OpenSSL之外的任何Ruby的TLS绑定?

0 个答案:

没有答案