I have decided to change the docker SELinux policy package on github.com from docker-selinux to container-selinux
The main reason I did this was after seeing the following on twitter. Docker, INC is requesting people not use docker prefix for packages on github.
Since the policy for container-selinux can be used for more container runtimes then just docker, this seems like a good idea. I plan on using it for OCID, and would consider plugging it into the RKT CRI.
I have modified all of the types inside of the policy to container_*. For instance docker_t is now container_runtime_t and docker_exec_t is container_runtime_exec_t.
I have taken advantage of the typealias capability of SELinux policy to allow the types to be preserved over an upgrade.
typealias container_runtime_t alias docker_t;
typealias container_runtime_exec_t alias docker_exec_t;
This means people can continue to use docker_t and docker_exec_t with tools but the kernel will automatically translate them to the primary name container_runtime_t and container_runtime_exec_t.
This policy is arriving today in rawhide in the container-selinux.rpm which obsoletes the docker-selinux.rpm. Once we are confident about the upgrade path, we will be rolling out the new packaging to Fedora and eventually to RHEL and CentOS.
Changing the types associated with container processes.
Secondarily I have begun to change the type names for running containers. Way back when I wrote the first policy for containers, we were using libvirt_lxc for launching containers, and we already had types defined for VMS launched out of libvirt. VM's were labeled svirt_t. When I decided to extend the policy for Containers I decided on extending svirt with lxc.
svirt_lxc, but I also wanted to show that it had full network. svirt_lxc_net_t. I labeled the content inside of the container svirt_sandbox_file_t.
Once containers exploded on the seen with the arrival of docker, I knew I had made a mistake choosng the types associated with container processes. Time to clean this up. I have submitted pull requests into selinux-policy to change these types to container_t and container_image_t.
typealias container_t alias svirt_lxc_net_t;
typealais container_image_t alias svirt_sandbox_file_t;
The old types will still work due to typealias, but I think it would become a lot easier for people to understand the SELinux types with simpler names. There is a lot of documentation and "google" knowledge out there about svirt_lxc_net_t and svirt_sandbox_file_t, which we can modify over time.
Luckily I have a chance at a do-over.