Bug 273860 - security/knock does not open port anymore on freebsd 13.2
Summary: security/knock does not open port anymore on freebsd 13.2
Status: Open
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Some People
Assignee: Sofian Brabez
URL: https://www.freshports.org/security/k...
Keywords:
Depends on:
Blocks:
 
Reported: 2023-09-16 17:50 UTC by gotnull
Modified: 2023-09-17 09:59 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (sbz)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description gotnull 2023-09-16 17:50:18 UTC
Hi,

knock doesn't work on 13.2,  it's like it isn't triggered or doesn't received the signal, yet tcpdump shows the packets received from the client sent via security/knock.
The firewall doesn't seem involved because I tried with pf or ipfw but in vain the result is the same. 
Meanwhile on Freebsd 12.4 security/knock works just fine, so the problem is coming from 13.2.

Just in case, I put the link of the forum's thread that talks about it.
https://forums.freebsd.org/threads/the-knock-of-amd64-freebsd-cannot-listen-for-information.90272/


Freebsd 12.4 as client
root@fbsd12 ~ : freebsd-version ; uname -asm
12.4-RELEASE-p5
FreeBSD fbsd12 12.4-RELEASE-p5 FreeBSD 12.4-RELEASE-p5 GENERIC  amd64
root@fbsd12 ~ : ifconfig vtnet0 | grep inet
        inet 192.168.2.172 netmask 0xffffff00 broadcast 192.168.2.255
root@fbsd12 ~ : knock -v 192.168.2.173 7000:tcp 8000:tcp 9000:tcp
hitting tcp 192.168.2.173:7000
hitting tcp 192.168.2.173:8000
hitting tcp 192.168.2.173:9000
root@fbsd12 ~ : nmap -p 22 192.168.2.173 | grep ssh
22/tcp filtered ssh

Freebsd 13.2 as serveur
root@fbsd13 ~ :  freebsd-version ; uname -asm
13.2-RELEASE-p3
FreeBSD fbsd13 13.2-RELEASE-p3 FreeBSD 13.2-RELEASE-p3 GENERIC amd64

root@fbsd13 ~ : ifconfig vtnet0 | grep inet
        inet 192.168.2.173 netmask 0xffffff00 broadcast 192.168.2.255

root@fbsd13 ~ : cat /var/log/knockd.log
[2023-09-16 18:42:56] starting up, listening on vtnet0

root@fbsd13 ~ : tcpdump -n -t -i vtnet0 tcp
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on vtnet0, link-type EN10MB (Ethernet), capture size 262144 bytes
IP 192.168.2.172.64594 > 192.168.2.173.7000: Flags [S], seq 3144177609, win 65535, options [mss 1460,nop,wscale 6,sackOK,TS val 3683868432 ecr 0], length 0
IP 192.168.2.172.26006 > 192.168.2.173.8000: Flags [S], seq 2244267204, win 65535, options [mss 1460,nop,wscale 6,sackOK,TS val 1283481177 ecr 0], length 0
IP 192.168.2.172.57766 > 192.168.2.173.9000: Flags [S], seq 233451712, win 65535, options [mss 1460,nop,wscale 6,sackOK,TS val 2416705257 ecr 0], length 0
^C
3 packets captured
10 packets received by filter
0 packets dropped by kernel


Looking at the /var/log/knockd.log there is nothing expect when the service is stopped or started and the port 22 remains closed.


Now if I invert the role meaning using freebsd 12.4 as server and freebsd 13.2 as client everything works.
Note that I've used the same exact knockd config file in both case.

root@fbsd13 ~ : knock -v 192.168.2.172 7000:tcp 8000:tcp 9000:tcp
hitting tcp 192.168.2.172:7000
hitting tcp 192.168.2.172:8000
hitting tcp 192.168.2.172:9000
root@fbsd13 ~ : nmap -p 22 192.168.2.172 | grep ssh
22/tcp open  ssh

root@fbsd12 ~ : tail -f /var/log/knockd.log
[2023-09-16 19:32:59] 192.168.2.173: openSSH: Stage 1
[2023-09-16 19:32:59] 192.168.2.173: openSSH: Stage 2
[2023-09-16 19:32:59] 192.168.2.173: openSSH: Stage 3
[2023-09-16 19:32:59] 192.168.2.173: openSSH: OPEN SESAME
[2023-09-16 19:32:59] openSSH: running command: /sbin/ipfw -q add 95 allow proto tcp src-ip 192.168.2.173 dst-port 22


I hope I gave you enough information.  
Thank you in advance.
Comment 1 gotnull 2023-09-17 09:57:46 UTC
Tested also on Freebsd 14.2 beta2, it works fine like with Freebsd 12.4, looks like only Freebsd 13.2 have a problem.

root@fbsd14b2 ~ : freebsd-version ; uname -asm
14.0-BETA2
FreeBSD fbsd14b2 14.0-BETA2 FreeBSD 14.0-BETA2 #0 releng/14.0-n265096-dfd44f2f0143: Fri Sep 15 05:46:35 UTC 2023     root@releng1.nyi.freebsd.org:/usr/obj/usr/src/amd64.amd64/sys/GENERIC amd64
Comment 2 gotnull 2023-09-17 09:59:44 UTC
(In reply to gotnull from comment #1)
Sorry I meant Freebsd 14.0 beta2