idnits 2.17.00 (12 Aug 2021) /tmp/idnits55004/draft-ietf-opsawg-sdi-03.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 (February 11, 2020) is 830 days in the past. Is this intentional? Checking references for intended status: Informational ---------------------------------------------------------------------------- == Missing Reference: 'AU' is mentioned on line 595, but not defined == Missing Reference: 'Some-State' is mentioned on line 596, 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: August 14, 2020 Juniper Networks 6 February 11, 2020 8 Secure Device Install 9 draft-ietf-opsawg-sdi-03 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 August 14, 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 . . . . . . . . . . . . . . . . . . . . 4 71 3. Vendor Role / Requirements . . . . . . . . . . . . . . . . . 5 72 3.1. Device key generation . . . . . . . . . . . . . . . . . . 5 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 . . . . . . . . . . . . . . . . . . 10 79 5.1. Key storage . . . . . . . . . . . . . . . . . . . . . . . 10 80 5.2. Key replacement . . . . . . . . . . . . . . . . . . . . . 10 81 5.3. Device reinstall . . . . . . . . . . . . . . . . . . . . 10 82 6. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 10 83 7. Security Considerations . . . . . . . . . . . . . . . . . . . 10 84 8. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 11 85 9. References . . . . . . . . . . . . . . . . . . . . . . . . . 11 86 9.1. Normative References . . . . . . . . . . . . . . . . . . 11 87 9.2. Informative References . . . . . . . . . . . . . . . . . 11 88 Appendix A. Changes / Author Notes. . . . . . . . . . . . . . . 12 89 Appendix B. Demo / proof of concept . . . . . . . . . . . . . . 13 90 B.1. Step 1: Generating the certificate. . . . . . . . . . . . 13 91 B.1.1. Step 1.1: Generate the private key. . . . . . . . . . 13 92 B.1.2. Step 1.2: Generate the certificate signing request. . 14 93 B.1.3. Step 1.3: Generate the (self signed) certificate 94 itself. . . . . . . . . . . . . . . . . . . . . . . . 14 95 B.2. Step 2: Generating the encrypted config. . . . . . . . . 14 96 B.2.1. Step 2.1: Fetch the certificate. . . . . . . . . . . 14 97 B.2.2. Step 2.2: Encrypt the config file. . . . . . . . . . 14 98 B.2.3. Step 2.3: Copy config to the config server. . . . . . 15 99 B.3. Step 3: Decrypting and using the config. . . . . . . . . 15 100 B.3.1. Step 3.1: Fetch encrypted config file from config 101 server. . . . . . . . . . . . . . . . . . . . . . . . 15 102 B.3.2. Step 3.2: Decrypt and use the config. . . . . . . . . 15 103 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 16 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 1.1. Requirements notation 151 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 152 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 153 "OPTIONAL" in this document are to be interpreted as described in BCP 154 14 [RFC2119] [RFC8174] when, and only when, they appear in all 155 capitals, as shown here. 157 2. Overview 159 Most network devices already include some sort of initial 160 bootstrapping logic (sometimes called 'autoboot', or 'autoinstall'). 161 This generally works by having a newly installed / unconfigured 162 device obtain an IP address and address of a config server (often 163 called 'next-server', 'siaddr' or 'tftp-server-name') using DHCP. 164 The device then contacts this configuration server to download its 165 initial configuration, which is often identified using the devices 166 serial number, MAC address or similar. This document extends this 167 (vendor specific) paradigm by allowing the configuration file to be 168 encrypted. 170 This document uses the serial number of the device as a unique 171 identifier for simplicity; some vendors may not want to implement the 172 system using the serial number as the identifier for business reasons 173 (a competitor or similar could enumerate the serial numbers and 174 determine how many devices have been manufactured). Implementors are 175 free to choose some other way of generating identifiers (e.g UUID 176 [RFC4122]), but this will likely make it somewhat harder for 177 operators to use (the serial number is usually easy to find on a 178 device, a more complex system is likely harder to track). 180 [ Ed note: This example also uses TFTP because that is what many 181 vendors use in their auto-install / ZTP feature. It could easily 182 instead be HTTP, FTP, etc. ] 184 2.1. Example Scenario 186 Sirius Cybernetics Corp needs another peering router, and so they 187 order another router from Acme Network Widgets, to be drop-shipped to 188 the Point of Presence (POP) / datacenter. Acme begins assembling the 189 new device, and tells Sirius what the new device's serial number will 190 be (SN:17894321). When Acme first installs the firmware on the 191 device and boots it, the device generates a public-private keypair, 192 and Acme publishes it on their keyserver (in a certificate, for ease 193 of use). 195 While the device is being shipped, Sirius generates the initial 196 device configuration, fetches the certificate from Acme keyservers by 197 providing the serial number of the new device. Sirius then encrypts 198 the device configuration and puts this encrypted config on a (local) 199 TFTP server. 201 When the device arrives at the POP, it gets installed in Sirius' 202 rack, and cabled as instructed. The new device powers up and 203 discovers that it has not yet been configured. It enters its 204 autoboot state, and begins the DHCP process. Sirius' DHCP server 205 provides it with an IP address and the address of the configuration 206 server. The router uses TFTP to fetch its config file (note that all 207 this is existing functionality). The device attempts to load the 208 config file - if the config file is unparsable, (new functionality) 209 the device tries to use its private key to decrypt the file, and, 210 assuming it validates, installs the new configuration. 212 Only the "correct" device will have the required private key and be 213 able to decrypt and use the config file (See Security 214 Considerations). An attacker would be able to connect to the network 215 and get an IP address. They would also be able to retrieve 216 (encrypted) config files by guessing serial numbers (or perhaps the 217 server would allow directory listing), but without the private keys 218 an attacker will not be able to decrypt the files. 220 3. Vendor Role / Requirements 222 This section describes the vendors roles and responsibilities and 223 provides an overview of what the device needs to do. 225 3.1. Device key generation 227 During the manufacturing stage, when the device is initially powered 228 on, it will generate a public-private keypair. It will send its 229 unique identifier and the public key to the vendor's Certificate 230 Publication Server to be published. The mechanism used to do this is 231 left undefined. Note that some devices may be constrained, and so 232 may send the raw public key and unique identifier to the certificate 233 publication server, while mode capable devices may generate and send 234 self-signed certificates. 236 3.2. Certificate Publication Server 238 The certificate publication server contains a database of 239 certificates. If newly manufactured devices upload certificates the 240 certificate publication server can simply publish these, if the 241 devices provide raw public keys and unique identifiers the 242 certificate publication server will need to wrap these in a 243 certificate. Note that the certificate publication server MUST only 244 accept certificates or keys from the vendor's manufacturing 245 facilities. 247 The customers (e.g Sirius Cybernetics Corp) query this server with 248 the serial number (or other provided unique identifier) of a device, 249 and retrieve the associated certificate. It is expected that 250 operators will receive the unique identifier (serial number) of 251 devices when they purchase them, and will download and store / cache 252 the certificate. This means that there is not a hard requirement on 253 the uptime / reachability of the certificate publication server. 255 +------------+ 256 +------+ |Certificate | 257 |Device| |Publication | 258 +------+ | Server | 259 +------------+ 260 +----------------+ +--------------+ 261 | +---------+ | | | 262 | | Initial | | | | 263 | | boot? | | | | 264 | +----+----+ | | | 265 | | | | | 266 | +------v-----+ | | | 267 | | Generate | | | | 268 | |Self-signed | | | | 269 | |Certificate | | | | 270 | +------------+ | | | 271 | | | | +-------+ | 272 | +-------|---|-->|Receive| | 273 | | | +---+---+ | 274 | | | | | 275 | | | +---v---+ | 276 | | | |Publish| | 277 | | | +-------+ | 278 | | | | 279 +----------------+ +--------------+ 281 Initial certificate generation and publication. 283 4. Operator Role / Responsibilities 285 4.1. Administrative 287 When purchasing a new device, the accounting department will need to 288 get the unique device identifier (likely serial number) of the new 289 device and communicate it to the operations group. 291 4.2. Technical 293 The operator will contact the vendor's publication server, and 294 download the certificate (by providing the unique device identifier 295 of the device). The operator SHOULD fetch the certificate using a 296 secure transport (e.g HTTPS). The operator will then encrypt the 297 initial configuration to the key in the certificate, and place it on 298 their TFTP server. See Appendix B for examples. 300 +------------+ 301 +--------+ |Certificate | 302 |Operator| |Publication | 303 +--------+ | Server | 304 +------------+ 305 +----------------+ +----------------+ 306 | +-----------+ | | +-----------+ | 307 | | Fetch | | | | | | 308 | | Device |<------>|Certificate| | 309 | |Certificate| | | | | | 310 | +-----+-----+ | | +-----------+ | 311 | | | | | 312 | +-----v------+ | | | 313 | | Encrypt | | | | 314 | | Device | | | | 315 | | Config | | | | 316 | +-----+------+ | | | 317 | | | | | 318 | +-----v------+ | | | 319 | | Publish | | | | 320 | | TFTP | | | | 321 | | Server | | | | 322 | +------------+ | | | 323 | | | | 324 +----------------+ +----------------+ 326 Fetching the certificate, encrypting the configuration, publishing 327 the encrypted configuration. 329 4.3. Initial Customer Boot 331 When the device is first booted by the customer (and on subsequent 332 boots), if the device has no valid configuration, it will use 333 existing auto-install type functionality - it performs DHCP Discovery 334 until it gets a DHCP offer including DHCP option 66 or 150, contact 335 the server listed in these DHCP options and download its config file. 337 After retrieving the config file, the device will examine the file 338 and determine if it seems to be a valid config, and if so, proceeds 339 as it normally would. Note that this is existing functionality (for 340 example, Cisco devices fetch the config file named by the Bootfile- 341 Name DHCP option (67)). 343 If the file appears be "garbage", the device will attempt to decrypt 344 the configuration file using its private key. If it is able to 345 decrypt and validate the file it will install the configuration, and 346 start using it. The exact method that the device uses to determine 347 if a config file is "valid" is implementation specific, but a normal 348 config file looks significantly different to an encrypted blob. 350 Note that the device only needs DHCP and to be able to download the 351 config file; after the initial power-on in the factory it never needs 352 to access the Internet or vendor or certificate publication server - 353 it (and only it) has the private key and so has the ability to 354 decrypt the config file. 356 +--------+ +--------------+ 357 | Device | |Config server | 358 +--------+ | (e.g TFTP) | 359 +--------------+ 360 +---------------------------+ +------------------+ 361 | +-----------+ | | | 362 | | | | | | 363 | | DHCP | | | | 364 | | | | | | 365 | +-----+-----+ | | | 366 | | | | | 367 | +-----v------+ | | +-----------+ | 368 | | | | | | Encrypted | | 369 | |Fetch config|<------------------>| config | | 370 | | | | | | file | | 371 | +-----+------+ | | +-----------+ | 372 | | | | | 373 | X | | | 374 | / \ | | | 375 | / \ Y +--------+ | | | 376 | |Sane?|---->|Install,| | | | 377 | \ / | Boot | | | | 378 | \ / +--------+ | | | 379 | V | | | 380 | |N | | | 381 | | | | | 382 | +-----v------+ | | | 383 | |Decrypt with| | | | 384 | |private key | | | | 385 | +-----+------+ | | | 386 | | | | | 387 | v | | | 388 | / \ | | | 389 | / \ Y +--------+ | | | 390 | |Sane?|---->|Install,| | | | 391 | \ / | Boot | | | | 392 | \ / +--------+ | | | 393 | V | | | 394 | |N | | | 395 | | | | | 396 | +----v---+ | | | 397 | |Give up | | | | 398 | |go home | | | | 399 | +--------+ | | | 400 | | | | 401 +---------------------------+ +------------------+ 403 Device boot, fetch and install config file 405 5. Additional Considerations 407 5.1. Key storage 409 Ideally, the keypair would be stored in a TPM on something which is 410 identified as the "router" - for example, the chassis / backplane. 411 This is so that a keypair is bound to what humans think of as the 412 "device", and not, for example (redundant) routing engines. Devices 413 which implement IEEE 802.1AR could choose to use the IDevID for this 414 purpose. 416 5.2. Key replacement 418 It is anticipated that some operator may want to replace the (vendor 419 provided) keys after installing the device. There are two options 420 when implementing this - a vendor could allow the operator's key to 421 completely replace the initial device generated key (which means 422 that, if the device is ever sold, the new owner couldn't use this 423 technique to install the device), or the device could prefer the 424 operators installed key. This is an implementation decision left to 425 the vendor. 427 5.3. Device reinstall 429 Increasingly, operations is moving towards an automated model of 430 device management, whereby portions (or the entire) configuration is 431 programmatically generated. This means that operators may want to 432 generate an entire configuration after the device has been initially 433 installed and ask the device to load and use this new configuration. 434 It is expected (but not defined in this document, as it is vendor 435 specific) that vendors will allow the operator to copy a new, 436 encrypted config (or part of a config) onto a device and then request 437 that the device decrypt and install it (e.g: 'load replace 438 encrypted)). The operator could also choose to reset the device to 439 factory defaults, and allow the device to act as though it were the 440 initial boot (see Section 4.3). 442 6. IANA Considerations 444 This document makes no requests of the IANA. 446 7. Security Considerations 448 This mechanism is intended to replace either expensive (traveling 449 employees) or insecure mechanisms of installing newly deployed 450 devices such as: unencrypted config files which can be downloaded by 451 connecting to unprotected ports in datacenters, mailing initial 452 config files on flash drives, or emailing config files and asking a 453 third-party to copy and paste it over a serial terminal. It does not 454 protect against devices with malicious firmware, nor theft and reuse 455 of devices. 457 An attacker (e.g a malicious datacenter employee) who has physical 458 access to the device before it is connected to the network the 459 attacker may be able to extract the device private key (especially if 460 it isn't stored in a TPM), pretend to be the device when connecting 461 to the network, and download and extract the (encrypted) config file. 463 This mechanism does not protect against a malicious vendor - while 464 the keypair should be generated on the device, and the private key 465 should be securely stored, the mechanism cannot detect or protect 466 against a vendor who claims to do this, but instead generates the 467 keypair off device and keeps a copy of the private key. It is 468 largely understood in the operator community that a malicious vendor 469 or attacker with physical access to the device is largely a "Game 470 Over" situation. 472 Even when using a secure bootstrapping mechanism, security conscious 473 operators may wish to bootstrapping devices with a minimal / less 474 sensitive config, and then replace this with a more complete one 475 after install. 477 8. Acknowledgements 479 The authors wish to thank everyone who contributed, including Benoit 480 Claise, Sam Ribeiro, Michael Richardson, Sean Turner and Kent Watsen. 481 Joe Clarke provided significant comments and review. 483 9. References 485 9.1. Normative References 487 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 488 Requirement Levels", BCP 14, RFC 2119, 489 DOI 10.17487/RFC2119, March 1997, 490 . 492 [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 493 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 494 May 2017, . 496 9.2. Informative References 498 [RFC4122] Leach, P., Mealling, M., and R. Salz, "A Universally 499 Unique IDentifier (UUID) URN Namespace", RFC 4122, 500 DOI 10.17487/RFC4122, July 2005, 501 . 503 [RFC8572] Watsen, K., Farrer, I., and M. Abrahamsson, "Secure Zero 504 Touch Provisioning (SZTP)", RFC 8572, 505 DOI 10.17487/RFC8572, April 2019, 506 . 508 Appendix A. Changes / Author Notes. 510 [RFC Editor: Please remove this section before publication ] 512 From individual WG-01 to -03: 514 o Addressed Joe Clarke's comments - 515 https://mailarchive.ietf.org/arch/msg/opsawg/JTzsdVXw- 516 XtWXZIIFhH7aW_-0YY 518 o Many typos / nits 520 o Broke Overview and Example Scenario into 2 sections. 522 o Reordered text for above. 524 From individual -04 to WG-01: 526 o Renamed from draft-wkumari-opsawg-sdi-04 -> draft-ietf-opsawg- 527 sdi-00 529 From -00 to -01 531 o Nothing changed in the template! 533 From -01 to -03: 535 o See github commit log (AKA, we forgot to update this!) 537 o Added Colin Doyle. 539 From -03 to -04: 541 Addressed a number of comments received before / at IETF104 (Prague). 542 These include: 544 o Pointer to https://datatracker.ietf.org/doc/draft-ietf-netconf- 545 zerotouch -- included reference to (now) RFC8572 (KW) 547 o Suggested that 802.1AR IDevID (or similar) could be used. Stress 548 that this is designed for simplicity (MR) 550 o Added text to explain that any unique device identifier can be 551 used, not just serial number - serial number is simple and easy, 552 but anything which is unique (and can be communicated to the 553 customer) will work (BF). 555 o Lots of clarifications from Joe Clarke. 557 o Make it clear it should first try use the config, and if it 558 doesn't work, then try decrypt and use it. 560 o The CA part was confusing people - the certificate is simply a 561 wrapper for the key, and the Subject just an index, and so removed 562 that. 564 o Added a bunch of ASCII diagrams 566 Appendix B. Demo / proof of concept 568 This section contains a rough demo / proof of concept of the system. 569 It is only intended for illustration; presumably things like 570 algorithms, key lengths, format / containers will provide much fodder 571 for discussion. 573 It uses OpenSSL from the command line, in production something more 574 automated would be used. In this example, the unique identifier is 575 the serial number of the router, SN19842256. 577 B.1. Step 1: Generating the certificate. 579 This step is performed by the router. It generates a key, then a 580 csr, and then a self signed certificate. 582 B.1.1. Step 1.1: Generate the private key. 584 $ openssl genrsa -out key.pem 2048 585 Generating RSA private key, 2048 bit long modulus 586 ................................................. 587 ................................................. 588 ..........................+++ 589 ...................+++ 590 e is 65537 (0x10001) 592 B.1.2. Step 1.2: Generate the certificate signing request. 594 $ openssl req -new -key key.pem -out SN19842256.csr 595 Country Name (2 letter code) [AU]:. 596 State or Province Name (full name) [Some-State]:. 597 Locality Name (eg, city) []:. 598 Organization Name (eg, company) [Internet Widgits Pty Ltd]:. 599 Organizational Unit Name (eg, section) []:. 600 Common Name (e.g. server FQDN or YOUR name) []:SN19842256 601 Email Address []:. 603 Please enter the following 'extra' attributes 604 to be sent with your certificate request 605 A challenge password []: 606 An optional company name []:. 608 B.1.3. Step 1.3: Generate the (self signed) certificate itself. 610 $ openssl req -x509 -days 36500 -key key.pem -in SN19842256.csr -out 611 SN19842256.crt 613 The router then sends the key to the vendor's keyserver for 614 publication (not shown). 616 B.2. Step 2: Generating the encrypted config. 618 The operator now wants to deploy the new router. 620 They generate the initial config (using whatever magic tool generates 621 router configs!), fetch the router's certificate and encrypt the 622 config file to that key. This is done by the operator. 624 B.2.1. Step 2.1: Fetch the certificate. 626 $ wget http://keyserv.example.net/certificates/SN19842256.crt 628 B.2.2. Step 2.2: Encrypt the config file. 630 I'm using S/MIME because it is simple to demonstrate. This is almost 631 definitely not the best way to do this. 633 $ openssl smime -encrypt -aes-256-cbc -in SN19842256.cfg\ 634 -out SN19842256.enc -outform PEM SN19842256.crt 635 $ more SN19842256.enc 636 -----BEGIN PKCS7----- 637 MIICigYJKoZIhvcNAQcDoIICezCCAncCAQAxggE+MIIBOgIBADAiMBUxEzARBgNV 638 BAMMClNOMTk4NDIyNTYCCQDJVuBlaTOb1DANBgkqhkiG9w0BAQEFAASCAQBABvM3 639 ... 640 LZoq08jqlWhZZWhTKs4XPGHUdmnZRYIP8KXyEtHt 641 -----END PKCS7----- 643 B.2.3. Step 2.3: Copy config to the config server. 645 $ scp SN19842256.enc config.example.com:/tftpboot 647 B.3. Step 3: Decrypting and using the config. 649 When the router connects to the operator's network it will detect 650 that does not have a valid configuration file, and will start the 651 "autoboot" process. This is a well documented process, but the high 652 level overview is that it will use DHCP to obtain an IP address and 653 config server. It will then use TFTP to download a configuration 654 file, based upon its serial number (this document modifies the 655 solution to fetch an encrypted config file (ending in .enc)). It 656 will then then decrypt the config file, and install it. 658 B.3.1. Step 3.1: Fetch encrypted config file from config server. 660 $ tftp 192.0.2.1 -c get SN19842256.enc 662 B.3.2. Step 3.2: Decrypt and use the config. 664 $ openssl smime -decrypt -in SN19842256.enc -inform pkcs7\ 665 -out config.cfg -inkey key.pem 667 If an attacker does not have the correct key, they will not be able 668 to decrypt the config: 670 $ openssl smime -decrypt -in SN19842256.enc -inform pkcs7\ 671 -out config.cfg -inkey wrongkey.pem 672 Error decrypting PKCS#7 structure 673 140352450692760:error:06065064:digital envelope 674 routines:EVP_DecryptFinal_ex:bad decrypt:evp_enc.c:592: 675 $ echo $? 676 4 678 Authors' Addresses 680 Warren Kumari 681 Google 682 1600 Amphitheatre Parkway 683 Mountain View, CA 94043 684 US 686 Email: warren@kumari.net 688 Colin Doyle 689 Juniper Networks 690 1133 Innovation Way 691 Sunnyvale, CA 94089 692 US 694 Email: cdoyle@juniper.net