blob: b492c77bb5081c41ae5f3d3e7631504271ee50ee [file] [log] [blame]
romanc1d2b092023-02-02 08:58:27 +01001module ietf-keystore {
2 yang-version 1.1;
3 namespace "urn:ietf:params:xml:ns:yang:ietf-keystore";
4 prefix ks;
5
6 import ietf-netconf-acm {
7 prefix nacm;
8 reference
9 "RFC 8341: Network Configuration Access Control Model";
10 }
11
12 import ietf-crypto-types {
13 prefix ct;
14 reference
15 "RFC AAAA: YANG Data Types and Groupings for Cryptography";
16 }
17
18 organization
19 "IETF NETCONF (Network Configuration) Working Group";
20
21 contact
22 "WG Web: https://datatracker.ietf.org/wg/netconf
23 WG List: NETCONF WG list <mailto:netconf@ietf.org>
24 Author: Kent Watsen <mailto:kent+ietf@watsen.net>";
25
26 description
27 "This module defines a 'keystore' to centralize management
28 of security credentials.
29
roman7fdc84d2023-06-06 13:14:53 +020030 Copyright (c) 2023 IETF Trust and the persons identified
romanc1d2b092023-02-02 08:58:27 +010031 as authors of the code. All rights reserved.
32
33 Redistribution and use in source and binary forms, with
34 or without modification, is permitted pursuant to, and
35 subject to the license terms contained in, the Revised
36 BSD License set forth in Section 4.c of the IETF Trust's
37 Legal Provisions Relating to IETF Documents
38 (https://trustee.ietf.org/license-info).
39
40 This version of this YANG module is part of RFC CCCC
41 (https://www.rfc-editor.org/info/rfcCCCC); see the RFC
42 itself for full legal notices.
43
44 The key words 'MUST', 'MUST NOT', 'REQUIRED', 'SHALL',
45 'SHALL NOT', 'SHOULD', 'SHOULD NOT', 'RECOMMENDED',
46 'NOT RECOMMENDED', 'MAY', and 'OPTIONAL' in this document
47 are to be interpreted as described in BCP 14 (RFC 2119)
48 (RFC 8174) when, and only when, they appear in all
49 capitals, as shown here.";
50
Michal Vaskocf898172024-01-15 15:04:28 +010051 revision 2023-12-28 {
romanc1d2b092023-02-02 08:58:27 +010052 description
53 "Initial version";
54 reference
55 "RFC CCCC: A YANG Data Model for a Keystore";
56 }
57
58 /****************/
59 /* Features */
60 /****************/
61
62 feature central-keystore-supported {
63 description
64 "The 'central-keystore-supported' feature indicates that
Michal Vaskocf898172024-01-15 15:04:28 +010065 the server supports the central keystore (i.e., fully
66 implements the 'ietf-keystore' module).";
romanc1d2b092023-02-02 08:58:27 +010067 }
68
roman7fdc84d2023-06-06 13:14:53 +020069 feature inline-definitions-supported {
romanc1d2b092023-02-02 08:58:27 +010070 description
roman7fdc84d2023-06-06 13:14:53 +020071 "The 'inline-definitions-supported' feature indicates that
romanc1d2b092023-02-02 08:58:27 +010072 the server supports locally-defined keys.";
73 }
74
75 feature asymmetric-keys {
76 description
77 "The 'asymmetric-keys' feature indicates that the server
roman7fdc84d2023-06-06 13:14:53 +020078 implements the /keystore/asymmetric-keys subtree.";
79
romanc1d2b092023-02-02 08:58:27 +010080 }
81
82 feature symmetric-keys {
83 description
84 "The 'symmetric-keys' feature indicates that the server
roman7fdc84d2023-06-06 13:14:53 +020085 implements the /keystore/symmetric-keys subtree.";
romanc1d2b092023-02-02 08:58:27 +010086 }
87
88 /****************/
89 /* Typedefs */
90 /****************/
91
92 typedef symmetric-key-ref {
93 type leafref {
94 path "/ks:keystore/ks:symmetric-keys/ks:symmetric-key"
95 + "/ks:name";
96 }
97 description
98 "This typedef enables modules to easily define a reference
Michal Vaskocf898172024-01-15 15:04:28 +010099 to a symmetric key stored in the central keystore.";
romanc1d2b092023-02-02 08:58:27 +0100100 }
101
102 typedef asymmetric-key-ref {
103 type leafref {
104 path "/ks:keystore/ks:asymmetric-keys/ks:asymmetric-key"
105 + "/ks:name";
106 }
107 description
108 "This typedef enables modules to easily define a reference
Michal Vaskocf898172024-01-15 15:04:28 +0100109 to an asymmetric key stored in the central keystore.";
romanc1d2b092023-02-02 08:58:27 +0100110 }
111
112 /*****************/
113 /* Groupings */
114 /*****************/
115
Michal Vaskocf898172024-01-15 15:04:28 +0100116 grouping encrypted-by-grouping {
romanc1d2b092023-02-02 08:58:27 +0100117 description
118 "A grouping that defines a 'choice' statement that can be
119 augmented into the 'encrypted-by' node, present in the
120 'symmetric-key-grouping' and 'asymmetric-key-pair-grouping'
121 groupings defined in RFC AAAA, enabling references to keys
Michal Vaskocf898172024-01-15 15:04:28 +0100122 in the central keystore.";
123 choice encrypted-by {
romanc1d2b092023-02-02 08:58:27 +0100124 nacm:default-deny-write;
125 mandatory true;
126 description
127 "A choice amongst other symmetric or asymmetric keys.";
128 case symmetric-key-ref {
129 if-feature "central-keystore-supported";
130 if-feature "symmetric-keys";
131 leaf symmetric-key-ref {
132 type ks:symmetric-key-ref;
133 description
134 "Identifies the symmetric key used to encrypt the
135 associated key.";
136 }
137 }
138 case asymmetric-key-ref {
139 if-feature "central-keystore-supported";
140 if-feature "asymmetric-keys";
141 leaf asymmetric-key-ref {
142 type ks:asymmetric-key-ref;
143 description
144 "Identifies the asymmetric key whose public key
145 encrypted the associated key.";
146 }
147 }
148 }
149 }
150
Michal Vaskocf898172024-01-15 15:04:28 +0100151 // *-ref groupings
152
romanc1d2b092023-02-02 08:58:27 +0100153 grouping asymmetric-key-certificate-ref-grouping {
154 description
Michal Vaskocf898172024-01-15 15:04:28 +0100155 "Grouping for the reference to a certificate associated
156 with an asymmetric key stored in the central keystore.";
romanc1d2b092023-02-02 08:58:27 +0100157 leaf asymmetric-key {
158 nacm:default-deny-write;
159 if-feature "central-keystore-supported";
160 if-feature "asymmetric-keys";
161 type ks:asymmetric-key-ref;
162 must '../certificate';
163 description
164 "A reference to an asymmetric key in the keystore.";
165 }
166 leaf certificate {
167 nacm:default-deny-write;
168 type leafref {
169 path "/ks:keystore/ks:asymmetric-keys/ks:asymmetric-key"
170 + "[ks:name = current()/../asymmetric-key]/"
171 + "ks:certificates/ks:certificate/ks:name";
172 }
173 must '../asymmetric-key';
174 description
175 "A reference to a specific certificate of the
176 asymmetric key in the keystore.";
177 }
178 }
179
roman7fdc84d2023-06-06 13:14:53 +0200180 // inline-or-keystore-* groupings
romanc1d2b092023-02-02 08:58:27 +0100181
roman7fdc84d2023-06-06 13:14:53 +0200182 grouping inline-or-keystore-symmetric-key-grouping {
romanc1d2b092023-02-02 08:58:27 +0100183 description
Michal Vaskocf898172024-01-15 15:04:28 +0100184 "A grouping for the configuration of a symmetric key. The
185 symmetric key may be defined inline or as a reference to
186 a symmetric key stored in the central keystore.
romanc1d2b092023-02-02 08:58:27 +0100187
Michal Vaskocf898172024-01-15 15:04:28 +0100188 Servers that do not define the 'central-keystore-supported'
189 feature SHOULD augment in custom 'case' statements enabling
190 references to alternate keystore locations.";
roman7fdc84d2023-06-06 13:14:53 +0200191 choice inline-or-keystore {
romanc1d2b092023-02-02 08:58:27 +0100192 nacm:default-deny-write;
193 mandatory true;
194 description
195 "A choice between an inlined definition and a definition
196 that exists in the keystore.";
roman7fdc84d2023-06-06 13:14:53 +0200197 case inline {
198 if-feature "inline-definitions-supported";
199 container inline-definition {
romanc1d2b092023-02-02 08:58:27 +0100200 description
201 "Container to hold the local key definition.";
202 uses ct:symmetric-key-grouping;
203 }
204 }
Michal Vaskocf898172024-01-15 15:04:28 +0100205 case central-keystore {
romanc1d2b092023-02-02 08:58:27 +0100206 if-feature "central-keystore-supported";
207 if-feature "symmetric-keys";
Michal Vaskocf898172024-01-15 15:04:28 +0100208 leaf central-keystore-reference {
romanc1d2b092023-02-02 08:58:27 +0100209 type ks:symmetric-key-ref;
210 description
211 "A reference to an symmetric key that exists in
Michal Vaskocf898172024-01-15 15:04:28 +0100212 the central keystore.";
romanc1d2b092023-02-02 08:58:27 +0100213 }
214 }
215 }
216 }
roman7fdc84d2023-06-06 13:14:53 +0200217
218 grouping inline-or-keystore-asymmetric-key-grouping {
romanc1d2b092023-02-02 08:58:27 +0100219 description
Michal Vaskocf898172024-01-15 15:04:28 +0100220 "A grouping for the configuration of an asymmetric key. The
221 asymmetric key may be defined inline or as a reference to
222 an asymmetric key stored in the central keystore.
romanc1d2b092023-02-02 08:58:27 +0100223
Michal Vaskocf898172024-01-15 15:04:28 +0100224 Servers that do not define the 'central-keystore-supported'
225 feature SHOULD augment in custom 'case' statements enabling
226 references to alternate keystore locations.";
roman7fdc84d2023-06-06 13:14:53 +0200227 choice inline-or-keystore {
romanc1d2b092023-02-02 08:58:27 +0100228 nacm:default-deny-write;
229 mandatory true;
230 description
231 "A choice between an inlined definition and a definition
232 that exists in the keystore.";
roman7fdc84d2023-06-06 13:14:53 +0200233 case inline {
234 if-feature "inline-definitions-supported";
235 container inline-definition {
romanc1d2b092023-02-02 08:58:27 +0100236 description
237 "Container to hold the local key definition.";
238 uses ct:asymmetric-key-pair-grouping;
239 }
240 }
Michal Vaskocf898172024-01-15 15:04:28 +0100241 case central-keystore {
romanc1d2b092023-02-02 08:58:27 +0100242 if-feature "central-keystore-supported";
243 if-feature "asymmetric-keys";
Michal Vaskocf898172024-01-15 15:04:28 +0100244 leaf central-keystore-reference {
romanc1d2b092023-02-02 08:58:27 +0100245 type ks:asymmetric-key-ref;
246 description
247 "A reference to an asymmetric key that exists in
Michal Vaskocf898172024-01-15 15:04:28 +0100248 the central keystore. The intent is to reference
249 just the asymmetric key without any regard for
250 any certificates that may be associated with it.";
romanc1d2b092023-02-02 08:58:27 +0100251 }
252 }
253 }
254 }
255
roman7fdc84d2023-06-06 13:14:53 +0200256 grouping inline-or-keystore-asymmetric-key-with-certs-grouping {
romanc1d2b092023-02-02 08:58:27 +0100257 description
Michal Vaskocf898172024-01-15 15:04:28 +0100258 "A grouping for the configuration of an asymmetric key and
259 its associated certificates. The asymmetric key and its
260 associated certificates may be defined inline or as a
261 reference to an asymmetric key (and its associated
262 certificates) in the central keystore.
roman7fdc84d2023-06-06 13:14:53 +0200263
Michal Vaskocf898172024-01-15 15:04:28 +0100264 Servers that do not define the 'central-keystore-supported'
265 feature SHOULD augment in custom 'case' statements enabling
266 references to alternate keystore locations.";
roman7fdc84d2023-06-06 13:14:53 +0200267 choice inline-or-keystore {
romanc1d2b092023-02-02 08:58:27 +0100268 nacm:default-deny-write;
269 mandatory true;
270 description
271 "A choice between an inlined definition and a definition
272 that exists in the keystore.";
roman7fdc84d2023-06-06 13:14:53 +0200273 case inline {
274 if-feature "inline-definitions-supported";
275 container inline-definition {
romanc1d2b092023-02-02 08:58:27 +0100276 description
277 "Container to hold the local key definition.";
278 uses ct:asymmetric-key-pair-with-certs-grouping;
279 }
280 }
Michal Vaskocf898172024-01-15 15:04:28 +0100281 case central-keystore {
romanc1d2b092023-02-02 08:58:27 +0100282 if-feature "central-keystore-supported";
283 if-feature "asymmetric-keys";
Michal Vaskocf898172024-01-15 15:04:28 +0100284 leaf central-keystore-reference {
romanc1d2b092023-02-02 08:58:27 +0100285 type ks:asymmetric-key-ref;
286 description
287 "A reference to an asymmetric-key (and all of its
288 associated certificates) in the keystore, when
289 this module is implemented.";
290 }
291 }
292 }
293 }
294
roman7fdc84d2023-06-06 13:14:53 +0200295 grouping inline-or-keystore-end-entity-cert-with-key-grouping {
romanc1d2b092023-02-02 08:58:27 +0100296 description
Michal Vaskocf898172024-01-15 15:04:28 +0100297 "A grouping for the configuration of an asymmetric key and
298 its associated end-entity certificate. The asymmetric key
299 and its associated end-entity certificate may be defined
300 inline or as a reference to an asymmetric key (and its
301 associated end-entity certificate) in the central keystore.
romanc1d2b092023-02-02 08:58:27 +0100302
Michal Vaskocf898172024-01-15 15:04:28 +0100303 Servers that do not define the 'central-keystore-supported'
304 feature SHOULD augment in custom 'case' statements enabling
305 references to alternate keystore locations.";
roman7fdc84d2023-06-06 13:14:53 +0200306 choice inline-or-keystore {
romanc1d2b092023-02-02 08:58:27 +0100307 nacm:default-deny-write;
308 mandatory true;
309 description
310 "A choice between an inlined definition and a definition
311 that exists in the keystore.";
roman7fdc84d2023-06-06 13:14:53 +0200312 case inline {
313 if-feature "inline-definitions-supported";
314 container inline-definition {
romanc1d2b092023-02-02 08:58:27 +0100315 description
316 "Container to hold the local key definition.";
317 uses ct:asymmetric-key-pair-with-cert-grouping;
318 }
319 }
Michal Vaskocf898172024-01-15 15:04:28 +0100320 case central-keystore {
romanc1d2b092023-02-02 08:58:27 +0100321 if-feature "central-keystore-supported";
322 if-feature "asymmetric-keys";
Michal Vaskocf898172024-01-15 15:04:28 +0100323 container central-keystore-reference {
romanc1d2b092023-02-02 08:58:27 +0100324 uses asymmetric-key-certificate-ref-grouping;
325 description
326 "A reference to a specific certificate associated with
Michal Vaskocf898172024-01-15 15:04:28 +0100327 an asymmetric key stored in the central keystore.";
romanc1d2b092023-02-02 08:58:27 +0100328 }
329 }
330 }
331 }
332
Michal Vaskocf898172024-01-15 15:04:28 +0100333 // the keystore grouping
334
romanc1d2b092023-02-02 08:58:27 +0100335 grouping keystore-grouping {
336 description
337 "Grouping definition enables use in other contexts. If ever
338 done, implementations MUST augment new 'case' statements
roman7fdc84d2023-06-06 13:14:53 +0200339 into the various inline-or-keystore 'choice' statements to
romanc1d2b092023-02-02 08:58:27 +0100340 supply leafrefs to the model-specific location(s).";
341 container asymmetric-keys {
342 nacm:default-deny-write;
343 if-feature "asymmetric-keys";
344 description
345 "A list of asymmetric keys.";
346 list asymmetric-key {
347 key "name";
348 description
349 "An asymmetric key.";
350 leaf name {
351 type string;
352 description
353 "An arbitrary name for the asymmetric key.";
354 }
355 uses ct:asymmetric-key-pair-with-certs-grouping;
356 }
357 }
358 container symmetric-keys {
359 nacm:default-deny-write;
360 if-feature "symmetric-keys";
361 description
362 "A list of symmetric keys.";
363 list symmetric-key {
364 key "name";
365 description
366 "A symmetric key.";
367 leaf name {
368 type string;
369 description
370 "An arbitrary name for the symmetric key.";
371 }
372 uses ct:symmetric-key-grouping;
373 }
374 }
375 }
376
377 /*********************************/
378 /* Protocol accessible nodes */
379 /*********************************/
380
381 container keystore {
382 if-feature central-keystore-supported;
383 description
384 "A central keystore containing a list of symmetric keys and
385 a list of asymmetric keys.";
386 nacm:default-deny-write;
387 uses keystore-grouping {
388 augment "symmetric-keys/symmetric-key/key-type/encrypted-key/"
389 + "encrypted-key/encrypted-by" {
390 description
391 "Augments in a choice statement enabling the encrypting
392 key to be any other symmetric or asymmetric key in the
393 central keystore.";
Michal Vaskocf898172024-01-15 15:04:28 +0100394 uses encrypted-by-grouping;
romanc1d2b092023-02-02 08:58:27 +0100395 }
396 augment "asymmetric-keys/asymmetric-key/private-key-type/"
397 + "encrypted-private-key/encrypted-private-key/"
398 + "encrypted-by" {
399 description
400 "Augments in a choice statement enabling the encrypting
401 key to be any other symmetric or asymmetric key in the
402 central keystore.";
Michal Vaskocf898172024-01-15 15:04:28 +0100403 uses encrypted-by-grouping;
romanc1d2b092023-02-02 08:58:27 +0100404 }
405 }
406 }
407}