Self-Hosted Gitlab Invalid reCaptcha key type

Viewed 521

I am self hosting Gitlab, and added force reCaptcha to login/register.

I accidentally entered a v3 key and not a v2 key and now I can't log in because it shows:

ERROR for site owner: Invalid key type. 

Any idea on how to change it manually in the files?
I am running Ubuntu Desktop 18.04.4

3 Answers

I did the same mistake and was mistaken ReCaptcha v2 with v3. I was completely locked out and didn't have the personal access token.

This solution worked for me as well. However, I would not recommend doing it so, if you are not familiar with Postgres or even GitLab's configuration, you don't know if other auditing actions are intercepting once you updated the configuration in the admin panel and you might break something else.

This solution is just updating GitLab's application setting via gitlabhq_production database. The following steps work in my case having the Omnibus package installation method used. I assume it should not be much different if you have direct access to the database.

  1. gitlab-psql -d gitlabhq_production # login to GitLab's database
  2. UPDATE application_settings SET login_recaptcha_protection_enabled = 'f'; # to disable login with recaptcha check
  3. gitlab-ctl reconfigure # to reconfigure Gitlab instance or restart your Gitlab instance.

Another possibility, which I used:

If you're able to gain access via a previously generated (and saved) GitLab ReST API - PERSONAL ACCESS TOKEN (created with All Scopes / Full Admin privileges), then you can use that token to update your reCAPTCHA keys via the following CLI command:

user$ curl --request PUT --header \
       "PRIVATE-TOKEN: <PersonalAccessToken>" \
       "https://gitlab.example.com/api/v4/application/settings?recaptcha_private_key=<SecretKey>&recaptcha_site_key=<SiteKey>"

I hope this helps others.

Related