From 3aac0fb4412cb1536273c695868b7849fbfa96a6 Mon Sep 17 00:00:00 2001 From: Justin Stephenson Date: Thu, 25 Jan 2024 12:37:43 -0500 Subject: [PATCH] Config: Update to authselect with-tlog feature Use runtime detection to determine the authselect feature command to execute, this is done by checking the output of 'authselect list-features' as the with-tlog option will only be F40/RHEL10+ --- src/config.jsx | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/config.jsx b/src/config.jsx index ead9c87e..b3b8ea58 100644 --- a/src/config.jsx +++ b/src/config.jsx @@ -430,6 +430,7 @@ class SssdConfig extends React.Component { exclude_groups: "", groups: "", submitting: false, + authselectWithTlog: undefined }; } @@ -445,8 +446,10 @@ class SssdConfig extends React.Component { confSave(obj) { const chmod_cmd = ["chmod", "600", "/etc/sssd/conf.d/sssd-session-recording.conf"]; - /* Update nsswitch, this will fail on RHEL8/F34 and lower as 'with-files-domain' feature is not added there */ - const authselect_cmd = ["authselect", "select", "sssd", "with-files-domain", "--force"]; + let authselect_cmd = ["authselect", "select", "sssd", "with-files-domain", "--force"]; + if (this.state.authselectWithTlog) { + authselect_cmd = ["authselect", "select", "sssd", "with-tlog", "--force"]; + } this.setState({ submitting: true }); this.file.replace(obj) .then(tag => { @@ -501,6 +504,19 @@ class SssdConfig extends React.Component { .catch(error => { console.log("Error: " + error); }); + + /* Check authselect features */ + cockpit.spawn(['authselect', 'list-features', 'sssd'], { err: 'message' }) + .then(features => { + if (features.toLowerCase().includes('with-tlog')) { + this.setState({ authselectWithTlog: true }); + } else { + this.setState({ authselectWithTlog: false }); + } + }) + .catch(e => { + console.log("Error getting authselect features: " + e.toString()); + }); } handleSubmit(e) {