Port knocking with UFW

Port knocking is a security technique used to secure servers. Connection is attempted to a sequence of ports to open or close an application/service port.
UFW (Uncomplicated Firewall) is available on all recent Ubuntu versions.

knockd installation:

apt install knockd

knockd configuration file:

/etc/knockd.conf

[options] UseSyslog [SSH] sequence = 7000,8000,9000 seq_timeout = 5 start_command = ufw allow from %IP% to any port 22 tcpflags = syn cmd_timeout = 10 stop_command = ufw delete allow from %IP% to any port 22

The sequence for opening port 22 is 7000–8000–9000. The SSH port will be open for 10 seconds before it is closed again. SSH access is enabled only for the IP which is knocking.
The ports in the knocking sequence should be allowed in the firewall first.

--

--

--

I work with cloud, containers, linux

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Decoding Privacy/Security of Social Media Applications

How To Approach Security Development Lifecycle (SDL)

AWS Greengrass Announcement

{UPDATE} Chimeras: Cursed and Forgotten - Hidden Object Hack Free Resources Generator

Be Careful: Criminals and Corporations, Too, Want Your Biometric Data

The meloot token Referral program

CoinTiger X GWSPP is officially launched by CoinTiger!

Finding the Balance Between Required Information for Smart Devices to Facilitate Daily Life and…

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Adithya

Adithya

I work with cloud, containers, linux

More from Medium

Fixing low sound volume in Linux

Install and Configure Apache Web Server on Ubuntu 20.04

Redirection Operator in Linux

Running a Linux-based NFS Server in Docker on Windows