Skip to content

Commit 7c1f5af

Browse files
committed
Use more secure OpenSSL default ciphers
This makes sure we don't use weak ciphers when connecting to services that run over SSL.
1 parent 3f2d8f3 commit 7c1f5af

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

ext/openssl/lib/openssl/ssl.rb

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,19 @@
2020
module OpenSSL
2121
module SSL
2222
class SSLContext
23+
options = OpenSSL::SSL::OP_ALL
24+
if defined?(OpenSSL::SSL::OP_DONT_INSERT_EMPTY_FRAGMENTS)
25+
options &= ~OpenSSL::SSL::OP_DONT_INSERT_EMPTY_FRAGMENTS
26+
end
27+
if defined?(OpenSSL::SSL::OP_NO_COMPRESSION)
28+
options |= OpenSSL::SSL::OP_NO_COMPRESSION
29+
end
30+
2331
DEFAULT_PARAMS = {
2432
:ssl_version => "SSLv23",
2533
:verify_mode => OpenSSL::SSL::VERIFY_PEER,
26-
:ciphers => "ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW",
27-
:options => defined?(OpenSSL::SSL::OP_DONT_INSERT_EMPTY_FRAGMENTS) ?
28-
OpenSSL::SSL::OP_ALL & ~OpenSSL::SSL::OP_DONT_INSERT_EMPTY_FRAGMENTS :
29-
OpenSSL::SSL::OP_ALL,
34+
:ciphers => "DEFAULT:!aNULL:!eNULL:!LOW:!EXPORT:!SSLv2:!ADH",
35+
:options => options,
3036
}
3137

3238
DEFAULT_CERT_STORE = OpenSSL::X509::Store.new

0 commit comments

Comments
 (0)