TUTORIAL Knock 3 Times: knockd

Huckda

Guru
Joined
May 28, 2013
Messages
143
Reaction score
27
I've been using knockd in some form or other since about 10 years ago... it works
 

Huckda

Guru
Joined
May 28, 2013
Messages
143
Reaction score
27
Better late than never!
It's just another layer of security/piece of mind :)
And seriously.. who can keep up with every little nuance piece of software out there for all of the different OS's, it really is ridiculous to even try.
Where I am.. the educational I.T. folk used to get together each month just to hash out what we've been looking at/trying/experimenting with/implementing...
Every month everyone learned something new to use or ignore...
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,206
Reaction score
5,227
FWIW: The current version of knockd is less than a month old. Judging from the history of the project, it's much improved over earlier releases both in terms of reliability and from a security standpoint. Same goes for the client history. Many of them still don't work reliably with all servers.
 
Last edited by a moderator:

howardsl2

Guru
Joined
Aug 5, 2013
Messages
88
Reaction score
25
Thanks for the helpful article Ward.

An alternative to knockd is the pknock module provided by xtables-addons. It works entirely within IPTables with no external daemon required.

A tutorial for its installation and usage can be found on my blog:
IPTables GeoIP, Port Knocking and Port Scan Detection

Upon completion of install, run "man xtables-addons" to view detailed usage of all available modules. You can then search for pknock. (type /pknock Enter)

An example IPTables rule would look like this:
Code:
iptables -A INPUT -p tcp -m pknock --knockports 4002,4001,4004 --strict --name SSH --time 10 --autoclose 60 --dport 22 -j ACCEPT
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,206
Reaction score
5,227
knockd installer for ARM-based systems has been added to today's article. BBB has been tested and works fine. Raspberry Pi testing soon.
Code:
cd /root
wget http://nerdvittles.com/wp-content/knock-ARM.tar.gz
tar zxvf knock*
rm knock-ARM.tar.gz
./knock*
 

miguel

Member
Joined
May 22, 2013
Messages
276
Reaction score
8
this looks great, I will try it, anyway is there a way to uninstalling jut in case?
best regards,
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,206
Reaction score
5,227
RedHat/CentOS: rpm -e packagename
Ubuntu/Debian: apt-get remove packagename
 

miguel

Member
Joined
May 22, 2013
Messages
276
Reaction score
8
another question, if I unistall will the server be as it was before ? with the opened ports that I inputed before?
 

miguel

Member
Joined
May 22, 2013
Messages
276
Reaction score
8
now I cant remove it it says that the package is not installed, what do I do?
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,206
Reaction score
5,227
What is the command you issued to uninstall it and on what platform?
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,206
Reaction score
5,227
another question, if I unistall will the server be as it was before ? with the opened ports that I inputed before?


Don't really have much of an idea what you've done so I can't really respond. You can restart iptables to wipe out any openings made by knockd if that's what you're asking.
 

miguel

Member
Joined
May 22, 2013
Messages
276
Reaction score
8
I installed as metioned in the forum:

wget http://nerdvittles.com/wp-content/knock-R.tar.gz
tar zxvf knock*
rm knock-R.tar.gz
./knock*

then I wanted to unistall as you mentioned before :

rpm -e packagename (knock* or knockd tried both) and it tells me:
rpm -e knocked
error: package knocked is not installed

rpm -e knock*
error: package knock.FAQ is not installed
error: package knock-R.sh is not installed

but obviously if I get service knockd restart I get:

root@pbx:~ $ service knockd restart
Shutting down knockd: [ OK ]
Starting knockd: [ OK ]

so the service is installed so my question is how do I uninstall knockd on the server?
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,206
Reaction score
5,227
Actually, on the RedHat platform, it's rpm -e knock-server

You can get a list of installed packages using a wild card like this: yum list knock\*

OR yum list \* will get you everything

AND so will: yum list installed
 

miguel

Member
Joined
May 22, 2013
Messages
276
Reaction score
8
that did the trick thanks a bunch, also by some strange reason it did not worked for me I tried to log in from my 3g connection on the cellphone without knocking and I registered, what could I be doing wrong?
 

Members online

Forum statistics

Threads
25,824
Messages
167,826
Members
19,249
Latest member
jetest
Get 3CX - Absolutely Free!

Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.
Top