Alexander Afanasyev | 7c6aeb0 | 2014-04-10 19:59:19 -0700 | [diff] [blame] | 1 | Validator Configuration File Format |
| 2 | =================================== |
| 3 | |
Yingdi Yu | 4e99f53 | 2014-08-25 19:40:57 -0700 | [diff] [blame] | 4 | You can set up a ``Validator`` via a configuration file. Next, we will show you how to |
| 5 | write a configuration file. |
| 6 | |
| 7 | The configuration file consists of **rules** and **trust-anchors** that will be used in |
| 8 | validation. **Rules** tell the validator how to validate a packet, while **trust-anchors** |
| 9 | tell the validator which certificates are valid immediately. Here is an example of |
Alexander Afanasyev | e5a19b8 | 2017-01-30 22:30:46 -0800 | [diff] [blame] | 10 | configuration file containing two rules and a trust anchor. |
Alexander Afanasyev | 7c6aeb0 | 2014-04-10 19:59:19 -0700 | [diff] [blame] | 11 | |
| 12 | :: |
| 13 | |
| 14 | rule |
| 15 | { |
| 16 | id "Simple Rule" |
| 17 | for data |
| 18 | filter |
| 19 | { |
| 20 | type name |
| 21 | name /localhost/example |
| 22 | relation is-prefix-of |
| 23 | } |
| 24 | checker |
| 25 | { |
| 26 | type customized |
| 27 | sig-type rsa-sha256 |
| 28 | key-locator |
| 29 | { |
| 30 | type name |
Alexander Afanasyev | c381bca | 2017-10-15 14:51:49 -0400 | [diff] [blame] | 31 | name /ndn/edu/ucla/yingdi/KEY/1234 |
Alexander Afanasyev | 7c6aeb0 | 2014-04-10 19:59:19 -0700 | [diff] [blame] | 32 | relation equal |
| 33 | } |
| 34 | } |
| 35 | } |
| 36 | rule |
| 37 | { |
| 38 | id "Testbed Validation Rule" |
| 39 | for data |
| 40 | checker |
| 41 | { |
| 42 | type hierarchical |
| 43 | sig-type rsa-sha256 |
| 44 | } |
| 45 | } |
| 46 | trust-anchor |
| 47 | { |
| 48 | type file |
| 49 | file-name "testbed-trust-anchor.cert" |
| 50 | } |
| 51 | |
Davide Pesavento | 487cc9a | 2025-05-01 23:32:05 -0400 | [diff] [blame^] | 52 | .. important:: The order of rules MATTERS! |
Alexander Afanasyev | 7c6aeb0 | 2014-04-10 19:59:19 -0700 | [diff] [blame] | 53 | |
| 54 | A rule can be broken into two parts: |
| 55 | |
| 56 | - The first part is to qualify packets to which the rule can be |
| 57 | applied; |
| 58 | - The second part is to check whether further validation process is |
| 59 | necessary. |
| 60 | |
Alexander Afanasyev | e5a19b8 | 2017-01-30 22:30:46 -0800 | [diff] [blame] | 61 | When a packet is presented for validation, the validator will check the rules one-by-one |
| 62 | in the configuration file using **for** and **filter** conditions against the packet, |
| 63 | until finding a rule for which the packet qualifies. After that, the **checker** |
| 64 | conditions of the matched rule will be used to check the validity of the packet. If the |
| 65 | packet does not match any rules, it is treated as an invalid packet. Once a packet has |
| 66 | been matched by a rule, the remaining rules are not applied to the packet (i.e., the |
| 67 | matched rule "captures" the packet). Therefore, you should always put the most specific |
| 68 | rule first. |
Alexander Afanasyev | 7c6aeb0 | 2014-04-10 19:59:19 -0700 | [diff] [blame] | 69 | |
Yingdi Yu | 4e99f53 | 2014-08-25 19:40:57 -0700 | [diff] [blame] | 70 | In the example configuration, the first rule indicates that all the data packets under the |
Alexander Afanasyev | e5a19b8 | 2017-01-30 22:30:46 -0800 | [diff] [blame] | 71 | name prefix ``/localhost/example`` must be signed by a certificate whose name (the key |
Alexander Afanasyev | c381bca | 2017-10-15 14:51:49 -0400 | [diff] [blame] | 72 | part) is ``/ndn/edu/ucla/yingdi/KEY/1234``. If a packet does not have a name under |
Alexander Afanasyev | e5a19b8 | 2017-01-30 22:30:46 -0800 | [diff] [blame] | 73 | prefix ``/localhost/example``, the validator will skip the first rule and apply the second |
| 74 | rule. The second rule indicates that all other data packets must be validated using the |
| 75 | hierarchical policy (data name should be prefix or equal to the identity part of the |
| 76 | certificate name). The example configuration defines that all certificate chains must be |
| 77 | rooted in the certificate defined in the file "testbed-trust-anchor.cert". |
Alexander Afanasyev | 7c6aeb0 | 2014-04-10 19:59:19 -0700 | [diff] [blame] | 78 | |
| 79 | Rules in general |
| 80 | ---------------- |
| 81 | |
Alexander Afanasyev | e5a19b8 | 2017-01-30 22:30:46 -0800 | [diff] [blame] | 82 | A rule has four properties: **id**, **for**, **filter**, and **checker**. |
Alexander Afanasyev | 7c6aeb0 | 2014-04-10 19:59:19 -0700 | [diff] [blame] | 83 | |
Alexander Afanasyev | e5a19b8 | 2017-01-30 22:30:46 -0800 | [diff] [blame] | 84 | The **id** property uniquely identifies the rule in the configuration file. As long as |
Yingdi Yu | 4e99f53 | 2014-08-25 19:40:57 -0700 | [diff] [blame] | 85 | being unique, any name can be given to a rule, e.g., "Simple Rule", "Testbed Validation |
| 86 | Rule". A rule must have one and only one **id** property. |
Alexander Afanasyev | 7c6aeb0 | 2014-04-10 19:59:19 -0700 | [diff] [blame] | 87 | |
Alexander Afanasyev | e5a19b8 | 2017-01-30 22:30:46 -0800 | [diff] [blame] | 88 | A rule is either used to validate a data packet or an interest packet. This information |
| 89 | is specified in the **for** property, which can be either **data** or **interest**. A |
| 90 | rule must have exactly one **for** property. |
Alexander Afanasyev | 7c6aeb0 | 2014-04-10 19:59:19 -0700 | [diff] [blame] | 91 | |
Alexander Afanasyev | e5a19b8 | 2017-01-30 22:30:46 -0800 | [diff] [blame] | 92 | The **filter** property further constrains the packets that can be checked by the |
| 93 | rule. The filter property is not required in a rule; if omitted, the rule will capture all |
| 94 | packets passed to it. A rule may contain multiple filters, in this case, a packet |
| 95 | is captured by the rule only if all filters are satisfied. |
Alexander Afanasyev | 7c6aeb0 | 2014-04-10 19:59:19 -0700 | [diff] [blame] | 96 | |
Davide Pesavento | 487cc9a | 2025-05-01 23:32:05 -0400 | [diff] [blame^] | 97 | .. caution:: A packet that satisfies all the filters may not be valid. |
Alexander Afanasyev | 7c6aeb0 | 2014-04-10 19:59:19 -0700 | [diff] [blame] | 98 | |
Alexander Afanasyev | e5a19b8 | 2017-01-30 22:30:46 -0800 | [diff] [blame] | 99 | The **checker** property defines the conditions that a matched packet must fulfill to be |
Zhiyi Zhang | 044bb7e | 2016-06-10 00:02:37 -0700 | [diff] [blame] | 100 | treated as a valid packet. A rule must have at least one **checker** property. A packet is |
| 101 | treated as valid if it can pass at least one of the checkers and as invalid when it cannot |
| 102 | pass any checkers. |
Alexander Afanasyev | 7c6aeb0 | 2014-04-10 19:59:19 -0700 | [diff] [blame] | 103 | |
Alexander Afanasyev | 7c6aeb0 | 2014-04-10 19:59:19 -0700 | [diff] [blame] | 104 | Filter Property |
| 105 | --------------- |
| 106 | |
Alexander Afanasyev | e5a19b8 | 2017-01-30 22:30:46 -0800 | [diff] [blame] | 107 | Filter has a **type** property and type-specific properties. Although a rule can contain |
| 108 | more than one filters, there can be at most one filter of each type. |
| 109 | |
| 110 | Currently, only the packet name filter is defined. |
Alexander Afanasyev | 7c6aeb0 | 2014-04-10 19:59:19 -0700 | [diff] [blame] | 111 | |
| 112 | Name Filter |
| 113 | ~~~~~~~~~~~ |
| 114 | |
Alexander Afanasyev | e5a19b8 | 2017-01-30 22:30:46 -0800 | [diff] [blame] | 115 | There are two ways to express the conditions on packet name: |
| 116 | |
| 117 | - relationship between the packet name and the specified name |
| 118 | - :doc:`NDN regular expression <utils-ndn-regex>` match. |
| 119 | |
| 120 | Name and Relation |
| 121 | ^^^^^^^^^^^^^^^^^ |
| 122 | |
| 123 | In the first case, two more properties are required: **name** and **relation**. A packet |
| 124 | can fulfill the condition if the **name** has a **relation** to the packet's name. Three |
| 125 | types of **relation** has been defined: **equal**, **is-prefix-of**, |
| 126 | **is-strict-prefix-of**. For example, the filter |
Alexander Afanasyev | 7c6aeb0 | 2014-04-10 19:59:19 -0700 | [diff] [blame] | 127 | |
| 128 | :: |
| 129 | |
| 130 | filter |
| 131 | { |
| 132 | type name |
| 133 | name /localhost/example |
| 134 | relation equal |
| 135 | } |
| 136 | |
Alexander Afanasyev | e5a19b8 | 2017-01-30 22:30:46 -0800 | [diff] [blame] | 137 | will capture only a packet with the exact name ``/localhost/example``. |
| 138 | |
| 139 | The filter |
Alexander Afanasyev | 7c6aeb0 | 2014-04-10 19:59:19 -0700 | [diff] [blame] | 140 | |
| 141 | :: |
| 142 | |
| 143 | filter |
| 144 | { |
| 145 | type name |
| 146 | name /localhost/example |
| 147 | relation is-prefix-of |
| 148 | } |
| 149 | |
Alexander Afanasyev | e5a19b8 | 2017-01-30 22:30:46 -0800 | [diff] [blame] | 150 | will capture a packet with name ``/localhost/example`` or ``/localhost/example/data``, but |
| 151 | will not capture a packet with name ``/localhost/another_example``. And the filter |
Alexander Afanasyev | 7c6aeb0 | 2014-04-10 19:59:19 -0700 | [diff] [blame] | 152 | |
| 153 | :: |
| 154 | |
| 155 | filter |
| 156 | { |
| 157 | type name |
| 158 | name /localhost/example |
| 159 | relation is-strict-prefix-of |
| 160 | } |
| 161 | |
Alexander Afanasyev | e5a19b8 | 2017-01-30 22:30:46 -0800 | [diff] [blame] | 162 | will capture a packet with name ``/localhost/example/data``, but will not capture a packet |
Yingdi Yu | 4e99f53 | 2014-08-25 19:40:57 -0700 | [diff] [blame] | 163 | with name ``/localhost/example``. |
Alexander Afanasyev | 7c6aeb0 | 2014-04-10 19:59:19 -0700 | [diff] [blame] | 164 | |
Alexander Afanasyev | e5a19b8 | 2017-01-30 22:30:46 -0800 | [diff] [blame] | 165 | NDN Regular Expression Match |
| 166 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 167 | |
Yingdi Yu | 4e99f53 | 2014-08-25 19:40:57 -0700 | [diff] [blame] | 168 | The second way is to specify an :doc:`utils-ndn-regex` that can match the packet. In this |
Alexander Afanasyev | e5a19b8 | 2017-01-30 22:30:46 -0800 | [diff] [blame] | 169 | case, only one property **regex** is required. For example, the filter |
Alexander Afanasyev | 7c6aeb0 | 2014-04-10 19:59:19 -0700 | [diff] [blame] | 170 | |
| 171 | :: |
| 172 | |
| 173 | filter |
| 174 | { |
| 175 | type name |
Alexander Afanasyev | e5a19b8 | 2017-01-30 22:30:46 -0800 | [diff] [blame] | 176 | regex ^<>*<KEY><><><>$ |
Alexander Afanasyev | 7c6aeb0 | 2014-04-10 19:59:19 -0700 | [diff] [blame] | 177 | } |
| 178 | |
Alexander Afanasyev | e5a19b8 | 2017-01-30 22:30:46 -0800 | [diff] [blame] | 179 | will capture all certificates. |
Alexander Afanasyev | 7c6aeb0 | 2014-04-10 19:59:19 -0700 | [diff] [blame] | 180 | |
| 181 | Checker Property |
| 182 | ---------------- |
| 183 | |
Yingdi Yu | 4e99f53 | 2014-08-25 19:40:57 -0700 | [diff] [blame] | 184 | Passing all the filters in a rule only indicates that a packet can be checked using the |
Alexander Afanasyev | e5a19b8 | 2017-01-30 22:30:46 -0800 | [diff] [blame] | 185 | rule, and it does not necessarily imply that the packet is valid. The validity of a |
Yingdi Yu | 4e99f53 | 2014-08-25 19:40:57 -0700 | [diff] [blame] | 186 | packet is determined by the property **checker**, which defines the conditions that a |
| 187 | valid packet must fulfill. |
Alexander Afanasyev | 7c6aeb0 | 2014-04-10 19:59:19 -0700 | [diff] [blame] | 188 | |
Alexander Afanasyev | e5a19b8 | 2017-01-30 22:30:46 -0800 | [diff] [blame] | 189 | Same as **filter**, **checker** has a property **type**. We have defined two types of |
| 190 | checkers: |
| 191 | |
| 192 | - **customized** is a checker that allows customization of the conditions according to specific |
| 193 | requirements; |
| 194 | |
| 195 | - **hierarchical** is a checker with pre-defined hierarchical trust model. |
Alexander Afanasyev | 7c6aeb0 | 2014-04-10 19:59:19 -0700 | [diff] [blame] | 196 | |
| 197 | Customized Checker |
| 198 | ~~~~~~~~~~~~~~~~~~ |
| 199 | |
Alexander Afanasyev | 17d4b93 | 2021-03-17 17:58:40 -0400 | [diff] [blame] | 200 | The customized checker can include optional **sig-type** property, which specifies the acceptable signature |
| 201 | type. If not specified, the checker will only accept ECDSA signature. Possible values for **sig-type** are: |
| 202 | |
| 203 | - **ecdsa-sha256**: ECDSA signature required (default if **sig-type** not specified) |
| 204 | - **rsa-sha256**: RSA signature required |
| 205 | - **sha256** (not recommended, as it is not a real signature): SHA256 digest is required |
| 206 | |
| 207 | If sig-type is **rsa-sha256** or **ecdsa-sha256**, the customized checker requires |
| 208 | **key-locator** property. If sig-type is **sha256**, **key-locator** property can be |
| 209 | specified, but is optional. |
Alexander Afanasyev | 7c6aeb0 | 2014-04-10 19:59:19 -0700 | [diff] [blame] | 210 | |
| 211 | :: |
| 212 | |
| 213 | checker |
| 214 | { |
| 215 | type customized |
Alexander Afanasyev | 17d4b93 | 2021-03-17 17:58:40 -0400 | [diff] [blame] | 216 | sig-type rsa-sha256 |
Alexander Afanasyev | 7c6aeb0 | 2014-04-10 19:59:19 -0700 | [diff] [blame] | 217 | key-locator |
| 218 | { |
| 219 | ... |
| 220 | } |
| 221 | } |
| 222 | |
Alexander Afanasyev | 17d4b93 | 2021-03-17 17:58:40 -0400 | [diff] [blame] | 223 | checker |
| 224 | { |
| 225 | type customized |
| 226 | sig-type sha256 |
| 227 | } |
Alexander Afanasyev | 7c6aeb0 | 2014-04-10 19:59:19 -0700 | [diff] [blame] | 228 | |
Alexander Afanasyev | 17d4b93 | 2021-03-17 17:58:40 -0400 | [diff] [blame] | 229 | The **key-locator** property is a nested configuration property that can appear exactly once |
| 230 | and specifies conditions on ``KeyLocator``. It requires **type** property that currently |
| 231 | supports only one value: **name**. |
Alexander Afanasyev | 7c6aeb0 | 2014-04-10 19:59:19 -0700 | [diff] [blame] | 232 | |
| 233 | :: |
| 234 | |
| 235 | key-locator |
| 236 | { |
| 237 | type name |
| 238 | ... |
| 239 | } |
| 240 | |
Alexander Afanasyev | 17d4b93 | 2021-03-17 17:58:40 -0400 | [diff] [blame] | 241 | ``KeyLocator`` conditions can be specified in the same way as the name filter. For example, a |
| 242 | checker that requires ``SignatureSha256WithRsa`` signature type with ``KeyLocator`` to be exactly |
| 243 | ``/ndn/edu/ucla/yingdi/KEY/1234`` can be written as follows: |
Alexander Afanasyev | 7c6aeb0 | 2014-04-10 19:59:19 -0700 | [diff] [blame] | 244 | |
| 245 | :: |
| 246 | |
| 247 | checker |
| 248 | { |
| 249 | type customized |
| 250 | sig-type rsa-sha256 |
| 251 | key-locator |
| 252 | { |
| 253 | type name |
Alexander Afanasyev | c381bca | 2017-10-15 14:51:49 -0400 | [diff] [blame] | 254 | name /ndn/edu/ucla/yingdi/KEY/1234 |
Alexander Afanasyev | 7c6aeb0 | 2014-04-10 19:59:19 -0700 | [diff] [blame] | 255 | relation equal |
| 256 | } |
| 257 | } |
| 258 | |
Alexander Afanasyev | 17d4b93 | 2021-03-17 17:58:40 -0400 | [diff] [blame] | 259 | Similarly, a checker that requires ``SignatureSha256WithEcdsa`` signature with ``KeyLocator`` |
| 260 | that follows a regular expression pattern ``<ndn><>*<KEY><>{1,3}`` can be written as follows: |
Alexander Afanasyev | 7c6aeb0 | 2014-04-10 19:59:19 -0700 | [diff] [blame] | 261 | |
Alexander Afanasyev | 17d4b93 | 2021-03-17 17:58:40 -0400 | [diff] [blame] | 262 | :: |
| 263 | |
| 264 | checker |
| 265 | { |
| 266 | type customized |
| 267 | sig-type ecdsa-sha256 |
| 268 | key-locator |
| 269 | { |
| 270 | type name |
| 271 | regex <ndn><>*<KEY><>{1,3} |
| 272 | relation equal |
| 273 | } |
| 274 | } |
| 275 | |
| 276 | |
| 277 | In addition, ``KeyLocator`` can be further constrained using information extracted from the |
| 278 | packet name using the **hyper-relation** property. |
| 279 | The **hyper-relation** property consists of three parts: |
Alexander Afanasyev | 7c6aeb0 | 2014-04-10 19:59:19 -0700 | [diff] [blame] | 280 | |
Alexander Afanasyev | e5a19b8 | 2017-01-30 22:30:46 -0800 | [diff] [blame] | 281 | - an NDN regular expression that extracts information from the packet name |
| 282 | - an NDN regular expression that extracts information from the ``KeyLocator`` name |
| 283 | - relation from the part extracted from the ``KeyLocator`` name to the one extracted from |
| 284 | the packet name |
Alexander Afanasyev | 7c6aeb0 | 2014-04-10 19:59:19 -0700 | [diff] [blame] | 285 | |
| 286 | For example, a checker: |
| 287 | |
| 288 | :: |
| 289 | |
| 290 | checker |
| 291 | { |
| 292 | type customized |
| 293 | sig-type rsa-sha256 |
| 294 | key-locator |
| 295 | { |
| 296 | type name |
| 297 | hyper-relation |
| 298 | { |
Alexander Afanasyev | 17d4b93 | 2021-03-17 17:58:40 -0400 | [diff] [blame] | 299 | k-regex ^(<>*)<KEY><>{1,3}$ |
Alexander Afanasyev | e5a19b8 | 2017-01-30 22:30:46 -0800 | [diff] [blame] | 300 | k-expand \\1 |
Alexander Afanasyev | 7c6aeb0 | 2014-04-10 19:59:19 -0700 | [diff] [blame] | 301 | h-relation is-prefix-of |
| 302 | p-regex ^(<>*)$ |
| 303 | p-expand \\1 |
| 304 | |
| 305 | } |
| 306 | } |
| 307 | } |
| 308 | |
Alexander Afanasyev | e5a19b8 | 2017-01-30 22:30:46 -0800 | [diff] [blame] | 309 | requires the packet name must be under the corresponding namespace (identity part) of the |
| 310 | ``KeyLocator`` name. |
Alexander Afanasyev | 7c6aeb0 | 2014-04-10 19:59:19 -0700 | [diff] [blame] | 311 | |
| 312 | Hierarchical Checker |
| 313 | ~~~~~~~~~~~~~~~~~~~~ |
| 314 | |
Yingdi Yu | 4e99f53 | 2014-08-25 19:40:57 -0700 | [diff] [blame] | 315 | As implied by its name, hierarchical checker requires that the packet name must be under |
| 316 | the namespace of the packet signer. A hierarchical checker: |
Alexander Afanasyev | 7c6aeb0 | 2014-04-10 19:59:19 -0700 | [diff] [blame] | 317 | |
| 318 | :: |
| 319 | |
| 320 | checker |
| 321 | { |
| 322 | type hierarchical |
| 323 | sig-type rsa-sha256 |
| 324 | } |
| 325 | |
| 326 | is equivalent to a customized checker: |
| 327 | |
| 328 | :: |
| 329 | |
| 330 | checker |
| 331 | { |
| 332 | type customized |
| 333 | sig-type rsa-sha256 |
| 334 | key-locator |
| 335 | { |
| 336 | type name |
| 337 | hyper-relation |
| 338 | { |
Junxiao Shi | 5dc7560 | 2021-02-19 11:33:00 -0700 | [diff] [blame] | 339 | k-regex ^(<>*)<KEY><>{1,3}$ |
Alexander Afanasyev | e5a19b8 | 2017-01-30 22:30:46 -0800 | [diff] [blame] | 340 | k-expand \\1 |
Alexander Afanasyev | 7c6aeb0 | 2014-04-10 19:59:19 -0700 | [diff] [blame] | 341 | h-relation is-prefix-of |
| 342 | p-regex ^(<>*)$ |
| 343 | p-expand \\1 |
| 344 | } |
| 345 | } |
| 346 | } |
| 347 | |
Alexander Afanasyev | d36dd55 | 2014-06-30 12:42:46 -0700 | [diff] [blame] | 348 | .. _validator-conf-trust-anchors: |
| 349 | |
Alexander Afanasyev | 7c6aeb0 | 2014-04-10 19:59:19 -0700 | [diff] [blame] | 350 | Trust Anchors |
| 351 | ------------- |
| 352 | |
Alexander Afanasyev | e5a19b8 | 2017-01-30 22:30:46 -0800 | [diff] [blame] | 353 | **trust-anchor** is a necessary option in order to properly validate packets. A |
| 354 | configuration file may contain more than one trust anchors and the order of trust anchors |
| 355 | does not matter. The structure of trust-anchor is as follows: |
Alexander Afanasyev | 7c6aeb0 | 2014-04-10 19:59:19 -0700 | [diff] [blame] | 356 | |
| 357 | :: |
| 358 | |
| 359 | trust-anchor |
| 360 | { |
| 361 | type file |
| 362 | file-name "trusted-signer.cert" |
| 363 | } |
| 364 | trust-anchor |
| 365 | { |
| 366 | type base64 |
| 367 | base64-string "Bv0DGwdG...amHFvHIMDw==" |
| 368 | } |
| 369 | |
Yingdi Yu | 4e99f53 | 2014-08-25 19:40:57 -0700 | [diff] [blame] | 370 | You may also specify a trust-anchor directory. All certificates under this directory are |
Alexander Afanasyev | e5a19b8 | 2017-01-30 22:30:46 -0800 | [diff] [blame] | 371 | taken as static trust anchors. For example, if all trust anchors are put into |
Yingdi Yu | 4e99f53 | 2014-08-25 19:40:57 -0700 | [diff] [blame] | 372 | ``/usr/local/etc/ndn/keys``. |
Yingdi Yu | b465065 | 2014-04-17 10:19:59 -0700 | [diff] [blame] | 373 | |
| 374 | :: |
| 375 | |
| 376 | trust-anchor |
| 377 | { |
| 378 | type dir |
Alexander Afanasyev | e5a19b8 | 2017-01-30 22:30:46 -0800 | [diff] [blame] | 379 | dir /usr/local/etc/ndn/keys |
Yingdi Yu | b465065 | 2014-04-17 10:19:59 -0700 | [diff] [blame] | 380 | } |
| 381 | |
Yingdi Yu | 4e99f53 | 2014-08-25 19:40:57 -0700 | [diff] [blame] | 382 | If certificates under the directory might be changed during runtime, you can set a refresh |
Davide Pesavento | 487cc9a | 2025-05-01 23:32:05 -0400 | [diff] [blame^] | 383 | period:: |
Yingdi Yu | b465065 | 2014-04-17 10:19:59 -0700 | [diff] [blame] | 384 | |
| 385 | trust-anchor |
| 386 | { |
| 387 | type dir |
Alexander Afanasyev | e5a19b8 | 2017-01-30 22:30:46 -0800 | [diff] [blame] | 388 | dir /usr/local/etc/ndn/keys |
Davide Pesavento | 487cc9a | 2025-05-01 23:32:05 -0400 | [diff] [blame^] | 389 | refresh 1h ; refresh certs every hour, other supported units are 'm' (for minutes) and 's' (for seconds) |
Yingdi Yu | b465065 | 2014-04-17 10:19:59 -0700 | [diff] [blame] | 390 | } |
| 391 | |
Davide Pesavento | 487cc9a | 2025-05-01 23:32:05 -0400 | [diff] [blame^] | 392 | There is also a special trust anchor: ``any``. As long as such a trust anchor is defined |
Yingdi Yu | 4e99f53 | 2014-08-25 19:40:57 -0700 | [diff] [blame] | 393 | in config file, packet validation will be turned off. |
Yingdi Yu | 44d190c | 2014-04-16 17:05:46 -0700 | [diff] [blame] | 394 | |
Yingdi Yu | 44d190c | 2014-04-16 17:05:46 -0700 | [diff] [blame] | 395 | :: |
| 396 | |
| 397 | trust-anchor |
| 398 | { |
| 399 | type any |
| 400 | } |
| 401 | |
Davide Pesavento | 487cc9a | 2025-05-01 23:32:05 -0400 | [diff] [blame^] | 402 | .. danger:: |
| 403 | This type of trust anchor is insecure. You should used it only when you want |
| 404 | to disable packet validation temporarily (e.g., debugging code, building a demo). |
| 405 | |
Yingdi Yu | b465065 | 2014-04-17 10:19:59 -0700 | [diff] [blame] | 406 | |
Alexander Afanasyev | 7c6aeb0 | 2014-04-10 19:59:19 -0700 | [diff] [blame] | 407 | Example Configuration For NLSR |
| 408 | ------------------------------ |
| 409 | |
Yingdi Yu | 4e99f53 | 2014-08-25 19:40:57 -0700 | [diff] [blame] | 410 | The trust model of NLSR is semi-hierarchical. An example certificate signing hierarchy is: |
Alexander Afanasyev | 7c6aeb0 | 2014-04-10 19:59:19 -0700 | [diff] [blame] | 411 | |
| 412 | :: |
| 413 | |
| 414 | root |
| 415 | | |
| 416 | +--------------+---------------+ |
| 417 | site1 site2 |
| 418 | | | |
| 419 | +---------+---------+ + |
| 420 | operator1 operator2 operator3 |
| 421 | | | | |
| 422 | +-----+-----+ +----+-----+ +-----+-----+--------+ |
| 423 | router1 router2 router3 router4 router5 router6 router7 |
| 424 | | | | | | | | |
| 425 | + + + + + + + |
| 426 | NLSR NSLR NSLR NSLR NSLR NSLR NSLR |
| 427 | |
| 428 | However, entities name may not follow the signing hierarchy, for |
| 429 | example: |
| 430 | |
Alexander Afanasyev | 3aeeaeb | 2014-04-22 23:34:23 -0700 | [diff] [blame] | 431 | +------------+-------------------------------------------------------------------------------------+ |
| 432 | | Entity | Identity name and examples | |
| 433 | +============+=====================================================================================+ |
| 434 | | root | ``/<network>`` | |
| 435 | | | | |
| 436 | | | Identity example: ``/ndn`` | |
| 437 | | | | |
Alexander Afanasyev | c381bca | 2017-10-15 14:51:49 -0400 | [diff] [blame] | 438 | | | Certificate name example: ``/ndn/KEY/1/%00/%01`` | |
Alexander Afanasyev | 3aeeaeb | 2014-04-22 23:34:23 -0700 | [diff] [blame] | 439 | +------------+-------------------------------------------------------------------------------------+ |
| 440 | | site | ``/<network>/<site>`` | |
| 441 | | | | |
| 442 | | | Identity example: ``/ndn/edu/ucla`` | |
| 443 | | | | |
Alexander Afanasyev | c381bca | 2017-10-15 14:51:49 -0400 | [diff] [blame] | 444 | | | Certificate name example: ``/ndn/edu/ucla/KEY/2/%00/%01`` | |
Alexander Afanasyev | 3aeeaeb | 2014-04-22 23:34:23 -0700 | [diff] [blame] | 445 | +------------+-------------------------------------------------------------------------------------+ |
| 446 | | operator | ``/<network>/<site>/%C1.O.N./<operator-id>`` | |
| 447 | | | | |
| 448 | | | Identity example: ``/ndn/edu/ucla/%C1.O.N./op1`` | |
| 449 | | | | |
Alexander Afanasyev | c381bca | 2017-10-15 14:51:49 -0400 | [diff] [blame] | 450 | | | Certificate name example: ``/ndn/edu/ucla/%C1.O.N./op1/KEY/3/%00/%01`` | |
Alexander Afanasyev | 3aeeaeb | 2014-04-22 23:34:23 -0700 | [diff] [blame] | 451 | +------------+-------------------------------------------------------------------------------------+ |
| 452 | | router | ``/<network>/<site>/%C1.O.R./<router-id>`` | |
| 453 | | | | |
| 454 | | | Identity example: ``/ndn/edu/ucla/%C1.O.R./rt1`` | |
| 455 | | | | |
Alexander Afanasyev | c381bca | 2017-10-15 14:51:49 -0400 | [diff] [blame] | 456 | | | Certificate name example: ``/ndn/edu/ucla/%C1.O.R./rt1/KEY/4/%00/%01`` | |
Alexander Afanasyev | 3aeeaeb | 2014-04-22 23:34:23 -0700 | [diff] [blame] | 457 | +------------+-------------------------------------------------------------------------------------+ |
| 458 | | NLSR | ``/<network>/<site>/%C1.O.R./<router-id>/NLSR`` | |
| 459 | | | | |
| 460 | | | Identity example: ``/ndn/edu/ucla/%C1.O.R./rt1/NLSR`` | |
| 461 | | | | |
Alexander Afanasyev | c381bca | 2017-10-15 14:51:49 -0400 | [diff] [blame] | 462 | | | Certificate name example: ``/ndn/edu/ucla/%C1.O.R./rt1/NLSR/KEY/5/%00/%01`` | |
Alexander Afanasyev | 3aeeaeb | 2014-04-22 23:34:23 -0700 | [diff] [blame] | 463 | +------------+-------------------------------------------------------------------------------------+ |
Alexander Afanasyev | 7c6aeb0 | 2014-04-10 19:59:19 -0700 | [diff] [blame] | 464 | |
| 465 | Assume that a typical NLSR data name is |
Yingdi Yu | 4e99f53 | 2014-08-25 19:40:57 -0700 | [diff] [blame] | 466 | ``/ndn/edu/ucla/%C1.O.R./rt1/NLSR/LSA/LSType.1/%01``. Then, the exception of naming |
| 467 | hierarchy is "operator-router". So we can write a configuration file with three rules. The |
| 468 | first one is a customized rule that capture the normal NLSR data. The second one is a |
| 469 | customized rule that handles the exception case of the hierarchy (operator->router). And |
| 470 | the last one is a hierarchical rule that handles the normal cases of the hierarchy. |
Alexander Afanasyev | 7c6aeb0 | 2014-04-10 19:59:19 -0700 | [diff] [blame] | 471 | |
Yingdi Yu | 4e99f53 | 2014-08-25 19:40:57 -0700 | [diff] [blame] | 472 | We put the NLSR data rule to the first place, because NLSR data packets are the most |
| 473 | frequently checked. The hierarchical exception rule is put to the second, because it is |
| 474 | more specific than the last one. |
Alexander Afanasyev | 7c6aeb0 | 2014-04-10 19:59:19 -0700 | [diff] [blame] | 475 | |
| 476 | And here is the configuration file: |
| 477 | |
| 478 | :: |
| 479 | |
| 480 | rule |
| 481 | { |
| 482 | id "NSLR LSA Rule" |
| 483 | for data |
| 484 | filter |
| 485 | { |
| 486 | type name |
Alexander Afanasyev | c381bca | 2017-10-15 14:51:49 -0400 | [diff] [blame] | 487 | regex ^<>*<NLSR><LSA><><>$ |
Alexander Afanasyev | 7c6aeb0 | 2014-04-10 19:59:19 -0700 | [diff] [blame] | 488 | } |
| 489 | checker |
| 490 | { |
| 491 | type customized |
| 492 | sig-type rsa-sha256 |
| 493 | key-locator |
| 494 | { |
| 495 | type name |
| 496 | hyper-relation |
| 497 | { |
Alexander Afanasyev | c381bca | 2017-10-15 14:51:49 -0400 | [diff] [blame] | 498 | k-regex ^(<>*)<KEY><>$ |
Alexander Afanasyev | 7c6aeb0 | 2014-04-10 19:59:19 -0700 | [diff] [blame] | 499 | k-expand \\1 |
| 500 | h-relation equal |
Alexander Afanasyev | c381bca | 2017-10-15 14:51:49 -0400 | [diff] [blame] | 501 | p-regex ^(<>*)<NLSR><LSA><><>$ |
Alexander Afanasyev | 7c6aeb0 | 2014-04-10 19:59:19 -0700 | [diff] [blame] | 502 | p-expand \\1 |
| 503 | } |
| 504 | } |
| 505 | } |
| 506 | } |
| 507 | rule |
| 508 | { |
| 509 | id "NSLR Hierarchy Exception Rule" |
| 510 | for data |
| 511 | filter |
| 512 | { |
| 513 | type name |
Alexander Afanasyev | c381bca | 2017-10-15 14:51:49 -0400 | [diff] [blame] | 514 | regex ^<>*<%C1.O.R.><><KEY><><><>$ |
Alexander Afanasyev | 7c6aeb0 | 2014-04-10 19:59:19 -0700 | [diff] [blame] | 515 | } |
| 516 | checker |
| 517 | { |
| 518 | type customized |
| 519 | sig-type rsa-sha256 |
| 520 | key-locator |
| 521 | { |
| 522 | type name |
| 523 | hyper-relation |
| 524 | { |
Alexander Afanasyev | c381bca | 2017-10-15 14:51:49 -0400 | [diff] [blame] | 525 | k-regex ^(<>*)<%C1.O.N.><><KEY><>$ |
Alexander Afanasyev | 7c6aeb0 | 2014-04-10 19:59:19 -0700 | [diff] [blame] | 526 | k-expand \\1 |
| 527 | h-relation equal |
Alexander Afanasyev | c381bca | 2017-10-15 14:51:49 -0400 | [diff] [blame] | 528 | p-regex ^(<>*)<%C1.O.R.><><KEY><><><>$ |
Alexander Afanasyev | 7c6aeb0 | 2014-04-10 19:59:19 -0700 | [diff] [blame] | 529 | p-expand \\1 |
| 530 | } |
| 531 | } |
| 532 | } |
| 533 | } |
| 534 | rule |
| 535 | { |
| 536 | id "NSLR Hierarchical Rule" |
| 537 | for data |
| 538 | filter |
| 539 | { |
| 540 | type name |
Alexander Afanasyev | c381bca | 2017-10-15 14:51:49 -0400 | [diff] [blame] | 541 | regex ^<>*<KEY><><><>$ |
Alexander Afanasyev | 7c6aeb0 | 2014-04-10 19:59:19 -0700 | [diff] [blame] | 542 | } |
| 543 | checker |
| 544 | { |
| 545 | type hierarchical |
| 546 | sig-type rsa-sha256 |
| 547 | } |
| 548 | } |
| 549 | trust-anchor |
| 550 | { |
| 551 | type file |
| 552 | file-name "testbed-trust-anchor.cert" |
| 553 | } |
| 554 | |
Yingdi Yu | 4e99f53 | 2014-08-25 19:40:57 -0700 | [diff] [blame] | 555 | Example Configuration For NFD RIB Management |
| 556 | -------------------------------------------- |
Alexander Afanasyev | 7c6aeb0 | 2014-04-10 19:59:19 -0700 | [diff] [blame] | 557 | |
Davide Pesavento | 0530b5b | 2016-11-07 03:23:58 +0100 | [diff] [blame] | 558 | Assume `NFD RIB Management <https://redmine.named-data.net/projects/nfd/wiki/RibMgmt>`_ |
Yingdi Yu | 4e99f53 | 2014-08-25 19:40:57 -0700 | [diff] [blame] | 559 | allows any valid testbed certificate to register prefix, the configuration file could be |
| 560 | written as: |
Alexander Afanasyev | 7c6aeb0 | 2014-04-10 19:59:19 -0700 | [diff] [blame] | 561 | |
| 562 | :: |
| 563 | |
Alexander Afanasyev | e5a19b8 | 2017-01-30 22:30:46 -0800 | [diff] [blame] | 564 | rule |
| 565 | { |
| 566 | id "RIB Prefix Registration Command Rule" |
| 567 | for interest ; rule for Interests (to validate CommandInterests) |
| 568 | filter |
| 569 | { |
| 570 | type name ; condition on interest name (w/o signature) |
| 571 | regex ^[<localhop><localhost>]<nfd><rib>[<register><unregister>]<><><>$ ; prefix before |
| 572 | ; SigInfo & SigValue |
| 573 | } |
| 574 | checker |
| 575 | { |
| 576 | type customized |
| 577 | sig-type rsa-sha256 ; interest must have a rsa-sha256 signature |
| 578 | key-locator |
| 579 | { |
| 580 | type name ; key locator must be the certificate name of the |
| 581 | ; signing key |
| 582 | regex ^<>*<KEY><><><>$ |
| 583 | } |
| 584 | } |
| 585 | checker |
| 586 | { |
| 587 | type customized |
| 588 | sig-type ecdsa-sha256 ; interest must have a ecdsa-sha256 signature |
| 589 | key-locator |
| 590 | { |
| 591 | type name ; key locator must be the certificate name of the |
| 592 | ; signing key |
| 593 | regex ^<>*<KEY><><><>$ |
| 594 | } |
| 595 | } |
| 596 | } |
| 597 | rule |
| 598 | { |
| 599 | id "NDN Testbed Hierarchy Rule" |
| 600 | for data ; rule for Data (to validate NDN certificates) |
| 601 | filter |
| 602 | { |
| 603 | type name ; condition on data name |
| 604 | regex ^<>*<KEY><><><>$ |
| 605 | } |
| 606 | checker |
| 607 | { |
| 608 | type hierarchical ; the certificate name of the signing key and |
| 609 | ; the data name must follow the hierarchical model |
| 610 | sig-type rsa-sha256 ; data must have a rsa-sha256 signature |
| 611 | } |
| 612 | checker |
| 613 | { |
| 614 | type hierarchical ; the certificate name of the signing key and |
| 615 | ; the data name must follow the hierarchical model |
| 616 | sig-type ecdsa-sha256 ; data must have a ecdsa-sha256 signature |
| 617 | } |
| 618 | } |
| 619 | trust-anchor |
| 620 | { |
| 621 | type file |
| 622 | file-name keys/ndn-testbed-root.ndncert.base64 |
| 623 | } |