secolor.conf(5)
π secolor.conf β the SELinux color config file π
okay bestie, welcome to secolor.conf(5), the optional file that decides what colors your SELinux contexts get when some SELinux-aware app wants to show context info all pretty. it's giving aesthetic, it's giving rgb, it's giving "why is my terminal suddenly a rainbow". let's go π
β¨ NAME β¨
secolor.conf β the SELinux color configuration file π
πΈ DESCRIPTION πΈ
so like. this file is optional (yes, optional, you don't have to, but why wouldn't you). it controls the color that gets associated to the context components that come along with the raw context passed in by selinux_raw_context_to_color(3) β that's the function that kicks in when context-related info is gonna be displayed in color by an SELinux-aware application.
and where does selinux_raw_context_to_color(3) get this color info from? from the active policy secolor.conf file, as returned by selinux_colors_path(3). yes bestie, it's a whole little pipeline. slay. π₯
π¦ FILE FORMAT π¦
okay here's the whole vibe, the file format is literally this:
color color_name = #color_mask
[...]
context_component string = fg_color_name bg_color_name
[...]
and now the breakdown, one by one, no skipping, i promised π«Ά
colorβ the color keyword. every single color entry goes on a new line. one per line, no crowding.color_nameβ a single word name for the color (like,red. iconic).color_maskβ a color mask that starts with a hash (#) and describes the hexadecimal RGB colors. black is#000000and white is#ffffff. those two are your anchors, remember them.context_componentβ the context component name, and it must be one of these four, no other options bestie:userroletyperange
and each context_component string ... entry gets its own new line too.
stringβ this is the context_component string that gets matched against the raw context component passed byselinux_raw_context_to_color(3).
heads up: a wildcard'*'may be used to match any undefined string β but only for theuser,roleandtypecontext_component entries. that's it. nowhere else. don't try it. π
fg_color_nameβ thecolor_namestring that'll be used as the foreground color. acolor_maskmay also be used here, so you're not locked to named colors.bg_color_nameβ thecolor_namestring that'll be used as the background color. and yep, acolor_maskmay also be used here too.
π EXAMPLES π
Example 1 β¨
Example 1 entries are:
color black = #000000
color green = #008000
color yellow = #ffff00
color blue = #0000ff
color white = #ffffff
color red = #ff0000
color orange = #ffa500
color tan = #D2B48C
user * = black white
role * = white black
type * = tan orange
range s0-s0:c0.c1023 = black green
range s1-s1:c0.c1023 = white green
range s3-s3:c0.c1023 = black tan
range s5-s5:c0.c1023 = white blue
range s7-s7:c0.c1023 = black red
range s9-s9:c0.c1023 = black orange
range s15-s15:c0.c1023 = black yellow
(and yes bestie, #D2B48C is capital-D capital-B-C in this one. lowercase shows up in example 2. they're both exactly as written, i don't make the rules, i just transcribe them π)
Example 2 πΈ
Example 2 entries are:
color black = #000000
color green = #008000
color yellow = #ffff00
color blue = #0000ff
color white = #ffffff
color red = #ff0000
color orange = #ffa500
color tan = #d2b48c
user unconfined_u = #ff0000 green
role unconfined_r = red #ffffff
type unconfined_t = red orange
user user_u = black green
role user_r = white black
type user_t = tan red
user xguest_u = black yellow
role xguest_r = black red
type xguest_t = black green
user sysadm_u = white black
range s0-s0:c0.c1023 = black white
user * = black white
role * = black white
type * = black white
see how the fg_color_name and bg_color_name slots can take either a name or a raw #color_mask? user unconfined_u = #ff0000 green is doing exactly that. main character energy. π
π SEE ALSO π
selinux(8), selinux_raw_context_to_color(3), selinux_colors_path(3)
and that's the whole page, bestie!! π«Ά this was the SELinux API documentation, dated 08 April 2011 β so yes it's vintage, and yes it still eats. go forth and color your contexts. periodt. π β¨
π¦ where this page comes from
- alpine 3.24: libselinux-doc 3.10-r1 Β· Public-Domain
- centos-stream 10: libselinux-utils 3.11-3.el10 Β· LicenseRef-Fedora-Public-Domain
- centos-stream 9: libselinux-utils 3.6-5.el9 Β· Public Domain
- debian bookworm: selinux-utils 3.4-1+b6
- debian trixie: selinux-utils 3.8.1-1 Β· LicenseRef-public-domain
- fedora 43: libselinux-utils 3.9-5.fc43 Β· LicenseRef-Fedora-Public-Domain
- fedora 44: libselinux-utils 3.10-1.fc44 Β· LicenseRef-Fedora-Public-Domain
- fedora 44: libselinux-utils 3.11-2.fc44 Β· LicenseRef-Fedora-Public-Domain
- nixos 26.05: libselinux 3.10
- nixpkgs unstable: libselinux 3.11
- opensuse-leap 16.0: selinux-tools 3.8.1-160000.4.1 Β· SUSE-Public-Domain
- opensuse-leap 16.0: selinux-tools 3.8.1-160000.4.1 Β· SUSE-Public-Domain
- opensuse-leap 16.0: selinux-tools 3.8.1-160000.4.1 Β· SUSE-Public-Domain
- opensuse-leap 16.0: selinux-tools 3.8.1-160000.4.1 Β· SUSE-Public-Domain
- ubuntu jammy: selinux-utils 3.3-1build2
- ubuntu noble: selinux-utils 3.5-2ubuntu2 Β· LicenseRef-public-domain
- ubuntu noble: selinux-utils 3.5-2ubuntu2.1 Β· LicenseRef-public-domain
- ubuntu questing: selinux-utils 3.8.1-1build1
- ubuntu resolute: selinux-utils 3.9-4build1 Β· LicenseRef-public-domain
- ubuntu stonking: selinux-utils 3.11-2.1 Β· LicenseRef-public-domain
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms