Commit Graph

27 Commits

Author SHA1 Message Date
Karol Bucek dbf450bdd2
[jruby] allow truststore without password (#2904) 2022-08-27 15:18:24 -05:00
Karol Bucek e9f09ba1fe
[jruby] support setting TLS protocols + rename ssl_cipher_list (#2899)
* [jruby] support setting TLS protocols + rename ssl_cipher_list

follow Java naming as we already do with keystore/truststore ...

Context now does the string split and accepts an Array

* [test] cipher_suites and protocols behavior

* [jruby] support new TLS settings in DSL
2022-07-04 09:16:31 -05:00
Karol Bucek dfe46adc3e
[fix] TLS verification hang on JRuby (#2890)
* [fix] jruby hang with TLS due not executing task

basically the use of Java SSL API was incorrect and reproduced when verification is enabled - the engine needs to execute a task but the handling code was not reached

* Revert "[fix] jruby hang with TLS due not executing task"

This reverts commit d1731a5607.

* [chore] re-generate certs with a subjectAltName ext

* [test] more ssl test with server verify peer

* [test] a proper reproducer for the TLS hang in JRuby

* [test] cleanup and better naming

* Revert "[chore] re-generate certs with a subjectAltName ext"

This reverts commit a1b01a187e.

* Revert "Revert "[fix] jruby hang with TLS due not executing task""

This reverts commit 3c5727f9e3.

* [test] restore ssl run - hangs with peer on MRI
2022-05-31 19:30:17 -05:00
Karol Bucek acfc0859c4
[jruby] enable TLSv1.3 support (#2886)
* [jruby] enable TLSv1.3 support

* JRuby - TestPumaServerSSLClient - add IOError for macOS
2022-05-30 18:36:37 -05:00
Karol Bucek aa2132695b
[jruby] improve the truststore option (#2884)
* [jruby] refactor - only keep peer cert around

* [jruby] make miss an error not to be caught!

* [test] follow-up proper testing of GH-2849

* [jruby] support truststore = :default

* [jruby] sync dsl/context-builder with new props
2022-05-30 10:23:39 -05:00
Karol Bucek ceb4c56ad4
[jruby] support a truststore option (#2849)
* [jruby] support a truststore option

which might be a completely different file than keystore ...

due backwards compatibility we assume `truststore = keystore`
(`truststore_pass = keystore_pass`)

* [jruby] actually use truststore on initialize

* [jruby] add keystore_type and truststore_type

* [jruby] dry and simplify native bits

* [jruby] setup SSLError in native (like C part)

* [jruby] map to SSLError from native exception

* [jruby] provide peercert even if hand-shake fails
2022-04-09 08:58:51 -06:00
Karol Bucek 66962e4c18
[jruby] a couple refactorings - avoid copy-ing bytes (#2730)
* [jruby][refactor] avoid byte[] copy-ing

* [jruby][refactor] proper ASCII string creation

* [jruby][refactor] drop unused KeyStore instances

* [jruby][refactor] review exception handling (catch less)

* [jruby][refactor] no need to copy local byte[] array
2021-11-01 15:23:37 -06:00
Nate Berkopec f5378563d8
Merge branch 'jwp/fileleak1' of https://github.com/looker/puma into looker-jwp/fileleak1 2020-09-08 13:57:30 -06:00
MSP-Greg fa6e916fc0
JRuby - Add Puma::MiniSSL::Engine#init? and #teardown methods, run all SSL tests (#2317)
Update MiniSSL.java and minissl.rb for JRuby

Add Puma::MiniSSL::Engine#init? and #teardown methods
2020-09-01 17:00:36 -05:00
John W. Phillips f639b96597 Move initialization of KeyManagerFactory, TrustManagerFactory to server
initialization.  This avoids reading the keystore file twice on every
ssl request, and also fixes a filehandle leak from reading the keystore
file without closing it properly.
2020-07-01 16:32:58 +00:00
Mike Aleksiuk 32ac93ab65 Unskip two jruby ssl tests that were hanging.
1. Fix the conversion of a nil verify_mode to integer (was throwing 'no
implicit conversion of nil into Integer')
2. Use the correct keystore password.
3. Use cipher suites that are supported in Java 8.
2020-06-06 15:27:38 -07:00
MSP-Greg 35dbec0eaa add no_tlsv1_1 to binder, config, etc 2019-08-03 14:56:30 -05:00
Thomas E. Enebo 9b029362cd Fixes #1772. Explicit cast to Buffer to make Java 8 still find proper signature (when compiled with 9+ and specify Java 8 compat level) 2019-04-13 20:58:49 -05:00
Marek Skrobacki e142b9f043 add support for disabling TLSv1.0
Many organizations run their applications using in environments that fall into
scope of PCI-DSS compliance audits. One of the requirements set out by standard
is to migrate to more secure protocols if possible.

PCI Security Standards council has advised to migrate away from TLSv1.0 over
last few years and recently set a migration deadline of 30 June 2018 (see [1]
for more details).

Change proposed in this commit gives an user option to disable `TLSv1.0` during
bind, while still leaving the `TLSv1.1` and `TLSv1.2` enabled. `SSLv2` and
`SSLv3` are permanently disabled (as they should).

Default behaviour is not changed if the `no_tls` option is not defined.

[1]: https://blog.pcisecuritystandards.org/are-you-ready-for-30-june-2018-sayin-goodbye-to-ssl-early-tls
2018-05-11 13:12:14 +01:00
284km c2f6803d00 Add support for specifying ssl ciphers via :binds parameters 2017-11-29 22:45:51 +00:00
David Arnold ad27aa82bb Handle unauthenticated case 2017-03-20 19:19:29 -04:00
David Arnold 485bc9b81f Replace stub method with working implementation 2017-03-20 18:57:49 -04:00
joe miller 4ae0de4f4c support TLS client auth (verify_mode) in jruby
Adds support for `verify_mode` to configure client authentication when running under JRuby.

Things to note:

- Assumes the CA used to verify client certs is in the same java
  keystore file that is used when setting up the HTTPS TLS listener. We
could split this out, but not sure if it's necessary.
- Friendly/helpful error messages explaining why the verification failed
  are not present in the same way they are in the CRuby/OpenSSL code
path. I'm not sure how to make them available.
- I did not include any code to create the `keystore.jks` file in the
  `examples/puma/client-certs` directory because I didn't see any
existing code to create the `examples/puma/keystore.jks` file. The
commands to create this keystore would be:

```
cd examples/puma/client-certs
  openssl pkcs12 -chain -CAfile ./ca.crt -export -password pass:blahblah -inkey server.key -in server.crt -name server -out server.p12
  keytool -importkeystore -srckeystore server.p12 -srcstoretype pkcs12 -srcstorepass blahblah -destkeystore keystore.jks -deststoretype JKS -storepass blahblah
  keytool -importcert -alias ca -noprompt -trustcacerts -file ca.crt -keystore keystore.jks -storepass blahblah
```
2015-11-28 18:17:01 -08:00
Daniel Marcotte 95a0645443 Eliminate logging overhead from JRuby SSL
Previously, even when not debugging, we were doing work to compose the
log messages.  Delete these diagnostic messages to keep things as fast
and lean as possible.
2015-08-12 14:21:11 -07:00
Evan Phoenix 2348285fcb Stub out peercert on JRuby for now. Fixes #739 2015-07-17 11:48:47 -07:00
Daniel Marcotte abcce826d1 Remove `enable_SSLv3` support from JRuby
The C implementation has not supported SSLv3 at all since #591, and
SSLv3 is disabled by default in java now
(http://www.oracle.com/technetwork/java/javase/documentation/cve-2014-3566-2342133.html)
so we can drop support from JRuby.
2015-05-01 16:49:48 -07:00
Daniel Marcotte 6995981303 Fix hang on bad SSL handshake
Both the C and JRuby SSL implementations would hang on a bad handshake
because they were not producing the EOF expected in that case.
Update their error handling to behave correctly here (note:
`test_ssl_v3_rejection` covers this).
2015-05-01 16:39:22 -07:00
Daniel Marcotte 8eee16d445 JRuby SSL POODLE update
Default SSLv3 to disabled in response to the POODLE vulnerability.
2014-10-15 20:04:58 -07:00
Daniel Marcotte c54807700c Add SSL support for JRuby
- Implement MiniSSL for JRuby

- Modify `Binder` and `MiniSSL::Context` to to accommodate the fact
that Java SSL demands a java keystore rather than a key/cert pair

- Change the MiniSSL native extension interface to take a
`MiniSSL::Context` rather than a key/cert pair so that each extension
can grab keys off the context as appropriate
2014-05-05 14:30:15 -07:00
Evan Phoenix 7adcb771a5 More work on the Java version, not working 2012-08-26 13:55:36 -07:00
Jingwen Owen Ou 6a5b30ea30 Move singleton method to MiniSSL.java 2012-08-23 20:06:18 -07:00
Evan Phoenix e191003fc4 Start java version of MiniSSL 2012-08-23 16:56:37 -07:00