2.7 Recovery from Lost Master Key

If you accidentally delete or replace the sgtech_config.json file, then the master key is lost and the Spatial Studio application will throw an error.

The sgtech_config.json file includes a master seed property which contains the master key value that enables decryption of encrypted items such as database passwords. It is therefore recommended to backup your sgtech_config.json file in a safe location.

However, if you lose the sgtech_config.json file, then it is possible to recover from a lost master key by performing the following steps:

  1. Stop the Spatial Studio instance by running the following command from the application installation directory:
    ./stop.sh

    If you installed the application from the Cloud Marketplace, then use the following command:

    sudo systemctl stop spatialstudio
  2. Run the following command in your Spatial Studio repository using a SQL client (such as Database Actions, SQL Plus or SQL Developer):
    DELETE
        "SGTECH_OBJECT"
    WHERE
        "TENANTID" = 'GLOBAL'
        AND (
            "ID" IN ('id__sgtech.safe_text.magicword', 'id__sgtech.key_pair.rsa')
            OR "OBJECTTYPE" = 'access_token'
        );
    COMMIT;
  3. Start Spatial Studio by running the following command from the application installation directory:
    ./start.sh

    If you installed the application from the Cloud Marketplace, then use the following command:

    sudo systemctl start spatialstudio
  4. Log into Spatial Studio as the admin user.
  5. Navigate to the Connections page.
  6. Right-click on each connection, select Edit, and re-enter the password for each connection.
  7. Open Access Tokens dialog and delete each active token.
  8. Navigate to the Administration page.
  9. Optionally, if you had created a custom basemap with a separate API key, then re-enter the API Key by editing the required custom basemap.
    Click Basemaps under Settings to view and edit your custom basemap.
  10. Optionally, if you had created a Cesium basemap with a separate API key, then re-enter the API Key by editing the required Cesium basemap.
    Click Cesium Basemaps under Settings to view and edit your Cesium basemap.
Make sure to back up the sgtech_config.json configuration file safely this time so you do not have to repeat this process in the future.