Page MenuHomeDevCentral

Review SELinux context for Docker containers
Closed, ResolvedPublic

Description

First, svirt_sandbox_file_t is superseded by container_t

But more importantly, the following Salt block fails on Equatower:

selinux_context_etherpad_data:
  selinux.fcontext_policy_present:
    - name: /srv/etherpad
    - sel_type: svirt_sandbox_file_t

selinux_context_etherpad_data_applied:
  selinux.fcontext_policy_applied:
    - name: /srv/etherpad

Event Timeline

Use the new container_file_t solves the issue:

Equatower
$ semanage fcontext -a -t svirt_sandbox_file_t /srv/pad                                                                              
ValueError: Type svirt_sandbox_file_t is invalid, must be a file or device type
$ semanage fcontext -a -t container_file_t /srv/pad
(no error)
$ salt equatower state.apply roles/paas-docker/containers/jenkins
----------
          ID: selinux_context_jenkins_home
    Function: selinux.fcontext_policy_present
        Name: /srv/jenkins/cd/jenkins_home
      Result: True
     Comment: 
     Started: 12:54:16.919480
    Duration: 4048.744 ms
     Changes:   
              ----------
              new:
                  ----------
                  /srv/jenkins/cd/jenkins_home:
                      ----------
                      filetype:
                          all files
                      sel_type:
                          container_file_t
              old:
                  ----------
----------