The sys admin's daily grind: Single-packet authentication

Key Experience

Article from Issue 95/2008
Author(s):

Conventional, woodpecker-style port knocking is open to sniffing and brute force knocking attacks. Sending an encrypted packet with an access request to the server is safer and more modern. Learn more about Firewall Knock Operator, a.k.a. Fwknop.

Conventional port knocking, which I described last month [1], protects you against attackers who routinely scan whole networks looking for "low-hanging fruit." A cracker who takes more time and logs communications can also identify knocking signals because the sequences will repeat.

In theory, you might consider using lists of one-off knocking signals that become obsolete after use. Unfortunately, this is really complex. Besides, if the administrator is not creative enough, an attacker could just try out popular knocking sequences (port 7000, 8000, 9000, …) to gain access.

Single-Packet Authentication (SPA) is one possible solution. The knocking system sends a single packet containing the encrypted authentication credentials – typically a pass phrase – and the client request to open a specific port. An SPA implementation that works really well is Firewall Knock Operator, or Fwknop [2]. Besides the normal build tools, the installation requires Perl, the libpcap-dev package, and the CPAN Net::Pcap module. After installing all of these resources, installing Fwknop is a breeze thanks to the Perl-based installer.

Matching Knobs

Fwknop comprises the fwknopd server and the fwknop client. By editing two files below /etc/fwknop/, you can configure the server; fwknop.conf contains the basic configuration. Initially, you will just need to change a couple of parameters, which are tagged __CHANGEME__.

The other knobs you could tweak here have very sensible defaults. Note that you need to synchronize the time between the server and the client because if the difference is too big, fwknopd will ignore the knocking client.

The entries in /etc/fwknop/access.conf define how fwknopd responds to a client knocking. The secret key that the client uses to identify itself is stored here. The SOURCE line can be used to restrict the networks from which the daemon accepts knocking. To set the port that the system opens on successful knocking – for example, tcp/22 for SSH – you can use OPEN_PORTS. Figure 1 shows a successful attempt. The fwknop client picks up the key from its own /etc/fwknop/access.conf.

If the SSH connection doesn't open quickly enough, the FW_ACCESS_TIMEOUT on the server triggers. This time is normally set to 30 seconds, but I went for twice that – never rush an admin on the job!

Infos

  1. "Knock-Knock" by Charly Kühnast, Linux Magazine, September 2008, http://www.linux-magazine.com/issues/2008/94/knock_knock
  2. Fwknop: http://www.cipherdyne.org/fwknop/

The Author

Charly Kühnast is a Unix operating system administrator at the Data Center in Moers, Germany. His tasks include firewall and DMZ security and availability. He divides his leisure time into hot, wet, and eastern sectors, where he enjoys cooking, fresh water aquariums, and learning Japanese, respectively.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Single-Packet Port Knocking

    If you are looking for an extra layer of remote access security, try single-packet port knocking.

  • Charly's Column

    Horror stories are full of scary characters knocking on doors at night. On Linux, we just call this port knocking, and it can actually be quite useful.

  • Charly's Column – Whowatch

    For no particular reason, Charly occasionally patrols his server farm and hunts down attackers. He has put together a neat toolbox for this job.

  • Letters

     

  • Books

    Reviews of O'Reilly's Beautiful Code: Leading Programmers Explain How They Think, Prentice Hall's The Official Damn Small Linux Book, and Linux Firewalls: Attack Detection and Response with iptables, psad, and fwsnort from No Starch Press.

comments powered by Disqus
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.

Learn More

News