I've noticed a strange interaction with custom ports and booleans. After setting a boolean, the list of ports for a particular type (which has been customized) shows duplicate entries.
$ semanage port -a -t http_port_t -p tcp 12345
$ semanage port -l | grep http_port_t
http_port_t tcp 12345, 80, 81, 443, 488, 8008, 8009, 8443, 9000
$ setsebool -P zebra_write_config false
$ semanage port -l | grep http_port_t
http_port_t tcp 12345, 12345, 80, 81, 443, 488, 8008, 8009, 8443, 9000
$ setsebool -P zebra_write_config false
$ semanage port -l | grep http_port_t
http_port_t tcp 12345, 12345, 12345, 80, 81, 443, 488, 8008, 8009, 8443, 9000
As can be seen, each time a boolean is set persistently (it doesn't matter which boolean or which state), the custom port 12345
is duplicated. Running semodule -B
clears the duplicates.
However, if only the local customizations are listed, the port is always listed only once:
$ semanage port -l -C
SELinux Port Type Proto Port Number
http_port_t tcp 12345
$ cat /etc/centos-release
CentOS Linux release 7.3.1611 (Core)
$ rpm -qf /usr/sbin/semanage
policycoreutils-python-2.5-11.el7_3.x86_64