Selinux policies
When system starts the policies are loaded into memory
Disclaimer
Don’t write your own policies for the apps.
Use Containers!
If they fail, use a tool like udica to label them.
If you absolutely have to, then clone context from the existing app, like Nginx.
List modules
Semanage
listing the predefained policies
Changing the context
- first tell selinux what should be the defult value
- *Then change it with restorecon**
Not standard ports
Sel has policies for the standard port
To change the policy to something different
range can be specyfied via -
-m
is to modyfie already existing policy-d
to delete-t
type-a
add
U can check for only your customization wiht -lC
$ semanage port -lC
-------------------------------------------------------
SELinux Port Type Proto Port Number
grafana_port_t tcp 3000
[root@localhost Notes]# [
Permissive policies
Booleans
It’s when u have to enable a option in the policy thats prevented by default Docks
- Set the boolen yourself
- Check boolens set by users
List of set boolens by user is stored in (old verisons)
/etc/selinux/targeted/modules/activeactive
Tip
Install setroubleshoot-server to deal with the message
[Selinux MAIN]({{\< ref “posts/SELinux.md”>}}) [Selinux Containers]({{\< ref “posts/redhat/selinux_containers.md”>}})