How to assign a different context to a port with pre-existing SELinux context as per default policy?
Issue
-
A port is mapped with pre-existing SELinux context:
- Attempting to remove the context fails
# semanage port -d -t printer_port_t -p tcp 515 ValueError: Port tcp/515 is defined in policy, cannot be deleted
- Attempting to add a new context fails
# semanage port -d -t printer_port_t -p tcp 515 ValueError: Port tcp/515 is already defined.
Environment
- Red Hat Enterprise Linux 8
- SELinux
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.