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