SCAutolib.models.authselect
This module provides methods allowing to configure the system for smart-card
authentication using the authselect tool.
It is implemented as a context manager (Authselect class), which
ensures that system configurations are properly set up upon entry and
restored to their original state upon exit.
The module interacts with authselect(8) to apply the sssd profile
with specified features (for more information see manual page for
authselect(8)).
Classes
- class Authselect(required=False, lock_on_removal=False, mk_homedir=False, sudo=False)[source]
Manages the
authselectconfiguration of the system for smart card authentication. This class is designed to be used as a context manager, ensuring that any changes made toauthselectprofiles are automatically backed up and restored to their previous state upon exiting the context. It configures thesssdprofile with specific features likewith-smartcard.Initializes the
Authselectobject with desiredauthselectprofile features. By default, it sets thewith-smartcardfeature for thesssdprofile and uses the--forceoption to apply changes.- Parameters:
required (bool) – If
True, thewith-smartcard-requiredoption will be added to theauthselectprofile.lock_on_removal (bool) – If
True, thewith-smartcard-lock-on-removaloption will be added to theauthselectprofile.mk_homedir (bool) – If
True, thewith-mkhomediroption will be added to theauthselectprofile, ensuring home directories are created on login.sudo (bool) – If
True, thewith-sudooption will be added to theauthselectprofile, enabling sudo integration.
- Returns:
None
- Return type:
None
- _restore()[source]
Restores the Authselect configuration to the state it was in before the Authselect class context manager applied its changes. It attempts to restore from the backup file created during
_set().- Returns:
None
- Return type:
None
- Raises:
FileNotFoundError – If the backup file expected for restoration does not exist.