Enable SSSD files domain unconditionally

Use authselect to update nsswitch to work with files domain
This commit is contained in:
Justin Stephenson 2022-04-06 10:18:21 -04:00
parent da32f4f344
commit bab09074b3

View file

@ -397,6 +397,7 @@ class SssdConfig extends React.Component {
this.handleSubmit = this.handleSubmit.bind(this); this.handleSubmit = this.handleSubmit.bind(this);
this.setConfig = this.setConfig.bind(this); this.setConfig = this.setConfig.bind(this);
this.confSave = this.confSave.bind(this); this.confSave = this.confSave.bind(this);
this.restartSSSD = this.restartSSSD.bind(this);
this.file = null; this.file = null;
this.state = { this.state = {
scope: "", scope: "",
@ -408,26 +409,34 @@ class SssdConfig extends React.Component {
}; };
} }
restartSSSD() {
let sssd_cmd = ["systemctl", "restart", "sssd"];
cockpit.spawn(sssd_cmd, { superuser: "require" });
this.setState({ submitting: false });
}
confSave(obj) { confSave(obj) {
let 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 */
let authselect_cmd = ["authselect", "select", "sssd", "with-files-domain", "--force"];
this.setState({ submitting: true }); this.setState({ submitting: true });
this.file.replace(obj).done(() => { this.file.replace(obj).done(() => {
cockpit.spawn( cockpit.spawn(chmod_cmd, { superuser: "require" })
["chmod", "600", "/etc/sssd/conf.d/sssd-session-recording.conf"], .then(() => {
{ superuser: "require" }).done(() => { cockpit.spawn(authselect_cmd, { superuser: "require" })
cockpit.spawn( .then(this.restartSSSD)
["systemctl", "restart", "sssd"], .catch(this.restartSSSD);
{ superuser: "require" }).done(() => { });
this.setState({ submitting: false });
})
.fail((data) => console.log(data));
})
.fail((data) => console.log(data));
}); });
} }
setConfig(data) { setConfig(data) {
if (data === null) { if (data === null) {
const obj = {}; const obj = {};
/* Always enable files domain */
obj.sssd = {};
obj.sssd.enable_files_domain = "true";
obj.sssd.services = "nss";
obj.session_recording = {}; obj.session_recording = {};
obj.session_recording.scope = "none"; obj.session_recording.scope = "none";
this.confSave(obj); this.confSave(obj);
@ -459,6 +468,9 @@ class SssdConfig extends React.Component {
handleSubmit(e) { handleSubmit(e) {
const obj = {}; const obj = {};
obj.sssd = {};
obj.sssd.enable_files_domain = "true";
obj.sssd.services = "nss";
obj.session_recording = {}; obj.session_recording = {};
obj.session_recording.scope = this.state.scope; obj.session_recording.scope = this.state.scope;
switch (this.state.scope) { switch (this.state.scope) {