2018-08-28 05:03:55 +00:00
|
|
|
import { supportedSecretBackends } from 'vault/helpers/supported-secret-backends';
|
|
|
|
const supportedBackends = supportedSecretBackends();
|
|
|
|
|
|
|
|
export default {
|
|
|
|
key: 'secrets',
|
|
|
|
initial: 'idle',
|
|
|
|
on: {
|
|
|
|
RESET: 'idle',
|
|
|
|
DONE: 'complete',
|
|
|
|
ERROR: 'error',
|
|
|
|
},
|
|
|
|
states: {
|
|
|
|
idle: {
|
|
|
|
onEntry: [
|
|
|
|
{ type: 'routeTransition', params: ['vault.cluster.settings.mount-secret-backend'] },
|
|
|
|
{ type: 'render', level: 'feature', component: 'wizard/mounts-wizard' },
|
|
|
|
{ type: 'render', level: 'step', component: 'wizard/secrets-idle' },
|
|
|
|
],
|
|
|
|
on: {
|
|
|
|
CONTINUE: 'enable',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
enable: {
|
|
|
|
onEntry: [
|
|
|
|
{ type: 'render', level: 'feature', component: 'wizard/mounts-wizard' },
|
|
|
|
{ type: 'render', level: 'step', component: 'wizard/secrets-enable' },
|
|
|
|
],
|
|
|
|
on: {
|
|
|
|
CONTINUE: {
|
2021-12-17 03:44:29 +00:00
|
|
|
details: { cond: (type) => supportedBackends.includes(type) },
|
|
|
|
list: { cond: (type) => !supportedBackends.includes(type) },
|
2018-08-28 05:03:55 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
details: {
|
|
|
|
onEntry: [
|
|
|
|
{ type: 'render', level: 'feature', component: 'wizard/mounts-wizard' },
|
|
|
|
{ type: 'render', level: 'step', component: 'wizard/secrets-details' },
|
|
|
|
],
|
|
|
|
on: {
|
|
|
|
CONTINUE: {
|
2021-02-23 20:52:39 +00:00
|
|
|
connection: {
|
2021-12-17 03:44:29 +00:00
|
|
|
cond: (type) => type === 'database',
|
2021-02-23 20:52:39 +00:00
|
|
|
},
|
2018-08-28 05:03:55 +00:00
|
|
|
role: {
|
2021-12-17 03:44:29 +00:00
|
|
|
cond: (type) => ['pki', 'aws', 'ssh'].includes(type),
|
2018-08-28 05:03:55 +00:00
|
|
|
},
|
|
|
|
secret: {
|
2021-12-17 03:44:29 +00:00
|
|
|
cond: (type) => ['kv'].includes(type),
|
2018-08-28 05:03:55 +00:00
|
|
|
},
|
|
|
|
encryption: {
|
2021-12-17 03:44:29 +00:00
|
|
|
cond: (type) => type === 'transit',
|
2018-08-28 05:03:55 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2021-02-23 20:52:39 +00:00
|
|
|
connection: {
|
|
|
|
onEntry: [
|
|
|
|
{ type: 'render', level: 'step', component: 'wizard/secrets-connection' },
|
|
|
|
{ type: 'render', level: 'feature', component: 'wizard/mounts-wizard' },
|
|
|
|
],
|
|
|
|
on: {
|
|
|
|
CONTINUE: 'displayConnection',
|
|
|
|
},
|
|
|
|
},
|
2018-08-28 05:03:55 +00:00
|
|
|
encryption: {
|
|
|
|
onEntry: [
|
|
|
|
{ type: 'render', level: 'feature', component: 'wizard/mounts-wizard' },
|
|
|
|
{ type: 'render', level: 'step', component: 'wizard/secrets-encryption' },
|
|
|
|
],
|
|
|
|
on: {
|
|
|
|
CONTINUE: 'display',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
credentials: {
|
|
|
|
onEntry: [
|
|
|
|
{ type: 'render', level: 'step', component: 'wizard/secrets-credentials' },
|
|
|
|
{ type: 'render', level: 'feature', component: 'wizard/mounts-wizard' },
|
|
|
|
],
|
|
|
|
on: {
|
|
|
|
CONTINUE: 'display',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
role: {
|
|
|
|
onEntry: [
|
|
|
|
{ type: 'render', level: 'step', component: 'wizard/secrets-role' },
|
|
|
|
{ type: 'render', level: 'feature', component: 'wizard/mounts-wizard' },
|
|
|
|
],
|
|
|
|
on: {
|
|
|
|
CONTINUE: 'displayRole',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
displayRole: {
|
|
|
|
onEntry: [
|
|
|
|
{ type: 'render', level: 'step', component: 'wizard/secrets-display-role' },
|
|
|
|
{ type: 'render', level: 'feature', component: 'wizard/mounts-wizard' },
|
|
|
|
],
|
|
|
|
on: {
|
|
|
|
CONTINUE: 'credentials',
|
|
|
|
},
|
|
|
|
},
|
2021-02-23 20:52:39 +00:00
|
|
|
displayConnection: {
|
|
|
|
onEntry: [
|
|
|
|
{ type: 'render', level: 'step', component: 'wizard/secrets-connection-show' },
|
|
|
|
{ type: 'render', level: 'feature', component: 'wizard/mounts-wizard' },
|
|
|
|
],
|
|
|
|
on: {
|
|
|
|
CONTINUE: 'displayRoleDatabase',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
displayRoleDatabase: {
|
|
|
|
onEntry: [
|
|
|
|
{ type: 'render', level: 'step', component: 'wizard/secrets-display-database-role' },
|
|
|
|
{ type: 'render', level: 'feature', component: 'wizard/mounts-wizard' },
|
|
|
|
],
|
|
|
|
on: {
|
|
|
|
CONTINUE: 'display',
|
|
|
|
},
|
|
|
|
},
|
2018-08-28 05:03:55 +00:00
|
|
|
secret: {
|
|
|
|
onEntry: [
|
|
|
|
{ type: 'render', level: 'step', component: 'wizard/secrets-secret' },
|
|
|
|
{ type: 'render', level: 'feature', component: 'wizard/mounts-wizard' },
|
|
|
|
],
|
|
|
|
on: {
|
|
|
|
CONTINUE: 'display',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
display: {
|
|
|
|
onEntry: [
|
|
|
|
{ type: 'render', level: 'step', component: 'wizard/secrets-display' },
|
|
|
|
{ type: 'render', level: 'feature', component: 'wizard/mounts-wizard' },
|
|
|
|
],
|
|
|
|
on: {
|
|
|
|
REPEAT: {
|
2021-02-23 20:52:39 +00:00
|
|
|
connection: {
|
2021-12-17 03:44:29 +00:00
|
|
|
cond: (type) => type === 'database',
|
2021-02-23 20:52:39 +00:00
|
|
|
actions: [{ type: 'routeTransition', params: ['vault.cluster.secrets.backend.create-root'] }],
|
|
|
|
},
|
2018-08-28 05:03:55 +00:00
|
|
|
role: {
|
2021-12-17 03:44:29 +00:00
|
|
|
cond: (type) => ['pki', 'aws', 'ssh'].includes(type),
|
2018-08-28 05:03:55 +00:00
|
|
|
actions: [{ type: 'routeTransition', params: ['vault.cluster.secrets.backend.create-root'] }],
|
|
|
|
},
|
|
|
|
secret: {
|
2021-12-17 03:44:29 +00:00
|
|
|
cond: (type) => ['kv'].includes(type),
|
2018-08-28 05:03:55 +00:00
|
|
|
actions: [{ type: 'routeTransition', params: ['vault.cluster.secrets.backend.create-root'] }],
|
|
|
|
},
|
|
|
|
encryption: {
|
2021-12-17 03:44:29 +00:00
|
|
|
cond: (type) => type === 'transit',
|
2018-08-28 05:03:55 +00:00
|
|
|
actions: [{ type: 'routeTransition', params: ['vault.cluster.secrets.backend.create-root'] }],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
list: {
|
|
|
|
onEntry: [
|
|
|
|
{ type: 'render', level: 'step', component: 'wizard/secrets-list' },
|
|
|
|
{ type: 'render', level: 'feature', component: 'wizard/mounts-wizard' },
|
|
|
|
],
|
|
|
|
on: {
|
|
|
|
CONTINUE: 'display',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
error: {
|
|
|
|
onEntry: [
|
|
|
|
{ type: 'render', level: 'step', component: 'wizard/tutorial-error' },
|
|
|
|
{ type: 'render', level: 'feature', component: 'wizard/mounts-wizard' },
|
|
|
|
],
|
|
|
|
on: {
|
|
|
|
CONTINUE: 'complete',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
complete: {
|
|
|
|
onEntry: ['completeFeature'],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|