idnits 2.17.00 (12 Aug 2021) /tmp/idnits50424/draft-ietf-opsawg-sdi-04.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- -- The document has examples using IPv4 documentation addresses according to RFC6890, but does not use any IPv6 documentation addresses. Maybe there should be IPv6 examples, too? Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document date (March 04, 2020) is 808 days in the past. Is this intentional? Checking references for intended status: Informational ---------------------------------------------------------------------------- == Missing Reference: 'AU' is mentioned on line 626, but not defined == Missing Reference: 'Some-State' is mentioned on line 627, but not defined Summary: 0 errors (**), 0 flaws (~~), 3 warnings (==), 2 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Network Working Group W. Kumari 3 Internet-Draft Google 4 Intended status: Informational C. Doyle 5 Expires: September 5, 2020 Juniper Networks 6 March 04, 2020 8 Secure Device Install 9 draft-ietf-opsawg-sdi-04 11 Abstract 13 Deploying a new network device often requires that an employee 14 physically travel to a datacenter to perform the initial install and 15 configuration, even in shared datacenters with "smart-hands" type 16 support. In many cases, this could be avoided if there were a 17 standard, secure way to initially provision the devices. 19 This document extends existing auto-install / Zero-Touch Provisioning 20 mechanisms to make the process more secure. 22 [ Ed note: Text inside square brackets ([]) is additional background 23 information, answers to frequently asked questions, general musings, 24 etc. They will be removed before publication. This document is 25 being collaborated on in Github at: https://github.com/wkumari/draft- 26 wkumari-opsawg-sdi. The most recent version of the document, open 27 issues, etc should all be available here. The authors (gratefully) 28 accept pull requests. ] 30 [ Ed note: This document introduces concepts and serves as the basic 31 for discussion - because of this, it is conversational, and would 32 need to be firmed up before being published ] 34 Status of This Memo 36 This Internet-Draft is submitted in full conformance with the 37 provisions of BCP 78 and BCP 79. 39 Internet-Drafts are working documents of the Internet Engineering 40 Task Force (IETF). Note that other groups may also distribute 41 working documents as Internet-Drafts. The list of current Internet- 42 Drafts is at https://datatracker.ietf.org/drafts/current/. 44 Internet-Drafts are draft documents valid for a maximum of six months 45 and may be updated, replaced, or obsoleted by other documents at any 46 time. It is inappropriate to use Internet-Drafts as reference 47 material or to cite them other than as "work in progress." 48 This Internet-Draft will expire on September 5, 2020. 50 Copyright Notice 52 Copyright (c) 2020 IETF Trust and the persons identified as the 53 document authors. All rights reserved. 55 This document is subject to BCP 78 and the IETF Trust's Legal 56 Provisions Relating to IETF Documents 57 (https://trustee.ietf.org/license-info) in effect on the date of 58 publication of this document. Please review these documents 59 carefully, as they describe your rights and restrictions with respect 60 to this document. Code Components extracted from this document must 61 include Simplified BSD License text as described in Section 4.e of 62 the Trust Legal Provisions and are provided without warranty as 63 described in the Simplified BSD License. 65 Table of Contents 67 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3 68 1.1. Requirements notation . . . . . . . . . . . . . . . . . . 4 69 2. Overview . . . . . . . . . . . . . . . . . . . . . . . . . . 4 70 2.1. Example Scenario . . . . . . . . . . . . . . . . . . . . 5 71 3. Vendor Role / Requirements . . . . . . . . . . . . . . . . . 6 72 3.1. Device key generation . . . . . . . . . . . . . . . . . . 6 73 3.2. Certificate Publication Server . . . . . . . . . . . . . 6 74 4. Operator Role / Responsibilities . . . . . . . . . . . . . . 7 75 4.1. Administrative . . . . . . . . . . . . . . . . . . . . . 7 76 4.2. Technical . . . . . . . . . . . . . . . . . . . . . . . . 7 77 4.3. Initial Customer Boot . . . . . . . . . . . . . . . . . . 8 78 5. Additional Considerations . . . . . . . . . . . . . . . . . . 11 79 5.1. Key storage . . . . . . . . . . . . . . . . . . . . . . . 11 80 5.2. Key replacement . . . . . . . . . . . . . . . . . . . . . 11 81 5.3. Device reinstall . . . . . . . . . . . . . . . . . . . . 11 82 6. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 11 83 7. Security Considerations . . . . . . . . . . . . . . . . . . . 11 84 8. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 12 85 9. References . . . . . . . . . . . . . . . . . . . . . . . . . 12 86 9.1. Normative References . . . . . . . . . . . . . . . . . . 12 87 9.2. Informative References . . . . . . . . . . . . . . . . . 12 88 Appendix A. Changes / Author Notes. . . . . . . . . . . . . . . 13 89 Appendix B. Demo / proof of concept . . . . . . . . . . . . . . 14 90 B.1. Step 1: Generating the certificate. . . . . . . . . . . . 14 91 B.1.1. Step 1.1: Generate the private key. . . . . . . . . . 14 92 B.1.2. Step 1.2: Generate the certificate signing request. . 15 93 B.1.3. Step 1.3: Generate the (self signed) certificate 94 itself. . . . . . . . . . . . . . . . . . . . . . . . 15 95 B.2. Step 2: Generating the encrypted config. . . . . . . . . 15 96 B.2.1. Step 2.1: Fetch the certificate. . . . . . . . . . . 15 97 B.2.2. Step 2.2: Encrypt the config file. . . . . . . . . . 16 98 B.2.3. Step 2.3: Copy config to the config server. . . . . . 16 99 B.3. Step 3: Decrypting and using the config. . . . . . . . . 16 100 B.3.1. Step 3.1: Fetch encrypted config file from config 101 server. . . . . . . . . . . . . . . . . . . . . . . . 16 102 B.3.2. Step 3.2: Decrypt and use the config. . . . . . . . . 16 103 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 17 105 1. Introduction 107 In a growing, global network, significant amounts of time and money 108 are spent simply deploying new devices and "forklift" upgrading 109 existing devices. In many cases, these devices are in shared 110 datacenters (for example, Internet Exchange Points (IXP) or "carrier 111 neutral datacenters"), which have staff on hand that can be 112 contracted to perform tasks including physical installs, device 113 reboots, loading initial configurations, etc. There are also a 114 number of (often vendor proprietary) protocols to perform initial 115 device installs and configurations - for example, many network 116 devices will attempt to use DHCP to get an IP address and 117 configuration server, and then fetch and install a configuration when 118 they are first powered on. 120 Network device configurations contain a significant amount of 121 security related and / or proprietary information (for example, 122 RADIUS or TACACS+ secrets). Exposing these to a third party to load 123 onto a new device (or using an auto-install techniques which fetch an 124 unencrypted config file via something like TFTP) is simply not 125 acceptable to many operators, and so they have to send employees to 126 remote locations to perform the initial configuration work. As well 127 as having a significant monetary cost, it also takes significantly 128 longer to install devices and is generally inefficient. 130 There are some workarounds to this, such as asking the vendor to pre- 131 configure the devices before shipping it; asking the smart-hands to 132 install a terminal server; providing a minimal, unsecured 133 configuration and using that to bootstrap to a complete 134 configuration, etc; but these are often clumsy and have security 135 issues - for example, in the terminal server case, the console port 136 connection could be easily snooped. 138 This document layers security onto existing auto-install solutions to 139 provide a secure method to initially configure new devices. It is 140 optimized for simplicity, both for the implementor and the operator; 141 it is explicitly not intended to be an "all singing, all dancing" 142 fully featured system for managing installed / deployed devices, nor 143 is it intended to solve all use-cases - rather it is a simple 144 targeted solution to solve a common operational issue. Solutions 145 such as Secure Zero Touch Provisioning (SZTP)" [RFC8572] are much 146 more fully featured, but also more complex to implement and / or are 147 not widely deployed yet. 149 This solution is specifically designed to be a simple method on top 150 of exiting device functionality. If devices do not support this new 151 method, they can continue to use the existing functionality. In 152 addition, operators can choose to use this to protect their 153 configuration information, or can continue to use the existing 154 functionality. 156 The issue of securely installing devices is in no way a new issue, 157 nor is it limited to network devices; it occurs when deploying 158 servers, PCs, IoT devices, and in many other situations. While the 159 solution described in this document is obvious (encrypt the config, 160 then decrypt it with a device key), this document only discusses the 161 use for network devices, such as routers and switches. 163 1.1. Requirements notation 165 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 166 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 167 "OPTIONAL" in this document are to be interpreted as described in BCP 168 14 [RFC2119] [RFC8174] when, and only when, they appear in all 169 capitals, as shown here. 171 2. Overview 173 Most network devices already include some sort of initial 174 bootstrapping logic (sometimes called 'autoboot', or 'autoinstall'). 175 This generally works by having a newly installed / unconfigured 176 device obtain an IP address and address of a config server (often 177 called 'next-server', 'siaddr' or 'tftp-server-name') using DHCP. 178 The device then contacts this configuration server to download its 179 initial configuration, which is often identified using the devices 180 serial number, MAC address or similar. This document extends this 181 (vendor specific) paradigm by allowing the configuration file to be 182 encrypted. 184 This document describes a concept, and some example ways of 185 implementing this concept. As devices have different capabilities, 186 and use different configuration paradigms, one method will not suit 187 all, and so it is expected that vendors will differ in exactly how 188 they implement this. 190 This document uses the serial number of the device as a unique 191 identifier for simplicity; some vendors may not want to implement the 192 system using the serial number as the identifier for business reasons 193 (a competitor or similar could enumerate the serial numbers and 194 determine how many devices have been manufactured). Implementors are 195 free to choose some other way of generating identifiers (e.g UUID 196 [RFC4122]), but this will likely make it somewhat harder for 197 operators to use (the serial number is usually easy to find on a 198 device, a more complex system is likely harder to track). 200 [ Ed note: This example also uses TFTP because that is what many 201 vendors use in their auto-install / ZTP feature. It could easily 202 instead be HTTP, FTP, etc. ] 204 2.1. Example Scenario 206 Sirius Cybernetics Corp needs another peering router, and so they 207 order another router from Acme Network Widgets, to be drop-shipped to 208 the Point of Presence (POP) / datacenter. Acme begins assembling the 209 new device, and tells Sirius what the new device's serial number will 210 be (SN:17894321). When Acme first installs the firmware on the 211 device and boots it, the device generates a public-private keypair, 212 and Acme publishes it on their keyserver (in a certificate, for ease 213 of use). 215 While the device is being shipped, Sirius generates the initial 216 device configuration, fetches the certificate from Acme keyservers by 217 providing the serial number of the new device. Sirius then encrypts 218 the device configuration and puts this encrypted config on a (local) 219 TFTP server. 221 When the device arrives at the POP, it gets installed in Sirius' 222 rack, and cabled as instructed. The new device powers up and 223 discovers that it has not yet been configured. It enters its 224 autoboot state, and begins the DHCP process. Sirius' DHCP server 225 provides it with an IP address and the address of the configuration 226 server. The router uses TFTP to fetch its config file (note that all 227 this is existing functionality). The device attempts to load the 228 config file - if the config file is unparsable, (new functionality) 229 the device tries to use its private key to decrypt the file, and, 230 assuming it validates, installs the new configuration. 232 Only the "correct" device will have the required private key and be 233 able to decrypt and use the config file (See Security 234 Considerations). An attacker would be able to connect to the network 235 and get an IP address. They would also be able to retrieve 236 (encrypted) config files by guessing serial numbers (or perhaps the 237 server would allow directory listing), but without the private keys 238 an attacker will not be able to decrypt the files. 240 3. Vendor Role / Requirements 242 This section describes the vendors roles and responsibilities and 243 provides an overview of what the device needs to do. 245 3.1. Device key generation 247 During the manufacturing stage, when the device is initially powered 248 on, it will generate a public-private keypair. It will send its 249 unique identifier and the public key to the vendor's Certificate 250 Publication Server to be published. The mechanism used to do this is 251 left undefined. Note that some devices may be constrained, and so 252 may send the raw public key and unique identifier to the certificate 253 publication server, while mode capable devices may generate and send 254 self-signed certificates. 256 3.2. Certificate Publication Server 258 The certificate publication server contains a database of 259 certificates. If newly manufactured devices upload certificates the 260 certificate publication server can simply publish these, if the 261 devices provide raw public keys and unique identifiers the 262 certificate publication server will need to wrap these in a 263 certificate. Note that the certificate publication server MUST only 264 accept certificates or keys from the vendor's manufacturing 265 facilities. 267 The customers (e.g Sirius Cybernetics Corp) query this server with 268 the serial number (or other provided unique identifier) of a device, 269 and retrieve the associated certificate. It is expected that 270 operators will receive the unique identifier (serial number) of 271 devices when they purchase them, and will download and store / cache 272 the certificate. This means that there is not a hard requirement on 273 the uptime / reachability of the certificate publication server. 275 +------------+ 276 +------+ |Certificate | 277 |Device| |Publication | 278 +------+ | Server | 279 +------------+ 280 +----------------+ +--------------+ 281 | +---------+ | | | 282 | | Initial | | | | 283 | | boot? | | | | 284 | +----+----+ | | | 285 | | | | | 286 | +------v-----+ | | | 287 | | Generate | | | | 288 | |Self-signed | | | | 289 | |Certificate | | | | 290 | +------------+ | | | 291 | | | | +-------+ | 292 | +-------|---|-->|Receive| | 293 | | | +---+---+ | 294 | | | | | 295 | | | +---v---+ | 296 | | | |Publish| | 297 | | | +-------+ | 298 | | | | 299 +----------------+ +--------------+ 301 Initial certificate generation and publication. 303 4. Operator Role / Responsibilities 305 4.1. Administrative 307 When purchasing a new device, the accounting department will need to 308 get the unique device identifier (likely serial number) of the new 309 device and communicate it to the operations group. 311 4.2. Technical 313 The operator will contact the vendor's publication server, and 314 download the certificate (by providing the unique device identifier 315 of the device). The operator SHOULD fetch the certificate using a 316 secure transport (e.g HTTPS). The operator will then encrypt the 317 initial configuration to the key in the certificate, and place it on 318 their TFTP server. See Appendix B for examples. 320 +------------+ 321 +--------+ |Certificate | 322 |Operator| |Publication | 323 +--------+ | Server | 324 +------------+ 325 +----------------+ +----------------+ 326 | +-----------+ | | +-----------+ | 327 | | Fetch | | | | | | 328 | | Device |<------>|Certificate| | 329 | |Certificate| | | | | | 330 | +-----+-----+ | | +-----------+ | 331 | | | | | 332 | +-----v------+ | | | 333 | | Encrypt | | | | 334 | | Device | | | | 335 | | Config | | | | 336 | +-----+------+ | | | 337 | | | | | 338 | +-----v------+ | | | 339 | | Publish | | | | 340 | | TFTP | | | | 341 | | Server | | | | 342 | +------------+ | | | 343 | | | | 344 +----------------+ +----------------+ 346 Fetching the certificate, encrypting the configuration, publishing 347 the encrypted configuration. 349 4.3. Initial Customer Boot 351 When the device is first booted by the customer (and on subsequent 352 boots), if the device does not have a valid configuration, it will 353 use existing auto-install functionality. As an example, it performs 354 DHCP Discovery until it gets a DHCP offer including DHCP option 66 or 355 150, contact the server listed in these DHCP options and downloads 356 its config file. Note that this is existing functionality (for 357 example, Cisco devices fetch the config file named by the Bootfile- 358 Name DHCP option (67)). 360 After retrieving the config file, the device needs to determine if it 361 is encrypted or not. If it is not encrypted, the existing behavior 362 is used. If the configuration is encrypted, the process continues as 363 described in this document. The method used to determine if the 364 config is encrypted or not is implementation dependant; there are a 365 number of (obvious) options, including having a magic string in the 366 file header, using a file name extension (e.g config.enc), or using 367 specific DHCP options. 369 If the file is encrypted, the device will attempt to decrypt and 370 parse the file. It able, it will install the configuration, and 371 start using it. If this fails, the device with either abort the 372 auto-install process, or will repeat this process until it succeeds. 374 Note that the device only needs DHCP and to be able to download the 375 config file; after the initial power-on in the factory it never needs 376 to access the Internet or vendor or certificate publication server - 377 it (and only it) has the private key and so has the ability to 378 decrypt the config file. 380 +--------+ +--------------+ 381 | Device | |Config server | 382 +--------+ | (e.g TFTP) | 383 +--------------+ 384 +---------------------------+ +------------------+ 385 | +-----------+ | | | 386 | | | | | | 387 | | DHCP | | | | 388 | | | | | | 389 | +-----+-----+ | | | 390 | | | | | 391 | +-----v------+ | | +-----------+ | 392 | | | | | | Encrypted | | 393 | |Fetch config|<------------------>| config | | 394 | | | | | | file | | 395 | +-----+------+ | | +-----------+ | 396 | | | | | 397 | X | | | 398 | / \ | | | 399 | / \ N +--------+ | | | 400 | | Enc?|---->|Install,| | | | 401 | \ / | Boot | | | | 402 | \ / +--------+ | | | 403 | V | | | 404 | |Y | | | 405 | | | | | 406 | +-----v------+ | | | 407 | |Decrypt with| | | | 408 | |private key | | | | 409 | +-----+------+ | | | 410 | | | | | 411 | v | | | 412 | / \ | | | 413 | / \ Y +--------+ | | | 414 | |Sane?|---->|Install,| | | | 415 | \ / | Boot | | | | 416 | \ / +--------+ | | | 417 | V | | | 418 | |N | | | 419 | | | | | 420 | +----v---+ | | | 421 | |Give up | | | | 422 | |go home | | | | 423 | +--------+ | | | 424 | | | | 425 +---------------------------+ +------------------+ 427 Device boot, fetch and install config file 429 5. Additional Considerations 431 5.1. Key storage 433 Ideally, the keypair would be stored in a TPM on something which is 434 identified as the "router" - for example, the chassis / backplane. 435 This is so that a keypair is bound to what humans think of as the 436 "device", and not, for example (redundant) routing engines. Devices 437 which implement IEEE 802.1AR could choose to use the IDevID for this 438 purpose. 440 5.2. Key replacement 442 It is anticipated that some operator may want to replace the (vendor 443 provided) keys after installing the device. There are two options 444 when implementing this - a vendor could allow the operator's key to 445 completely replace the initial device generated key (which means 446 that, if the device is ever sold, the new owner couldn't use this 447 technique to install the device), or the device could prefer the 448 operators installed key. This is an implementation decision left to 449 the vendor. 451 5.3. Device reinstall 453 Increasingly, operations is moving towards an automated model of 454 device management, whereby portions (or the entire) configuration is 455 programmatically generated. This means that operators may want to 456 generate an entire configuration after the device has been initially 457 installed and ask the device to load and use this new configuration. 458 It is expected (but not defined in this document, as it is vendor 459 specific) that vendors will allow the operator to copy a new, 460 encrypted config (or part of a config) onto a device and then request 461 that the device decrypt and install it (e.g: 'load replace 462 encrypted)). The operator could also choose to reset the device to 463 factory defaults, and allow the device to act as though it were the 464 initial boot (see Section 4.3). 466 6. IANA Considerations 468 This document makes no requests of the IANA. 470 7. Security Considerations 472 This mechanism is intended to replace either expensive (traveling 473 employees) or insecure mechanisms of installing newly deployed 474 devices such as: unencrypted config files which can be downloaded by 475 connecting to unprotected ports in datacenters, mailing initial 476 config files on flash drives, or emailing config files and asking a 477 third-party to copy and paste it over a serial terminal. It does not 478 protect against devices with malicious firmware, nor theft and reuse 479 of devices. 481 An attacker (e.g a malicious datacenter employee) who has physical 482 access to the device before it is connected to the network the 483 attacker may be able to extract the device private key (especially if 484 it isn't stored in a TPM), pretend to be the device when connecting 485 to the network, and download and extract the (encrypted) config file. 487 This mechanism does not protect against a malicious vendor - while 488 the keypair should be generated on the device, and the private key 489 should be securely stored, the mechanism cannot detect or protect 490 against a vendor who claims to do this, but instead generates the 491 keypair off device and keeps a copy of the private key. It is 492 largely understood in the operator community that a malicious vendor 493 or attacker with physical access to the device is largely a "Game 494 Over" situation. 496 Even when using a secure bootstrapping mechanism, security conscious 497 operators may wish to bootstrapping devices with a minimal / less 498 sensitive config, and then replace this with a more complete one 499 after install. 501 8. Acknowledgements 503 The authors wish to thank everyone who contributed, including Benoit 504 Claise, Tom Petch, Sam Ribeiro, Michael Richardson, Sean Turner and 505 Kent Watsen. Joe Clarke provided significant comments and review. 507 9. References 509 9.1. Normative References 511 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 512 Requirement Levels", BCP 14, RFC 2119, 513 DOI 10.17487/RFC2119, March 1997, 514 . 516 [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 517 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 518 May 2017, . 520 9.2. Informative References 522 [RFC4122] Leach, P., Mealling, M., and R. Salz, "A Universally 523 Unique IDentifier (UUID) URN Namespace", RFC 4122, 524 DOI 10.17487/RFC4122, July 2005, 525 . 527 [RFC8572] Watsen, K., Farrer, I., and M. Abrahamsson, "Secure Zero 528 Touch Provisioning (SZTP)", RFC 8572, 529 DOI 10.17487/RFC8572, April 2019, 530 . 532 Appendix A. Changes / Author Notes. 534 [RFC Editor: Please remove this section before publication ] 536 From -03 to -04 538 o Addressed Joe's WGLC comments. This involved changing the "just 539 try decrypt and pray" to vendor specific, like a file extension, 540 magic header sting, etc. 542 o Addressed tom's comments. 544 From individual WG-01 to -03: 546 o Addressed Joe Clarke's comments - 547 https://mailarchive.ietf.org/arch/msg/opsawg/JTzsdVXw- 548 XtWXZIIFhH7aW_-0YY 550 o Many typos / nits 552 o Broke Overview and Example Scenario into 2 sections. 554 o Reordered text for above. 556 From individual -04 to WG-01: 558 o Renamed from draft-wkumari-opsawg-sdi-04 -> draft-ietf-opsawg- 559 sdi-00 561 From -00 to -01 563 o Nothing changed in the template! 565 From -01 to -03: 567 o See github commit log (AKA, we forgot to update this!) 569 o Added Colin Doyle. 571 From -03 to -04: 573 Addressed a number of comments received before / at IETF104 (Prague). 574 These include: 576 o Pointer to https://datatracker.ietf.org/doc/draft-ietf-netconf- 577 zerotouch -- included reference to (now) RFC8572 (KW) 579 o Suggested that 802.1AR IDevID (or similar) could be used. Stress 580 that this is designed for simplicity (MR) 582 o Added text to explain that any unique device identifier can be 583 used, not just serial number - serial number is simple and easy, 584 but anything which is unique (and can be communicated to the 585 customer) will work (BF). 587 o Lots of clarifications from Joe Clarke. 589 o Make it clear it should first try use the config, and if it 590 doesn't work, then try decrypt and use it. 592 o The CA part was confusing people - the certificate is simply a 593 wrapper for the key, and the Subject just an index, and so removed 594 that. 596 o Added a bunch of ASCII diagrams 598 Appendix B. Demo / proof of concept 600 This section contains a rough demo / proof of concept of the system. 601 It is only intended for illustration, and is not intended to be used 602 in production. 604 It uses OpenSSL from the command line, in production something more 605 automated would be used. In this example, the unique identifier is 606 the serial number of the router, SN19842256. 608 B.1. Step 1: Generating the certificate. 610 This step is performed by the router. It generates a key, then a 611 csr, and then a self signed certificate. 613 B.1.1. Step 1.1: Generate the private key. 615 $ openssl genrsa -out key.pem 2048 616 Generating RSA private key, 2048 bit long modulus 617 ................................................. 618 ................................................. 619 ..........................+++ 620 ...................+++ 621 e is 65537 (0x10001) 623 B.1.2. Step 1.2: Generate the certificate signing request. 625 $ openssl req -new -key key.pem -out SN19842256.csr 626 Country Name (2 letter code) [AU]:. 627 State or Province Name (full name) [Some-State]:. 628 Locality Name (eg, city) []:. 629 Organization Name (eg, company) [Internet Widgits Pty Ltd]:. 630 Organizational Unit Name (eg, section) []:. 631 Common Name (e.g. server FQDN or YOUR name) []:SN19842256 632 Email Address []:. 634 Please enter the following 'extra' attributes 635 to be sent with your certificate request 636 A challenge password []: 637 An optional company name []:. 639 B.1.3. Step 1.3: Generate the (self signed) certificate itself. 641 $ openssl req -x509 -days 36500 -key key.pem -in SN19842256.csr -out 642 SN19842256.crt 644 The router then sends the key to the vendor's keyserver for 645 publication (not shown). 647 B.2. Step 2: Generating the encrypted config. 649 The operator now wants to deploy the new router. 651 They generate the initial config (using whatever magic tool generates 652 router configs!), fetch the router's certificate and encrypt the 653 config file to that key. This is done by the operator. 655 B.2.1. Step 2.1: Fetch the certificate. 657 $ wget http://keyserv.example.net/certificates/SN19842256.crt 659 B.2.2. Step 2.2: Encrypt the config file. 661 I'm using S/MIME because it is simple to demonstrate. This is almost 662 definitely not the best way to do this. 664 $ openssl smime -encrypt -aes-256-cbc -in SN19842256.cfg\ 665 -out SN19842256.enc -outform PEM SN19842256.crt 666 $ more SN19842256.enc 667 -----BEGIN PKCS7----- 668 MIICigYJKoZIhvcNAQcDoIICezCCAncCAQAxggE+MIIBOgIBADAiMBUxEzARBgNV 669 BAMMClNOMTk4NDIyNTYCCQDJVuBlaTOb1DANBgkqhkiG9w0BAQEFAASCAQBABvM3 670 ... 671 LZoq08jqlWhZZWhTKs4XPGHUdmnZRYIP8KXyEtHt 672 -----END PKCS7----- 674 B.2.3. Step 2.3: Copy config to the config server. 676 $ scp SN19842256.enc config.example.com:/tftpboot 678 B.3. Step 3: Decrypting and using the config. 680 When the router connects to the operator's network it will detect 681 that does not have a valid configuration file, and will start the 682 "autoboot" process. This is a well documented process, but the high 683 level overview is that it will use DHCP to obtain an IP address and 684 config server. It will then use TFTP to download a configuration 685 file, based upon its serial number (this document modifies the 686 solution to fetch an encrypted config file (ending in .enc)). It 687 will then then decrypt the config file, and install it. 689 B.3.1. Step 3.1: Fetch encrypted config file from config server. 691 $ tftp 192.0.2.1 -c get SN19842256.enc 693 B.3.2. Step 3.2: Decrypt and use the config. 695 $ openssl smime -decrypt -in SN19842256.enc -inform pkcs7\ 696 -out config.cfg -inkey key.pem 698 If an attacker does not have the correct key, they will not be able 699 to decrypt the config: 701 $ openssl smime -decrypt -in SN19842256.enc -inform pkcs7\ 702 -out config.cfg -inkey wrongkey.pem 703 Error decrypting PKCS#7 structure 704 140352450692760:error:06065064:digital envelope 705 routines:EVP_DecryptFinal_ex:bad decrypt:evp_enc.c:592: 706 $ echo $? 707 4 709 Authors' Addresses 711 Warren Kumari 712 Google 713 1600 Amphitheatre Parkway 714 Mountain View, CA 94043 715 US 717 Email: warren@kumari.net 719 Colin Doyle 720 Juniper Networks 721 1133 Innovation Way 722 Sunnyvale, CA 94089 723 US 725 Email: cdoyle@juniper.net