does fedora comes with preconfigured firewall or i need to do so like ufw or iptable or firewalld if yes then how to check and if no is there a good documentation available.
yes, it has a firewall, and the default is firewalld.
Using firewalld :: Fedora Docs.
firewall-cmd --list-all FedoraWorkstation (active) target: default icmp-block-inversion: no interfaces: wlp0s19f2u1 sources: services: dhcpv6-client mdns samba-client ssh ports: 1025-65535/udp 1025-65535/tcp protocols: forward: no masquerade: no forward-ports: source-ports: icmp-blocks: rich rules:
this ports are opened i want to close all ports and open 22 80 443 9090 53 etc and close all other ports i actually does not understand if those are opened or not
You can close these ports permanently using the following command:
sudo firewall-cmd --permanent --remove-port=$PORT/tcp
Where $PORT is the one you want to remove(you can specify a range using a hyphen like you see in the list) and you can change the protocol as well
my recommendation would be to use the firewalld gui if on desktop and just use nftables via config file if on server, and/or nftables via config file for both desktop and server. I find it easier/clearer overall.