Cookbooks
selinux
documentation
Selinux Port

Back to resource list

selinux_port

Allows assigning a network port to a certain SELinux context, e.g. for running a webserver on a non-standard port.

Actions

ActionDescription
:manage(Default) Assigns the port to the right context regardless of previous state.
:addAssigns the port context if not set.(-a)
:modifyUpdates the port context if previously set.(-m)
:deleteRemoves the port context if set. (-d)

Properties

NameTypeDefaultDescription
portStringResource nameThe port in question.
protocolStringEither tcp or udp.
secontextStringThe SELinux context to assign the port to.

Examples

# Allow nginx/apache to bind to port 5678 by giving it the http_port_t context
selinux_port '5678' do
 protocol 'tcp'
 secontext 'http_port_t'
end