segraph_query(1)
π segraph_query β the SELinux policy analysis tool bestie you didn't know you needed
okay so real talk, this is segraph_query(1), and it lives in the SELinux Policy Analysis Tool family. it's a little command-line cutie that reads your policy graph and answers questions about it. no cap, it's giving detective energy πβ¨
β¨ NAME β¨
segraph_query β SELinux policy analysis tool
πΈ SYNOPSIS πΈ
segraph_query [-h] [-d POLICY_GRAPH2] POLICY_GRAPH QUERY_FUNCTIONS
π¦ DESCRIPTION π¦
so basically it analyses a policy graph using whatever query functions you hand it. you give it a graph, you give it questions, it gives you answers. main character energy fr fr π
the query functions available rn:
write_executableβ finds all types that correspond to executables and that can be written to. it lists a dictionary where the executable types are the keys and the types with write permission are the values. so like, "who can scribble on which binary" vibes πtransition_writeβ finds domain transitions via entrypoints that the source domain can rewrite. and the way that this effectively increases the reach of the source domain by the access rights of the target domain?? iconic. it lists triplets of(source domain, target domain, entrypoint)write_to_securityβ finds domains that are allowed write access to "security related" types. it lists the domains with that specified write access, plus lists of the affected types (the security types that can be written to). lowkey important, highkey scary π
β¨ OPTIONS β¨
π Positional arguments
POLICY_GRAPHβ the policy graph file. the whole reason we're here π«ΆQUERY_FUNCTIONSβ a comma separated list of the query functions you want executed. yes, comma separated, not space separated, don't do it to yourself π
π Optional arguments
-h,--helpβ show the help message and dip out. classic β¨-d POLICY_GRAPH2,--diff POLICY_GRAPH2β another policy graph file, but this one's for comparison. bring a friend so the tool can compare them π
π EXAMPLE π
check a policy graph (one you made using sebuild_graph) with the write_executable function:
$ graph_query.py graph write_executable
show the consequences of a change in policy (where graph2 was created after the change):
$ segraph_query graph2 write_executable,transition_write,write_to_security -d graph
π psst β the first example literally says graph_query.py, so keep it exactly like that when you run it. i don't make the rules, i just vibe with them.
π SEE ALSO π
sebuild_graph(1) β go make a graph first, bestie, you can't query what doesn't exist π
π AUTHOR π
Vit Mojzis <vmojzis@redhat.com>
and that's the whole page, periodt. this version came from the SELinux Policy Analysis Tool source, dated 2017-02-09, and it's segraph_query(1) through and through. slay, stay safe, and never write to your security types without thinking twice πβ¨π¦
π¦ where this page comes from
- fedora 43: sepolicy_analysis 0.1-32.fc43 Β· GPL-3.0-only
- fedora 44: sepolicy_analysis 0.1-33.fc44 Β· GPL-3.0-only
- Copyright 2016 Vit Mojzis, vmojzis@redhat.com
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms