sesearch(1)

πŸ“¦
version 4.7.1 Β· 4 versions
, in centos-stream 10, debian trixie, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu questing, ubuntu resolute, ubuntu stonking

✨ 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 β€” find allow and allowxperm rules.
  • --allow β€” find allow rules.
  • --auditallow β€” find auditallow rules.
  • --dontaudit β€” find dontaudit rules.
  • --allowxperm β€” find allowxperm rules.
  • --auditallowxperm β€” find auditallowxperm rules.
  • --dontauditxperm β€” find dontauditxperm rules.
  • -T, --type_transition β€” find type_transition rules.
  • --type_member β€” find type_member rules.
  • --type_change β€” find type_change rules.

🌈 RBAC Rule Types 🌈

  • --role_allow β€” find role allow rules.
  • --role_transition β€” find role_transition rules.
⚠️ 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 β€” find range_transition rules.

πŸŽ€ Rule Fields πŸŽ€

  • -s NAME, --source NAME β€” find rules where NAME is the source type/role.
  • -t NAME, --target NAME β€” find rules where NAME is the target type/role.
  • -D NAME, --default NAME β€” find rules where NAME is the default type/role/level.
  • -c NAME, --class NAME β€” find rules where NAME is 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 πŸ’–