roman | c1d2b09 | 2023-02-02 08:58:27 +0100 | [diff] [blame] | 1 | module 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 Vasko | cf89817 | 2024-01-15 15:04:28 +0100 | [diff] [blame] | 25 | |
roman | c1d2b09 | 2023-02-02 08:58:27 +0100 | [diff] [blame] | 26 | description |
| 27 | "This module defines a 'truststore' to centralize management |
| 28 | of trust anchors including certificates and public keys. |
| 29 | |
roman | 7fdc84d | 2023-06-06 13:14:53 +0200 | [diff] [blame] | 30 | Copyright (c) 2023 IETF Trust and the persons identified |
roman | c1d2b09 | 2023-02-02 08:58:27 +0100 | [diff] [blame] | 31 | 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 Vasko | cf89817 | 2024-01-15 15:04:28 +0100 | [diff] [blame] | 51 | revision 2023-12-28 { |
roman | c1d2b09 | 2023-02-02 08:58:27 +0100 | [diff] [blame] | 52 | 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 | |
roman | 7fdc84d | 2023-06-06 13:14:53 +0200 | [diff] [blame] | 69 | feature inline-definitions-supported { |
roman | c1d2b09 | 2023-02-02 08:58:27 +0100 | [diff] [blame] | 70 | description |
roman | 7fdc84d | 2023-06-06 13:14:53 +0200 | [diff] [blame] | 71 | "The 'inline-definitions-supported' feature indicates that |
roman | c1d2b09 | 2023-02-02 08:58:27 +0100 | [diff] [blame] | 72 | the server supports locally-defined trust anchors."; |
| 73 | } |
Michal Vasko | cf89817 | 2024-01-15 15:04:28 +0100 | [diff] [blame] | 74 | |
roman | c1d2b09 | 2023-02-02 08:58:27 +0100 | [diff] [blame] | 75 | 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 Vasko | cf89817 | 2024-01-15 15:04:28 +0100 | [diff] [blame] | 98 | in the central truststore."; |
roman | c1d2b09 | 2023-02-02 08:58:27 +0100 | [diff] [blame] | 99 | } |
| 100 | |
| 101 | typedef certificate-ref { |
| 102 | type leafref { |
| 103 | path "/ts:truststore/ts:certificate-bags/ts:certificate-bag" |
Michal Vasko | cf89817 | 2024-01-15 15:04:28 +0100 | [diff] [blame] | 104 | + "[ts:name = current()/../certificate-bag]/" |
roman | c1d2b09 | 2023-02-02 08:58:27 +0100 | [diff] [blame] | 105 | + "ts:certificate/ts:name"; |
| 106 | } |
| 107 | description |
| 108 | "This typedef defines a reference to a specific certificate |
Michal Vasko | cf89817 | 2024-01-15 15:04:28 +0100 | [diff] [blame] | 109 | 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'."; |
roman | c1d2b09 | 2023-02-02 08:58:27 +0100 | [diff] [blame] | 113 | } |
| 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 Vasko | cf89817 | 2024-01-15 15:04:28 +0100 | [diff] [blame] | 122 | in the central truststore."; |
roman | c1d2b09 | 2023-02-02 08:58:27 +0100 | [diff] [blame] | 123 | } |
| 124 | |
| 125 | typedef public-key-ref { |
| 126 | type leafref { |
| 127 | path "/ts:truststore/ts:public-key-bags/ts:public-key-bag" |
Michal Vasko | cf89817 | 2024-01-15 15:04:28 +0100 | [diff] [blame] | 128 | + "[ts:name = current()/../public-key-bag]/" |
roman | c1d2b09 | 2023-02-02 08:58:27 +0100 | [diff] [blame] | 129 | + "ts:public-key/ts:name"; |
| 130 | } |
| 131 | description |
| 132 | "This typedef defines a reference to a specific public key |
Michal Vasko | cf89817 | 2024-01-15 15:04:28 +0100 | [diff] [blame] | 133 | 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'."; |
roman | c1d2b09 | 2023-02-02 08:58:27 +0100 | [diff] [blame] | 137 | } |
| 138 | |
| 139 | /*****************/ |
| 140 | /* Groupings */ |
| 141 | /*****************/ |
| 142 | |
Michal Vasko | cf89817 | 2024-01-15 15:04:28 +0100 | [diff] [blame] | 143 | // *-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 | |
roman | 7fdc84d | 2023-06-06 13:14:53 +0200 | [diff] [blame] | 192 | grouping inline-or-truststore-certs-grouping { |
roman | c1d2b09 | 2023-02-02 08:58:27 +0100 | [diff] [blame] | 193 | description |
Michal Vasko | cf89817 | 2024-01-15 15:04:28 +0100 | [diff] [blame] | 194 | "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. |
roman | c1d2b09 | 2023-02-02 08:58:27 +0100 | [diff] [blame] | 197 | |
Michal Vasko | cf89817 | 2024-01-15 15:04:28 +0100 | [diff] [blame] | 198 | Servers that do not define the 'central-truststore-supported' |
| 199 | feature SHOULD augment in custom 'case' statements enabling |
| 200 | references to alternate truststore locations."; |
roman | 7fdc84d | 2023-06-06 13:14:53 +0200 | [diff] [blame] | 201 | choice inline-or-truststore { |
roman | c1d2b09 | 2023-02-02 08:58:27 +0100 | [diff] [blame] | 202 | 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."; |
roman | 7fdc84d | 2023-06-06 13:14:53 +0200 | [diff] [blame] | 207 | case inline { |
| 208 | if-feature "inline-definitions-supported"; |
| 209 | container inline-definition { |
roman | c1d2b09 | 2023-02-02 08:58:27 +0100 | [diff] [blame] | 210 | 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 Vasko | cf89817 | 2024-01-15 15:04:28 +0100 | [diff] [blame] | 231 | case central-truststore { |
roman | c1d2b09 | 2023-02-02 08:58:27 +0100 | [diff] [blame] | 232 | if-feature "central-truststore-supported"; |
| 233 | if-feature "certificates"; |
Michal Vasko | cf89817 | 2024-01-15 15:04:28 +0100 | [diff] [blame] | 234 | leaf central-truststore-reference { |
roman | c1d2b09 | 2023-02-02 08:58:27 +0100 | [diff] [blame] | 235 | type ts:certificate-bag-ref; |
| 236 | description |
| 237 | "A reference to a certificate bag that exists in the |
Michal Vasko | cf89817 | 2024-01-15 15:04:28 +0100 | [diff] [blame] | 238 | central truststore."; |
roman | c1d2b09 | 2023-02-02 08:58:27 +0100 | [diff] [blame] | 239 | } |
| 240 | } |
| 241 | } |
| 242 | } |
| 243 | |
roman | 7fdc84d | 2023-06-06 13:14:53 +0200 | [diff] [blame] | 244 | grouping inline-or-truststore-public-keys-grouping { |
roman | c1d2b09 | 2023-02-02 08:58:27 +0100 | [diff] [blame] | 245 | 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 Vasko | cf89817 | 2024-01-15 15:04:28 +0100 | [diff] [blame] | 250 | Servers that do not define the 'central-truststore-supported' |
| 251 | feature SHOULD augment in custom 'case' statements enabling |
| 252 | references to alternate truststore locations."; |
roman | 7fdc84d | 2023-06-06 13:14:53 +0200 | [diff] [blame] | 253 | choice inline-or-truststore { |
roman | c1d2b09 | 2023-02-02 08:58:27 +0100 | [diff] [blame] | 254 | 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."; |
roman | 7fdc84d | 2023-06-06 13:14:53 +0200 | [diff] [blame] | 259 | case inline { |
| 260 | if-feature "inline-definitions-supported"; |
| 261 | container inline-definition { |
roman | c1d2b09 | 2023-02-02 08:58:27 +0100 | [diff] [blame] | 262 | 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 Vasko | cf89817 | 2024-01-15 15:04:28 +0100 | [diff] [blame] | 277 | case central-truststore { |
roman | c1d2b09 | 2023-02-02 08:58:27 +0100 | [diff] [blame] | 278 | if-feature "central-truststore-supported"; |
| 279 | if-feature "public-keys"; |
Michal Vasko | cf89817 | 2024-01-15 15:04:28 +0100 | [diff] [blame] | 280 | leaf central-truststore-reference { |
roman | c1d2b09 | 2023-02-02 08:58:27 +0100 | [diff] [blame] | 281 | type ts:public-key-bag-ref; |
| 282 | description |
| 283 | "A reference to a bag of public keys that exists |
Michal Vasko | cf89817 | 2024-01-15 15:04:28 +0100 | [diff] [blame] | 284 | in the central truststore."; |
roman | c1d2b09 | 2023-02-02 08:58:27 +0100 | [diff] [blame] | 285 | } |
| 286 | } |
| 287 | } |
| 288 | } |
| 289 | |
Michal Vasko | cf89817 | 2024-01-15 15:04:28 +0100 | [diff] [blame] | 290 | |
| 291 | // the truststore grouping |
| 292 | |
roman | c1d2b09 | 2023-02-02 08:58:27 +0100 | [diff] [blame] | 293 | grouping truststore-grouping { |
| 294 | description |
| 295 | "A grouping definition that enables use in other contexts. |
| 296 | Where used, implementations MUST augment new 'case' |
roman | 7fdc84d | 2023-06-06 13:14:53 +0200 | [diff] [blame] | 297 | statements into the various inline-or-truststore 'choice' |
roman | c1d2b09 | 2023-02-02 08:58:27 +0100 | [diff] [blame] | 298 | 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 | } |