aboutsummaryrefslogtreecommitdiff
path: root/modules/computer
diff options
context:
space:
mode:
authorLeandro Pereira <leandro@hardinfo.org>2019-06-18 07:36:01 -0700
committerLeandro Pereira <leandro@hardinfo.org>2019-06-18 07:36:01 -0700
commit62cccb86cc10abd4f27fe6009c0e14df5aa0fd62 (patch)
tree65f057967d8fe749b1312c9a854ac529f6ba4498 /modules/computer
parent915233d5539e03fb7124af4f5a483b7c063d1a80 (diff)
Add information about SELinux and other LSMs
Diffstat (limited to 'modules/computer')
-rw-r--r--modules/computer/os.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/modules/computer/os.c b/modules/computer/os.c
index 49210307..5872ff82 100644
--- a/modules/computer/os.c
+++ b/modules/computer/os.c
@@ -490,3 +490,30 @@ computer_get_os(void)
return os;
}
+
+const gchar *
+computer_get_selinux(void)
+{
+ int r;
+ gboolean spawned = g_spawn_command_line_sync("selinuxenabled",
+ NULL, NULL, &r, NULL);
+
+ if (!spawned)
+ return _("Not installed");
+
+ if (r == 0)
+ return _("Enabled");
+
+ return _("Disabled");
+}
+
+gchar *
+computer_get_lsm(void)
+{
+ gchar *contents;
+
+ if (!g_file_get_contents("/sys/kernel/security/lsm", &contents, NULL, NULL))
+ return g_strdup(_("Unknown"));
+
+ return contents;
+}