|
Name |
|
Date |
Size |
#Lines |
LOC |
| .. | | - | - |
| .circleci/ | | 03-May-2024 | - | 41 | 28 |
| .github/workflows/ | | 03-May-2024 | - | 265 | 211 |
| checkpolicy/ | | 03-May-2024 | - | 13,260 | 11,242 |
| dbus/ | | 03-May-2024 | - | 672 | 546 |
| gui/ | | 03-May-2024 | - | 7,969 | 7,181 |
| libselinux/ | | 03-May-2024 | - | 35,611 | 28,403 |
| libsemanage/ | | 03-May-2024 | - | 39,825 | 28,452 |
| libsepol/ | | 03-May-2024 | - | 134,852 | 101,125 |
| mcstrans/ | | 03-May-2024 | - | 6,263 | 4,789 |
| policycoreutils/ | | 03-May-2024 | - | 577,215 | 457,261 |
| python/ | | 03-May-2024 | - | 57,786 | 49,191 |
| restorecond/ | | 03-May-2024 | - | 2,033 | 1,464 |
| sandbox/ | | 03-May-2024 | - | 2,439 | 1,932 |
| scripts/ | | 03-May-2024 | - | 727 | 448 |
| secilc/ | | 03-May-2024 | - | 9,565 | 7,717 |
| semodule-utils/ | | 03-May-2024 | - | 1,484 | 1,232 |
| .gitignore | D | 03-May-2024 | 277 | 28 | 25 |
| .travis.yml | D | 03-May-2024 | 317 | 15 | 8 |
| Android.bp | D | 03-May-2024 | 1.4 KiB | 44 | 41 |
| CONTRIBUTING.md | D | 03-May-2024 | 3.6 KiB | 88 | 61 |
| CleanSpec.mk | D | 03-May-2024 | 310 | 7 | 3 |
| METADATA | D | 03-May-2024 | 43 | 4 | 3 |
| MODULE_LICENSE_GPL | D | 03-May-2024 | 0 | | |
| Makefile | D | 03-May-2024 | 1.2 KiB | 52 | 45 |
| NOTICE | D | 03-May-2024 | 106.1 KiB | 2,061 | 1,704 |
| OWNERS | D | 03-May-2024 | 56 | 4 | 3 |
| README.android | D | 03-May-2024 | 1.7 KiB | 42 | 31 |
| README.md | D | 03-May-2024 | 4.8 KiB | 147 | 108 |
| VERSION | D | 03-May-2024 | 4 | 2 | 1 |
| lgtm.yml | D | 03-May-2024 | 108 | 6 | 5 |
README.android
1This fork of Android differs in the following ways:
2 - README.android
3 - All Android.mk and Android.bp files
4 - ALL MODULE_LICENSE_* files
5 - libselinux/include/selinux/android.h
6 - libselinux/src/android/android.c
7
8All other changes should be upstreamed to selinux as
9Android no longer carries changes outside of those files.
10
11The upstream project can be found at:
12https://github.com/SELinuxProject/selinux
13
14Thus, since all changes are in separate files, updates merged from
15upstream should occur with no merge conflicts.
16
17This fork differs from upstream libselinux in at least the following ways:
18
19* The Android fork omits compiling many of the src files and specifies
20 custom build configurations. The exact details, are encoded in the
21 Android.bp and Android.mk files.
22
23* The SELinux policy files are all located in / rather than under
24 /etc/selinux since /etc is not available in Android until /system
25 is mounted and use fixed paths, not dependent on /etc/selinux/config.
26
27* The kernel policy file (sepolicy in Android, policy.N in Linux) does
28 not include a version suffix since Android does not need to support
29 booting multiple kernels.
30
31* The policy loading logic does not support automatic downgrading of
32 the kernel policy file to a version known to the kernel, since this
33 requires libsepol on the device and is only needed to support mixing
34 and matching kernels and userspace easily.
35
36* restorecon functionality, including recursive restorecon, has been
37 been upstreamed as selinux_restorecon(), but there are residual
38 differences between it and selinux_android_restorecon().
39
40* Support for seapp_contexts, a new Android-specific SELinux
41 configuration file has been added within android.c.
42
README.md
1SELinux Userspace
2=================
3
4
5[](https://github.com/SELinuxProject/selinux/actions/workflows/run_tests.yml)
6[](https://github.com/SELinuxProject/selinux/actions/workflows/vm_testsuite.yml)
7[](https://oss-fuzz-build-logs.storage.googleapis.com/index.html#selinux)
8[](https://github.com/SELinuxProject/selinux/actions/workflows/cifuzz.yml)
9
10Please submit all bug reports and patches to <selinux@vger.kernel.org>.
11
12Subscribe by sending "subscribe selinux" in the body of an email
13to <majordomo@vger.kernel.org>.
14
15Archive of this mailing list is available on https://lore.kernel.org/selinux/.
16
17
18Installation
19------------
20
21SELinux 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
33Building and testing
34--------------------
35
36Build dependencies on Fedora:
37
38```sh
39# For C libraries and programs
40dnf 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 \
54 pcre2-devel \
55 xmlto
56
57# For Python and Ruby bindings
58dnf install \
59 python3-devel \
60 ruby-devel \
61 swig
62```
63
64Build dependencies on Debian:
65
66```sh
67# For C libraries and programs
68apt-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 \
81 libpcre2-dev \
82 pkgconf \
83 python3 \
84 python3-distutils \
85 systemd \
86 xmlto
87
88# For Python and Ruby bindings
89apt-get install --no-install-recommends --no-install-suggests \
90 python3-dev \
91 ruby-dev \
92 swig
93```
94
95To build and install everything under a private directory, run:
96
97 make clean distclean
98
99 make DESTDIR=~/obj install install-rubywrap install-pywrap
100
101On 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
103To 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`.
104This can be done using [./scripts/env_use_destdir](./scripts/env_use_destdir):
105
106 DESTDIR=~/obj ./scripts/env_use_destdir make test
107
108Some tests require the reference policy to be installed (for example in `python/sepolgen`).
109In order to run these ones, instructions similar to the ones in section `install` of [./.travis.yml](./.travis.yml) can be executed.
110
111To install as the default system libraries and binaries
112(overwriting any previously installed ones - dangerous!),
113on x86_64, run:
114
115 make LIBDIR=/usr/lib64 SHLIBDIR=/lib64 install install-pywrap relabel
116
117or on x86 (32-bit), run:
118
119 make install install-pywrap relabel
120
121This may render your system unusable if the upstream SELinux userspace
122lacks library functions or other dependencies relied upon by your
123distribution. If it breaks, you get to keep both pieces.
124
125
126## Setting CFLAGS
127
128Setting CFLAGS during the make process will cause the omission of many defaults. While the project strives
129to provide a reasonable set of default flags, custom CFLAGS could break the build, or have other undesired
130changes on the build output. Thus, be very careful when setting CFLAGS. CFLAGS that are encouraged to be
131set 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
137macOS
138-----
139
140To install libsepol on macOS (mainly for policy analysis):
141
142 cd libsepol; make PREFIX=/usr/local install
143
144This requires GNU coreutils:
145
146 brew install coreutils
147