-
Notifications
You must be signed in to change notification settings - Fork 4.1k
/
config-pki-ca.hbs
214 lines (213 loc) · 8.32 KB
/
config-pki-ca.hbs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
{{#if replaceCA}}
<MessageError @model={{model}} />
<h2 data-test-title class="title is-3">
{{#if needsConfig}}
Configure CA Certificate
{{else}}
Replace CA Certificate
{{/if}}
</h2>
{{#if (or model.certificate model.csr)}}
{{#each model.attrs as |attr|}}
{{#if attr.options.masked}}
<InfoTableRow data-test-table-row
@label={{capitalize (or attr.options.label (humanize (dasherize attr.name)))}}
@value={{get model attr.name}}>
<MaskedInput
@value={{get model attr.name}}
@displayOnly={{true}}
@allowCopy={{true}}
/>
</InfoTableRow>
{{else if (and (get model attr.name) (or (eq attr.name "issueDate") (eq attr.name "expiryDate")))}}
<InfoTableRow data-test-table-row={{value}}
@label={{capitalize (or attr.options.label (humanize (dasherize attr.name)))}}
@value={{date-format (get model attr.name) 'MMM dd, yyyy hh:mm:ss a' isFormatted=true}}/>
{{else}}
<InfoTableRow data-test-table-row={{value}}
@label={{capitalize (or attr.options.label (humanize (dasherize attr.name)))}}
@value={{get model attr.name}}/>
{{/if}}
{{/each}}
<div class="field is-grouped box is-fullwidth is-bottomless">
<div class="control">
<CopyButton @clipboardText={{or model.certificate model.csr}} @class="button" @buttonType="button" @success={{action (set-flash-message (concat (if model.certificate "Certificate" "CSR") " copied!"))}}>
Copy {{if model.certificate "Certificate" "CSR"}}
</CopyButton>
</div>
<div class="control">
<button data-test-back-button {{action "refresh"}} type="button" class="button">
Back
</button>
</div>
</div>
{{else}}
<form {{action "saveCA" on="submit"}} data-test-generate-root-cert="true">
<NamespaceReminder @mode="save" @noun="PKI change" />
{{#if model.uploadPemBundle}}
<AlertBanner
@type="warning"
@message="If you have already set a certificate and key, they will be overridden with the successful saving of a new PEM bundle."
data-test-warning
/>
{{/if}}
<FormFieldGroupsLoop
@model={{model}}
@mode={{mode}}
/>
<div class="field is-grouped is-grouped-split box is-fullwidth is-bottomless">
<div class="field is-grouped">
<div class="control">
<button data-test-submit type="submit" class="button is-primary {{if loading 'is-loading'}}" disabled={{loading}}>
Save
</button>
</div>
<div class="control">
<button data-test-back-button {{action "toggleReplaceCA"}} type="button" class="button">
Cancel
</button>
</div>
</div>
<div class="control">
{{#if model.canDeleteRoot}}
<ConfirmAction
@buttonClasses="button"
@confirmTitle="Delete this CA key?"
@confirmMessage="This CA certificate will still be available for reading until a new certificate/key is generated or uploaded."
@onConfirmAction={{action "deleteCA"}}
>
Delete
</ConfirmAction>
{{/if}}
</div>
</div>
</form>
{{/if}}
{{else if signIntermediate}}
{{#if (or model.certificate)}}
<AlertBanner
@type="warning"
@message="If using this for an Intermediate CA in Vault, copy the certificate below and write it to the PKI mount being used as an intermediate using the `Set signed Intermediate` endpoint."
data-test-warning
/>
{{#each model.attrs as |attr|}}
{{#if attr.options.masked}}
<InfoTableRow
data-test-table-row={{value}}
@label={{capitalize (or attr.options.label (humanize (dasherize attr.name)))}}
@value={{get model attr.name}}>
<MaskedInput
@value={{get model attr.name}}
@displayOnly={{true}}
@allowCopy={{true}}
/>
</InfoTableRow>
{{else if (and (get model attr.name) (or (eq attr.name "issueDate") (eq attr.name "expiryDate")))}}
<InfoTableRow data-test-table-row={{value}}
@label={{capitalize (or attr.options.label (humanize (dasherize attr.name)))}}
@value={{date-format (get model attr.name) 'MMM dd, yyyy hh:mm:ss a' isFormatted=true}}/>
{{else}}
<InfoTableRow data-test-table-row={{value}}
@label={{capitalize (or attr.options.label (humanize (dasherize attr.name)))}}
@value={{get model attr.name}}/>
{{/if}}
{{/each}}
<div class="field is-grouped box is-fullwidth is-bottomless">
<div class="control">
<CopyButton @clipboardText={{model.certificate}} @class="button" @buttonType="button" @success={{action (set-flash-message "Certificate copied!")}}>
Copy Certificate
</CopyButton>
</div>
<div class="control">
<button data-test-back-button {{action "refresh"}} type="button" class="button">
Back
</button>
</div>
</div>
{{else}}
<h2 data-test-title class="title is-3">Sign intermediate</h2>
<NamespaceReminder @mode="save" @noun="PKI change" />
<MessageError @model={{model}} />
<form {{action "saveCA" on="submit"}} data-test-sign-intermediate-form="true">
<FormFieldGroupsLoop
@model={{model}}
@mode={{mode}}
/>
<div class="field is-grouped box is-fullwidth is-bottomless">
<div class="control">
<button data-test-submit type="submit" class="button is-primary {{if loading 'is-loading'}}" disabled={{loading}}>
Save
</button>
</div>
<div class="control">
<button {{action "toggleVal" "signIntermediate" false}} type="button" class="button">
Cancel
</button>
</div>
</div>
</form>
{{/if}}
{{else if setSignedIntermediate}}
<h2 data-test-title class="title is-3">Set signed intermediate</h2>
<NamespaceReminder @mode="save" @noun="PKI change" />
<MessageError @model={{model}} />
<p class="has-text-grey-dark">
Submit a signed CA certificate corresponding to a generated private key.
</p>
<form {{action "saveCA" "setSignedIntermediate" on="submit"}} data-test-set-signed-intermediate-form="true">
<div class="field">
<label for="certificate" class="is-label">
Signed Intermediate Certificate
</label>
<div class="control">
{{textarea data-test-signed-intermediate class="textarea" id="certificate" name="certificate" value=model.certificate}}
</div>
</div>
<div class="field is-grouped box is-fullwidth is-bottomless">
<div class="control">
<button data-test-submit type="submit" class="button is-primary {{if loading 'is-loading'}}" disabled={{loading}}>
Save
</button>
</div>
<div class="control">
<button data-test-back-button {{action "toggleVal" "setSignedIntermediate" false}} type="button" class="button">
Cancel
</button>
</div>
</div>
</form>
{{else}}
<p class="has-text-grey-dark">
This is the default CA certificate used in Vault. It is not used for self-signed certificates or if you have a signed intermediate CA certificate with a generated key.
</p>
{{#each downloadHrefs as |dl|}}
<div class="box is-shadowless is-marginless is-fullwidth has-slim-padding">
<a data-test-ca-download-link href={{dl.url}} download={{dl.name}}>
{{dl.display}}
</a>
</div>
{{/each}}
<div class="field is-grouped box is-fullwidth is-shadowless">
<div class="control">
<button data-test-go-replace-ca type="button" {{action "toggleReplaceCA"}} class="button">
{{#if needsConfig}}
Configure CA
{{else}}
Replace CA
{{/if}}
</button>
</div>
{{#if config.pem}}
<div class="control">
<button data-test-go-sign-intermediate type="button" {{action "toggleVal" "signIntermediate"}} class="button">
Sign intermediate
</button>
</div>
{{/if}}
<div class="control">
<button data-test-go-set-signed-intermediate type="button" {{action "toggleVal" "setSignedIntermediate"}} class="button">
Set signed intermediate
</button>
</div>
</div>
{{/if}}