Skip to content

Commit

Permalink
Config: Update to authselect with-tlog feature
Browse files Browse the repository at this point in the history
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+
  • Loading branch information
justin-stephenson committed Jan 29, 2024
1 parent 0365f24 commit 3aac0fb
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions src/config.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,7 @@ class SssdConfig extends React.Component {
exclude_groups: "",
groups: "",
submitting: false,
authselectWithTlog: undefined
};
}

Expand All @@ -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 => {
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 3aac0fb

Please sign in to comment.