From 62cccb86cc10abd4f27fe6009c0e14df5aa0fd62 Mon Sep 17 00:00:00 2001 From: Leandro Pereira Date: Tue, 18 Jun 2019 07:36:01 -0700 Subject: Add information about SELinux and other LSMs --- modules/computer/os.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'modules/computer') 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; +} -- cgit v1.2.3