Skip to main content

Captcha Http module

The CaptchaHttp module is used to identify false-positives on the BitNinja challenge list and allow human web users to remove themselves from the challenge list easily. In other words, if an IP is placed onto the BitNinja challenge list and tries to access a web page on a server protected by BitNinja, the request will be forwarded to an alternative web server (created by BitNinja) and a Browser Integrity Check (BIC) page will be shown to the user. If the browser integrity test is successful then the BIC page will redirect them to the original url after 5 seconds.

You won't have to fill or type anything because the process is automatic. If your server generates an incident locally, then BitNinja will show the CAPTCHA page instead of the BIC one. If the user is a human visitor, he/she can easily solve the CAPTCHA and the IP automatically gets delisted. The visitor will be redirected to the original page and he/she can go on surfing the pages. The submission of the CAPTCHA form is delayed by 2 seconds.

The web server created to serve the CAPTCHA page is specially tuned to sustain a high traffic load and serve every request from memory. It is a one-threaded, event-driven web server so it cannot overload a multi CPU system. The memory consumption of the server is also limited, so it cannot eat up all the system memory. In case of an overload of this server, it will crash and restart automatically after 5 minutes. This tiny web server was designed especially for serving CAPTCHA pages, receiving any malicious traffic, and sending it to BitNinja central for further analysis, virtually creating a huge honey farm out of the servers using BitNinja.

Relations to other modules

CaptchaHttp sends events to the Shogun module in order to send it to BitNinja Central, as well as to the Anti Flood module to detect flood attempts and block them.

Configuration

You can find the configuration file for this module at /etc/bitninja/CaptchaHttp/config.ini

    [CaptchaHttpSettings]
; The backlog is the limit for the queue of incoming connections.
socketBacklogSize = 50
; How many times BIC page will be shown for new visitors
maxBICRetries = 1
; Add HoneyConent meta tags to captcha page
loadHoneyContent = 0;
; Add Captcha service for greylist HTTP connections on the following ports
http_captcha_ports[]=8080
http_captcha_ports[]=8888
; Add Captcha service for greylist HTTPS connections on the following ports
https_captcha_ports[]=8443
https_captcha_ports[]=8888
tip

The above mentioned HTTP/HTTPS configurations are not enabled by default.

Customizing the BIC page

You can easily customize the texts and styles of the BIC page on your server. It works on a per server basis and supports multilingual BIC sites.

The BIC page is translated to the following languages so far:

  • English
  • Hungarian
  • Japanese
  • German
  • Spanish
  • French
  • Italian
  • Dutch
  • Polish
  • Russian
  • Turkish
  • Danish

BitNinja has its default templates in the /opt/bitninja/modules/CaptchaHttp/lib/www/browser_integrity_check.html file.

You shouldn't change this file as the package manager will overwrite these files with every new BitNinja version, and sometimes we make changes on these files.

If you would like to use your own templates, you can use the /etc/bitninja/CaptchaHttp/www directory. Any files in this directory take precedence over the /opt/bitninja/modules/CaptchaHttp/lib/www counterparts. You can choose what to modify, or you can even overwrite all the templates and place them here.

tip

You can find a more detailed guide on how to customize the Captcha page here.

BitNinja will serve the file based on the accepted language header info sent by the browser. You can have, for example, a Greek version for people using Greek browsers and an English version for the rest of the world. In this case you should copy the original browser_integrity_check.html file and create a browser_integrity_check_gr.html file for Greek users with the two-character country code. (If you have made a translation and haven't changed anything else, like the personalized logo, feel free to send us your translation so we can include it in the official BitNinja package ;-) )

tip

Please remember, the language displayed depends on the browser language settings. If there is a Greek user with an English browser, it will display the English BIC page.

For the changes to take place, you have to restart BitNinja as we cache every file to memory in order to speed up file serving and save system resources.

tip

Please don't remove any html tags or javascript from the BIC page (except the loading icon), because it can cause errors. You can customize the css style inside the style tag.

Customizing the CAPTCHA page

You can customize the look and feel of the CAPTCHA page on your server. Currently it works on a per server basis and we support multilingual CAPTCHA pages.

The CAPTCHA page is translated to the following languages:

  • English
  • Hungarian
  • German
  • Spanish
  • French
  • Greek
  • Italian
  • Indonesian
  • Dutch
  • Polish
  • Portugese
  • Russian
  • Turkish
  • Vietnamese
  • Japanese
  • Danish

BitNinja has its default templates in the /opt/bitninja/modules/CaptchaHttp/lib/www directory. There you can find the default English page, as well as the JavaScript files that are responsible for changing the language based on the visitor's browser's language setting.

The v2/js/translations.js file contains the translated strings and the tags that are used in the template HTML file. The v2/js/detect-browser-language.js is responsible for getting the browser's language and setting the template page accordingly. If no translation is available in the v2/js/translations.js in the selected language, the CAPTCHA page will be shown in English by default.

You shouldn't change these files as with every new BitNinja version the package manager will overwrite these files, and sometimes we make changes on these files.

If you would like to use your own templates, you can use the /etc/bitninja/CaptchaHttp/www directory. Any files in this directory take precedence over the /opt/bitninja/modules/CaptchaHttp/lib/www counterparts. You can choose what to modify, or you can even overwrite all the templates and place them here.

BitNinja will serve the file based on the accepted language header info sent by the browser. You can have, for example, a Greek version for people using Greek browsers and an English version for the rest of the world. (If you have made a translation and haven't changed anything else like the personalized logo, feel free to send us your translation so we can include it in the official BitNinja package ;-) )

tip

Please remember, the language displayed depends on the browser language settings. If there is a Greek user with an English browser, it will display the English CAPTCHA page.

For the changes to take place, you have to restart BitNinja as we cache every file to memory in order to speed up file serving and save system resources.