Skip to content

Instantly share code, notes, and snippets.

@Green-li
Last active November 2, 2021 06:40
Show Gist options
  • Save Green-li/a818732858ef9351c4f942c06853ca5f to your computer and use it in GitHub Desktop.
Save Green-li/a818732858ef9351c4f942c06853ca5f to your computer and use it in GitHub Desktop.
open port on SELinux Centos 7
1. Start with checking the port allocation and confirming the port you want to allow access to isn't already being used,
`sudo semanage port -l | grep http_port_t`
2. Allow access to port
`sudo semanage port -a -t http_port_t -p tcp 12345`
3. Check firewall ports passthrough
`sudo firewall-cmd --list-all`
4. Add port (and make it permanent)
`sudo firewall-cmd --zone=public --add-port=12345/tcp --permanent`
5. Reload firewall for the changes to take effect
`sudo firewall-cmd --reload`
6. Check firewall ports passthrough
`sudo firewall-cmd --list-all`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment