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
-
Gnome 47.1 Released with a Few Fixes
The latest release of the Gnome desktop is all about fixing a few nagging issues and not about bringing new features into the mix.
-
System76 Unveils an Ampere-Powered Thelio Desktop
If you're looking for a new desktop system for developing autonomous driving and software-defined vehicle solutions. System76 has you covered.
-
VirtualBox 7.1.4 Includes Initial Support for Linux kernel 6.12
The latest version of VirtualBox has arrived and it not only adds initial support for kernel 6.12 but another feature that will make using the virtual machine tool much easier.
-
New Slimbook EVO with Raw AMD Ryzen Power
If you're looking for serious power in a 14" ultrabook that is powered by Linux, Slimbook has just the thing for you.
-
The Gnome Foundation Struggling to Stay Afloat
The foundation behind the Gnome desktop environment is having to go through some serious belt-tightening due to continued financial problems.
-
Thousands of Linux Servers Infected with Stealth Malware Since 2021
Perfctl is capable of remaining undetected, which makes it dangerous and hard to mitigate.
-
Halcyon Creates Anti-Ransomware Protection for Linux
As more Linux systems are targeted by ransomware, Halcyon is stepping up its protection.
-
Valve and Arch Linux Announce Collaboration
Valve and Arch have come together for two projects that will have a serious impact on the Linux distribution.
-
Hacker Successfully Runs Linux on a CPU from the Early ‘70s
From the office of "Look what I can do," Dmitry Grinberg was able to get Linux running on a processor that was created in 1971.
-
OSI and LPI Form Strategic Alliance
With a goal of strengthening Linux and open source communities, this new alliance aims to nurture the growth of more highly skilled professionals.