1

Let me know if more or different information needs to be provided. I don't want to add too much if it's unnecessary.

I'm trying to incorporate Wagtail recaptcha to a contact me form. I can do the google captcha just fine, but once I hit submit I run into an error. I am currently running into this error: SSL: CERTIFICATE_VERIFY_FAILED which you can see here https://pastebin.com/4WaqX1xT In my current setup I'm using ./ngrok 8000. My wagtail application runs on localhost:8000

These are the domains I have on google recaptcha admin panel

localhost
whateverlettersgeneratedby.ngrok.io
127.0.0.1

In my settings base.py I have this included to my INSTALLED_APPS

INSTALLED_APPS = [
    ...
    'sslserver',
    'captcha',
    'wagtailcaptcha',
    ...
]

That being said, I did try django-sslserver and received the same error. HTTPS was crossed out when I went to the url using HTTPS instead of HTTP.

Also in base.py I am using Google Recaptcha's development keys. Using my actual keys also result in the same error being generated.

RECAPTCHA_PUBLIC_KEY = '6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI'
RECAPTCHA_PRIVATE_KEY = '6LeIxAcTAAAAAGG-vFI1TnRWxMZNFuojJ4WifJWe'
NOCAPTCHA = True
RECAPTCHA_USE_SSL = False
SECURE_SSL_REDIRECT = False

Other things I've tried: stunnel, I get a 403 regarding CSRF Verification Failure https://pastebin.com/JXWVWNJq

My stunnel setup was from http://userpath.co/blog/a-simple-way-to-run-https-on-localhost/ Then I did the command below, but HTTPS was crossed out when I tried going to the url using HTTPS.

HTTPS=on python manage.py runserver

My Jinja template does use csrf token https://pastebin.com/meXdkbfC

user2899444
  • 313
  • 1
  • 3
  • 15

1 Answers1

0

The problem is an outgoing request that is failing SSL verification. Your local setup does not need to run under HTTPS. Try installing a certificate bundle with pip install certifi or see these answers "SSL: CERTIFICATE_VERIFY_FAILED" Error

  • Ok, I tried certifi at some point and same error. So if you can help me clarify the solution in that other question, that would be much appreciated. Question: where would the sslcontext code go in this case? Would it be a separate file outside of the project? – user2899444 May 22 '17 at 23:52
  • I don't think the accepted answer in the link I posted is the way to go, you can try setting `NOCAPTCHA = False` and `RECAPTCHA_USE_SSL = False` See: https://github.com/praekelt/django-recaptcha/blob/develop/captcha/client.py#L98 – Nikolai R Kristiansen May 23 '17 at 20:29
  • Changing NOCAPTCHA = False instead of NOCAPTCHA = True worked. Obviously foregoing the newer version captcha. – user2899444 May 25 '17 at 17:04