The Instance key is automatically generated during the installation of or update to JobRouter 5.1 and is stored as instance.key file in the config directory of the respective instance.
Please note: Please perform the update to JobRouter version 5.1 on the main instance first, otherwise errors may occur.
The Instance key is used for the secure encryption of passwords (e.g. for database access) and further keys serving other purposes and is unambiguous for all JobRouter web applications.
Please note: In case of an Instance key loss it is not possible to retrieve the data that has been encrypted with it. We recommend a complete backup.
Optional: Creation of an Instance key before updating to JobRouter version 5.1
It is possible to store the Instance key before performing the update to JobRouter version 5.1 in the web application. Therefore it is necessary co create a new instance.key file in the config directory of the respective instance with a 32 byte long string. The Instance key requires a cryptographically secure string.
JobRouter uses the functions openssl_random_pseudo_bytes:
$path = __DIR__ . '/instance.key';
do {
$randomBytes = openssl_random_pseudo_bytes(32, $wasItSecure);
} while (!$wasItSecure && $randomBytes !== false);
file_put_contents($path, $randomBytes);
To ensure that the Instance key does not have to be used for all other data to be secured, further keys are created in the JRSETTINGS table for specific intended purposes (e.g. for the JobRouter modules). It is recommended to also create a backup for these keys. The most simple approach to do so is to run a backup for the JobRouter database.
Please note: Further keys are listed in the chapter Key backup. Solely their location is different.
Additional safeguarding of the Instance key
Please note: The safeguarding of your Instance key does only make sense if you want to operate a cloud environment.
For an additional safeguarding of the Instance key you can use the Environment variable JR_SECRET in IIS. For further details please see the chapter JR_SECRET.