dlindahl / omniauth-cas

A CAS OmniAuth Strategy
MIT License
88 stars 79 forks source link

OpenSSL error : SSL_read: eof while reading #69

Open ClemStun opened 1 year ago

ClemStun commented 1 year ago

--- Infos ---

Ruby version : 3.0.2 Rails version : 7.0.4 omniauth version : 1.9.2 omniauth-cas version : 2.0.0 openssl version : 3.0.1 (upgrade after testing in 3.0.0

Error : OpenSSL::SSL::SSLError (SSL_read: unexpected eof while reading) the entire error is below

provider :cas, url: 'https://cas_url', login_url: '/cas/login', service_validate_url: '/cas/serviceValidate', ca_path: '/etc/ssl/certs'

--------------------

This error happends when omniauth-cas call the CAS for ticket validation in https, if I'm in http that work unfortunately the server telling that the result has moved at the same adresse but in https.

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>301 Moved Permanently</title>
</head><body>
<h1>Moved Permanently</h1>
<p>The document has moved <a href="https://cas_url/cas/serviceValidate?service=url%2Fauth%2Fcas%2Fcallback%3Furl%3Durl%252F&amp;ticket=ticket">here</a>.</p>
</body></html>

with provider :cas, host: 'cas-test.univ-lemans.fr', ssl: false, login_url: '/cas/login', service_validate_url: '/cas/serviceValidate', ca_path: '/etc/ssl/certs'

So if I try to switch to ssl: false I can't have a great response.

This is not an omniauth-cas error but maybe someone here can help and know why i have this error.

omniauth-cas (2.0.0) lib/omniauth/strategies/cas/service_ticket_validator.rb:107:in `block in get_service_response_body' 
-> response = c.get "#{@uri.path}?#{@uri.query}", VALIDATION_REQUEST_HEADERS.dup
OpenSSL::SSL::SSLError (SSL_read: unexpected eof while reading):

openssl (3.0.1) lib/openssl/buffering.rb:214:in `sysread_nonblock'
openssl (3.0.1) lib/openssl/buffering.rb:214:in `read_nonblock'
net-protocol (0.2.1) lib/net/protocol.rb:218:in `rbuf_fill'
net-protocol (0.2.1) lib/net/protocol.rb:185:in `read_all'
/usr/lib/ruby/3.0.0/net/http/response.rb:421:in `read_all'
/usr/lib/ruby/3.0.0/net/http/response.rb:308:in `block in read_body_0'
/usr/lib/ruby/3.0.0/net/http/response.rb:270:in `inflater'
/usr/lib/ruby/3.0.0/net/http/response.rb:290:in `read_body_0'
/usr/lib/ruby/3.0.0/net/http/response.rb:210:in `read_body'
/usr/lib/ruby/3.0.0/net/http.rb:1271:in `block in get'
/usr/lib/ruby/3.0.0/net/http.rb:1566:in `block in transport_request'
/usr/lib/ruby/3.0.0/net/http/response.rb:167:in `reading_body'
/usr/lib/ruby/3.0.0/net/http.rb:1565:in `transport_request'
/usr/lib/ruby/3.0.0/net/http.rb:1521:in `request'
/usr/lib/ruby/3.0.0/net/http.rb:1270:in `get'
omniauth-cas (2.0.0) lib/omniauth/strategies/cas/service_ticket_validator.rb:107:in `block in get_service_response_body'
/usr/lib/ruby/3.0.0/net/http.rb:960:in `start'
omniauth-cas (2.0.0) lib/omniauth/strategies/cas/service_ticket_validator.rb:106:in `get_service_response_body'
omniauth-cas (2.0.0) lib/omniauth/strategies/cas/service_ticket_validator.rb:26:in `call'
omniauth-cas (2.0.0) lib/omniauth/strategies/cas.rb:187:in `validate_service_ticket'
omniauth-cas (2.0.0) lib/omniauth/strategies/cas.rb:193:in `fetch_raw_info'
omniauth-cas (2.0.0) lib/omniauth/strategies/cas.rb:85:in `callback_phase'
omniauth (1.9.2) lib/omniauth/strategy.rb:238:in `callback_call'
omniauth (1.9.2) lib/omniauth/strategy.rb:189:in `call!'
omniauth (1.9.2) lib/omniauth/strategy.rb:169:in `call'
omniauth (1.9.2) lib/omniauth/builder.rb:45:in `call'
rack (2.2.4) lib/rack/tempfile_reaper.rb:15:in `call'
rack (2.2.4) lib/rack/etag.rb:27:in `call'
rack (2.2.4) lib/rack/conditional_get.rb:27:in `call'
rack (2.2.4) lib/rack/head.rb:12:in `call'
actionpack (7.0.4) lib/action_dispatch/http/permissions_policy.rb:38:in `call'
actionpack (7.0.4) lib/action_dispatch/http/content_security_policy.rb:36:in `call'
rack (2.2.4) lib/rack/session/abstract/id.rb:266:in `context'
rack (2.2.4) lib/rack/session/abstract/id.rb:260:in `call'
actionpack (7.0.4) lib/action_dispatch/middleware/cookies.rb:696:in `call'
activerecord (7.0.4) lib/active_record/migration.rb:603:in `call'
actionpack (7.0.4) lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
activesupport (7.0.4) lib/active_support/callbacks.rb:99:in `run_callbacks'
actionpack (7.0.4) lib/action_dispatch/middleware/callbacks.rb:26:in `call'
actionpack (7.0.4) lib/action_dispatch/middleware/executor.rb:14:in `call'
actionpack (7.0.4) lib/action_dispatch/middleware/actionable_exceptions.rb:17:in `call'
actionpack (7.0.4) lib/action_dispatch/middleware/debug_exceptions.rb:28:in `call'
web-console (4.2.0) lib/web_console/middleware.rb:132:in `call_app'
web-console (4.2.0) lib/web_console/middleware.rb:28:in `block in call'
web-console (4.2.0) lib/web_console/middleware.rb:17:in `catch'
web-console (4.2.0) lib/web_console/middleware.rb:17:in `call'
actionpack (7.0.4) lib/action_dispatch/middleware/show_exceptions.rb:26:in `call'
railties (7.0.4) lib/rails/rack/logger.rb:40:in `call_app'
railties (7.0.4) lib/rails/rack/logger.rb:25:in `block in call'
activesupport (7.0.4) lib/active_support/tagged_logging.rb:99:in `block in tagged'
activesupport (7.0.4) lib/active_support/tagged_logging.rb:37:in `tagged'
activesupport (7.0.4) lib/active_support/tagged_logging.rb:99:in `tagged'
railties (7.0.4) lib/rails/rack/logger.rb:25:in `call'
sprockets-rails (3.4.2) lib/sprockets/rails/quiet_assets.rb:13:in `call'
actionpack (7.0.4) lib/action_dispatch/middleware/remote_ip.rb:93:in `call'
actionpack (7.0.4) lib/action_dispatch/middleware/request_id.rb:26:in `call'
rack (2.2.4) lib/rack/method_override.rb:24:in `call'
rack (2.2.4) lib/rack/runtime.rb:22:in `call'
activesupport (7.0.4) lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
actionpack (7.0.4) lib/action_dispatch/middleware/server_timing.rb:61:in `block in call'
actionpack (7.0.4) lib/action_dispatch/middleware/server_timing.rb:26:in `collect_events'
actionpack (7.0.4) lib/action_dispatch/middleware/server_timing.rb:60:in `call'
actionpack (7.0.4) lib/action_dispatch/middleware/executor.rb:14:in `call'
actionpack (7.0.4) lib/action_dispatch/middleware/static.rb:23:in `call'
rack (2.2.4) lib/rack/sendfile.rb:110:in `call'
actionpack (7.0.4) lib/action_dispatch/middleware/host_authorization.rb:137:in `call'
railties (7.0.4) lib/rails/engine.rb:530:in `call'
puma (5.6.5) lib/puma/configuration.rb:252:in `call'
puma (5.6.5) lib/puma/request.rb:77:in `block in handle_request'
puma (5.6.5) lib/puma/thread_pool.rb:340:in `with_force_shutdown'
puma (5.6.5) lib/puma/request.rb:76:in `handle_request'
puma (5.6.5) lib/puma/server.rb:443:in `process_client'
puma (5.6.5) lib/puma/thread_pool.rb:147:in `block in spawn_thread'