Trying to make reCaptcha work

webbasica

Verified User
Joined
Feb 21, 2005
Messages
60
So I followed the official guide on how to enable reCaptcha protection.

This is my file: /usr/local/lsws/conf/httpd-lsrecaptcha.conf
Apache config:
lsrecaptcha  {
enabled                 1
siteKey                 xxx
secretKey             xxx
type                    1
maxTries                3
allowedRobotHits        3
botWhiteList  {
# google.com
}
regConnLimit            15000
sslConnLimit            10000
}
I then added a custom rule to all Virtual hosts using the template at: /usr/local/directadmin/data/templates/custom/cust_openlitespeed.CUSTOM.5.pre

Apache config:
RewriteCond %{REQUEST_URI} ^/wp-login\.php$
RewriteRule .* - [E=verifycaptcha: drop]

Then rewrote confs
Code:
cd /usr/local/directadmin/custombuild
./build rewrite_confs
Which reverted the changes on httpd-lsrecaptcha.conf so I had to go back and edit it.

Anyway, now when I try to trigger the reCaptcha at wp-login page, it loads without recaptcha. I even tried using a Tor browser, and one site's Jetpack protection got triggered, but not the Recaptcha.

I'm using recaptcha v2, the Checkbox type (which I confirmed is type 1). With the setting "Verify the origin of reCAPTCHA solutions" disabled.
It's obviously a Directadmin server, with more than a few sites. I'm using Cloudflare on most sites, but I also tested on sites without CF and got the same result.

I tried setting the regConnLimit and sslConnLimit to "1" and turns out, recaptcha is working, so my only issue is about the rewrite rule on the Virtual hosts.

I tried it this way, and got en error:

Apache config:
RewriteRule ^/wp-login\.php$ - [E=verifycaptcha: drop]

Any help would be appreciated.
 

LeonDynamic

Verified User
Joined
Sep 19, 2020
Messages
32
You can make a copy of the httpd-lsrecaptcha.conf file in the custom folder, that way any adjustments you make won't get overwritten when rebuilding OLS.

Code:
cd /usr/local/directadmin/custombuild/
cp -p configure/openlitespeed/conf/httpd-lsrecaptcha.conf custom/openlitespeed/conf/
nano /usr/local/directadmin/custombuild/custom/openlitespeed/conf/httpd-lsrecaptcha.conf

What error did you get with that rewrite rule?
 

webbasica

Verified User
Joined
Feb 21, 2005
Messages
60
Thanks for the tip.
About the error, there is none (as far as I can see), it just doesn't work. Where should check?
 

LeonDynamic

Verified User
Joined
Sep 19, 2020
Messages
32
When you set regConnLimit and sslConnLimit to 1, lsrecaptcha works fine and it goes through to the website fine at this stage?
Am I right in thinking the only issue you are facing is with the rewrite rule triggering lsrecaptcha when wp-login.php is accessed?
 

webbasica

Verified User
Joined
Feb 21, 2005
Messages
60
When you set regConnLimit and sslConnLimit to 1, lsrecaptcha works fine and it goes through to the website fine at this stage?
Am I right in thinking the only issue you are facing is with the rewrite rule triggering lsrecaptcha when wp-login.php is accessed?
That's absolutely right. All I want is to trigger Recaptcha every time you access wp-login (on any site)
 

LeonDynamic

Verified User
Joined
Sep 19, 2020
Messages
32
I have been testing this with a variety of different rewrite rules. On my test server (LiteSpeed/1.7.9 Open) if I set to regConnLimit and sslConnLimit to 1, lsrecaptcha will work but it won't work for any RewriteRule in either the vhost configuration file or .htaccess. At this point I would send in a ticket to the OLS support team to take a look. There could well be an issue with the reCAPTCHA rewrites again.
 
Top