These days I've been testing my PC on several sites for opened ports. Found several opened; for example the 8899 port. After that I've added rules in uwf and iptables to reject in and out connection with this port. But when I check again this port online, it is still indicated as 'open'. And what's more annoying, I was not able to determine which software or service is using this particular port in my system.
Here is the result of the sudo ufw status command:
Status: active
To Action From
-- ------ ----
*8899 DENY Anywhere *
*53 REJECT Anywhere *
*631 REJECT Anywhere *
*54500 REJECT Anywhere *
*56200 REJECT Anywhere *
*54657 REJECT Anywhere *
*8899 (v6) DENY Anywhere (v6) *
*53 (v6) REJECT Anywhere (v6) *
*631 (v6) REJECT Anywhere (v6) *
*54500 (v6) REJECT Anywhere (v6) *
*56200 (v6) REJECT Anywhere (v6) *
*54657 (v6) REJECT Anywhere (v6) *8899 REJECT OUT Anywhere (log-all)
*631 REJECT OUT Anywhere *
*54500 REJECT OUT Anywhere *
*56200 REJECT OUT Anywhere *
*54657 REJECT OUT Anywhere *
8899 (v6) REJECT OUT Anywhere (v6) (log-all)
*631 (v6) REJECT OUT Anywhere (v6) *
*54500 (v6) REJECT OUT Anywhere (v6) *
*56200 (v6) REJECT OUT Anywhere (v6) *
54657 (v6) REJECT OUT Anywhere (v6)
And here is the output of the iptables -L -n command:
Chain INPUT (policy DROP)
*target prot opt source destination *
*ufw-before-logging-input all -- 0.0.0.0/0 0.0.0.0/0 *
*ufw-before-input all -- 0.0.0.0/0 0.0.0.0/0 *
*ufw-after-input all -- 0.0.0.0/0 0.0.0.0/0 *
*ufw-after-logging-input all -- 0.0.0.0/0 0.0.0.0/0 *
*ufw-reject-input all -- 0.0.0.0/0 0.0.0.0/0 *
*ufw-track-input all -- 0.0.0.0/0 0.0.0.0/0 *Chain FORWARD (policy DROP)
*target prot opt source destination *
*ufw-before-logging-forward all -- 0.0.0.0/0 0.0.0.0/0 *
*ufw-before-forward all -- 0.0.0.0/0 0.0.0.0/0 *
*ufw-after-forward all -- 0.0.0.0/0 0.0.0.0/0 *
*ufw-after-logging-forward all -- 0.0.0.0/0 0.0.0.0/0 *
*ufw-reject-forward all -- 0.0.0.0/0 0.0.0.0/0 *
*ufw-track-forward all -- 0.0.0.0/0 0.0.0.0/0 *Chain OUTPUT (policy ACCEPT)
*target prot opt source destination *
*ufw-before-logging-output all -- 0.0.0.0/0 0.0.0.0/0 *
*ufw-before-output all -- 0.0.0.0/0 0.0.0.0/0 *
*ufw-after-output all -- 0.0.0.0/0 0.0.0.0/0 *
*ufw-after-logging-output all -- 0.0.0.0/0 0.0.0.0/0 *
*ufw-reject-output all -- 0.0.0.0/0 0.0.0.0/0 *
*ufw-track-output all -- 0.0.0.0/0 0.0.0.0/0 *
*ACCEPT all -- 0.0.0.0/0 127.0.0.1 *
*ACCEPT all -- 0.0.0.0/0 192.168.0.0/16 *
*ACCEPT all -- 0.0.0.0/0 10.0.0.0/8 *
*ACCEPT all -- 0.0.0.0/0 172.16.0.0/12 *Chain ufw-after-forward (1 references)
*target prot opt source destination *Chain ufw-after-input (1 references)
*target prot opt source destination *
ufw-skip-to-policy-input udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:137
ufw-skip-to-policy-input udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:138
ufw-skip-to-policy-input tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:139
ufw-skip-to-policy-input tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:445
ufw-skip-to-policy-input udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:67
ufw-skip-to-policy-input udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:68
ufw-skip-to-policy-input all -- 0.0.0.0/0 0.0.0.0/0 ADDRTYPE match dst-type BROADCASTChain ufw-after-logging-forward (1 references)
*target prot opt source destination *
LOG all -- 0.0.0.0/0 0.0.0.0/0 LOG flags 0 level 4 prefix "[UFW BLOCK] "Chain ufw-after-logging-input (1 references)
*target prot opt source destination *
LOG all -- 0.0.0.0/0 0.0.0.0/0 LOG flags 0 level 4 prefix "[UFW BLOCK] "Chain ufw-after-logging-output (1 references)
*target prot opt source destination *
LOG all -- 0.0.0.0/0 0.0.0.0/0 LOG flags 0 level 4 prefix "[UFW ALLOW] "Chain ufw-after-output (1 references)
*target prot opt source destination *Chain ufw-before-forward (1 references)
*target prot opt source destination *
ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 ctstate RELATED,ESTABLISHED
ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0 icmptype 3
ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0 icmptype 11
ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0 icmptype 12
ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0 icmptype 8
*ufw-user-forward all -- 0.0.0.0/0 0.0.0.0/0 *Chain ufw-before-input (1 references)
*target prot opt source destination *
*ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 *
ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 ctstate RELATED,ESTABLISHED
ufw-logging-deny all -- 0.0.0.0/0 0.0.0.0/0 ctstate INVALID
DROP all -- 0.0.0.0/0 0.0.0.0/0 ctstate INVALID
ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0 icmptype 3
ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0 icmptype 11
ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0 icmptype 12
ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0 icmptype 8
ACCEPT udp -- 0.0.0.0/0 0.0.0.0/0 udp spt:67 dpt:68
*ufw-not-local all -- 0.0.0.0/0 0.0.0.0/0 *
ACCEPT udp -- 0.0.0.0/0 224.0.0.251 udp dpt:5353
ACCEPT udp -- 0.0.0.0/0 239.255.255.250 udp dpt:1900
*ufw-user-input all -- 0.0.0.0/0 0.0.0.0/0 *Chain ufw-before-logging-forward (1 references)
*target prot opt source destination *
LOG all -- 0.0.0.0/0 0.0.0.0/0 LOG flags 0 level 4 prefix "[UFW AUDIT] "Chain ufw-before-logging-input (1 references)
*target prot opt source destination *
LOG all -- 0.0.0.0/0 0.0.0.0/0 LOG flags 0 level 4 prefix "[UFW AUDIT] "Chain ufw-before-logging-output (1 references)
*target prot opt source destination *
LOG all -- 0.0.0.0/0 0.0.0.0/0 LOG flags 0 level 4 prefix "[UFW AUDIT] "Chain ufw-before-output (1 references)
*target prot opt source destination *
*ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 *
ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 ctstate RELATED,ESTABLISHED
*ufw-user-output all -- 0.0.0.0/0 0.0.0.0/0 *Chain ufw-logging-allow (0 references)
*target prot opt source destination *
LOG all -- 0.0.0.0/0 0.0.0.0/0 LOG flags 0 level 4 prefix "[UFW ALLOW] "Chain ufw-logging-deny (2 references)
*target prot opt source destination *
LOG all -- 0.0.0.0/0 0.0.0.0/0 ctstate INVALID LOG flags 0 level 4 prefix "[UFW AUDIT INVALID] "
LOG all -- 0.0.0.0/0 0.0.0.0/0 LOG flags 0 level 4 prefix "[UFW BLOCK] "Chain ufw-not-local (1 references)
*target prot opt source destination *
RETURN all -- 0.0.0.0/0 0.0.0.0/0 ADDRTYPE match dst-type LOCAL
RETURN all -- 0.0.0.0/0 0.0.0.0/0 ADDRTYPE match dst-type MULTICAST
RETURN all -- 0.0.0.0/0 0.0.0.0/0 ADDRTYPE match dst-type BROADCAST
ufw-logging-deny all -- 0.0.0.0/0 0.0.0.0/0 limit: avg 3/min burst 10
*DROP all -- 0.0.0.0/0 0.0.0.0/0 *Chain ufw-reject-forward (1 references)
*target prot opt source destination *Chain ufw-reject-input (1 references)
*target prot opt source destination *Chain ufw-reject-output (1 references)
*target prot opt source destination *Chain ufw-skip-to-policy-forward (0 references)
*target prot opt source destination *
*DROP all -- 0.0.0.0/0 0.0.0.0/0 *Chain ufw-skip-to-policy-input (7 references)
*target prot opt source destination *
*DROP all -- 0.0.0.0/0 0.0.0.0/0 *Chain ufw-skip-to-policy-output (0 references)
*target prot opt source destination *
*ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 *Chain ufw-track-forward (1 references)
*target prot opt source destination *Chain ufw-track-input (1 references)
*target prot opt source destination *Chain ufw-track-output (1 references)
*target prot opt source destination *
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 ctstate NEW
ACCEPT udp -- 0.0.0.0/0 0.0.0.0/0 ctstate NEWChain ufw-user-forward (1 references)
*target prot opt source destination *Chain ufw-user-input (1 references)
*target prot opt source destination *
DROP tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:8899
DROP udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:8899
REJECT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:53 reject-with tcp-reset
REJECT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:53 reject-with icmp-port-unreachable
REJECT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:631 reject-with tcp-reset
REJECT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:631 reject-with icmp-port-unreachable
REJECT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:54500 reject-with tcp-reset
REJECT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:54500 reject-with icmp-port-unreachable
REJECT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:56200 reject-with tcp-reset
REJECT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:56200 reject-with icmp-port-unreachable
REJECT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:54657 reject-with tcp-reset
REJECT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:54657 reject-with icmp-port-unreachableChain ufw-user-limit (0 references)
*target prot opt source destination *
LOG all -- 0.0.0.0/0 0.0.0.0/0 limit: avg 3/min burst 5 LOG flags 0 level 4 prefix "[UFW LIMIT BLOCK] "
REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-port-unreachableChain ufw-user-limit-accept (0 references)
*target prot opt source destination *
*ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 *Chain ufw-user-logging-forward (0 references)
*target prot opt source destination *Chain ufw-user-logging-input (0 references)
*target prot opt source destination *Chain ufw-user-logging-output (2 references)
*target prot opt source destination *
LOG tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:8899 limit: avg 3/min burst 10 LOG flags 0 level 4 prefix "[UFW BLOCK] "
RETURN tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:8899
LOG udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:8899 limit: avg 3/min burst 10 LOG flags 0 level 4 prefix "[UFW BLOCK] "
RETURN udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:8899Chain ufw-user-output (1 references)
*target prot opt source destination *
ufw-user-logging-output tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:8899
REJECT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:8899 reject-with tcp-reset
ufw-user-logging-output udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:8899
REJECT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:8899 reject-with icmp-port-unreachable
REJECT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:631 reject-with tcp-reset
REJECT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:631 reject-with icmp-port-unreachable
REJECT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:54500 reject-with tcp-reset
REJECT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:54500 reject-with icmp-port-unreachable
REJECT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:56200 reject-with tcp-reset
REJECT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:56200 reject-with icmp-port-unreachable
REJECT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:54657 reject-with tcp-reset
REJECT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:54657 reject-with icmp-port-unreachable
And these are sites which I've used for checking: