Copying a production database to a test system (sadmin login)
This page describes what to do when the database of a production system is copied into an existing test or integration system (called "test system" below), and you then want to log in as the system administrator sadmin again. It applies to Webdesk 4.56 and later and is meant for system administrators and consultants. For background on the configuration file and the key, see Configuration file webdesk.properties and environment variables.
Why the login fails after the copy
Webdesk encrypts passwords stored in the database with a key (AES-256). This includes the password of sadmin: it is not an ordinary user but a system parameter stored in encrypted form. On every login, Webdesk decrypts the stored value and compares it with the password entered.
The key, however, is not stored in the database but with the installation: in the entry webdesk.encryption.key of the file webdesk.properties, or in the file enc.key. The test system has its own key. After the copy, the database contains values encrypted with the production system's key, but the test system still decrypts them with its own key:
Production system: database (encrypted with key P) + webdesk.properties with key P
Test system: copied database (key P) + webdesk.properties with key T
→ decrypting with T fails
Consequences:
- Logging in as
sadminfails, even with the correct (production) password. The log contains a message withjavax.crypto.AEADBadTagException: Tag mismatch. - All other passwords stored in encrypted form in the production database cannot be read on the test system either, for example those of connectors, document management repositories or groupware access.
The solution is to give the test system the production system's key.
Before the first start: mind the production configuration
Attention: With the production database, the test system also takes over the production system's configuration, for example time and attendance connections, connectors, e-mail sending and scheduled jobs. As soon as the passwords can be decrypted again, the test system can access production systems, write data or send e-mails. Check and deactivate or change these settings before you put the test system into operation with the production key.
Note: With the production key, the test system can read all encrypted production data. From then on, protect the test system's configuration as carefully as the production system's.
Procedure
- Stop Webdesk on the test system (on all nodes if there are several).
- Back up the test system's
webdesk.properties(andenc.key, if present). -
Find the production system's key. In the production system's
webdesk.properties, the entrywebdesk.encryption.key.sourcetells you where the key is:-
webdesk_properties: the key is the value ofwebdesk.encryption.keyin the same file. -
file: the key is in the fileenc.keynext towebdesk.properties.
-
-
Enter the key on the test system, in one of two ways:
webdesk.encryption.key.source = webdesk_properties webdesk.encryption.key = <key of the production system>
or replaceenc.keywith the production system's file and setwebdesk.encryption.key.source = file(the entrywebdesk.encryption.keyis then not used). With several nodes, do this on every node. -
Re-encrypt the database credentials. The username and password of the test database in
webdesk.propertiesare encrypted with the test system's previous key and no longer match after the key change. Without this step, the test system can no longer connect to its database. You only need this step ifwebdesk.credentials.encrypted = trueis set; withfalse(plain text), or with the old entrywebdesk.connection.encrypted, the values do not depend on the key. Two ways:-
Let Webdesk encrypt them at startup (recommended): enter the usernames and passwords of the Webdesk and Shark databases in plain text and delete the lines
webdesk.credentials.encryptedandshark.credentials.encrypted(do not set them tofalse):webdesk.connection.username = <database user> webdesk.connection.password = <database password> shark.connection.username = <database user> shark.connection.password = <database password>
At the next start, Webdesk encrypts the values with the new key, adds the entries...credentials.encrypted = trueagain and saves the file. The user Webdesk runs as needs write access to the file. Withfalse, Webdesk would leave the values as intentional plain text. -
With the tool: on Windows installations, start
manageWebdeskDBProps.batin Tomcat'sbinfolder, choose "Basic" mode and use the menu option for entering new values. The tool encrypts the values entered with the key from the file. Do not use the "Expert" mode parameterswebdeskLogin=/webdeskPassword=for this: on files that are already encrypted, they are saved unencrypted. The tool only supportswebdesk.encryption.key.source = webdesk_properties.
-
Let Webdesk encrypt them at startup (recommended): enter the usernames and passwords of the Webdesk and Shark databases in plain text and delete the lines
- Start Webdesk. Check that the system starts and that the credentials in
webdesk.propertiesare encrypted again (as Base64 text). - Log in as
sadminwith the production system's password. - Back up the test system's changed
webdesk.properties(orenc.key) again.
Troubleshooting
- The test system does not start after the key change, the database connection fails: the database credentials are still encrypted with the test system's old key (step 5).
-
Logging in as
sadminstill fails, the log containsAEADBadTagException: the test system does not use the production system's key. Check the key source and the key orenc.keyon all nodes. -
After the start, the credentials are still in plain text in the file: Webdesk could not write the file (write access), or the lines
...credentials.encryptedare still in the file withfalse. -
The production system's key can no longer be found: the encrypted values from the production database, including the
sadminpassword, then cannot be recovered. Contact Webdesk support.
Keine Kommentare vorhanden.