The sys admin's daily grind – Gatling
Apache Under Fire
Western aficionados and sys admin Charly are about to set up a Gatling in a field that is normally home to Apache. Read on to discover why blogger Fefe is to blame.
I admit to watching (too) many westerns as a child; in other words, I'm fully aware of what a Gatling gun is: an automatic weapon with multiple rotating barrels. In old movies, soldiers used its infernal din to send the horses of attacking Apaches galloping mad. And, this always worked until an Apache warrior crept up from behind and torched the ammunition chest.
As a rapid fire weapon, the Gatling lends its name to the web server I will be looking at today. The server's binary file is a lightweight compared with its name giver, weighing in at just 100KB. Its RAM requirements are minimal, too, because Gatling [1] does not fork. On an old PC, Gatling is just as fast as on my Raspberry Pi. The daemon is even included with the plain vanilla Raspbian distribution.
The server is designed for delivering static web pages as quickly as possible. To allow this to happen, its programmer, Felix "Fefe" von Leitner, whose widely read blog [2] naturally also runs on Gatling, gave the server just as many features as the number of shells you could slot into a revolver (IPv6, TLS/SSL, simply equipped virtual hosts, login via the .htaccess
mechanism).
If you want this tool, you need to build it from the source code, but before doing so, remember to install the IO-API library [3], which was also implemented by Fefe. Launched without any parameters, Gatling serves up the data from the current directory, but you can home in on a target like this:
gatling -u nobody -c /var/www
After Gatling has shot its way out of port 80, it drops its root privileges and continues running with the "nobody" account – which is also the name of a character played by actor Terence Hill 42 years ago [4]. The chroot
parameter -c /var/www
helps the sheriff bundle off the data into the county jail. And, -A number
fends off mass attacks by telling Gatling to restrict the number of HTTP requests per minute and client.
This Is the End of the Line, Django!
The log format is exotic (Figure 1), but it does help you understand the timing. An HTTP connection times out after a nerdy 23 seconds (last line). I tend to change this timeout value to 10 or fewer seconds using the -T seconds
paragraph, to release the sockets as quickly as possible. The reason for this change is that I tend to run Gatling on the front line, where access attempts are like a heavy barrage. The web server responds with static HTML, for example, when a server farm enters a maintenance window ("Please try again later") or in the case of blogs that are churned out by static site generators.
Gatling even offers a simple FTP server (which you can disable with the -F
switch). And, if you allow general access to the FTP directory, users can upload files. Conversely, you can only download files that you are allowed to read.
Backed up by a Gatling, "Nobody" can relax and coolly ride off into the sunset as the closing credits roll by.
Infos
- Gatling: http://www.fefe.de/gatling/
- Fefe's blog: http://blog.fefe.de (in German)
- Libowfat: http://www.fefe.de/libowfat/
- My Name is Nobody: https://en.wikipedia.org/wiki/My_Name_Is_Nobody
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
Canonical Releases Ubuntu 24.04
After a brief pause because of the XZ vulnerability, Ubuntu 24.04 is now available for install.
-
Linux Servers Targeted by Akira Ransomware
A group of bad actors who have already extorted $42 million have their sights set on the Linux platform.
-
TUXEDO Computers Unveils Linux Laptop Featuring AMD Ryzen CPU
This latest release is the first laptop to include the new CPU from Ryzen and Linux preinstalled.
-
XZ Gets the All-Clear
The back door xz vulnerability has been officially reverted for Fedora 40 and versions 38 and 39 were never affected.
-
Canonical Collaborates with Qualcomm on New Venture
This new joint effort is geared toward bringing Ubuntu and Ubuntu Core to Qualcomm-powered devices.
-
Kodi 21.0 Open-Source Entertainment Hub Released
After a year of development, the award-winning Kodi cross-platform, media center software is now available with many new additions and improvements.
-
Linux Usage Increases in Two Key Areas
If market share is your thing, you'll be happy to know that Linux is on the rise in two areas that, if they keep climbing, could have serious meaning for Linux's future.
-
Vulnerability Discovered in xz Libraries
An urgent alert for Fedora 40 has been posted and users should pay attention.
-
Canonical Bumps LTS Support to 12 years
If you're worried that your Ubuntu LTS release won't be supported long enough to last, Canonical has a surprise for you in the form of 12 years of security coverage.
-
Fedora 40 Beta Released Soon
With the official release of Fedora 40 coming in April, it's almost time to download the beta and see what's new.