secolor.conf(8)
π secolor.conf β the SELinux color configuration file π
okay bestie, sit down, hydrate, and let me tell you about secolor.conf from the System Manager's Manual. it's giving "make your SELinux contexts pretty" and honestly? iconic. β¨
π NAME π
secolor.conf β the SELinux color configuration file. that's it, that's the whole name, she's simple and she knows it π
π¦ DESCRIPTION π¦
so. the file at /etc/selinux/{SELINUXTYPE}/secolor.conf is the configuation file (yes that typo is in the original, we're keeping her, she's part of the family now π«Ά) that controls the color that gets associated to the context components associated to the raw context passed by selinux_raw_context_to_color(3) β that's when context related info is gonna be displayed in color by an SELinux-aware application.
and like, where does selinux_raw_context_to_color(3) even get this color info? from the active policy secolor.conf file, as returned by selinux_colors_path(3). no cap, that's the whole pipeline. π₯
π FILE FORMAT π
the file format is literally this:
color color_name = #color_mask
[...]
context_component string = fg_color_name bg_color_name
[...]
and now the deets, one by one, because we do not skip:
colorβ the color keyword. each color entry is on a new line, bestie. one per line. no crowding. β¨color_nameβ a single word name for the color (e.g. red).color_maskβ a color mask starting with a hash (#) that describes the hexadecimal RGB colors, with black being#000000and white being#ffffff. she's hex, she's precise, she ate. πcontext_componentβ the context component name, and it must be one of the following:user,role,typeorrange- each
context_component string ...entry goes on a new line.
stringβ this is thecontext_componentstring that will be matched with the raw context component passed byselinux_raw_context_to_color(3).
a wildcard'*'may be used to match any undefined string for theuser,roleandtypecontext_componententries only. so don't go trying it onrange, she said what she said. π
fg_color_nameβ thecolor_namestring that will be used as the foreground color. acolor_maskmay also be used, so you have options, main character energy. πbg_color_nameβ thecolor_namestring that will be used as the background color. acolor_maskmay also be used here too. π
πΈ EXAMPLES πΈ
β¨ 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:c0.c1023 = black yellow
look at those ranges, one per line, living their best lives. β¨
β¨ 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:c0.c1023 = black white
user * = black white
role * = black white
type * = black white
notice how example 2 mixes color_name and color_mask in the same line? yeah. she's flexible like that. and yeah, tan is lowercase #d2b48c here vs #D2B48C in example 1 β both are exactly as written, don't @ me, hex doesn't care about your capitalization vibes. π
π₯ SEE ALSO π₯
go read those too, they're the supporting cast and they deserve their flowers. πΊ
and that's the whole page, bestie!! this was the SELinux API documentation, dated 08 April 2011 β yeah she's an elder but she's still serving. go forth and color your contexts, ily, bye!! πβ¨ππ¦πΈπ
π«Ά
π¦ where this page comes from
- centos-stream 10: mcstrans 3.11-1.el10 Β· GPL-2.0-or-later
- centos-stream 9: mcstrans 3.6-3.el9 Β· GPL+
- fedora 43: mcstrans 3.9-2.fc43 Β· GPL-2.0-or-later
- fedora 44: mcstrans 3.10-1.fc44 Β· GPL-2.0-or-later
- fedora 44: mcstrans 3.11-1.fc44 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms