GithubHelp home page GithubHelp logo

isabella232 / user-container-selinux Goto Github PK

View Code? Open in Web Editor NEW

This project forked from intel/user-container-selinux

0.0 0.0 0.0 51 KB

This repository contains user tailored container SELinux policies and the method for deploying these policies on Red Hat OpenShift Container Platform.

License: GNU General Public License v2.0

Dockerfile 100.00%

user-container-selinux's Introduction

Overview

This repository contains user-tailored container SELinux policies and the method for deploying these policies on Red Hat OpenShift Container Platform. These SELinux policies are required for the device plugins and the workloads leveraging these device plugins in intel-device-plugins-for-kubernetes to deploy on Red Hat OpenShift Container Platform. So the device plugin and workload do not have to run as the privileged container, see issue.

These policies create a new domain called container_device_t for user workloads, container_device_plugin_t for device plugins, and container_device_plugin_init_t for init containers. The device plugins are labeled as container_device_plugin_t by SELinux so they can be assigned the proper permissions to access the resources on the host. These policies are derived from the corresponding policies in container-selinux project.

Building and Installing the SELinux policies in RHEL

The following steps have been verified on RHEL 8.5. To build the policies, perform the following steps:

$ git clone https://github.com/intel/user-container-selinux.git
$ export USER_CONTAINER_SELINUX_SRC=/path/to/user-container-selinux
$ cd $USER_CONTAINER_SELINUX_SRC

Install necessary packages:

$ sudo dnf -y install make selinux-policy selinux-policy-devel container-selinux

Build policy binary:

$ make -f /usr/share/selinux/devel/Makefile

The command above creates a policy binary file named container_device.pp. To install the policy, run the following command:

$ sudo semodule -i container_device.pp

To verify that the policy is installed properly, run the command below to verify that it lists container_device.

$ sudo semodule -l | grep container_device 

The grep result of container_device shows that the policy is installed correctly.

Deploying the SELinux policy on a Red Hat OpenShift cluster

Before deploying the SELinux policy, make sure oc OpenShift CLI commands are installed on the development environment and verify that the OpenShift cluster is up and running. Also, make sure that the user has cluster-administrator privileges. The instructions for installing oc OpenShift CLI commands can be found here. This policy is tested on Red Hat OpenShift version 4.10. To deploy the policies on OpenShift Container Platform, run the following commands:

$ oc login (if not already logged in)
$ oc apply -f https://raw.githubusercontent.com/intel/user-container-selinux/main/policy-deployment.yaml

To verify that it is installed properly, run the command below and verify that it lists container_device.

$ oc debug node/<node-name>
$ chroot /host
$ semodule -l | grep container_device

Note: Replace <node-name> with the name of the node on which you would like to check SELinux policy status.

License

user-container-selinux policy code is under GNU GPL v2.0 license. See the LICENSE file for details.

Security

If any potential security vulnerabilities are discovered, please follow the guidelines in the security.md file.

user-container-selinux's People

Contributors

mregmi avatar chaitanya1731 avatar hershpa avatar vbedida79 avatar dougtw avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.