fn: sgnd_ad_normalize_sssd_config
Purpose
Remove obsolete SSSD settings created by earlier SolidGroundUX AD-client releases and verify the resulting configuration before activation.
Behavior
- Reads /etc/sssd/sssd.conf through sudo so protected permissions are respected.
- Removes config_file_version only from the [sssd] section when present.
- Validates a protected temporary candidate with sssctl before replacing the live file.
- Preserves the existing owner, group, and permissions when replacing the live file.
- Restarts SSSD only after a validated change is installed.
- Restores the previous configuration when restart or activation validation fails.
- Routes diagnostics and status messages through SolidGroundUX logging primitives.
Side effects
May update /etc/sssd/sssd.conf and restart sssd.service.
Returns
- 0 when the configuration is already valid or is normalized successfully.
- 1 when the configuration cannot be read, validated, installed, or activated.
Usage
sgnd_ad_normalize_sssd_config
