Petr Lautrbach | 50b1c97 | 2020-04-23 20:54:49 +0200 | [diff] [blame] | 1 | SELinux Userspace |
| 2 | ================= |
| 3 | |
Nicolas Iooss | e0d4025 | 2020-05-01 11:26:15 +0200 | [diff] [blame] | 4 |  |
Nicolas Iooss | 60bde94 | 2021-09-27 10:49:44 +0200 | [diff] [blame] | 5 | [](https://github.com/SELinuxProject/selinux/actions/workflows/run_tests.yml) |
| 6 | [](https://github.com/SELinuxProject/selinux/actions/workflows/vm_testsuite.yml) |
Evgeny Vereshchagin | e456424 | 2021-07-10 12:03:02 +0000 | [diff] [blame] | 7 | [](https://oss-fuzz-build-logs.storage.googleapis.com/index.html#selinux) |
| 8 | [](https://github.com/SELinuxProject/selinux/actions/workflows/cifuzz.yml) |
Nicolas Iooss | e0d4025 | 2020-05-01 11:26:15 +0200 | [diff] [blame] | 9 | |
Petr Lautrbach | 50b1c97 | 2020-04-23 20:54:49 +0200 | [diff] [blame] | 10 | Please submit all bug reports and patches to <selinux@vger.kernel.org>. |
| 11 | |
| 12 | Subscribe by sending "subscribe selinux" in the body of an email |
| 13 | to <majordomo@vger.kernel.org>. |
| 14 | |
Nicolas Iooss | e0d4025 | 2020-05-01 11:26:15 +0200 | [diff] [blame] | 15 | Archive of this mailing list is available on https://lore.kernel.org/selinux/. |
| 16 | |
| 17 | |
Petr Lautrbach | 50b1c97 | 2020-04-23 20:54:49 +0200 | [diff] [blame] | 18 | Installation |
| 19 | ------------ |
| 20 | |
Nicolas Iooss | e0d4025 | 2020-05-01 11:26:15 +0200 | [diff] [blame] | 21 | SELinux libraries and tools are packaged in several Linux distributions: |
| 22 | |
| 23 | * Alpine Linux (https://pkgs.alpinelinux.org/package/edge/testing/x86/policycoreutils) |
| 24 | * Arch Linux User Repository (https://aur.archlinux.org/packages/policycoreutils/) |
| 25 | * Buildroot (https://git.buildroot.net/buildroot/tree/package/policycoreutils) |
| 26 | * Debian and Ubuntu (https://packages.debian.org/sid/policycoreutils) |
| 27 | * Gentoo (https://packages.gentoo.org/packages/sys-apps/policycoreutils) |
| 28 | * RHEL and Fedora (https://src.fedoraproject.org/rpms/policycoreutils) |
| 29 | * Yocto Project (http://git.yoctoproject.org/cgit/cgit.cgi/meta-selinux/tree/recipes-security/selinux) |
| 30 | * and many more (https://repology.org/project/policycoreutils/versions) |
| 31 | |
| 32 | |
| 33 | Building and testing |
| 34 | -------------------- |
| 35 | |
Petr Lautrbach | 50b1c97 | 2020-04-23 20:54:49 +0200 | [diff] [blame] | 36 | Build dependencies on Fedora: |
| 37 | |
Nicolas Iooss | e0d4025 | 2020-05-01 11:26:15 +0200 | [diff] [blame] | 38 | ```sh |
| 39 | # For C libraries and programs |
| 40 | dnf install \ |
| 41 | audit-libs-devel \ |
| 42 | bison \ |
| 43 | bzip2-devel \ |
| 44 | CUnit-devel \ |
| 45 | diffutils \ |
| 46 | flex \ |
| 47 | gcc \ |
| 48 | gettext \ |
| 49 | glib2-devel \ |
| 50 | make \ |
| 51 | libcap-devel \ |
| 52 | libcap-ng-devel \ |
| 53 | pam-devel \ |
Christian Göttsche | 4ffe2df | 2021-11-23 19:32:49 +0100 | [diff] [blame] | 54 | pcre2-devel \ |
Nicolas Iooss | e0d4025 | 2020-05-01 11:26:15 +0200 | [diff] [blame] | 55 | xmlto |
Petr Lautrbach | 50b1c97 | 2020-04-23 20:54:49 +0200 | [diff] [blame] | 56 | |
Nicolas Iooss | e0d4025 | 2020-05-01 11:26:15 +0200 | [diff] [blame] | 57 | # For Python and Ruby bindings |
| 58 | dnf install \ |
| 59 | python3-devel \ |
| 60 | ruby-devel \ |
| 61 | swig |
| 62 | ``` |
| 63 | |
| 64 | Build dependencies on Debian: |
| 65 | |
| 66 | ```sh |
| 67 | # For C libraries and programs |
| 68 | apt-get install --no-install-recommends --no-install-suggests \ |
| 69 | bison \ |
| 70 | flex \ |
| 71 | gawk \ |
| 72 | gcc \ |
| 73 | gettext \ |
| 74 | make \ |
| 75 | libaudit-dev \ |
| 76 | libbz2-dev \ |
| 77 | libcap-dev \ |
| 78 | libcap-ng-dev \ |
| 79 | libcunit1-dev \ |
| 80 | libglib2.0-dev \ |
Christian Göttsche | 4ffe2df | 2021-11-23 19:32:49 +0100 | [diff] [blame] | 81 | libpcre2-dev \ |
Nicolas Iooss | e0d4025 | 2020-05-01 11:26:15 +0200 | [diff] [blame] | 82 | pkgconf \ |
| 83 | python3 \ |
| 84 | python3-distutils \ |
| 85 | systemd \ |
| 86 | xmlto |
| 87 | |
| 88 | # For Python and Ruby bindings |
| 89 | apt-get install --no-install-recommends --no-install-suggests \ |
| 90 | python3-dev \ |
| 91 | ruby-dev \ |
| 92 | swig |
| 93 | ``` |
Petr Lautrbach | 50b1c97 | 2020-04-23 20:54:49 +0200 | [diff] [blame] | 94 | |
| 95 | To build and install everything under a private directory, run: |
| 96 | |
Nicolas Iooss | e0d4025 | 2020-05-01 11:26:15 +0200 | [diff] [blame] | 97 | make clean distclean |
| 98 | |
| 99 | make DESTDIR=~/obj install install-rubywrap install-pywrap |
| 100 | |
Christian Göttsche | 7c73601 | 2020-05-04 19:55:01 +0200 | [diff] [blame] | 101 | On Debian `PYTHON_SETUP_ARGS=--install-layout=deb` needs to be set when installing the python wrappers in order to create the correct python directory structure. |
| 102 | |
Nicolas Iooss | e0d4025 | 2020-05-01 11:26:15 +0200 | [diff] [blame] | 103 | To run tests with the built libraries and programs, several paths (relative to `$DESTDIR`) need to be added to variables `$LD_LIBRARY_PATH`, `$PATH` and `$PYTHONPATH`. |
| 104 | This can be done using [./scripts/env_use_destdir](./scripts/env_use_destdir): |
| 105 | |
| 106 | DESTDIR=~/obj ./scripts/env_use_destdir make test |
| 107 | |
| 108 | Some tests require the reference policy to be installed (for example in `python/sepolgen`). |
| 109 | In order to run these ones, instructions similar to the ones in section `install` of [./.travis.yml](./.travis.yml) can be executed. |
Petr Lautrbach | 50b1c97 | 2020-04-23 20:54:49 +0200 | [diff] [blame] | 110 | |
| 111 | To install as the default system libraries and binaries |
| 112 | (overwriting any previously installed ones - dangerous!), |
| 113 | on x86_64, run: |
| 114 | |
| 115 | make LIBDIR=/usr/lib64 SHLIBDIR=/lib64 install install-pywrap relabel |
| 116 | |
| 117 | or on x86 (32-bit), run: |
| 118 | |
| 119 | make install install-pywrap relabel |
| 120 | |
| 121 | This may render your system unusable if the upstream SELinux userspace |
| 122 | lacks library functions or other dependencies relied upon by your |
| 123 | distribution. If it breaks, you get to keep both pieces. |
| 124 | |
Nicolas Iooss | e0d4025 | 2020-05-01 11:26:15 +0200 | [diff] [blame] | 125 | |
William Roberts | ddcd6d1 | 2020-06-08 17:38:16 -0500 | [diff] [blame] | 126 | ## Setting CFLAGS |
| 127 | |
| 128 | Setting CFLAGS during the make process will cause the omission of many defaults. While the project strives |
| 129 | to provide a reasonable set of default flags, custom CFLAGS could break the build, or have other undesired |
| 130 | changes on the build output. Thus, be very careful when setting CFLAGS. CFLAGS that are encouraged to be |
| 131 | set when overriding are: |
| 132 | |
| 133 | - -fno-semantic-interposition for gcc or compilers that do not do this. clang does this by default. clang-10 and up |
| 134 | will support passing this flag, but ignore it. Previous clang versions fail. |
| 135 | |
| 136 | |
Nicolas Iooss | e0d4025 | 2020-05-01 11:26:15 +0200 | [diff] [blame] | 137 | macOS |
| 138 | ----- |
| 139 | |
Petr Lautrbach | 50b1c97 | 2020-04-23 20:54:49 +0200 | [diff] [blame] | 140 | To install libsepol on macOS (mainly for policy analysis): |
| 141 | |
| 142 | cd libsepol; make PREFIX=/usr/local install |
| 143 | |
| 144 | This requires GNU coreutils: |
| 145 | |
| 146 | brew install coreutils |