2020from argparse import SUPPRESS , Namespace
2121
2222from .._actions import BindActions , RebindActions
23- from .._constants import Clevis , EncryptionMethod
23+ from .._constants import Clevis
2424from ._shared import (
2525 TRUST_URL_OR_THUMBPRINT ,
26- UUID_OR_NAME ,
2726 ClevisEncryptionOptions ,
28- MoveNotice ,
2927 RejectAction ,
3028 ensure_nat ,
3129)
@@ -88,9 +86,6 @@ def __init__(self, namespace: Namespace):
8886 )
8987 ],
9088 "aliases" : [str (Clevis .TANG )],
91- "epilog" : str (
92- MoveNotice ("nbde" , "pool bind" , "pool encryption bind" , "3.10.0" )
93- ),
9489 "func" : BindActions .bind_clevis ,
9590 },
9691 ),
@@ -110,9 +105,6 @@ def __init__(self, namespace: Namespace):
110105 ),
111106 ("pool_name" , {"help" : "Pool name" }),
112107 ],
113- "epilog" : str (
114- MoveNotice ("tpm2" , "pool bind" , "pool encryption bind" , "3.10.0" )
115- ),
116108 "func" : BindActions .bind_clevis ,
117109 },
118110 ),
@@ -124,9 +116,6 @@ def __init__(self, namespace: Namespace):
124116 ("pool_name" , {"help" : "Pool name" }),
125117 ("keydesc" , {"help" : "key description" }),
126118 ],
127- "epilog" : str (
128- MoveNotice ("keyring" , "pool bind" , "pool encryption bind" , "3.10.0" )
129- ),
130119 "func" : BindActions .bind_keyring ,
131120 },
132121 ),
@@ -153,9 +142,6 @@ def __init__(self, namespace: Namespace):
153142 },
154143 ),
155144 ],
156- "epilog" : str (
157- MoveNotice ("clevis" , "pool rebind" , "pool encryption rebind" , "3.10.0" )
158- ),
159145 "func" : RebindActions .rebind_clevis ,
160146 },
161147 ),
@@ -181,230 +167,7 @@ def __init__(self, namespace: Namespace):
181167 },
182168 ),
183169 ],
184- "epilog" : str (
185- MoveNotice ("keyring" , "pool rebind" , "pool encryption rebind" , "3.10.0" )
186- ),
187- "func" : RebindActions .rebind_keyring ,
188- },
189- ),
190- ]
191-
192- BIND_SUBCMDS_ENCRYPTION = [
193- (
194- str (Clevis .NBDE ),
195- {
196- "help" : "Bind using NBDE via a tang server" ,
197- "args" : [
198- (
199- "--post-parser" ,
200- {
201- "action" : RejectAction ,
202- "default" : ClevisEncryptionOptionsForTang ,
203- "help" : SUPPRESS ,
204- "nargs" : "?" ,
205- },
206- ),
207- ("url" , {"help" : "URL of tang server" }),
208- ],
209- "groups" : [
210- (
211- "Pool Identifier" ,
212- {
213- "description" : "Choose one option to specify the pool to bind" ,
214- "mut_ex_args" : [
215- (True , UUID_OR_NAME ),
216- ],
217- },
218- ),
219- (
220- "Tang Server Verification" ,
221- {
222- "description" : "Choose one option" ,
223- "mut_ex_args" : [(True , TRUST_URL_OR_THUMBPRINT )],
224- },
225- ),
226- ],
227- "aliases" : [str (Clevis .TANG )],
228- "func" : BindActions .bind_clevis ,
229- },
230- ),
231- (
232- str (Clevis .TPM2 ),
233- {
234- "help" : "Bind using TPM2" ,
235- "args" : [
236- (
237- "--post-parser" ,
238- {
239- "action" : RejectAction ,
240- "default" : ClevisEncryptionOptionsForTpm2 ,
241- "help" : SUPPRESS ,
242- "nargs" : "?" ,
243- },
244- ),
245- ],
246- "groups" : [
247- (
248- "Pool Identifier" ,
249- {
250- "description" : "Choose one option to specify the pool to bind" ,
251- "mut_ex_args" : [
252- (True , UUID_OR_NAME ),
253- ],
254- },
255- )
256- ],
257- "func" : BindActions .bind_clevis ,
258- },
259- ),
260- (
261- "keyring" ,
262- {
263- "help" : "Bind using the kernel keyring" ,
264- "groups" : [
265- (
266- "Pool Identifier" ,
267- {
268- "description" : "Choose one option to specify the pool to bind" ,
269- "mut_ex_args" : [
270- (True , UUID_OR_NAME ),
271- ],
272- },
273- )
274- ],
275- "args" : [
276- ("keydesc" , {"help" : "key description" }),
277- ],
278- "func" : BindActions .bind_keyring ,
279- },
280- ),
281- ]
282-
283- REBIND_SUBCMDS_ENCRYPTION = [
284- (
285- "clevis" ,
286- {
287- "help" : (
288- "Rebind the specified pool using the current Clevis configuration"
289- ),
290- "groups" : [
291- (
292- "Pool Identifier" ,
293- {
294- "description" : "Choose one option to specify the pool to rebind" ,
295- "mut_ex_args" : [
296- (True , UUID_OR_NAME ),
297- ],
298- },
299- )
300- ],
301- "args" : [
302- (
303- "--token-slot" ,
304- {
305- "help" : (
306- "token slot; may be specified if there is more "
307- "than one binding with the specified method; for "
308- "V2 pools only"
309- ),
310- "type" : ensure_nat ,
311- },
312- ),
313- ],
314- "func" : RebindActions .rebind_clevis ,
315- },
316- ),
317- (
318- "keyring" ,
319- {
320- "help" : (
321- "Rebind the specified pool using the specified key in the "
322- "kernel keyring"
323- ),
324- "groups" : [
325- (
326- "Pool Identifier" ,
327- {
328- "description" : "Choose one option to specify the pool to rebind" ,
329- "mut_ex_args" : [
330- (True , UUID_OR_NAME ),
331- ],
332- },
333- )
334- ],
335- "args" : [
336- ("keydesc" , {"help" : "key description" }),
337- (
338- "--token-slot" ,
339- {
340- "help" : (
341- "token slot; may be specified if there is more "
342- "than one binding with the specified method; for "
343- "V2 pools only"
344- ),
345- "type" : ensure_nat ,
346- },
347- ),
348- ],
349170 "func" : RebindActions .rebind_keyring ,
350171 },
351172 ),
352173]
353-
354- ENCRYPTION_SUBCMDS = [
355- (
356- "bind" ,
357- {
358- "help" : "Bind the given pool with an additional encryption facility" ,
359- "subcmds" : BIND_SUBCMDS_ENCRYPTION ,
360- },
361- ),
362- (
363- "rebind" ,
364- {
365- "help" : (
366- "Rebind the given pool with a currently in use encryption "
367- "facility but new credentials"
368- ),
369- "subcmds" : REBIND_SUBCMDS_ENCRYPTION ,
370- },
371- ),
372- (
373- "unbind" ,
374- {
375- "help" : "Unbind the given pool, removing use of the specified encryption method" ,
376- "groups" : [
377- (
378- "Pool Identifier" ,
379- {
380- "description" : "Choose one option to specify the pool to unbind" ,
381- "mut_ex_args" : [
382- (True , UUID_OR_NAME ),
383- ],
384- },
385- )
386- ],
387- "args" : [
388- (
389- "method" ,
390- {
391- "choices" : list (EncryptionMethod ),
392- "help" : "Encryption method to unbind" ,
393- "type" : EncryptionMethod ,
394- },
395- ),
396- (
397- "--token-slot" ,
398- {
399- "help" : (
400- "token slot; must be specified if there is more "
401- "than one binding with the specified method"
402- ),
403- "type" : ensure_nat ,
404- },
405- ),
406- ],
407- "func" : BindActions .unbind ,
408- },
409- ),
410- ]
0 commit comments