Skip to content

Commit

Permalink
metadata backups: field 'privkey storage location descr'
Browse files Browse the repository at this point in the history
fixes #247
  • Loading branch information
joonas-fi committed Jun 10, 2024
1 parent a51761f commit e49cc47
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
16 changes: 14 additions & 2 deletions frontend/pages/MetadataBackupPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { Panel, tableClassStripedHover } from 'f61ui/component/bootstrap';
import { bytesToHumanReadable } from 'f61ui/component/bytesformatter';
import { CommandButton, CommandIcon } from 'f61ui/component/CommandButton';
import { Dropdown } from 'f61ui/component/dropdown';
import { Info } from 'f61ui/component/info';
import { MonospaceContent } from 'f61ui/component/monospacecontent';
import { SecretReveal } from 'f61ui/component/secretreveal';
import { Timestamp } from 'f61ui/component/timestamp';
Expand Down Expand Up @@ -108,7 +109,8 @@ export default class MetadataBackupPage extends React.Component<
accessKeySecret,
encryptionPublicKey,
alertmanagerBaseUrl,
] = backupConfig.Value ? JSON.parse(backupConfig.Value) : ['', '', '', '', '', ''];
encryptionPrivateKeyStorageLocationDescription,
] = backupConfig.Value ? JSON.parse(backupConfig.Value) : ['', '', '', '', '', '', ''];

return (
<Panel
Expand Down Expand Up @@ -150,7 +152,17 @@ export default class MetadataBackupPage extends React.Component<
</td>
</tr>
<tr>
<th>EncryptionPublicKey</th>
<th>
EncryptionPublicKey
{encryptionPrivateKeyStorageLocationDescription ? (
<Info
text={
'Private key storage location description: ' +
encryptionPrivateKeyStorageLocationDescription
}
/>
) : null}
</th>
<td>
<MonospaceContent>{encryptionPublicKey}</MonospaceContent>
</td>
Expand Down
6 changes: 4 additions & 2 deletions pkg/stoserver/backupcommandhandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ func (c *cHandlers) DatabaseBackupConfigure(cmd *stoservertypes.DatabaseBackupCo
cmd.AccessKeySecret,
cmd.EncryptionPublicKey,
cmd.AlertmanagerBaseUrl,
cmd.EncryptionPrivateKeyStorageLocationDescription,
})
if err != nil {
return err
Expand Down Expand Up @@ -107,8 +108,9 @@ func parseSerializedUbConfig(serializedUbConfig []byte) (*ubconfig.Config, error
return nil, err
}

if len(parts) != 6 {
return nil, fmt.Errorf("unexpected number of parts: %d", len(parts))
// encryptionPrivateKeyStorageLocationDescription was added later (though not used in backend so it's not read here)
if partCount := len(parts); partCount != 6 && partCount != 7 {
return nil, fmt.Errorf("unexpected number of parts: %d", partCount)
}

return &ubconfig.Config{
Expand Down
1 change: 1 addition & 0 deletions pkg/stoserver/stoservertypes/commands.json
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,7 @@
{ "key": "AccessKeyId", "title": "Access Key ID", "placeholder": "AKIAIOSFODNN7EXAMPLE" },
{ "key": "AccessKeySecret", "title": "Secret Access Key", "placeholder": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY" },
{ "key": "EncryptionPublicKey", "title": "µbackup encryption public key", "type": "multiline", "placeholder": "-----BEGIN RSA PUBLIC KEY-----\nMIIBCgKCAQEA+xGZ/wcz9ugFpP07Nspo6U17l0YhFiFpxxU4pTk3Lifz9R3zsIsu\n..." },
{ "key": "EncryptionPrivateKeyStorageLocationDescription", "title": "µbackup encryption private key storage location description", "placeholder": "In password manager with title ...", "optional": true },
{ "key": "AlertmanagerBaseUrl", "title": "AlertManager API URL", "placeholder": "https://abcdefghij.execute-api.us-east-1.amazonaws.com/prod", "help": "Only used if you're using lambda-alertmanager", "optional": true },
{ "key": "ConnectivityCheck", "title": "Perform connectivity check", "type": "checkbox", "help": "Try to connect to S3 to validate connection details" }
]
Expand Down

0 comments on commit e49cc47

Please sign in to comment.