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