You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
unsupported cipher algorithm (rc4) breaks winrm and anything using it on Windows (test-kitchen, kitchen-azurerm, kitchen-vagrant, ...) #148
Please, can you help? Since the rubyntlm project looks dead, I was wondering if you could add a backward compatible support to re-enable RC4 cipher when specified, so that it stays disabled by default but we can enable it when we actually need to use it? Otherwise we can throw away years of development on Test-Kitchen with WinRM.
Since this would be used only to connect from a local development box to another local development box running in e.g. Vagrant VM, we don't really care if we use unsecure RC4 algorithm, but we do care that our code and workflows we've developed over the years keeps working.
Unfortunately our team is in no way ready to start hacking openssl, rubyntlm or winrm gems to make it work by ourselves.
I am also my testing environment on my local virtualbox that is running Openshift platform and a defined my github account a webhook and to communicate both them configure ultrahook but there is a redirect traffic from payload url to private unsecure (https.//private_network/8443/oapi/v1/names paces/third/buildconfigs/php/webhooks/4f940a9e-6281-4f08-9386-a1ccfeb12bca/githu b) but i have get a ruby openssl issue as below
D:/Ruby24-x64/lib/ruby/2.4.0/openssl/buffering.rb:182:in sysread_nonblock': An existing connection was forcibly closed by the remote host. (Errno::ECONNRESET) from D:/Ruby24-x64/lib/ruby/2.4.0/openssl/buffering.rb:182:in read_nonb lock'
from D:/Ruby24-x64/lib/ruby/2.4.0/net/protocol.rb:172:in rbuf_fill' from D:/Ruby24-x64/lib/ruby/2.4.0/net/protocol.rb:154:in readuntil'
from D:/Ruby24-x64/lib/ruby/2.4.0/net/protocol.rb:164:in readline' from D:/Ruby24-x64/lib/ruby/2.4.0/net/http/response.rb:40:in read_statu s_line'
from D:/Ruby24-x64/lib/ruby/2.4.0/net/http/response.rb:29:in read_new' from D:/Ruby24-x64/lib/ruby/2.4.0/net/http.rb:1446:in block in transpor t_request'
from D:/Ruby24-x64/lib/ruby/2.4.0/net/http.rb:1443:in catch' from D:/Ruby24-x64/lib/ruby/2.4.0/net/http.rb:1443:in transport_request '
from D:/Ruby24-x64/lib/ruby/2.4.0/net/http.rb:1416:in request' from D:/Ruby24-x64/lib/ruby/2.4.0/net/http.rb:1409:in block in request'
from D:/Ruby24-x64/lib/ruby/2.4.0/net/http.rb:877:in start' from D:/Ruby24-x64/lib/ruby/2.4.0/net/http.rb:1407:in request'
from D:/Ruby24-x64/lib/ruby/2.4.0/net/http.rb:1430:in send_entity' from D:/Ruby24-x64/lib/ruby/2.4.0/net/http.rb:1218:in post'
from D:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/ultrahook-0.1.4/lib/ultrahoo k/client.rb:127:in http_post' from D:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/ultrahook-0.1.4/lib/ultrahoo k/client.rb:116:in process_request'
from D:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/ultrahook-0.1.4/lib/ultrahoo k/client.rb:90:in process' from D:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/ultrahook-0.1.4/lib/ultrahoo k/client.rb:160:in block (3 levels) in init_stream'
from D:/Ruby24-x64/lib/ruby/2.4.0/net/protocol.rb:429:in call_block' from D:/Ruby24-x64/lib/ruby/2.4.0/net/protocol.rb:420:in <<'
from D:/Ruby24-x64/lib/ruby/2.4.0/net/protocol.rb:126:in read' from D:/Ruby24-x64/lib/ruby/2.4.0/net/http/response.rb:321:in read_chun ked'
from D:/Ruby24-x64/lib/ruby/2.4.0/net/http/response.rb:285:in block in read_body_0' from D:/Ruby24-x64/lib/ruby/2.4.0/net/http/response.rb:278:in inflater'
from D:/Ruby24-x64/lib/ruby/2.4.0/net/http/response.rb:283:in read_body _0' from D:/Ruby24-x64/lib/ruby/2.4.0/net/http/response.rb:204:in read_body '
from D:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/ultrahook-0.1.4/lib/ultrahoo k/client.rb:155:in block (2 levels) in init_stream' from D:/Ruby24-x64/lib/ruby/2.4.0/net/http.rb:1455:in block in transpor t_request'
from D:/Ruby24-x64/lib/ruby/2.4.0/net/http/response.rb:165:in reading_b ody' from D:/Ruby24-x64/lib/ruby/2.4.0/net/http.rb:1454:in transport_request '
from D:/Ruby24-x64/lib/ruby/2.4.0/net/http.rb:1416:in request' from D:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/ultrahook-0.1.4/lib/ultrahoo k/client.rb:153:in block in init_stream'
from D:/Ruby24-x64/lib/ruby/2.4.0/net/http.rb:877:in start' from D:/Ruby24-x64/lib/ruby/2.4.0/net/http.rb:608:in start'
from D:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/ultrahook-0.1.4/lib/ultrahoo k/client.rb:148:in init_stream' from D:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/ultrahook-0.1.4/lib/ultrahoo k/client.rb:65:in start'
from D:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/ultrahook-0.1.4/bin/ultrahoo k:6:in <top (required)>' from D:/Ruby24-x64/bin/ultrahook:22:in load'
from D:/Ruby24-x64/bin/ultrahook:22:in `
#50 is about the default configuration used by OpenSSL::SSL::SSLContext#set_params and has nothing to do with OpenSSL::Cipher.
To my best knowledge, the error "unsupported cipher algorithm" indicates the OpenSSL library linked in has no RC4 support. What does running openssl enc -ciphers on terminal show?
@emre141 Please open a new issue for separate problems.
It seems that running openssl on a terminal has no effect on what is used by rubyntlm (via Ruby), since it is using a different version of openssl.so which has the RC4 cipher disabled in it.
Thanks for your answer.What is your suggestion there is any workaround to using rubyntlm? to using RC4 There is anything to doing on openshift server side or rubyntlm side ?
OpenSSL::Cipher.ciphers can also be used to get the list of supported algorithm names. Actually, Ruby/OpenSSL (openssl.so) doesn't have a hard-coded list, but just queries the OpenSSL library (libcrypto.so) at runtime.
Currently we have no workaround, because we've moved to Puppet 5/Ruby 2.4. We have only little knowledge of NTLM to try to re-implement rubyntlm with another cipher - we've just tried to change the hard-coded RC4 to something else and it didn't work.
If a cipher is removed from openssl, it would be great to give backwards compatible support by some kind of configuration override.
rhenium so could you clarify how can i use any workaround or it is not any workaround? I have not enough knowledge about ruby/openssl could you show me step by step that i would be applied if it is a solution?
@rhenium - Thank you for the update. I have found openssl.so in Ruby folder, but can't find libcrypto.so.
Any clue on how to "inject" RC4 support back to it?
We've found out that there is a list of ciphers in C:\Puppet\sys\ruby\lib\ruby\2.4.0\openssl\ssl.rb, which updates OpenSSL::SSL.SSLContextDEFAULT_PARAMS, so we can hack the list returned by OpenSSL::Cipher.ciphers to anything we want.
We've even tried to add this piece of code to it:
module OpenSSL
class Cipher
def self.ciphers()
%w{
AES-128-CBC
RC4
}
end
end
end
So that OpenSSL::Cipher.ciphers returns just these two.
However that has no effect during runtime. When we run OpenSSL::Cipher.new("RC4") with this change in place, it throws the same error -
After i have changed it below mentioned do i recompile ruby or if it is require any recompile? if it is ok how can i recomple it? And also if it not just when i restart my shell is enough?
It looks like the OpenSSL library used by Ruby/OpenSSL has no RC4 support -- it is likely disabled at compile-time. I guess you have to recompile OpenSSL with RC4 support (i.e., remove no-rc4 option from the arguments passed to OpenSSL's Configure script).
We've found out that there is a list of ciphers in C:\Puppet\sys\ruby\lib\ruby\2.4.0\openssl\ssl.rb
As I said in my first comment, it is only effective for OpenSSL::SSL::SSLContext#set_params which Ruby/NTLM does not use.
@emre141 I can't help you without more information. The Errno::ECONNRESET error usually indicates that the HTTP server forcibly closed the TCP connection without sending a close_notify alert. Anyway, it's an irrelevant topic. Please open a new issue at https://github.com/ruby/openssl/issues/new, preferably with a script so I can reproduce myself.
@mirogta A little more context. At the time one of our (Puppets) security engineers removed RC4 from our custom OpenSSL build in Puppet 5, it was during a security audit for insecure cipher support. Since RC4 is considered weak and is not recommended any longer, it was removed.
It wasn't realized that RC4 was in use for NTLM connectivity over WinRM / HTTP as there isn't anything natively in Puppet or its tools that builds NTLM messages directly. We recently discovered this ourselves given our new task running tool, Bolt, consumes the same rubyntlm library that Test Kitchen uses, and does build NTLM messages directly using the RC4 cipher. RC4 is baked into the NTLM protocol, and as such, cannot be reconfigured to use something more secure, which is why Microsoft recommends against using it as well. That said, it's still in wide use.
As @glennsarti mentioned, we're re-adding to our custom OpenSSL / Ruby stack and should have it addressed in upcoming Z releases of Puppet.
Activity
emre141 commentedon Sep 15, 2017
Hi
I am also my testing environment on my local virtualbox that is running Openshift platform and a defined my github account a webhook and to communicate both them configure ultrahook but there is a redirect traffic from payload url to private unsecure (https.//private_network/8443/oapi/v1/names paces/third/buildconfigs/php/webhooks/4f940a9e-6281-4f08-9386-a1ccfeb12bca/githu b) but i have get a ruby openssl issue as below
D:/Ruby24-x64/lib/ruby/2.4.0/openssl/buffering.rb:182:in
'sysread_nonblock': An existing connection was forcibly closed by the remote host. (Errno::ECONNRESET) from D:/Ruby24-x64/lib/ruby/2.4.0/openssl/buffering.rb:182:inread_nonb lock'from D:/Ruby24-x64/lib/ruby/2.4.0/net/protocol.rb:172:in
rbuf_fill' from D:/Ruby24-x64/lib/ruby/2.4.0/net/protocol.rb:154:inreaduntil'from D:/Ruby24-x64/lib/ruby/2.4.0/net/protocol.rb:164:in
readline' from D:/Ruby24-x64/lib/ruby/2.4.0/net/http/response.rb:40:inread_statu s_line'from D:/Ruby24-x64/lib/ruby/2.4.0/net/http/response.rb:29:in
read_new' from D:/Ruby24-x64/lib/ruby/2.4.0/net/http.rb:1446:inblock in transpor t_request'from D:/Ruby24-x64/lib/ruby/2.4.0/net/http.rb:1443:in
catch' from D:/Ruby24-x64/lib/ruby/2.4.0/net/http.rb:1443:intransport_request 'from D:/Ruby24-x64/lib/ruby/2.4.0/net/http.rb:1416:in
request' from D:/Ruby24-x64/lib/ruby/2.4.0/net/http.rb:1409:inblock in request'from D:/Ruby24-x64/lib/ruby/2.4.0/net/http.rb:877:in
start' from D:/Ruby24-x64/lib/ruby/2.4.0/net/http.rb:1407:inrequest'from D:/Ruby24-x64/lib/ruby/2.4.0/net/http.rb:1430:in
send_entity' from D:/Ruby24-x64/lib/ruby/2.4.0/net/http.rb:1218:inpost'from D:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/ultrahook-0.1.4/lib/ultrahoo k/client.rb:127:in
http_post' from D:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/ultrahook-0.1.4/lib/ultrahoo k/client.rb:116:inprocess_request'from D:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/ultrahook-0.1.4/lib/ultrahoo k/client.rb:90:in
process' from D:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/ultrahook-0.1.4/lib/ultrahoo k/client.rb:160:inblock (3 levels) in init_stream'from D:/Ruby24-x64/lib/ruby/2.4.0/net/protocol.rb:429:in
call_block' from D:/Ruby24-x64/lib/ruby/2.4.0/net/protocol.rb:420:in<<'from D:/Ruby24-x64/lib/ruby/2.4.0/net/protocol.rb:126:in
read' from D:/Ruby24-x64/lib/ruby/2.4.0/net/http/response.rb:321:inread_chun ked'from D:/Ruby24-x64/lib/ruby/2.4.0/net/http/response.rb:285:in
block in read_body_0' from D:/Ruby24-x64/lib/ruby/2.4.0/net/http/response.rb:278:ininflater'from D:/Ruby24-x64/lib/ruby/2.4.0/net/http/response.rb:283:in
read_body _0' from D:/Ruby24-x64/lib/ruby/2.4.0/net/http/response.rb:204:inread_body 'from D:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/ultrahook-0.1.4/lib/ultrahoo k/client.rb:155:in
block (2 levels) in init_stream' from D:/Ruby24-x64/lib/ruby/2.4.0/net/http.rb:1455:inblock in transpor t_request'from D:/Ruby24-x64/lib/ruby/2.4.0/net/http/response.rb:165:in
reading_b ody' from D:/Ruby24-x64/lib/ruby/2.4.0/net/http.rb:1454:intransport_request 'from D:/Ruby24-x64/lib/ruby/2.4.0/net/http.rb:1416:in
request' from D:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/ultrahook-0.1.4/lib/ultrahoo k/client.rb:153:inblock in init_stream'from D:/Ruby24-x64/lib/ruby/2.4.0/net/http.rb:877:in
start' from D:/Ruby24-x64/lib/ruby/2.4.0/net/http.rb:608:instart'from D:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/ultrahook-0.1.4/lib/ultrahoo k/client.rb:148:in
init_stream' from D:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/ultrahook-0.1.4/lib/ultrahoo k/client.rb:65:instart'from D:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/ultrahook-0.1.4/bin/ultrahoo k:6:in
<top (required)>' from D:/Ruby24-x64/bin/ultrahook:22:inload'from D:/Ruby24-x64/bin/ultrahook:22:in `
There is any workaroud solution on ruby ?
Thank you
rhenium commentedon Sep 15, 2017
#50 is about the default configuration used by OpenSSL::SSL::SSLContext#set_params and has nothing to do with OpenSSL::Cipher.
To my best knowledge, the error "unsupported cipher algorithm" indicates the OpenSSL library linked in has no RC4 support. What does running
openssl enc -cipherson terminal show?@emre141 Please open a new issue for separate problems.
mirogta commentedon Sep 16, 2017
>openssl enc -ciphersmirogta commentedon Sep 16, 2017
It seems that running openssl on a terminal has no effect on what is used by rubyntlm (via Ruby), since it is using a different version of openssl.so which has the RC4 cipher disabled in it.
emre141 commentedon Sep 16, 2017
Hi mirogta
Thanks for your answer.What is your suggestion there is any workaround to using rubyntlm? to using RC4 There is anything to doing on openshift server side or rubyntlm side ?
Thanks
rhenium commentedon Sep 16, 2017
OpenSSL::Cipher.cipherscan also be used to get the list of supported algorithm names. Actually, Ruby/OpenSSL (openssl.so) doesn't have a hard-coded list, but just queries the OpenSSL library (libcrypto.so) at runtime.mirogta commentedon Sep 16, 2017
Currently we have no workaround, because we've moved to Puppet 5/Ruby 2.4. We have only little knowledge of NTLM to try to re-implement rubyntlm with another cipher - we've just tried to change the hard-coded RC4 to something else and it didn't work.
If a cipher is removed from openssl, it would be great to give backwards compatible support by some kind of configuration override.
Puppet 1.10 / Ruby 2.3.3
OpenSSL::Cipher.ciphersPuppet 5.1 / Ruby 2.4.1
OpenSSL::Cipher.ciphersemre141 commentedon Sep 16, 2017
rhenium so could you clarify how can i use any workaround or it is not any workaround? I have not enough knowledge about ruby/openssl could you show me step by step that i would be applied if it is a solution?
Thanks
mirogta commentedon Sep 16, 2017
@rhenium - Thank you for the update. I have found openssl.so in Ruby folder, but can't find libcrypto.so.
Any clue on how to "inject" RC4 support back to it?
We've found out that there is a list of ciphers in
C:\Puppet\sys\ruby\lib\ruby\2.4.0\openssl\ssl.rb, which updatesOpenSSL::SSL.SSLContextDEFAULT_PARAMS, so we can hack the list returned byOpenSSL::Cipher.ciphersto anything we want.We've even tried to add this piece of code to it:
So that
OpenSSL::Cipher.ciphersreturns just these two.However that has no effect during runtime. When we run
OpenSSL::Cipher.new("RC4")with this change in place, it throws the same error -emre141 commentedon Sep 16, 2017
Hi
After i have changed it below mentioned do i recompile ruby or if it is require any recompile? if it is ok how can i recomple it? And also if it not just when i restart my shell is enough?
emre141 commentedon Sep 16, 2017
Yes i changed it and i have got the same error.
rhenium commentedon Sep 16, 2017
It looks like the OpenSSL library used by Ruby/OpenSSL has no RC4 support -- it is likely disabled at compile-time. I guess you have to recompile OpenSSL with RC4 support (i.e., remove
no-rc4option from the arguments passed to OpenSSL's Configure script).As I said in my first comment, it is only effective for OpenSSL::SSL::SSLContext#set_params which Ruby/NTLM does not use.
rhenium commentedon Sep 16, 2017
@emre141 I can't help you without more information. The Errno::ECONNRESET error usually indicates that the HTTP server forcibly closed the TCP connection without sending a close_notify alert. Anyway, it's an irrelevant topic. Please open a new issue at https://github.com/ruby/openssl/issues/new, preferably with a script so I can reproduce myself.
glennsarti commentedon Nov 13, 2017
@mirogta @rhenium
The compiled OpenSSL library that puppet-agent uses, does not contain the RC4 ciphers as of Puppet 5
puppetlabs/puppet-agent@0da0492
(PA-1059) Adjusting openssl configuration flags to disable weak ciphers
mirogta commentedon Nov 13, 2017
@glennsarti - thank you, this is very useful. I've ask Puppet to look into that on that changeset.
glennsarti commentedon Nov 14, 2017
@mirogta FYI - https://tickets.puppetlabs.com/browse/PA-1712 . That's to re-enable RC4
Iristyle commentedon Nov 14, 2017
@mirogta A little more context. At the time one of our (Puppets) security engineers removed RC4 from our custom OpenSSL build in Puppet 5, it was during a security audit for insecure cipher support. Since RC4 is considered weak and is not recommended any longer, it was removed.
It wasn't realized that RC4 was in use for NTLM connectivity over WinRM / HTTP as there isn't anything natively in Puppet or its tools that builds NTLM messages directly. We recently discovered this ourselves given our new task running tool, Bolt, consumes the same
rubyntlmlibrary that Test Kitchen uses, and does build NTLM messages directly using the RC4 cipher. RC4 is baked into the NTLM protocol, and as such, cannot be reconfigured to use something more secure, which is why Microsoft recommends against using it as well. That said, it's still in wide use.As @glennsarti mentioned, we're re-adding to our custom OpenSSL / Ruby stack and should have it addressed in upcoming Z releases of Puppet.
Sorry we didn't catch this sooner!
mirogta commentedon Nov 15, 2017
@Iristyle Thank you for the update
mirogta commentedon Nov 15, 2017
Since this will be fixed in one of the upcoming Puppet releases and it's in a custom OpenSSL build only, this issue can be closed.
mirogta commentedon Feb 19, 2018
Looks like the issue has been fixed in puppet-agent 5.3.4 (released on 2018/02/05)