opsi_auth: Database-based Authentication
The opsi_auth extension allows you to manage user accounts directly in the OPSI database.
The opsiconfd service verifies login credentials against the password or token hashes stored there.
Neither local Linux users nor an external directory service are required to log in to the OPSI service.
The accounts can be used, for example, for opsi-configed, the OPSI web GUI, and the JSON-RPC interface.
In addition to passwords, the extension supports authentication tokens, for example for automated API access.
Requirements and Activation
| This module is currently a paid extension. This means that you need a license file to unlock it. You will receive this file after you have purchased the extension. For evaluation purposes, we’re happy to provide you with a temporary license free of charge. Please contact us via email. |
You need an opsiconfd version that supports database authentication and a valid activation for the opsi_auth module.
The chapter OPSI Extensions explains how to install licenses and check module activation.
You manage users with an administrative account on the admin page at https://<opsi-configserver>:4447/admin/, on the Users tab.
The actions for managing database passwords and tokens are only displayed on the admin page if the module is activated and not disabled.
| Database users are neither Linux or Samba accounts nor separate MariaDB/MySQL users. They therefore do not get SSH or Samba access. The respective permissions still apply to file access; WebDAV access to the depot additionally requires membership in the file administrator group (see Users and Groups). |
Managing Users
Creating Users
-
Log in to the admin page with an administrative account and open the Users tab.
-
Click Create new user.
-
Enter the user name under Username. Use lowercase letters, because
opsiconfdconverts user names to lowercase at login. -
Enter the password under Password and Confirm password.
-
Select Admin for administrative access.
-
Confirm with Create user.
For a password that is set, the admin page requires at least eight characters, including at least one uppercase letter, one lowercase letter, one digit, and one special character. You can also create a user without a password and then generate a token for that user. A user without a password and without a token cannot authenticate via the database.
| The groups of a database user are read from their OPSI user object, not from the local Linux group management. The extension does not replace the separate management of user roles. |
Changing Passwords and Deleting Users
The Internal Authentication column shows whether a database password is stored. In the user’s row, open the Actions menu and select Change password to set or change a password. This does not change any Linux, Samba, or LDAP password.
With Delete user, you delete the OPSI user object including the password and token hashes stored there as well as the TOTP configuration.
Any existing account in the operating system or directory service remains in place.
If PAM or LDAP is still active, the user can log in again through them; opsiconfd then creates a new OPSI user object.
Authentication Tokens
Creating and Revoking Tokens
-
On the Users tab, open the Actions menu of the desired user.
-
Select New Authentication Token.
-
Copy the displayed token and store it securely. It is displayed only once.
The token consists of 64 hexadecimal characters. Only its hash is stored in the database. Each user can have one token; a new token replaces the previous one and invalidates it for new logins. The Token Authentication column shows whether a token is set up. Use Remove Authentication Token to remove it. The database password remains unaffected.
| A token grants access with the permissions of the associated user. Treat it like a password, transmit it only over HTTPS, and do not store it in scripts or version control systems. |
Using Tokens
For API calls, you can send the token as a bearer token in the HTTP header:
Authorization: Bearer <Token>
No user name is required; opsiconfd determines the user from the token.
Alternatively, HTTP Basic Authentication is possible: use the user name and the token instead of the password.
When logging in via /auth/login, you can also pass the token in the password field.
Configuration
Configure the following options in /etc/opsi/opsiconfd.conf (see Configuring opsiconfd):
database-password-hashing-method-
Hashing method for newly set or migrated database passwords. Possible values are
argon2id(default),bcrypt, andsha512. After a successful login with a database password, its hash is converted to the configured method if a different method was used before. The option does not affect token hashes. database-password-hash-migration-
With the value
database, after a successful password login via PAM or LDAP, a password hash is stored in the already existing OPSI user object, provided it does not yet contain a password hash. This migration is not enabled by default. disabled-auth-methods-
List of disabled authentication methods. An entry
databasedisables both password and token login against the database. Withpamandldap, you can disable these alternative methods. By default, the list is empty. auth-allowed-groups-
List of groups whose members are allowed to log in. The default value is
[{admingroup}, {readonly}]. An empty list removes this group restriction but does not grant any additional permissions.
After changing the configuration, reload the service:
opsiconfd reload
Taking Over Existing Users
As long as PAM or LDAP is not disabled, you can use database users and existing accounts in parallel.
opsiconfd first checks the database credentials.
If this check fails, the service tries the configured alternative method: LDAP if configured and activated, otherwise PAM.
A successful database login uses the groups stored in the OPSI user object.
After a successful login via PAM or LDAP, the groups from that source are copied to the user object.
| Changes to or locks of an account in the operating system or directory service do not deactivate its existing database password or token. If database authentication succeeds, PAM and LDAP are no longer queried. Therefore, also consider the OPSI user management when changing passwords or groups and when locking accounts. |