@@ -28,25 +28,46 @@ GHE_RESTORE_SNAPSHOT_PATH="$GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT"
2828echo " Restoring license ..."
2929ghe-ssh " $GHE_HOSTNAME " -- ' ghe-import-license' < " $GHE_RESTORE_SNAPSHOT_PATH /enterprise.ghl" 1>&3
3030
31- # Restore external MySQL password if running external MySQL DB.
32- if [ -f " $GHE_RESTORE_SNAPSHOT_PATH /external-mysql-password" ]; then
33- echo " Restoring external MySQL password ..."
34- echo " ghe-config secrets.external.mysql '$( cat " $GHE_RESTORE_SNAPSHOT_PATH /external-mysql-password" ) '" |
35- ghe-ssh " $GHE_HOSTNAME " -- /bin/bash
36- fi
31+ # Function to restore a secret setting stored in a file.
32+ # restore-secret <description> <file-name> <setting-name>
33+ restore-secret () {
34+ if [ -f " $GHE_RESTORE_SNAPSHOT_PATH /$2 " ]; then
35+ echo " Restoring $1 ..."
36+ echo " ghe-config '$3 ' '$( cat " $GHE_RESTORE_SNAPSHOT_PATH /$2 " ) '" |
37+ ghe-ssh " $GHE_HOSTNAME " -- /bin/bash
38+ fi
39+ }
3740
3841echo " Restoring settings ..."
42+
43+ # Restore external MySQL password if running external MySQL DB.
44+ restore-secret " external MySQL password" " external-mysql-password" " secrets.external.mysql"
45+
46+ # Restore Actions settings.
47+ restore-secret " Actions configuration database login" " actions-config-db-login" " secrets.actions.ConfigurationDatabaseSqlLogin"
48+ restore-secret " Actions configuration database password" " actions-config-db-password" " secrets.actions.ConfigurationDatabaseSqlPassword"
49+ restore-secret " Actions framework access token key secret" " actions-framework-access-token" " secrets.actions.FrameworkAccessTokenKeySecret"
50+ restore-secret " Actions Url signing HMAC key primary" " actions-url-signing-hmac-key-primary" " secrets.actions.UrlSigningHmacKeyPrimary"
51+ restore-secret " Actions Url signing HMAC key secondary" " actions-url-signing-hmac-key-secondary" " secrets.actions.UrlSigningHmacKeySecondary"
52+ restore-secret " Actions OAuth S2S signing cert" " actions-oauth-s2s-signing-cert" " secrets.actions.OAuthS2SSigningCert"
53+ restore-secret " Actions OAuth S2S signing key" " actions-oauth-s2s-signing-key" " secrets.actions.OAuthS2SSigningKey"
54+ restore-secret " Actions OAuth S2S signing cert thumbprint" " actions-oauth-s2s-signing-cert-thumbprint" " secrets.actions.OAuthS2SSigningCertThumbprint"
55+ restore-secret " Actions primary encryption cert thumbprint" " actions-primary-encryption-cert-thumbprint" " secrets.actions.PrimaryEncryptionCertificateThumbprint"
56+ restore-secret " Actions AAD cert thumbprint" " actions-add-cert-thumbprint" " secrets.actions.AADCertThumbprint"
57+ restore-secret " Actions delegated auth cert thumbprint" " actions-delegated-auth-cert-thumbprint" " secrets.actions.DelegatedAuthCertThumbprint"
58+ restore-secret " Actions runtime service principal cert" " actions-runtime-service-principal-cert" " secrets.actions.RuntimeServicePrincipalCertificate"
59+ restore-secret " Actions S2S encryption cert" " actions-s2s-encryption-cert" " secrets.actions.S2SEncryptionCertificate"
60+ restore-secret " Actions secondary encryption cert thumbprint" " actions-secondary-encryption-cert-thumbprint" " secrets.actions.SecondaryEncryptionCertificateThumbprint"
61+ restore-secret " Actions service principal cert" " actions-service-principal-cert" " secrets.actions.ServicePrincipalCertificate"
62+ restore-secret " Actions SPS validation cert thumbprint" " actions-sps-validation-cert-thumbprint" " secrets.actions.SpsValidationCertThumbprint"
63+
3964# work around issue importing settings with bad storage mode values
4065( cat " $GHE_RESTORE_SNAPSHOT_PATH /settings.json" && echo ) |
4166 sed ' s/"storage_mode": "device"/"storage_mode": "rootfs"/' |
4267 ghe-ssh " $GHE_HOSTNAME " -- ' /usr/bin/env GHEBUVER=2 ghe-import-settings' 1>&3
4368
4469# Restore management console password hash if present.
45- if [ -f " $GHE_RESTORE_SNAPSHOT_PATH /manage-password" ]; then
46- echo " Restoring management console password ..."
47- echo " ghe-config secrets.manage '$( cat " $GHE_RESTORE_SNAPSHOT_PATH /manage-password" ) '" |
48- ghe-ssh " $GHE_HOSTNAME " -- /bin/bash
49- fi
70+ restore-secret " management console password" " manage-password" " secrets.manage"
5071
5172# Restore SAML keys if present.
5273if [ -f " $GHE_RESTORE_SNAPSHOT_PATH /saml-keys.tar" ]; then
0 commit comments