Hi Everyone,
My knock server isn't working on centos 7 when I use it in combination with iptables.
I disable the default firewal in centos 7 and install iptables. ( not using iptables is not an option )
The syntax of the knockd configuration file is pretty simple to make debugging easy.
Code:
[options]
UseSyslog
Interface = eno1
LogFile = /var/log/knockd.log
[abstract]
sequence = 4444:udp
seq_timeout = 15
tcpflags = syn,ack
start_command = /sbin/iptables -A INPUT -s %IP% -p tcp --dport ssh -j ACCEPT
cmd_timeout = 10
stop_command = /sbin/iptables -D INPUT -s %IP% -p tcp --dport ssh -j ACCEPT
The knock log file does not show any activity. I had this before and it took hours to find out in some configuration file ( systemd service file, security setting, etc ) I had to make some changes. ( unfortunately I didnt remember )
My knocks do arrive at the server. This is from the logging of iptabeles traffic.
Code:
Oct 4 18:19:45 localhost kernel: IN=eno1 OUT= MAC=[thats me] SRC=[thats me as well] DST=[thats the server] LEN=28 TOS=0x08 PREC=0x40 TTL=117 ID=25835 PROTO=UDP SPT=54917 DPT=4444 LEN=8
This is all the knock log file shows, after the knock above:
Code:
[2019-10-04 17:57] starting up, listening on eno1
[2019-10-04 17:59] waiting for child processes...
[2019-10-04 17:59] shutting down
[2019-10-04 17:59] starting up, listening on eno1
[2019-10-04 18:18] waiting for child processes...
[2019-10-04 18:18] shutting down
[2019-10-04 18:19] starting up, listening on eno1
I know the solution is very simple. Unfortunately I've been running in circles now for hours.
Best Wishes,
Abstract