recaptcha support

This commit is contained in:
alteredCoder 2022-01-24 18:24:27 +01:00
parent b442956990
commit 5f4e74ad83
3 changed files with 26 additions and 3 deletions

View file

@ -5,5 +5,7 @@ if err ~= nil then
end
if not ok then
ngx.log(ngx.ALERT, "[Crowdsec] denied '" .. ngx.var.remote_addr .. "' with '"..remediation.."'")
ngx.exit(ngx.HTTP_FORBIDDEN)
if remediation == "ban" then
ngx.exit(ngx.HTTP_FORBIDDEN)
end
end

13
nginx/captcha.js Normal file
View file

@ -0,0 +1,13 @@
<html>
<head>
<title>reCAPTCHA demo: Simple page</title>
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
</head>
<body>
<form action="?" method="POST">
<div class="g-recaptcha" data-sitekey="{{recaptcha_site_key}}"></div>
<br/>
<input type="submit" value="Submit">
</form>
</body>
</html>

View file

@ -1,7 +1,15 @@
API_URL=${CROWDSEC_LAPI_URL}
API_KEY=${API_KEY}
CACHE_EXPIRATION=1
BOUNCING_ON_TYPE=ban
# bounce for all type of remediation that the bouncer can receive from the local API
BOUNCING_ON_TYPE=all
FALLBACK_REMEDIATION=ban
REQUEST_TIMEOUT=0.2
UPDATE_FREQUENCY=10
MODE=stream
MODE=stream
#those apply for "ban" action
REDIRECT_PATH=/toto
RET_CODE=403
#those apply for "captcha" action
SECRET_KEY=123
SITE_KEY=123