English Spanish
Closing a port Cerrando un puerto
When an open port is no longer needed, close that port in firewalld. It is highly recommended to close all unnecessary ports as soon as they are not used because leaving a port open represents a security risk. Cuando ya no es necesario un puerto abierto, cierre ese puerto en firewalld. Es altamente recomendable cerrar todos los puertos innecesarios tan pronto como dejen de usarse puesto que dejar un puerto abierto representa un alto riesgo para la seguridad.
Closing a port using the command line Cerrando un puerto usando la línea de comandos
To close a port, remove it from the list of allowed ports: Para cerrar un puerto, bórrelo de la lista de puertos permitidos:
List all allowed ports:
$ firewall-cmd --list-ports
$ firewall-cmd --list-ports
This command will only give you a list of ports that have been opened as ports. You will not be able to see any open ports that have been opened as a service. Therefore, you should consider using the --list-all option instead of --list-ports.
Remove the port from the allowed ports to close it for the incoming traffic:
$ sudo firewall-cmd --remove-port=port-number/port-type
Make the new settings persistent: Hacer persistentes los nuevos ajustes:
$ sudo firewall-cmd --runtime-to-permanent
$ sudo firewall-cmd --runtime-to-permanent