From abee9523b5c0c0b3be913a6bf57fb1df6be24728 Mon Sep 17 00:00:00 2001 From: cyqsimon <28627918+cyqsimon@users.noreply.github.com> Date: Mon, 27 May 2024 13:37:52 +0800 Subject: [PATCH 1/3] matchpathcon: add page --- pages/linux/matchpathcon.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 pages/linux/matchpathcon.md diff --git a/pages/linux/matchpathcon.md b/pages/linux/matchpathcon.md new file mode 100644 index 00000000000000..d5d16c7d021193 --- /dev/null +++ b/pages/linux/matchpathcon.md @@ -0,0 +1,17 @@ +# matchpathcon + +> Lookup the persistent SELinux security context setting of a path. +> See also: `semanage-fcontext`, `secon`, `chcon`, `restorecon`. +> More information: . + +- Lookup the persistent security context setting of a path: + +`matchpathcon {{/path/to/file}}` + +- Restrict lookup to settings on a specific file type: + +`matchpathcon -m {{file|dir|pipe|chr_file|blk_file|lnk_file|sock_file}} {{/path/to/file}}` + +- [V]erify that the persistent and current security context of a path agree: + +`matchpathcon -V {{/path/to/file}}` From a7e36fe1afad8c4bfbfb73168dbadfb460a965cf Mon Sep 17 00:00:00 2001 From: cyqsimon <28627918+cyqsimon@users.noreply.github.com> Date: Mon, 27 May 2024 14:09:48 +0800 Subject: [PATCH 2/3] secon: add page --- pages/linux/secon.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 pages/linux/secon.md diff --git a/pages/linux/secon.md b/pages/linux/secon.md new file mode 100644 index 00000000000000..db979b826d1b28 --- /dev/null +++ b/pages/linux/secon.md @@ -0,0 +1,25 @@ +# secon + +> Get the SELinux security context of a file, pid, current execution context, or a context specification. +> See also: `semanage`, `runcon`, `chcon`. +> More information: . + +- Get the security context of the current execution context: + +`secon` + +- Get the current security context of a process: + +`secon --pid {{1}}` + +- Get the current security context of a file, resolving all intermediate symlinks: + +`secon --file {{path/to/file_or_directory}}` + +- Get the current security context of a symlink itself (i.e. do not resolve): + +`secon --link {{path/to/symlink}}` + +- Parse and explain a context specification: + +`secon {{system_u:system_r:container_t:s0:c899,c900}}` From b8b255980d2f955c6221754509c883df076d0303 Mon Sep 17 00:00:00 2001 From: cyqsimon <28627918+cyqsimon@users.noreply.github.com> Date: Mon, 27 May 2024 16:59:37 +0800 Subject: [PATCH 3/3] Explicitly state "absolute path" Co-authored-by: Juri Dispan --- pages/linux/matchpathcon.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/linux/matchpathcon.md b/pages/linux/matchpathcon.md index d5d16c7d021193..ed451678dccbe1 100644 --- a/pages/linux/matchpathcon.md +++ b/pages/linux/matchpathcon.md @@ -4,7 +4,7 @@ > See also: `semanage-fcontext`, `secon`, `chcon`, `restorecon`. > More information: . -- Lookup the persistent security context setting of a path: +- Lookup the persistent security context setting of an absolute path: `matchpathcon {{/path/to/file}}`