sesearch(1)
β¨ sesearch β the SELinux policy query tool, but make it a group chat π
okay so bestie, this is sesearch, and it lives in the SETools: SELinux Policy Analysis Tools collection (it's a section 1 manual page, if you're keeping track π). It's basically the search bar for SELinux policy rules, and it ate. Let's get into it.
πΈ SYNOPSIS πΈ
sesearch [OPTIONS] [OPTIONS] [EXPRESSION] [POLICY]
(yes the [OPTIONS] shows up twice, no that's not a typo, that's just how she is π
)
π¦ DESCRIPTION π¦
sesearch lets you search the rules inside a SELinux policy. That's the whole vibe. You have a policy, you have questions, she has answers. Periodt.
π POLICY π
So the policy argument is a single file containing a binary policy. On Linux systems it's usually named by version, like, for example, policy.30 β¨. On Android systems it's usually named sepolicy π.
If you don't hand her a policy file, sesearch will go looking for the policy running on the current system β she'll find it herself, she's resourceful like that. And if no policy can be found at all? She prints an error message and exits. No drama, just receipts. π
π§ EXPRESSIONS π§
You can throw her an expression with values for a given field (or fields) in a rule. And here's the iconic part: if no expression is specified, or if none of the fields you gave apply to a given rule type, then all rules of that type are considered to match the expression. So like, no filter = match everything. She's generous. π«Ά
π Type Enforcement Rule Types π
-Aβ findallowandallowxpermrules.--allowβ findallowrules.--auditallowβ findauditallowrules.--dontauditβ finddontauditrules.--allowxpermβ findallowxpermrules.--auditallowxpermβ findauditallowxpermrules.--dontauditxpermβ finddontauditxpermrules.-T,--type_transitionβ findtype_transitionrules.--type_memberβ findtype_memberrules.--type_changeβ findtype_changerules.
π RBAC Rule Types π
--role_allowβ findrole allowrules.--role_transitionβ findrole_transitionrules.
β οΈ note bestie: TE/MLS rule searches cannot be mixed with RBAC rule searches. They do NOT sit together at lunch. π
β MLS Rule Types β
--range_transitionβ findrange_transitionrules.
π Rule Fields π
-s NAME,--source NAMEβ find rules whereNAMEis the source type/role.-t NAME,--target NAMEβ find rules whereNAMEis the target type/role.-D NAME,--default NAMEβ find rules whereNAMEis the default type/role/level.-c NAME,--class NAMEβ find rules whereNAMEis the object class.-p P1[,P2,...] --perm P1[,P2...]β find rules that have at least one of the permissions you listed. Multiple permissions? Comma-separated list, babe. π-b BOOL[,B2,...],--bool BOOL[,B2,...]β find conditional rules that have the named Boolean chillin' in their conditional expression. Multiple Booleans = comma-separated list. And heads up: this option includes rules in both the true and false lists of the conditional. She does not pick sides. π
π₯ Search Options π₯
These extra options change up how the search goes down. Obsessed.
-dsβ a matching rule has to have the specified source attribute/type/role explicitly, instead of matching by attribute contents.-dtβ a matching rule has to have the specified target attribute/type/role explicitly, instead of matching by attribute contents.-ebβ a matching rule has to have all the specified Booleans, instead of matching any of the specified Boolean.-epβ a matching rule has to have exactly the specified permissions, instead of matching any of the specified permission.-exβ a matching rule has to have exactly the specified extended permissions, instead of matching any listed extended permission.-Spβ a matching rule has to have permissions that are a superset of the specified permissions, instead of matching any of the permissions.-rsβ use a regular expression for matching the source type/role.-rtβ use a regular expression for matching the target type/role.-rcβ use a regular expression for matching the object class.-rdβ use a regular expression for matching the default type/role.-rbβ use a regular expression for matching Booleans.
π OPTIONS π
-h,--helpβ print help information and exit. (she'll tell you about herself, go ahead, ask π«Ά)--versionβ print version information and exit.-v,--verboseβ print additional informational messages. Chatty era. π£οΈ--debugβ enable debugging output. For when you need the lore. π
π EXAMPLE π
List allow (and allowxperm) rules for accessing files labeled container_file_t from domains with attribute container_domain:
# sesearch -A -s container_domain -t container_file_t -c file
List allow and dontaudit rules for accessing chr_files labeled container_file_t, that are controlled by boolean container_use_devices:
# sesearch -A --dontaudit -t container_file_t -c chr_file -b container_use_devices
List dontaudit rules assigned via application_domain_type attribute (rules concerning specific types with that attribute are excluded):
# sesearch --dontaudit -s application_domain_type -ds
π AUTHOR π
Chris PeBenito <pebenito@ieee.org> β the icon, the moment, the main character. π
π BUGS π
Found something broken? Please report bugs via the SETools bug tracker: https://github.com/SELinuxProject/setools/issues β she wants to hear it, fr fr. π
π SEE ALSO π
apol(1), sediff(1), sedta(1), seinfo(1), seinfoflow(1) β the whole friend group, go say hi. β¨
SELinux Project π¦ 2016-02-20 π β that's the source, the version-of-record date, and the manual name <rainbow>sesearch(1)</rainbow>, mwah, signing off bestie π
π¦ where this page comes from
- centos-stream 10: setools-console 4.7.1-1.1.el10 Β· GPL-2.0-only
- debian trixie: setools 4.5.1-1.1+b1
- fedora 43: setools-console 4.6.0-2.fc43 Β· GPL-2.0-only
- fedora 43: setools-console 4.6.0-4.fc43 Β· GPL-2.0-only
- fedora 44: setools-console 4.6.0-5.fc44 Β· GPL-2.0-only
- fedora 44: setools-console 4.6.0-6.fc44 Β· GPL-2.0-only
- nixos 26.05: setools 4.6.0
- nixpkgs unstable: setools 4.7.1
- opensuse-leap 16.0: setools-console 4.5.1-160000.3.1 Β· GPL-2.0-only
- opensuse-leap 16.0: setools-console 4.5.1-160000.3.1 Β· GPL-2.0-only
- opensuse-leap 16.0: setools-console 4.5.1-160000.3.1 Β· GPL-2.0-only
- opensuse-leap 16.0: setools-console 4.5.1-160000.3.1 Β· GPL-2.0-only
- ubuntu questing: setools 4.6.0-2
- ubuntu resolute: setools 4.6.0-2build3
- ubuntu stonking: setools 4.7.1-1
- Copyright (c) 2016 Tresys Technology, LLC. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms