SECON(1)

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

πŸ’– SECON β€” bestie, let's go look at an SELinux context πŸ’–

okay so this is secon, a manual page from the General Commands Manual squad, and it does exactly one thing but it does it beautifully: it shows you an SELinux context, and it can grab that context from a file, a program, or from you, the user. πŸ‘‘


✨ SYNOPSIS ✨

secon [-hVurtscmPRfLp] [CONTEXT]
[--file] FILE
[--link] FILE
[--pid] PID

🌸 DESCRIPTION 🌸

So like. A context is a whole vibe, right? And secon lets you see a part of a context. 🫢 The context gets taken from a file, a pid, your own user input, or β€” plot twist β€” from the context that secon itself was originally executed in. main character energy fr.

Here's the full menu of flags, no skips, no cap:

  • -V, --version β€” shows the current version of secon
  • -h, --help β€” shows the usage information for secon
  • -P, --prompt β€” outputs data in a format suitable for a prompt
  • -C, --color β€” outputs data with the associated ANSI color codes (this one requires -P, just so you know πŸ’…)
  • -u, --user β€” show the user of the security context
  • -r, --role β€” show the role of the security context
  • -t, --type β€” show the type of the security context
  • -s, --sensitivity β€” show the sensitivity level of the security context
  • -c, --clearance β€” show the clearance level of the security context
  • -m, --mls-range β€” show the sensitivity level and clearance, as a range, of the security context
  • -R, --raw β€” outputs the sensitivity level and clearance in an untranslated format.
  • -f, --file β€” gets the context from the specified file FILE
  • -L, --link β€” gets the context from the specified file FILE (and no, it doesn't follow symlinks πŸš«πŸ”—)
  • -p, --pid β€” gets the context from the specified process PID
  • --pid-exec β€” gets the exec context from the specified process PID
  • --pid-fs β€” gets the fscreate context from the specified process PID
  • --pid-key β€” gets the key context from the specified process PID
  • --current, --self β€” gets the context from the current process
  • --current-exec, --self-exec β€” gets the exec context from the current process
  • --current-fs, --self-fs β€” gets the fscreate context from the current process
  • --current-key, --self-key β€” gets the key context from the current process
  • --parent β€” gets the context from the parent of the current process
  • --parent-exec β€” gets the exec context from the parent of the current process
  • --parent-fs β€” gets the fscreate context from the parent of the current process
  • --parent-key β€” gets the key context from the parent of the current process

Now, the extra argument CONTEXT? You may hand it over, and it gets used if no options have been specified to make secon pull its context from another source. πŸŽ€

And if that argument is -, then the context will be read from stdin. πŸ‘€

If there's no argument at all, secon will try reading a context from stdin β€” but only if that stdin is not a tty. If it is a tty, then secon acts as though --self had been passed. iconic behaviour honestly.

Heads up bestie: if none of --user, --role, --type, --level or --mls-range is passed. Then all of them will be output. πŸ’€ (yes, all of them, every single one, we're going full send)

🌈 EXAMPLE 🌈

Show SElinux context of the init process

# secon --pid 1

Parse the type portion of given security context

# secon -t system_u:object_r:httpd_sys_rw_content_t:s0

πŸ”₯ SEE ALSO πŸ”₯


πŸ‘‘ AUTHORS πŸ‘‘

  • James Antill (james.antill@redhat.com)

and that's the whole page, bestie!! this one comes to you from Security Enhanced Linux, dated April 2006, and it's SECON(1) the whole way down. go forth and inspect some contexts, you absolute legend πŸ’œπŸ¦‹βœ¨