I’m looking for a solution on how to drop an established connection.
The screen shot show’s that is furthermore possible to use the (example) telnet session, if the firewall rule has been defined afterwards.
So, currently I see a fire (established connection) but I cannot extinguish (drop/kill) it.
A tool like tcpkill would help. Or the possibility to tell a firewall rule to prevent the traffic of an established connection as well.
and welcome here .
tcpkill is part of the dsniff package which have had seen the last work on it at 2010 and FTBFS on IPFire too. Debian have a patchset of 30 + patches for dsniff which makes it even harder to give it a try to build.
Two possible solutions for your question with on board tools.
- Via lsof with port definition and the kill command. Example for port 80 can looks like this
kill -9 $( lsof -i:80 -t )
- The ss command provides also an --kill option (-K) which attempts to forcible close sockets. Which should also work since it needs and enabled ‘CONFIG_INET_DIAG_DESTROY’ in the kernel --> https://git.ipfire.org/?p=ipfire-2.x.git&a=search&h=HEAD&st=grep&s=CONFIG_INET_DIAG_DESTROY .
ss -K dst 192.168.1.214 dport = 49029
Some ideas from here.
You can use conntrack to remove the existing connection from the connection tracking.
Unfortunately neither ss nor lsof nor netstat shows me the connections I can see in the GUI (iptables connection tracking) …
ss -s -t just shows me the established connections to the device itself ssh (:222) and https (:444).
That is indeed the solution!
conntrack -D -d 22.214.171.124 dropped the connection
Thank you very much!