summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorSumit Bose <sbose@redhat.com>2025-07-15 19:24:36 +0200
committerSumit Bose <sbose@redhat.com>2025-07-15 19:37:33 +0200
commitb37f35dc7b283327f0fd92a0fbeb48dd5de3fe8d (patch)
tree893c03e7da5aa1fc5a435ac43d47cfe23ba48e90 /tools
parent7fa4b84b6c7a0cbc3fc45728939f6487246c84ba (diff)
enroll: restore SELinux file context of keytab files
If SELinux is enable in a system the file context of the keytab file might be important because it will restrict access for confined services and applications. Typically the system keytab /etc/krb5.keytab is handled by the system policy. But adcli will create e.g. /etc/krb5.keytab.domain.name for MSAs which should get the keytab specific file context as well. This patch adds a SELinux policy module for adcli which set the file context for files matching the pattern /etc/krb5.keytab.* and /etc/sssd/krb5.keytab.* . Unfortunately wildcards are not supported for automatic transitions in the kernel so that adcli has to call selinux_restorecon() manually on new or changed keytab files. Resolves: https://issues.redhat.com/browse/RHEL-78631
Diffstat (limited to 'tools')
-rw-r--r--tools/computer.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/computer.c b/tools/computer.c
index 7f59f50..318fafb 100644
--- a/tools/computer.c
+++ b/tools/computer.c
@@ -520,6 +520,8 @@ adcli_tool_computer_join (adcli_conn *conn,
else if (show_password)
dump_password (conn, enroll);
+ ensure_host_keytab_selinux_context (ADCLI_SUCCESS, enroll);
+
adcli_enroll_unref (enroll);
return 0;
@@ -653,6 +655,8 @@ adcli_tool_computer_update (adcli_conn *conn,
else if (show_password)
dump_password (conn, enroll);
+ ensure_host_keytab_selinux_context (ADCLI_SUCCESS, enroll);
+
adcli_enroll_unref (enroll);
return 0;
@@ -1271,6 +1275,8 @@ adcli_tool_computer_managed_service_account (adcli_conn *conn,
else if (show_password)
dump_password (conn, enroll);
+ ensure_host_keytab_selinux_context (ADCLI_SUCCESS, enroll);
+
adcli_enroll_unref (enroll);
return 0;