Warning
When the interface IP address is added to or deleted from the system, the restart of the webshield is required for the latter to recognize the new IP.
service imunify360-webshield restart
Sometimes it's desired to change the WebShield "Server" header to something that suits certain requirements.
To do so, locate the more_set_headers
directive in the /etc/imunify360-webshield/webshield.conf
file.
By default, the directive contains the "Server: imunify360-webshield/1.8";
value. You can set string after the colon to whatever suits your needs.
The CAPTCHA is a feature intended to distinguish human from machine input and protect websites from the spam and different types of automated abuse. Imunify360 uses reCAPTCHA service.
Warning
Please note that the WebShield Captcha is not compatible with aggressive CDN caching modes, like Cloudflare 'cache everything' with 'Edge Cache TTL'. If the Сaptcha page is cached by CDN, a visitor will see the Captcha from CDN cache disregarding it has been passed or not. In order to fix that, either disable the aggressive CDN caching or the Captcha functionality in the Imunify360.
There are two layers in CAPTCHA behavior:
Note
The IP address on the screenshot above is given as an example.
If successful, a user is redirected to the website, which means that the access is unblocked and the IP address of this user is removed from the Grey List.
It is also possible to enable the invisible reCAPTCHA via the Imunify360 Settings page. With the invisible reCAPTCHA enabled, a human user is not required to go through human confirmation - the process will pass under the hood and a user will be redirected to the website. In case if invisible reCAPTCHA failed to detect if a user is a human or not, then visible reCAPTCHA appears.
The reCaptcha supports localization. Depending on user’s browser settings, reCaptcha will use the browser default language and allow to change it:
To modify footer, header or body of the CAPTCHA use the templates in /usr/share/imunify360-webshield/captcha/templates/
.
There are three files:
head.tpl
– this file goes inside <head></head>
tags. So you can add JavaScript, CSS styles, etc.
body.tpl
– the main template file, modify it as you wish. CAPTCHA goes above all the layers.
static
– here you can place images, CSS, JavaScript, etc. and access these files as /static/<filename>
.
To find information on supported browsers follow this link https://support.google.com/recaptcha/answer/6223828.
A user can change the text of captcha messages for the supported languages. Note that adding custom language is not supported.
To change the text of the Imunify360 Captcha and update the localizations text, please do the following:
Locate appropriate Captcha localization files by running:
ls /usr/share/imunify360-webshield/captcha/translations/locale/{lang}/LC_MESSAGES/messages.po
For example for Polish language the catalog looks like this:
/usr/share/imunify360-webshield/captcha/translations/locale/pl/LC_MESSAGES/messages.po
Update Captcha localization files by editing msgstr "my customization or translation"
for appropriate msgid “original plain english text"
.
Where msgstr
contains text that is shown to user and msgid
contains Captcha original English text.
For example:
#: templates/index.html:154
msgid ""
"We have noticed an unusual activity from your <b>IP {client_ip}</b> and "
"blocked access to this website."
msgstr ""
"Zauważyliśmy nietypową aktywność związaną z twoim adresem <b>IP "
"{client_ip}</b> i zablokowaliśmy dostęp do tej strony internetowej"
To add Polish translation edit text in the msgstr
field. To change the text for a default English translation, edit text in the msgid
field.
Save files.
When translation in messages.po
files is finished, restart imunify360-webshield service:
service imunify360-webshield restart
If a server owner has his own Google reCAPTCHA keys (both private and public), he may use them instead of the default CloudLinux keys.
To set Google reCAPTCHA keys, place your keys into the /etc/imunify360-webshield/webshield-http.conf.d/captchakeys.conf
file as shown in the example below:
captcha_site_key <YOUR_SITE_KEY>;
captcha_secret_key <YOUR_SECRET_KEY>;
Then reload WebShield.
See how to setup invisible CAPTCHA.
Imunify360 admin should specify reCAPTCHA keys for the server since we’re planning to completely remove embedded reCAPTCHA keys in the future versions.
In this article, you can find a step by step guide on how to set up a custom site and secret keys for your Imunify360 server.
Public and secret reCAPTCHA keys are required for integration between Imunify360 and Google reCAPTCHA service.
The site key will be publicly available and shown on pages along with reCAPTCHA widget or Invisible CAPTCHA, whereas the secret key will be stored for intercommunication between the backend of Imunify360 and Google service.
Note: Due to the captcha rate limit we recommend using different reCAPTCHA keys for each server.
Google’s quotation: If you wish to make more than 1k calls per second or 1m calls per month, you must use reCAPTCHA Enterprise or fill out this form and wait for an exception approval.
Fill in required values
Note
You don’t need to put all your domains here
Accept terms and proceed
Notice keys
You need to put these keys on the Imunify360 settings page
or use the following CLI commands:
# imunify360-agent config update '{"WEBSHIELD": {"captcha_site_key": "6Ldu4XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXCN6fJ"}}'
# imunify360-agent config update '{"WEBSHIELD": {"captcha_secret_key": "6Ldu4XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXQqUuk"}}'
The final step is to allow Google to process requests from any of your domains
Open the Settings page
And disable the Verify the origin of reCAPTCHA solutions
That’s it.
In order to make sure that you’ve done everything correctly you need to do the following:
Make sure that your IP is not whitelisted (using the CLI):
# imunify360-agent whitelist ip list
IP TTL COUNTRY IMPORTED_FROM COMMENT
1.2.3.4 10256 None None Whitelisted for 3 hours due to successful panel login
# imunify360-agent whitelist ip delete 1.2.3.4
OK
# imunify360-agent whitelist ip list
IP TTL COUNTRY IMPORTED_FROM COMMENT
Make sure your target domain is not whitelisted:
# imunify360-agent whitelist domain list
example.com
# imunify360-agent whitelist domain delete example.com
OK
Send at least two WAF test requests to any domain on the server
# curl -v http://example.org/?i360test=88ff0adf94a190b9d1311c8b50fe2891c85af732
Open your test domain in the browser and let it pass the captcha challenge
Check the list of whitelisted IPs again
# imunify360-agent whitelist ip list
IP TTL COUNTRY IMPORTED_FROM COMMENT
1.2.3.4 86377 None None IP auto-whitelisted with expiration date: 2020-05-28 15:29:34
If you see that your IP is whitelisted then integration between Imunify360 and reCAPTCHA service was done properly.
You can watch how invisible reCAPTCHA works at https://www.youtube.com/watch?v=GQXmAj5hyDo.
Note
It is also possible to test Captcha by the server IP. Find more information here
Imunify360 correctly graylists and blocks IPs behind Cloudflare and other CDNs (see here for the full list).
Imunify360 passes all requests from CDN through WebShield, and uses CF-Connecting-IP and X-Forwarded-For headers to identify real IPs.
To enable it now, run the command:
imunify360-agent config update '{"WEBSHIELD": {"known_proxies_support": true}}'
Note
If you are using cPanel/EasyApache3, Imunify360 will not automatically deploy mod_remoteip, and log files will show local server IP for visitors coming from CDN. EasyApache 3 is EOL since December 2018, and we don't plan to add automated mod_remoteip setup and configuration for it.
Note
For cPanel/EasyApache 4, Plesk, DirectAdmin and LiteSpeed mod_remoteip will be automatically installed and configured.
Imunify360 Captcha isn't available in some countries due to certain restrictions, for example, in China. To alleviate this, Chinese customers can use Imunify360 SplashScreen as Captcha.
To enable SplashScreen, open the file /etc/imunify360-webshield/wscheck.conf
, find the following line:
wscheck_splashscreen_as_captcha off;
Change off
to on
:
wscheck_splashscreen_as_captcha on;
Save the file and run the following command:
For Ubuntu:
service imunify360-websheld reload
For CentOS:
systemctl reload imunify360-webshield
The graylisted visitors will see such screen for 5 seconds before redirecting to their initial destination.
Note
You can find WebShield and Captcha related logs in the /var/log/imunify360-webshield/
file.
Country blocking is available in both Admin UI and CLI
Starting from version 5.6, Imunify360 distinguishes bots from real visitors using the JavaScript challenge "Splash Screen." Most bots don’t solve the challenge, and their requests will not reach web applications such as WordPress, Drupal, and others. This can save the server’s resources and protects websites from scanners, automated attacks, and web-spammers.
Only bad actors will be redirected to the Imunify360 Splash Screen challenge page. Legitimate visitors get original content without any verification page nor any delay. The users forced to the Splash Screen will not see the challenge or CAPTCHA and be redirected to the page with the original content. Cookies and JavaScript support are required in a browser to successfully pass the challenge of Anti-bot protection.
The “Anti-bot protection” feature will not block legitimate bots (e.g., Google crawler).
You can enable Anti-bot protection, in the UI. Go to the General tab -> Settings and check the Anti-bot protection checkbox. You can find the details here.
Or via CLI. To do so, run the following command:
# imunify360-agent config update '{"WEBSHIELD": {"splash_screen": true}}'