Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catch SSL_Connect error #7

Open
adrianshort opened this issue Sep 20, 2018 · 5 comments
Open

Catch SSL_Connect error #7

adrianshort opened this issue Sep 20, 2018 · 5 comments
Labels
bug Something isn't working

Comments

@adrianshort
Copy link
Owner

Getting: https://www.planningpa.bolton.gov.uk/online-applications-17/search.do?action=advanced
 /app/vendor/ruby-2.3.1/lib/ruby/2.3.0/net/http.rb:933:in `connect_nonblock': SSL_connect returned=1 errno=0 state=unknown state: unknown protocol (OpenSSL::SSL::SSLError)
 	from /app/vendor/ruby-2.3.1/lib/ruby/2.3.0/net/http.rb:933:in `connect'
 	from /app/vendor/ruby-2.3.1/lib/ruby/2.3.0/net/http.rb:863:in `do_start'
 	from /app/vendor/ruby-2.3.1/lib/ruby/2.3.0/net/http.rb:858:in `start'
 	from /app/vendor/bundle/ruby/2.3.0/gems/net-http-persistent-3.0.0/lib/net/http/persistent.rb:692:in `start'
 	from /app/vendor/bundle/ruby/2.3.0/gems/net-http-persistent-3.0.0/lib/net/http/persistent.rb:622:in `connection_for'
 	from /app/vendor/bundle/ruby/2.3.0/gems/net-http-persistent-3.0.0/lib/net/http/persistent.rb:927:in `request'
 	from /app/vendor/bundle/ruby/2.3.0/gems/mechanize-2.7.6/lib/mechanize/http/agent.rb:280:in `fetch'
 	from /app/vendor/bundle/ruby/2.3.0/gems/mechanize-2.7.6/lib/mechanize.rb:464:in `get'
 	from /app/vendor/bundle/ruby/2.3.0/bundler/gems/uk_planning_scraper-8d15678700bb/lib/uk_planning_scraper/idox.rb:13:in `scrape_idox'
 	from /app/vendor/bundle/ruby/2.3.0/bundler/gems/uk_planning_scraper-8d15678700bb/lib/uk_planning_scraper/authority.rb:43:in `scrape'
 	from scraper.rb:9:in `block in <main>'
 	from scraper.rb:6:in `each'
 	from scraper.rb:6:in `each_with_index'
 	from scraper.rb:6:in `<main>'
@adrianshort adrianshort added the bug Something isn't working label Sep 20, 2018
@KeithP
Copy link
Contributor

KeithP commented Sep 20, 2018

Maybe try this when intialising Mechanize:

instead of just
agent = Mechanize.new

try
agent = Mechanize.new{ |a| a.ssl_version, a.verify_mode = 'TLSv1', OpenSSL::SSL::VERIFY_NONE }

@adrianshort
Copy link
Owner Author

Locally, this works for Bolton but then breaks for Sutton:

OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=unknown state: tlsv1 alert protocol version

@adrianshort
Copy link
Owner Author

@adrianshort
Copy link
Owner Author

I've got the same problem (transiently) with Bury, running locally:

Getting: https://planning.bury.gov.uk/online-applications/search.do?action=advanced
../.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/net/http.rb:933:in `connect_nonblock': SSL_connect returned=1 errno=0 state=error: certificate verify failed (OpenSSL::SSL::SSLError)

@KeithP
Copy link
Contributor

KeithP commented Oct 24, 2020

In the last couple of days Sutton has started returning an SSL error:
OpenSSL::SSL::SSLError (SSL_connect returned=1 errno=0 state=error: certificate verify failed (unable to get local issuer certificate))

It appears the target server is misconfigured. It is missing chain certificates, as can be seen by running this:
https://www.ssllabs.com/ssltest/analyze.html?d=planningregister.sutton.gov.uk

This server's certificate chain is incomplete. Grade capped to B.

Not sure how to resolve this. Came to a dead end trying to add the missing cert to the local CA store, and anyway doing so feels dirty.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants