blob: 540ea4100b00fdc67fabf2b14df049f7764f13bf [file] [log] [blame]
romanc1d2b092023-02-02 08:58:27 +01001module ietf-truststore {
2 yang-version 1.1;
3 namespace "urn:ietf:params:xml:ns:yang:ietf-truststore";
4 prefix ts;
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 <kent+ietf@watsen.net>";
Michal Vaskocf898172024-01-15 15:04:28 +010025
romanc1d2b092023-02-02 08:58:27 +010026 description
27 "This module defines a 'truststore' to centralize management
28 of trust anchors including certificates and public keys.
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 BBBB
41 (https://www.rfc-editor.org/info/rfcBBBB); 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 BBBB: A YANG Data Model for a Truststore";
56 }
57
58 /****************/
59 /* Features */
60 /****************/
61
62 feature central-truststore-supported {
63 description
64 "The 'central-truststore-supported' feature indicates that
65 the server supports the truststore (i.e., implements the
66 'ietf-truststore' module).";
67 }
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 trust anchors.";
73 }
Michal Vaskocf898172024-01-15 15:04:28 +010074
romanc1d2b092023-02-02 08:58:27 +010075 feature certificates {
76 description
77 "The 'certificates' feature indicates that the server
78 implements the /truststore/certificate-bags subtree.";
79 }
80
81 feature public-keys {
82 description
83 "The 'public-keys' feature indicates that the server
84 implements the /truststore/public-key-bags subtree.";
85 }
86
87 /****************/
88 /* Typedefs */
89 /****************/
90
91 typedef certificate-bag-ref {
92 type leafref {
93 path "/ts:truststore/ts:certificate-bags/"
94 + "ts:certificate-bag/ts:name";
95 }
96 description
97 "This typedef defines a reference to a certificate bag
Michal Vaskocf898172024-01-15 15:04:28 +010098 in the central truststore.";
romanc1d2b092023-02-02 08:58:27 +010099 }
100
101 typedef certificate-ref {
102 type leafref {
103 path "/ts:truststore/ts:certificate-bags/ts:certificate-bag"
Michal Vaskocf898172024-01-15 15:04:28 +0100104 + "[ts:name = current()/../certificate-bag]/"
romanc1d2b092023-02-02 08:58:27 +0100105 + "ts:certificate/ts:name";
106 }
107 description
108 "This typedef defines a reference to a specific certificate
Michal Vaskocf898172024-01-15 15:04:28 +0100109 in a certificate bag in the central truststore. This typedef
110 requires that there exist a sibling 'leaf' node called
111 'certificate-bag' that SHOULD have the typedef
112 'certificate-bag-ref'.";
romanc1d2b092023-02-02 08:58:27 +0100113 }
114
115 typedef public-key-bag-ref {
116 type leafref {
117 path "/ts:truststore/ts:public-key-bags/"
118 + "ts:public-key-bag/ts:name";
119 }
120 description
121 "This typedef defines a reference to a public key bag
Michal Vaskocf898172024-01-15 15:04:28 +0100122 in the central truststore.";
romanc1d2b092023-02-02 08:58:27 +0100123 }
124
125 typedef public-key-ref {
126 type leafref {
127 path "/ts:truststore/ts:public-key-bags/ts:public-key-bag"
Michal Vaskocf898172024-01-15 15:04:28 +0100128 + "[ts:name = current()/../public-key-bag]/"
romanc1d2b092023-02-02 08:58:27 +0100129 + "ts:public-key/ts:name";
130 }
131 description
132 "This typedef defines a reference to a specific public key
Michal Vaskocf898172024-01-15 15:04:28 +0100133 in a public key bag in the truststore. This typedef
134 requires that there exist a sibling 'leaf' node called
135 'public-key-bag' that SHOULD have the typedef
136 'public-key-bag-ref'.";
romanc1d2b092023-02-02 08:58:27 +0100137 }
138
139 /*****************/
140 /* Groupings */
141 /*****************/
142
Michal Vaskocf898172024-01-15 15:04:28 +0100143 // *-ref groupings
144
145 grouping certificate-ref-grouping {
146 description
147 "Grouping for the reference to a certificate in a
148 certificate-bag in the central truststore.";
149 leaf certificate-bag {
150 nacm:default-deny-write;
151 if-feature "central-truststore-supported";
152 if-feature "certificates";
153 type ts:certificate-bag-ref;
154 must "../certificate";
155 description
156 "Reference to a certificate-bag in the truststore.";
157 }
158 leaf certificate {
159 nacm:default-deny-write;
160 type ts:certificate-ref;
161 must "../certificate-bag";
162 description
163 "Reference to a specific certificate in the
164 referenced certificate-bag.";
165 }
166 }
167
168 grouping public-key-ref-grouping {
169 description
170 "Grouping for the reference to a public key in a
171 public-key-bag in the central truststore.";
172 leaf public-key-bag {
173 nacm:default-deny-write;
174 if-feature "central-truststore-supported";
175 if-feature "public-keys";
176 type ts:public-key-bag-ref;
177 description
178 "Reference of a public key bag in the truststore inlucding
179 the certificate to authenticate the TLS client.";
180 }
181 leaf public-key {
182 nacm:default-deny-write;
183 type ts:public-key-ref;
184 description
185 "Reference to a specific public key in the
186 referenced public-key-bag.";
187 }
188 }
189
190 // inline-or-truststore-* groupings
191
roman7fdc84d2023-06-06 13:14:53 +0200192 grouping inline-or-truststore-certs-grouping {
romanc1d2b092023-02-02 08:58:27 +0100193 description
Michal Vaskocf898172024-01-15 15:04:28 +0100194 "A grouping for the configuration of a list of certificates.
195 The list of certificate may be defined inline or as a
196 reference to a certificate bag in the central truststore.
romanc1d2b092023-02-02 08:58:27 +0100197
Michal Vaskocf898172024-01-15 15:04:28 +0100198 Servers that do not define the 'central-truststore-supported'
199 feature SHOULD augment in custom 'case' statements enabling
200 references to alternate truststore locations.";
roman7fdc84d2023-06-06 13:14:53 +0200201 choice inline-or-truststore {
romanc1d2b092023-02-02 08:58:27 +0100202 nacm:default-deny-write;
203 mandatory true;
204 description
205 "A choice between an inlined definition and a definition
206 that exists in the truststore.";
roman7fdc84d2023-06-06 13:14:53 +0200207 case inline {
208 if-feature "inline-definitions-supported";
209 container inline-definition {
romanc1d2b092023-02-02 08:58:27 +0100210 description
211 "A container for locally configured trust anchor
212 certificates.";
213 list certificate {
214 key "name";
215 min-elements 1;
216 description
217 "A trust anchor certificate.";
218 leaf name {
219 type string;
220 description
221 "An arbitrary name for this certificate.";
222 }
223 uses ct:trust-anchor-cert-grouping {
224 refine "cert-data" {
225 mandatory true;
226 }
227 }
228 }
229 }
230 }
Michal Vaskocf898172024-01-15 15:04:28 +0100231 case central-truststore {
romanc1d2b092023-02-02 08:58:27 +0100232 if-feature "central-truststore-supported";
233 if-feature "certificates";
Michal Vaskocf898172024-01-15 15:04:28 +0100234 leaf central-truststore-reference {
romanc1d2b092023-02-02 08:58:27 +0100235 type ts:certificate-bag-ref;
236 description
237 "A reference to a certificate bag that exists in the
Michal Vaskocf898172024-01-15 15:04:28 +0100238 central truststore.";
romanc1d2b092023-02-02 08:58:27 +0100239 }
240 }
241 }
242 }
243
roman7fdc84d2023-06-06 13:14:53 +0200244 grouping inline-or-truststore-public-keys-grouping {
romanc1d2b092023-02-02 08:58:27 +0100245 description
246 "A grouping that allows the public keys to be either
247 configured locally, within the using data model, or be a
248 reference to a public key bag stored in the truststore.
249
Michal Vaskocf898172024-01-15 15:04:28 +0100250 Servers that do not define the 'central-truststore-supported'
251 feature SHOULD augment in custom 'case' statements enabling
252 references to alternate truststore locations.";
roman7fdc84d2023-06-06 13:14:53 +0200253 choice inline-or-truststore {
romanc1d2b092023-02-02 08:58:27 +0100254 nacm:default-deny-write;
255 mandatory true;
256 description
257 "A choice between an inlined definition and a definition
258 that exists in the truststore.";
roman7fdc84d2023-06-06 13:14:53 +0200259 case inline {
260 if-feature "inline-definitions-supported";
261 container inline-definition {
romanc1d2b092023-02-02 08:58:27 +0100262 description
263 "A container to hold local public key definitions.";
264 list public-key {
265 key "name";
266 description
267 "A public key definition.";
268 leaf name {
269 type string;
270 description
271 "An arbitrary name for this public key.";
272 }
273 uses ct:public-key-grouping;
274 }
275 }
276 }
Michal Vaskocf898172024-01-15 15:04:28 +0100277 case central-truststore {
romanc1d2b092023-02-02 08:58:27 +0100278 if-feature "central-truststore-supported";
279 if-feature "public-keys";
Michal Vaskocf898172024-01-15 15:04:28 +0100280 leaf central-truststore-reference {
romanc1d2b092023-02-02 08:58:27 +0100281 type ts:public-key-bag-ref;
282 description
283 "A reference to a bag of public keys that exists
Michal Vaskocf898172024-01-15 15:04:28 +0100284 in the central truststore.";
romanc1d2b092023-02-02 08:58:27 +0100285 }
286 }
287 }
288 }
289
Michal Vaskocf898172024-01-15 15:04:28 +0100290
291 // the truststore grouping
292
romanc1d2b092023-02-02 08:58:27 +0100293 grouping truststore-grouping {
294 description
295 "A grouping definition that enables use in other contexts.
296 Where used, implementations MUST augment new 'case'
roman7fdc84d2023-06-06 13:14:53 +0200297 statements into the various inline-or-truststore 'choice'
romanc1d2b092023-02-02 08:58:27 +0100298 statements to supply leafrefs to the model-specific
299 location(s).";
300 container certificate-bags {
301 nacm:default-deny-write;
302 if-feature "certificates";
303 description
304 "A collection of certificate bags.";
305 list certificate-bag {
306 key "name";
307 description
308 "A bag of certificates. Each bag of certificates SHOULD
309 be for a specific purpose. For instance, one bag could
310 be used to authenticate a specific set of servers, while
311 another could be used to authenticate a specific set of
312 clients.";
313 leaf name {
314 type string;
315 description
316 "An arbitrary name for this bag of certificates.";
317 }
318 leaf description {
319 type string;
320 description
321 "A description for this bag of certificates. The
322 intended purpose for the bag SHOULD be described.";
323 }
324 list certificate {
325 key "name";
326 description
327 "A trust anchor certificate.";
328 leaf name {
329 type string;
330 description
331 "An arbitrary name for this certificate.";
332 }
333 uses ct:trust-anchor-cert-grouping {
334 refine "cert-data" {
335 mandatory true;
336 }
337 }
338 }
339 }
340 }
341 container public-key-bags {
342 nacm:default-deny-write;
343 if-feature "public-keys";
344 description
345 "A collection of public key bags.";
346 list public-key-bag {
347 key "name";
348 description
349 "A bag of public keys. Each bag of keys SHOULD be for
350 a specific purpose. For instance, one bag could be used
351 authenticate a specific set of servers, while another
352 could be used to authenticate a specific set of clients.";
353 leaf name {
354 type string;
355 description
356 "An arbitrary name for this bag of public keys.";
357 }
358 leaf description {
359 type string;
360 description
361 "A description for this bag public keys. The
362 intended purpose for the bag SHOULD be described.";
363 }
364 list public-key {
365 key "name";
366 description
367 "A public key.";
368 leaf name {
369 type string;
370 description
371 "An arbitrary name for this public key.";
372 }
373 uses ct:public-key-grouping;
374 }
375 }
376 }
377 }
378
379 /*********************************/
380 /* Protocol accessible nodes */
381 /*********************************/
382
383 container truststore {
384 if-feature central-truststore-supported;
385 nacm:default-deny-write;
386 description
387 "The truststore contains bags of certificates and
388 public keys.";
389 uses truststore-grouping;
390 }
391}