1
0
Fork 0
mirror of https://github.com/puma/puma.git synced 2022-11-09 13:48:40 -05:00
Commit graph

10 commits

Author SHA1 Message Date
Karol Bucek
dbf450bdd2
[jruby] allow truststore without password (#2904) 2022-08-27 15:18:24 -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
Johnny Shields
8a4ef0c16c
[WIP] Refactor: Split out LogWriter from Events (no logic change) (#2798)
* Split out LogWriter from Events

* Improve code comment

* Fix constructor interfaces

* Fix file includes

* Fix specs and requires

* Fix LogWriter

* More fixes

* Fix tests

* Fix specs

* Fix spec

* Fix more specs

* Refactor: Split out LogWriter from Events

* Improve comments

* Fix bundle pruner

Co-authored-by: shields <shields@tablecheck.com>
2022-02-05 10:06:22 -07:00
MSP-Greg
242043b6dc
Update test certs to work with more secure OpenSSL (Ubuntu 20.04)
Added code for generating/updating
2020-09-07 23:35:22 -05:00
Vladimir Dementyev
42580133a8 Use Rubocop 0.50; fix SpaceBeforeBlockBraces layout (#1472) 2017-11-30 08:52:40 -07: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
Julian Langschaedel
e8d25b30f3 ssl: Add Client Side Certificate Auth
Add Client Side Certificate Auth feature and handling to puma's MiniSSL. Also exposes SSL errors to puma/apps.

 compatibility notes: MRI only

 shell example:

   puma -b 'ssl://127.0.0.1:9292?key=path_to_key&cert=path_to_cert&ca=path_to_ca&verify_mode=force_peer'

 code example: (examples/client_side_ssl)

    app = proc {|env| p env['puma.peercert']; [200, {}, ["hey"]] }

    events = SSLEvents.new($stdout, $stderr)
    server = Puma::Server.new(app, events)

    admin_context             = Puma::MiniSSL::Context.new
    admin_context.key         = KEY_PATH
    admin_context.cert        = CERT_PATH
    admin_context.ca          = CA_CERT_PATH
    admin_context.verify_mode = Puma::MiniSSL::VERIFY_PEER | Puma::MiniSSL::VERIFY_FAIL_IF_NO_PEER_CERT

    server.add_ssl_listener("0.0.0.0", ADMIN_PORT, admin_context)
    server.min_threads = MIN_THREADS
    server.max_threads = MAX_THREADS
    server.persistent_timeout = IDLE_TIMEOUT
    server.run.join

 additional credits: Andy Alness <andy.alness@gmail.com>
2015-06-06 23:15:00 +02:00
Evan Phoenix
7adcb771a5 More work on the Java version, not working 2012-08-26 13:55:36 -07:00
Evan Phoenix
b2016c68bf Add native support for ssl. Fixes #28 2012-01-13 16:29:50 -08:00