puppet-selinux icon indicating copy to clipboard operation
puppet-selinux copied to clipboard

Selinux port ensure => absent do not work with port_range

Open myMarck opened this issue 4 years ago • 2 comments

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 5.5.x
  • Ruby:
  • Distribution: CentOS
  • Module version: 3.2.0

How to reproduce (e.g Puppet code you use)

This example is based on mongo

semanage port -l | grep mongo mongod_port_t tcp 27017-27019, 28017-28019

selinux::port { 'mongo_port [27017,27019]': ensure => 'absent', seltype => 'mongod_port_t', protocol => 'tcp', port_range => [27017,27019], }

What are you seeing

Nothing happens

What behaviour did you expect instead

semanage port -l | grep mongo mongod_port_t tcp 28017-28019

Output log

This is from debug log Debug: /Stage[main]/Selinux::Config/before: before to Selinux::Port[mongo_port [27017,27019]] Debug: /Stage[main]/My_mongodb::Install/Selinux::Port[mongo_port [27017,27019]]/before: before to Anchor[selinux::module pre]

Any additional information you'd like to impart

myMarck avatar Jul 01 '20 11:07 myMarck

@myMarck are those port definitions local modifications using a previous Puppet manifest or in the system policy? The SELinux module can't remove system definitions, only local customizations.

oranenj avatar May 18 '21 10:05 oranenj

If you want to change the port definitions, you can add a definition that assigns the ports to some other SELinux type

oranenj avatar May 18 '21 10:05 oranenj