├── .gitignore ├── Cargo.lock ├── Cargo.toml ├── LICENSE-APACHE ├── LICENSE-MIT ├── README.md ├── cloud-seed.service └── src ├── execute.rs ├── main.rs ├── schema.rs ├── source.rs └── source ├── alibaba.rs ├── amazon.rs ├── exoscale.rs ├── google.rs ├── helpers.rs ├── openstack.rs ├── oracle.rs └── vultr.rs /.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | -------------------------------------------------------------------------------- /Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 3 4 | 5 | [[package]] 6 | name = "adler" 7 | version = "1.0.2" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" 10 | 11 | [[package]] 12 | name = "aho-corasick" 13 | version = "1.0.1" 14 | source = "registry+https://github.com/rust-lang/crates.io-index" 15 | checksum = "67fc08ce920c31afb70f013dcce1bfc3a3195de6a228474e45e1f145b36f8d04" 16 | dependencies = [ 17 | "memchr", 18 | ] 19 | 20 | [[package]] 21 | name = "anyhow" 22 | version = "1.0.71" 23 | source = "registry+https://github.com/rust-lang/crates.io-index" 24 | checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8" 25 | 26 | [[package]] 27 | name = "async-compression" 28 | version = "0.3.15" 29 | source = "registry+https://github.com/rust-lang/crates.io-index" 30 | checksum = "942c7cd7ae39e91bde4820d74132e9862e62c2f386c3aa90ccf55949f5bad63a" 31 | dependencies = [ 32 | "flate2", 33 | "futures-core", 34 | "memchr", 35 | "pin-project-lite", 36 | "tokio", 37 | ] 38 | 39 | [[package]] 40 | name = "async-trait" 41 | version = "0.1.68" 42 | source = "registry+https://github.com/rust-lang/crates.io-index" 43 | checksum = "b9ccdd8f2a161be9bd5c023df56f1b2a0bd1d83872ae53b71a84a12c9bf6e842" 44 | dependencies = [ 45 | "proc-macro2", 46 | "quote", 47 | "syn 2.0.15", 48 | ] 49 | 50 | [[package]] 51 | name = "autocfg" 52 | version = "1.1.0" 53 | source = "registry+https://github.com/rust-lang/crates.io-index" 54 | checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" 55 | 56 | [[package]] 57 | name = "aws-config" 58 | version = "0.55.2" 59 | source = "registry+https://github.com/rust-lang/crates.io-index" 60 | checksum = "fc00553f5f3c06ffd4510a9d576f92143618706c45ea6ff81e84ad9be9588abd" 61 | dependencies = [ 62 | "aws-credential-types", 63 | "aws-http", 64 | "aws-sdk-sts", 65 | "aws-smithy-async", 66 | "aws-smithy-client", 67 | "aws-smithy-http", 68 | "aws-smithy-http-tower", 69 | "aws-smithy-json", 70 | "aws-smithy-types", 71 | "aws-types", 72 | "bytes", 73 | "fastrand", 74 | "http", 75 | "hyper", 76 | "time", 77 | "tokio", 78 | "tower", 79 | "tracing", 80 | ] 81 | 82 | [[package]] 83 | name = "aws-credential-types" 84 | version = "0.55.2" 85 | source = "registry+https://github.com/rust-lang/crates.io-index" 86 | checksum = "4cb57ac6088805821f78d282c0ba8aec809f11cbee10dda19a97b03ab040ccc2" 87 | dependencies = [ 88 | "aws-smithy-async", 89 | "aws-smithy-types", 90 | "fastrand", 91 | "tokio", 92 | "tracing", 93 | "zeroize", 94 | ] 95 | 96 | [[package]] 97 | name = "aws-endpoint" 98 | version = "0.55.2" 99 | source = "registry+https://github.com/rust-lang/crates.io-index" 100 | checksum = "9c5f6f84a4f46f95a9bb71d9300b73cd67eb868bc43ae84f66ad34752299f4ac" 101 | dependencies = [ 102 | "aws-smithy-http", 103 | "aws-smithy-types", 104 | "aws-types", 105 | "http", 106 | "regex", 107 | "tracing", 108 | ] 109 | 110 | [[package]] 111 | name = "aws-http" 112 | version = "0.55.2" 113 | source = "registry+https://github.com/rust-lang/crates.io-index" 114 | checksum = "a754683c322f7dc5167484266489fdebdcd04d26e53c162cad1f3f949f2c5671" 115 | dependencies = [ 116 | "aws-credential-types", 117 | "aws-smithy-http", 118 | "aws-smithy-types", 119 | "aws-types", 120 | "bytes", 121 | "http", 122 | "http-body", 123 | "lazy_static", 124 | "percent-encoding", 125 | "pin-project-lite", 126 | "tracing", 127 | ] 128 | 129 | [[package]] 130 | name = "aws-sdk-sts" 131 | version = "0.27.0" 132 | source = "registry+https://github.com/rust-lang/crates.io-index" 133 | checksum = "2d0fbe3c2c342bc8dfea4bb43937405a8ec06f99140a0dcb9c7b59e54dfa93a1" 134 | dependencies = [ 135 | "aws-credential-types", 136 | "aws-endpoint", 137 | "aws-http", 138 | "aws-sig-auth", 139 | "aws-smithy-async", 140 | "aws-smithy-client", 141 | "aws-smithy-http", 142 | "aws-smithy-http-tower", 143 | "aws-smithy-json", 144 | "aws-smithy-query", 145 | "aws-smithy-types", 146 | "aws-smithy-xml", 147 | "aws-types", 148 | "bytes", 149 | "http", 150 | "regex", 151 | "tower", 152 | "tracing", 153 | ] 154 | 155 | [[package]] 156 | name = "aws-sig-auth" 157 | version = "0.55.2" 158 | source = "registry+https://github.com/rust-lang/crates.io-index" 159 | checksum = "84dc92a63ede3c2cbe43529cb87ffa58763520c96c6a46ca1ced80417afba845" 160 | dependencies = [ 161 | "aws-credential-types", 162 | "aws-sigv4", 163 | "aws-smithy-http", 164 | "aws-types", 165 | "http", 166 | "tracing", 167 | ] 168 | 169 | [[package]] 170 | name = "aws-sigv4" 171 | version = "0.55.2" 172 | source = "registry+https://github.com/rust-lang/crates.io-index" 173 | checksum = "392fefab9d6fcbd76d518eb3b1c040b84728ab50f58df0c3c53ada4bea9d327e" 174 | dependencies = [ 175 | "aws-smithy-http", 176 | "form_urlencoded", 177 | "hex", 178 | "hmac", 179 | "http", 180 | "once_cell", 181 | "percent-encoding", 182 | "regex", 183 | "sha2", 184 | "time", 185 | "tracing", 186 | ] 187 | 188 | [[package]] 189 | name = "aws-smithy-async" 190 | version = "0.55.2" 191 | source = "registry+https://github.com/rust-lang/crates.io-index" 192 | checksum = "ae23b9fe7a07d0919000116c4c5c0578303fbce6fc8d32efca1f7759d4c20faf" 193 | dependencies = [ 194 | "futures-util", 195 | "pin-project-lite", 196 | "tokio", 197 | "tokio-stream", 198 | ] 199 | 200 | [[package]] 201 | name = "aws-smithy-client" 202 | version = "0.55.2" 203 | source = "registry+https://github.com/rust-lang/crates.io-index" 204 | checksum = "5230d25d244a51339273b8870f0f77874cd4449fb4f8f629b21188ae10cfc0ba" 205 | dependencies = [ 206 | "aws-smithy-async", 207 | "aws-smithy-http", 208 | "aws-smithy-http-tower", 209 | "aws-smithy-types", 210 | "bytes", 211 | "fastrand", 212 | "http", 213 | "http-body", 214 | "hyper", 215 | "hyper-rustls", 216 | "lazy_static", 217 | "pin-project-lite", 218 | "rustls", 219 | "tokio", 220 | "tower", 221 | "tracing", 222 | ] 223 | 224 | [[package]] 225 | name = "aws-smithy-http" 226 | version = "0.55.2" 227 | source = "registry+https://github.com/rust-lang/crates.io-index" 228 | checksum = "b60e2133beb9fe6ffe0b70deca57aaeff0a35ad24a9c6fab2fd3b4f45b99fdb5" 229 | dependencies = [ 230 | "aws-smithy-types", 231 | "bytes", 232 | "bytes-utils", 233 | "futures-core", 234 | "http", 235 | "http-body", 236 | "hyper", 237 | "once_cell", 238 | "percent-encoding", 239 | "pin-project-lite", 240 | "pin-utils", 241 | "tracing", 242 | ] 243 | 244 | [[package]] 245 | name = "aws-smithy-http-tower" 246 | version = "0.55.2" 247 | source = "registry+https://github.com/rust-lang/crates.io-index" 248 | checksum = "3a4d94f556c86a0dd916a5d7c39747157ea8cb909ca469703e20fee33e448b67" 249 | dependencies = [ 250 | "aws-smithy-http", 251 | "aws-smithy-types", 252 | "bytes", 253 | "http", 254 | "http-body", 255 | "pin-project-lite", 256 | "tower", 257 | "tracing", 258 | ] 259 | 260 | [[package]] 261 | name = "aws-smithy-json" 262 | version = "0.55.2" 263 | source = "registry+https://github.com/rust-lang/crates.io-index" 264 | checksum = "5ce3d6e6ebb00b2cce379f079ad5ec508f9bcc3a9510d9b9c1840ed1d6f8af39" 265 | dependencies = [ 266 | "aws-smithy-types", 267 | ] 268 | 269 | [[package]] 270 | name = "aws-smithy-query" 271 | version = "0.55.2" 272 | source = "registry+https://github.com/rust-lang/crates.io-index" 273 | checksum = "d58edfca32ef9bfbc1ca394599e17ea329cb52d6a07359827be74235b64b3298" 274 | dependencies = [ 275 | "aws-smithy-types", 276 | "urlencoding", 277 | ] 278 | 279 | [[package]] 280 | name = "aws-smithy-types" 281 | version = "0.55.2" 282 | source = "registry+https://github.com/rust-lang/crates.io-index" 283 | checksum = "58db46fc1f4f26be01ebdb821751b4e2482cd43aa2b64a0348fb89762defaffa" 284 | dependencies = [ 285 | "base64-simd", 286 | "itoa", 287 | "num-integer", 288 | "ryu", 289 | "time", 290 | ] 291 | 292 | [[package]] 293 | name = "aws-smithy-xml" 294 | version = "0.55.2" 295 | source = "registry+https://github.com/rust-lang/crates.io-index" 296 | checksum = "fb557fe4995bd9ec87fb244bbb254666a971dc902a783e9da8b7711610e9664c" 297 | dependencies = [ 298 | "xmlparser", 299 | ] 300 | 301 | [[package]] 302 | name = "aws-types" 303 | version = "0.55.2" 304 | source = "registry+https://github.com/rust-lang/crates.io-index" 305 | checksum = "de0869598bfe46ec44ffe17e063ed33336e59df90356ca8ff0e8da6f7c1d994b" 306 | dependencies = [ 307 | "aws-credential-types", 308 | "aws-smithy-async", 309 | "aws-smithy-client", 310 | "aws-smithy-http", 311 | "aws-smithy-types", 312 | "http", 313 | "rustc_version", 314 | "tracing", 315 | ] 316 | 317 | [[package]] 318 | name = "base64" 319 | version = "0.21.0" 320 | source = "registry+https://github.com/rust-lang/crates.io-index" 321 | checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a" 322 | 323 | [[package]] 324 | name = "base64-simd" 325 | version = "0.8.0" 326 | source = "registry+https://github.com/rust-lang/crates.io-index" 327 | checksum = "339abbe78e73178762e23bea9dfd08e697eb3f3301cd4be981c0f78ba5859195" 328 | dependencies = [ 329 | "outref", 330 | "vsimd", 331 | ] 332 | 333 | [[package]] 334 | name = "bitflags" 335 | version = "1.3.2" 336 | source = "registry+https://github.com/rust-lang/crates.io-index" 337 | checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" 338 | 339 | [[package]] 340 | name = "block-buffer" 341 | version = "0.10.4" 342 | source = "registry+https://github.com/rust-lang/crates.io-index" 343 | checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" 344 | dependencies = [ 345 | "generic-array", 346 | ] 347 | 348 | [[package]] 349 | name = "bumpalo" 350 | version = "3.12.1" 351 | source = "registry+https://github.com/rust-lang/crates.io-index" 352 | checksum = "9b1ce199063694f33ffb7dd4e0ee620741495c32833cde5aa08f02a0bf96f0c8" 353 | 354 | [[package]] 355 | name = "bytes" 356 | version = "1.4.0" 357 | source = "registry+https://github.com/rust-lang/crates.io-index" 358 | checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" 359 | 360 | [[package]] 361 | name = "bytes-utils" 362 | version = "0.1.3" 363 | source = "registry+https://github.com/rust-lang/crates.io-index" 364 | checksum = "e47d3a8076e283f3acd27400535992edb3ba4b5bb72f8891ad8fbe7932a7d4b9" 365 | dependencies = [ 366 | "bytes", 367 | "either", 368 | ] 369 | 370 | [[package]] 371 | name = "cc" 372 | version = "1.0.79" 373 | source = "registry+https://github.com/rust-lang/crates.io-index" 374 | checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" 375 | 376 | [[package]] 377 | name = "cfg-if" 378 | version = "1.0.0" 379 | source = "registry+https://github.com/rust-lang/crates.io-index" 380 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 381 | 382 | [[package]] 383 | name = "cloud-seed" 384 | version = "0.1.0" 385 | dependencies = [ 386 | "anyhow", 387 | "async-compression", 388 | "async-trait", 389 | "aws-config", 390 | "base64", 391 | "flate2", 392 | "futures-util", 393 | "hostname", 394 | "hyper", 395 | "nix", 396 | "once_cell", 397 | "serde", 398 | "serde_json", 399 | "serde_yaml", 400 | "tokio", 401 | "tokio-util", 402 | "tracing", 403 | "tracing-subscriber", 404 | ] 405 | 406 | [[package]] 407 | name = "core-foundation" 408 | version = "0.9.3" 409 | source = "registry+https://github.com/rust-lang/crates.io-index" 410 | checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" 411 | dependencies = [ 412 | "core-foundation-sys", 413 | "libc", 414 | ] 415 | 416 | [[package]] 417 | name = "core-foundation-sys" 418 | version = "0.8.4" 419 | source = "registry+https://github.com/rust-lang/crates.io-index" 420 | checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" 421 | 422 | [[package]] 423 | name = "cpufeatures" 424 | version = "0.2.7" 425 | source = "registry+https://github.com/rust-lang/crates.io-index" 426 | checksum = "3e4c1eaa2012c47becbbad2ab175484c2a84d1185b566fb2cc5b8707343dfe58" 427 | dependencies = [ 428 | "libc", 429 | ] 430 | 431 | [[package]] 432 | name = "crc32fast" 433 | version = "1.3.2" 434 | source = "registry+https://github.com/rust-lang/crates.io-index" 435 | checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" 436 | dependencies = [ 437 | "cfg-if", 438 | ] 439 | 440 | [[package]] 441 | name = "crypto-common" 442 | version = "0.1.6" 443 | source = "registry+https://github.com/rust-lang/crates.io-index" 444 | checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" 445 | dependencies = [ 446 | "generic-array", 447 | "typenum", 448 | ] 449 | 450 | [[package]] 451 | name = "digest" 452 | version = "0.10.6" 453 | source = "registry+https://github.com/rust-lang/crates.io-index" 454 | checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f" 455 | dependencies = [ 456 | "block-buffer", 457 | "crypto-common", 458 | "subtle", 459 | ] 460 | 461 | [[package]] 462 | name = "either" 463 | version = "1.8.1" 464 | source = "registry+https://github.com/rust-lang/crates.io-index" 465 | checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" 466 | 467 | [[package]] 468 | name = "fastrand" 469 | version = "1.9.0" 470 | source = "registry+https://github.com/rust-lang/crates.io-index" 471 | checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" 472 | dependencies = [ 473 | "instant", 474 | ] 475 | 476 | [[package]] 477 | name = "flate2" 478 | version = "1.0.26" 479 | source = "registry+https://github.com/rust-lang/crates.io-index" 480 | checksum = "3b9429470923de8e8cbd4d2dc513535400b4b3fef0319fb5c4e1f520a7bef743" 481 | dependencies = [ 482 | "crc32fast", 483 | "miniz_oxide", 484 | ] 485 | 486 | [[package]] 487 | name = "fnv" 488 | version = "1.0.7" 489 | source = "registry+https://github.com/rust-lang/crates.io-index" 490 | checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" 491 | 492 | [[package]] 493 | name = "form_urlencoded" 494 | version = "1.1.0" 495 | source = "registry+https://github.com/rust-lang/crates.io-index" 496 | checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8" 497 | dependencies = [ 498 | "percent-encoding", 499 | ] 500 | 501 | [[package]] 502 | name = "futures-channel" 503 | version = "0.3.28" 504 | source = "registry+https://github.com/rust-lang/crates.io-index" 505 | checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" 506 | dependencies = [ 507 | "futures-core", 508 | ] 509 | 510 | [[package]] 511 | name = "futures-core" 512 | version = "0.3.28" 513 | source = "registry+https://github.com/rust-lang/crates.io-index" 514 | checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" 515 | 516 | [[package]] 517 | name = "futures-sink" 518 | version = "0.3.28" 519 | source = "registry+https://github.com/rust-lang/crates.io-index" 520 | checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" 521 | 522 | [[package]] 523 | name = "futures-task" 524 | version = "0.3.28" 525 | source = "registry+https://github.com/rust-lang/crates.io-index" 526 | checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" 527 | 528 | [[package]] 529 | name = "futures-util" 530 | version = "0.3.28" 531 | source = "registry+https://github.com/rust-lang/crates.io-index" 532 | checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" 533 | dependencies = [ 534 | "futures-core", 535 | "futures-task", 536 | "pin-project-lite", 537 | "pin-utils", 538 | "slab", 539 | ] 540 | 541 | [[package]] 542 | name = "generic-array" 543 | version = "0.14.7" 544 | source = "registry+https://github.com/rust-lang/crates.io-index" 545 | checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" 546 | dependencies = [ 547 | "typenum", 548 | "version_check", 549 | ] 550 | 551 | [[package]] 552 | name = "h2" 553 | version = "0.3.18" 554 | source = "registry+https://github.com/rust-lang/crates.io-index" 555 | checksum = "17f8a914c2987b688368b5138aa05321db91f4090cf26118185672ad588bce21" 556 | dependencies = [ 557 | "bytes", 558 | "fnv", 559 | "futures-core", 560 | "futures-sink", 561 | "futures-util", 562 | "http", 563 | "indexmap", 564 | "slab", 565 | "tokio", 566 | "tokio-util", 567 | "tracing", 568 | ] 569 | 570 | [[package]] 571 | name = "hashbrown" 572 | version = "0.12.3" 573 | source = "registry+https://github.com/rust-lang/crates.io-index" 574 | checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" 575 | 576 | [[package]] 577 | name = "hermit-abi" 578 | version = "0.2.6" 579 | source = "registry+https://github.com/rust-lang/crates.io-index" 580 | checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" 581 | dependencies = [ 582 | "libc", 583 | ] 584 | 585 | [[package]] 586 | name = "hex" 587 | version = "0.4.3" 588 | source = "registry+https://github.com/rust-lang/crates.io-index" 589 | checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" 590 | 591 | [[package]] 592 | name = "hmac" 593 | version = "0.12.1" 594 | source = "registry+https://github.com/rust-lang/crates.io-index" 595 | checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" 596 | dependencies = [ 597 | "digest", 598 | ] 599 | 600 | [[package]] 601 | name = "hostname" 602 | version = "0.3.1" 603 | source = "registry+https://github.com/rust-lang/crates.io-index" 604 | checksum = "3c731c3e10504cc8ed35cfe2f1db4c9274c3d35fa486e3b31df46f068ef3e867" 605 | dependencies = [ 606 | "libc", 607 | "match_cfg", 608 | "winapi", 609 | ] 610 | 611 | [[package]] 612 | name = "http" 613 | version = "0.2.9" 614 | source = "registry+https://github.com/rust-lang/crates.io-index" 615 | checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" 616 | dependencies = [ 617 | "bytes", 618 | "fnv", 619 | "itoa", 620 | ] 621 | 622 | [[package]] 623 | name = "http-body" 624 | version = "0.4.5" 625 | source = "registry+https://github.com/rust-lang/crates.io-index" 626 | checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" 627 | dependencies = [ 628 | "bytes", 629 | "http", 630 | "pin-project-lite", 631 | ] 632 | 633 | [[package]] 634 | name = "httparse" 635 | version = "1.8.0" 636 | source = "registry+https://github.com/rust-lang/crates.io-index" 637 | checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" 638 | 639 | [[package]] 640 | name = "httpdate" 641 | version = "1.0.2" 642 | source = "registry+https://github.com/rust-lang/crates.io-index" 643 | checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" 644 | 645 | [[package]] 646 | name = "hyper" 647 | version = "0.14.26" 648 | source = "registry+https://github.com/rust-lang/crates.io-index" 649 | checksum = "ab302d72a6f11a3b910431ff93aae7e773078c769f0a3ef15fb9ec692ed147d4" 650 | dependencies = [ 651 | "bytes", 652 | "futures-channel", 653 | "futures-core", 654 | "futures-util", 655 | "h2", 656 | "http", 657 | "http-body", 658 | "httparse", 659 | "httpdate", 660 | "itoa", 661 | "pin-project-lite", 662 | "socket2", 663 | "tokio", 664 | "tower-service", 665 | "tracing", 666 | "want", 667 | ] 668 | 669 | [[package]] 670 | name = "hyper-rustls" 671 | version = "0.23.2" 672 | source = "registry+https://github.com/rust-lang/crates.io-index" 673 | checksum = "1788965e61b367cd03a62950836d5cd41560c3577d90e40e0819373194d1661c" 674 | dependencies = [ 675 | "http", 676 | "hyper", 677 | "log", 678 | "rustls", 679 | "rustls-native-certs", 680 | "tokio", 681 | "tokio-rustls", 682 | ] 683 | 684 | [[package]] 685 | name = "indexmap" 686 | version = "1.9.3" 687 | source = "registry+https://github.com/rust-lang/crates.io-index" 688 | checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" 689 | dependencies = [ 690 | "autocfg", 691 | "hashbrown", 692 | ] 693 | 694 | [[package]] 695 | name = "instant" 696 | version = "0.1.12" 697 | source = "registry+https://github.com/rust-lang/crates.io-index" 698 | checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" 699 | dependencies = [ 700 | "cfg-if", 701 | ] 702 | 703 | [[package]] 704 | name = "itoa" 705 | version = "1.0.6" 706 | source = "registry+https://github.com/rust-lang/crates.io-index" 707 | checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" 708 | 709 | [[package]] 710 | name = "js-sys" 711 | version = "0.3.61" 712 | source = "registry+https://github.com/rust-lang/crates.io-index" 713 | checksum = "445dde2150c55e483f3d8416706b97ec8e8237c307e5b7b4b8dd15e6af2a0730" 714 | dependencies = [ 715 | "wasm-bindgen", 716 | ] 717 | 718 | [[package]] 719 | name = "lazy_static" 720 | version = "1.4.0" 721 | source = "registry+https://github.com/rust-lang/crates.io-index" 722 | checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" 723 | 724 | [[package]] 725 | name = "libc" 726 | version = "0.2.142" 727 | source = "registry+https://github.com/rust-lang/crates.io-index" 728 | checksum = "6a987beff54b60ffa6d51982e1aa1146bc42f19bd26be28b0586f252fccf5317" 729 | 730 | [[package]] 731 | name = "log" 732 | version = "0.4.17" 733 | source = "registry+https://github.com/rust-lang/crates.io-index" 734 | checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" 735 | dependencies = [ 736 | "cfg-if", 737 | ] 738 | 739 | [[package]] 740 | name = "match_cfg" 741 | version = "0.1.0" 742 | source = "registry+https://github.com/rust-lang/crates.io-index" 743 | checksum = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" 744 | 745 | [[package]] 746 | name = "matchers" 747 | version = "0.1.0" 748 | source = "registry+https://github.com/rust-lang/crates.io-index" 749 | checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" 750 | dependencies = [ 751 | "regex-automata", 752 | ] 753 | 754 | [[package]] 755 | name = "memchr" 756 | version = "2.5.0" 757 | source = "registry+https://github.com/rust-lang/crates.io-index" 758 | checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" 759 | 760 | [[package]] 761 | name = "miniz_oxide" 762 | version = "0.7.1" 763 | source = "registry+https://github.com/rust-lang/crates.io-index" 764 | checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" 765 | dependencies = [ 766 | "adler", 767 | ] 768 | 769 | [[package]] 770 | name = "mio" 771 | version = "0.8.6" 772 | source = "registry+https://github.com/rust-lang/crates.io-index" 773 | checksum = "5b9d9a46eff5b4ff64b45a9e316a6d1e0bc719ef429cbec4dc630684212bfdf9" 774 | dependencies = [ 775 | "libc", 776 | "log", 777 | "wasi", 778 | "windows-sys 0.45.0", 779 | ] 780 | 781 | [[package]] 782 | name = "nix" 783 | version = "0.26.2" 784 | source = "registry+https://github.com/rust-lang/crates.io-index" 785 | checksum = "bfdda3d196821d6af13126e40375cdf7da646a96114af134d5f417a9a1dc8e1a" 786 | dependencies = [ 787 | "bitflags", 788 | "cfg-if", 789 | "libc", 790 | "static_assertions", 791 | ] 792 | 793 | [[package]] 794 | name = "nu-ansi-term" 795 | version = "0.46.0" 796 | source = "registry+https://github.com/rust-lang/crates.io-index" 797 | checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" 798 | dependencies = [ 799 | "overload", 800 | "winapi", 801 | ] 802 | 803 | [[package]] 804 | name = "num-integer" 805 | version = "0.1.45" 806 | source = "registry+https://github.com/rust-lang/crates.io-index" 807 | checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" 808 | dependencies = [ 809 | "autocfg", 810 | "num-traits", 811 | ] 812 | 813 | [[package]] 814 | name = "num-traits" 815 | version = "0.2.15" 816 | source = "registry+https://github.com/rust-lang/crates.io-index" 817 | checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" 818 | dependencies = [ 819 | "autocfg", 820 | ] 821 | 822 | [[package]] 823 | name = "num_cpus" 824 | version = "1.15.0" 825 | source = "registry+https://github.com/rust-lang/crates.io-index" 826 | checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" 827 | dependencies = [ 828 | "hermit-abi", 829 | "libc", 830 | ] 831 | 832 | [[package]] 833 | name = "once_cell" 834 | version = "1.17.1" 835 | source = "registry+https://github.com/rust-lang/crates.io-index" 836 | checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" 837 | 838 | [[package]] 839 | name = "openssl-probe" 840 | version = "0.1.5" 841 | source = "registry+https://github.com/rust-lang/crates.io-index" 842 | checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" 843 | 844 | [[package]] 845 | name = "outref" 846 | version = "0.5.1" 847 | source = "registry+https://github.com/rust-lang/crates.io-index" 848 | checksum = "4030760ffd992bef45b0ae3f10ce1aba99e33464c90d14dd7c039884963ddc7a" 849 | 850 | [[package]] 851 | name = "overload" 852 | version = "0.1.1" 853 | source = "registry+https://github.com/rust-lang/crates.io-index" 854 | checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" 855 | 856 | [[package]] 857 | name = "percent-encoding" 858 | version = "2.2.0" 859 | source = "registry+https://github.com/rust-lang/crates.io-index" 860 | checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" 861 | 862 | [[package]] 863 | name = "pin-project" 864 | version = "1.0.12" 865 | source = "registry+https://github.com/rust-lang/crates.io-index" 866 | checksum = "ad29a609b6bcd67fee905812e544992d216af9d755757c05ed2d0e15a74c6ecc" 867 | dependencies = [ 868 | "pin-project-internal", 869 | ] 870 | 871 | [[package]] 872 | name = "pin-project-internal" 873 | version = "1.0.12" 874 | source = "registry+https://github.com/rust-lang/crates.io-index" 875 | checksum = "069bdb1e05adc7a8990dce9cc75370895fbe4e3d58b9b73bf1aee56359344a55" 876 | dependencies = [ 877 | "proc-macro2", 878 | "quote", 879 | "syn 1.0.109", 880 | ] 881 | 882 | [[package]] 883 | name = "pin-project-lite" 884 | version = "0.2.9" 885 | source = "registry+https://github.com/rust-lang/crates.io-index" 886 | checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" 887 | 888 | [[package]] 889 | name = "pin-utils" 890 | version = "0.1.0" 891 | source = "registry+https://github.com/rust-lang/crates.io-index" 892 | checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" 893 | 894 | [[package]] 895 | name = "proc-macro2" 896 | version = "1.0.56" 897 | source = "registry+https://github.com/rust-lang/crates.io-index" 898 | checksum = "2b63bdb0cd06f1f4dedf69b254734f9b45af66e4a031e42a7480257d9898b435" 899 | dependencies = [ 900 | "unicode-ident", 901 | ] 902 | 903 | [[package]] 904 | name = "quote" 905 | version = "1.0.26" 906 | source = "registry+https://github.com/rust-lang/crates.io-index" 907 | checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" 908 | dependencies = [ 909 | "proc-macro2", 910 | ] 911 | 912 | [[package]] 913 | name = "regex" 914 | version = "1.8.1" 915 | source = "registry+https://github.com/rust-lang/crates.io-index" 916 | checksum = "af83e617f331cc6ae2da5443c602dfa5af81e517212d9d611a5b3ba1777b5370" 917 | dependencies = [ 918 | "aho-corasick", 919 | "memchr", 920 | "regex-syntax 0.7.1", 921 | ] 922 | 923 | [[package]] 924 | name = "regex-automata" 925 | version = "0.1.10" 926 | source = "registry+https://github.com/rust-lang/crates.io-index" 927 | checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" 928 | dependencies = [ 929 | "regex-syntax 0.6.29", 930 | ] 931 | 932 | [[package]] 933 | name = "regex-syntax" 934 | version = "0.6.29" 935 | source = "registry+https://github.com/rust-lang/crates.io-index" 936 | checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" 937 | 938 | [[package]] 939 | name = "regex-syntax" 940 | version = "0.7.1" 941 | source = "registry+https://github.com/rust-lang/crates.io-index" 942 | checksum = "a5996294f19bd3aae0453a862ad728f60e6600695733dd5df01da90c54363a3c" 943 | 944 | [[package]] 945 | name = "ring" 946 | version = "0.16.20" 947 | source = "registry+https://github.com/rust-lang/crates.io-index" 948 | checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" 949 | dependencies = [ 950 | "cc", 951 | "libc", 952 | "once_cell", 953 | "spin", 954 | "untrusted", 955 | "web-sys", 956 | "winapi", 957 | ] 958 | 959 | [[package]] 960 | name = "rustc_version" 961 | version = "0.4.0" 962 | source = "registry+https://github.com/rust-lang/crates.io-index" 963 | checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" 964 | dependencies = [ 965 | "semver", 966 | ] 967 | 968 | [[package]] 969 | name = "rustls" 970 | version = "0.20.8" 971 | source = "registry+https://github.com/rust-lang/crates.io-index" 972 | checksum = "fff78fc74d175294f4e83b28343315ffcfb114b156f0185e9741cb5570f50e2f" 973 | dependencies = [ 974 | "log", 975 | "ring", 976 | "sct", 977 | "webpki", 978 | ] 979 | 980 | [[package]] 981 | name = "rustls-native-certs" 982 | version = "0.6.2" 983 | source = "registry+https://github.com/rust-lang/crates.io-index" 984 | checksum = "0167bac7a9f490495f3c33013e7722b53cb087ecbe082fb0c6387c96f634ea50" 985 | dependencies = [ 986 | "openssl-probe", 987 | "rustls-pemfile", 988 | "schannel", 989 | "security-framework", 990 | ] 991 | 992 | [[package]] 993 | name = "rustls-pemfile" 994 | version = "1.0.2" 995 | source = "registry+https://github.com/rust-lang/crates.io-index" 996 | checksum = "d194b56d58803a43635bdc398cd17e383d6f71f9182b9a192c127ca42494a59b" 997 | dependencies = [ 998 | "base64", 999 | ] 1000 | 1001 | [[package]] 1002 | name = "ryu" 1003 | version = "1.0.13" 1004 | source = "registry+https://github.com/rust-lang/crates.io-index" 1005 | checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" 1006 | 1007 | [[package]] 1008 | name = "schannel" 1009 | version = "0.1.21" 1010 | source = "registry+https://github.com/rust-lang/crates.io-index" 1011 | checksum = "713cfb06c7059f3588fb8044c0fad1d09e3c01d225e25b9220dbfdcf16dbb1b3" 1012 | dependencies = [ 1013 | "windows-sys 0.42.0", 1014 | ] 1015 | 1016 | [[package]] 1017 | name = "sct" 1018 | version = "0.7.0" 1019 | source = "registry+https://github.com/rust-lang/crates.io-index" 1020 | checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" 1021 | dependencies = [ 1022 | "ring", 1023 | "untrusted", 1024 | ] 1025 | 1026 | [[package]] 1027 | name = "security-framework" 1028 | version = "2.8.2" 1029 | source = "registry+https://github.com/rust-lang/crates.io-index" 1030 | checksum = "a332be01508d814fed64bf28f798a146d73792121129962fdf335bb3c49a4254" 1031 | dependencies = [ 1032 | "bitflags", 1033 | "core-foundation", 1034 | "core-foundation-sys", 1035 | "libc", 1036 | "security-framework-sys", 1037 | ] 1038 | 1039 | [[package]] 1040 | name = "security-framework-sys" 1041 | version = "2.8.0" 1042 | source = "registry+https://github.com/rust-lang/crates.io-index" 1043 | checksum = "31c9bb296072e961fcbd8853511dd39c2d8be2deb1e17c6860b1d30732b323b4" 1044 | dependencies = [ 1045 | "core-foundation-sys", 1046 | "libc", 1047 | ] 1048 | 1049 | [[package]] 1050 | name = "semver" 1051 | version = "1.0.17" 1052 | source = "registry+https://github.com/rust-lang/crates.io-index" 1053 | checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed" 1054 | 1055 | [[package]] 1056 | name = "serde" 1057 | version = "1.0.162" 1058 | source = "registry+https://github.com/rust-lang/crates.io-index" 1059 | checksum = "71b2f6e1ab5c2b98c05f0f35b236b22e8df7ead6ffbf51d7808da7f8817e7ab6" 1060 | dependencies = [ 1061 | "serde_derive", 1062 | ] 1063 | 1064 | [[package]] 1065 | name = "serde_derive" 1066 | version = "1.0.162" 1067 | source = "registry+https://github.com/rust-lang/crates.io-index" 1068 | checksum = "a2a0814352fd64b58489904a44ea8d90cb1a91dcb6b4f5ebabc32c8318e93cb6" 1069 | dependencies = [ 1070 | "proc-macro2", 1071 | "quote", 1072 | "syn 2.0.15", 1073 | ] 1074 | 1075 | [[package]] 1076 | name = "serde_json" 1077 | version = "1.0.96" 1078 | source = "registry+https://github.com/rust-lang/crates.io-index" 1079 | checksum = "057d394a50403bcac12672b2b18fb387ab6d289d957dab67dd201875391e52f1" 1080 | dependencies = [ 1081 | "itoa", 1082 | "ryu", 1083 | "serde", 1084 | ] 1085 | 1086 | [[package]] 1087 | name = "serde_yaml" 1088 | version = "0.9.21" 1089 | source = "registry+https://github.com/rust-lang/crates.io-index" 1090 | checksum = "d9d684e3ec7de3bf5466b32bd75303ac16f0736426e5a4e0d6e489559ce1249c" 1091 | dependencies = [ 1092 | "indexmap", 1093 | "itoa", 1094 | "ryu", 1095 | "serde", 1096 | "unsafe-libyaml", 1097 | ] 1098 | 1099 | [[package]] 1100 | name = "sha2" 1101 | version = "0.10.6" 1102 | source = "registry+https://github.com/rust-lang/crates.io-index" 1103 | checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" 1104 | dependencies = [ 1105 | "cfg-if", 1106 | "cpufeatures", 1107 | "digest", 1108 | ] 1109 | 1110 | [[package]] 1111 | name = "sharded-slab" 1112 | version = "0.1.4" 1113 | source = "registry+https://github.com/rust-lang/crates.io-index" 1114 | checksum = "900fba806f70c630b0a382d0d825e17a0f19fcd059a2ade1ff237bcddf446b31" 1115 | dependencies = [ 1116 | "lazy_static", 1117 | ] 1118 | 1119 | [[package]] 1120 | name = "slab" 1121 | version = "0.4.8" 1122 | source = "registry+https://github.com/rust-lang/crates.io-index" 1123 | checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" 1124 | dependencies = [ 1125 | "autocfg", 1126 | ] 1127 | 1128 | [[package]] 1129 | name = "smallvec" 1130 | version = "1.10.0" 1131 | source = "registry+https://github.com/rust-lang/crates.io-index" 1132 | checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" 1133 | 1134 | [[package]] 1135 | name = "socket2" 1136 | version = "0.4.9" 1137 | source = "registry+https://github.com/rust-lang/crates.io-index" 1138 | checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" 1139 | dependencies = [ 1140 | "libc", 1141 | "winapi", 1142 | ] 1143 | 1144 | [[package]] 1145 | name = "spin" 1146 | version = "0.5.2" 1147 | source = "registry+https://github.com/rust-lang/crates.io-index" 1148 | checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" 1149 | 1150 | [[package]] 1151 | name = "static_assertions" 1152 | version = "1.1.0" 1153 | source = "registry+https://github.com/rust-lang/crates.io-index" 1154 | checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" 1155 | 1156 | [[package]] 1157 | name = "subtle" 1158 | version = "2.4.1" 1159 | source = "registry+https://github.com/rust-lang/crates.io-index" 1160 | checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" 1161 | 1162 | [[package]] 1163 | name = "syn" 1164 | version = "1.0.109" 1165 | source = "registry+https://github.com/rust-lang/crates.io-index" 1166 | checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" 1167 | dependencies = [ 1168 | "proc-macro2", 1169 | "quote", 1170 | "unicode-ident", 1171 | ] 1172 | 1173 | [[package]] 1174 | name = "syn" 1175 | version = "2.0.15" 1176 | source = "registry+https://github.com/rust-lang/crates.io-index" 1177 | checksum = "a34fcf3e8b60f57e6a14301a2e916d323af98b0ea63c599441eec8558660c822" 1178 | dependencies = [ 1179 | "proc-macro2", 1180 | "quote", 1181 | "unicode-ident", 1182 | ] 1183 | 1184 | [[package]] 1185 | name = "thread_local" 1186 | version = "1.1.7" 1187 | source = "registry+https://github.com/rust-lang/crates.io-index" 1188 | checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" 1189 | dependencies = [ 1190 | "cfg-if", 1191 | "once_cell", 1192 | ] 1193 | 1194 | [[package]] 1195 | name = "time" 1196 | version = "0.3.20" 1197 | source = "registry+https://github.com/rust-lang/crates.io-index" 1198 | checksum = "cd0cbfecb4d19b5ea75bb31ad904eb5b9fa13f21079c3b92017ebdf4999a5890" 1199 | dependencies = [ 1200 | "serde", 1201 | "time-core", 1202 | "time-macros", 1203 | ] 1204 | 1205 | [[package]] 1206 | name = "time-core" 1207 | version = "0.1.0" 1208 | source = "registry+https://github.com/rust-lang/crates.io-index" 1209 | checksum = "2e153e1f1acaef8acc537e68b44906d2db6436e2b35ac2c6b42640fff91f00fd" 1210 | 1211 | [[package]] 1212 | name = "time-macros" 1213 | version = "0.2.8" 1214 | source = "registry+https://github.com/rust-lang/crates.io-index" 1215 | checksum = "fd80a657e71da814b8e5d60d3374fc6d35045062245d80224748ae522dd76f36" 1216 | dependencies = [ 1217 | "time-core", 1218 | ] 1219 | 1220 | [[package]] 1221 | name = "tokio" 1222 | version = "1.28.0" 1223 | source = "registry+https://github.com/rust-lang/crates.io-index" 1224 | checksum = "c3c786bf8134e5a3a166db9b29ab8f48134739014a3eca7bc6bfa95d673b136f" 1225 | dependencies = [ 1226 | "autocfg", 1227 | "bytes", 1228 | "libc", 1229 | "mio", 1230 | "num_cpus", 1231 | "pin-project-lite", 1232 | "socket2", 1233 | "tokio-macros", 1234 | "windows-sys 0.48.0", 1235 | ] 1236 | 1237 | [[package]] 1238 | name = "tokio-macros" 1239 | version = "2.1.0" 1240 | source = "registry+https://github.com/rust-lang/crates.io-index" 1241 | checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" 1242 | dependencies = [ 1243 | "proc-macro2", 1244 | "quote", 1245 | "syn 2.0.15", 1246 | ] 1247 | 1248 | [[package]] 1249 | name = "tokio-rustls" 1250 | version = "0.23.4" 1251 | source = "registry+https://github.com/rust-lang/crates.io-index" 1252 | checksum = "c43ee83903113e03984cb9e5cebe6c04a5116269e900e3ddba8f068a62adda59" 1253 | dependencies = [ 1254 | "rustls", 1255 | "tokio", 1256 | "webpki", 1257 | ] 1258 | 1259 | [[package]] 1260 | name = "tokio-stream" 1261 | version = "0.1.14" 1262 | source = "registry+https://github.com/rust-lang/crates.io-index" 1263 | checksum = "397c988d37662c7dda6d2208364a706264bf3d6138b11d436cbac0ad38832842" 1264 | dependencies = [ 1265 | "futures-core", 1266 | "pin-project-lite", 1267 | "tokio", 1268 | ] 1269 | 1270 | [[package]] 1271 | name = "tokio-util" 1272 | version = "0.7.8" 1273 | source = "registry+https://github.com/rust-lang/crates.io-index" 1274 | checksum = "806fe8c2c87eccc8b3267cbae29ed3ab2d0bd37fca70ab622e46aaa9375ddb7d" 1275 | dependencies = [ 1276 | "bytes", 1277 | "futures-core", 1278 | "futures-sink", 1279 | "pin-project-lite", 1280 | "tokio", 1281 | "tracing", 1282 | ] 1283 | 1284 | [[package]] 1285 | name = "tower" 1286 | version = "0.4.13" 1287 | source = "registry+https://github.com/rust-lang/crates.io-index" 1288 | checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" 1289 | dependencies = [ 1290 | "futures-core", 1291 | "futures-util", 1292 | "pin-project", 1293 | "pin-project-lite", 1294 | "tokio", 1295 | "tower-layer", 1296 | "tower-service", 1297 | "tracing", 1298 | ] 1299 | 1300 | [[package]] 1301 | name = "tower-layer" 1302 | version = "0.3.2" 1303 | source = "registry+https://github.com/rust-lang/crates.io-index" 1304 | checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" 1305 | 1306 | [[package]] 1307 | name = "tower-service" 1308 | version = "0.3.2" 1309 | source = "registry+https://github.com/rust-lang/crates.io-index" 1310 | checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" 1311 | 1312 | [[package]] 1313 | name = "tracing" 1314 | version = "0.1.37" 1315 | source = "registry+https://github.com/rust-lang/crates.io-index" 1316 | checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" 1317 | dependencies = [ 1318 | "cfg-if", 1319 | "log", 1320 | "pin-project-lite", 1321 | "tracing-attributes", 1322 | "tracing-core", 1323 | ] 1324 | 1325 | [[package]] 1326 | name = "tracing-attributes" 1327 | version = "0.1.24" 1328 | source = "registry+https://github.com/rust-lang/crates.io-index" 1329 | checksum = "0f57e3ca2a01450b1a921183a9c9cbfda207fd822cef4ccb00a65402cbba7a74" 1330 | dependencies = [ 1331 | "proc-macro2", 1332 | "quote", 1333 | "syn 2.0.15", 1334 | ] 1335 | 1336 | [[package]] 1337 | name = "tracing-core" 1338 | version = "0.1.30" 1339 | source = "registry+https://github.com/rust-lang/crates.io-index" 1340 | checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a" 1341 | dependencies = [ 1342 | "once_cell", 1343 | "valuable", 1344 | ] 1345 | 1346 | [[package]] 1347 | name = "tracing-log" 1348 | version = "0.1.3" 1349 | source = "registry+https://github.com/rust-lang/crates.io-index" 1350 | checksum = "78ddad33d2d10b1ed7eb9d1f518a5674713876e97e5bb9b7345a7984fbb4f922" 1351 | dependencies = [ 1352 | "lazy_static", 1353 | "log", 1354 | "tracing-core", 1355 | ] 1356 | 1357 | [[package]] 1358 | name = "tracing-subscriber" 1359 | version = "0.3.17" 1360 | source = "registry+https://github.com/rust-lang/crates.io-index" 1361 | checksum = "30a651bc37f915e81f087d86e62a18eec5f79550c7faff886f7090b4ea757c77" 1362 | dependencies = [ 1363 | "matchers", 1364 | "nu-ansi-term", 1365 | "once_cell", 1366 | "regex", 1367 | "sharded-slab", 1368 | "smallvec", 1369 | "thread_local", 1370 | "tracing", 1371 | "tracing-core", 1372 | "tracing-log", 1373 | ] 1374 | 1375 | [[package]] 1376 | name = "try-lock" 1377 | version = "0.2.4" 1378 | source = "registry+https://github.com/rust-lang/crates.io-index" 1379 | checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" 1380 | 1381 | [[package]] 1382 | name = "typenum" 1383 | version = "1.16.0" 1384 | source = "registry+https://github.com/rust-lang/crates.io-index" 1385 | checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" 1386 | 1387 | [[package]] 1388 | name = "unicode-ident" 1389 | version = "1.0.8" 1390 | source = "registry+https://github.com/rust-lang/crates.io-index" 1391 | checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" 1392 | 1393 | [[package]] 1394 | name = "unsafe-libyaml" 1395 | version = "0.2.8" 1396 | source = "registry+https://github.com/rust-lang/crates.io-index" 1397 | checksum = "1865806a559042e51ab5414598446a5871b561d21b6764f2eabb0dd481d880a6" 1398 | 1399 | [[package]] 1400 | name = "untrusted" 1401 | version = "0.7.1" 1402 | source = "registry+https://github.com/rust-lang/crates.io-index" 1403 | checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" 1404 | 1405 | [[package]] 1406 | name = "urlencoding" 1407 | version = "2.1.2" 1408 | source = "registry+https://github.com/rust-lang/crates.io-index" 1409 | checksum = "e8db7427f936968176eaa7cdf81b7f98b980b18495ec28f1b5791ac3bfe3eea9" 1410 | 1411 | [[package]] 1412 | name = "valuable" 1413 | version = "0.1.0" 1414 | source = "registry+https://github.com/rust-lang/crates.io-index" 1415 | checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" 1416 | 1417 | [[package]] 1418 | name = "version_check" 1419 | version = "0.9.4" 1420 | source = "registry+https://github.com/rust-lang/crates.io-index" 1421 | checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" 1422 | 1423 | [[package]] 1424 | name = "vsimd" 1425 | version = "0.8.0" 1426 | source = "registry+https://github.com/rust-lang/crates.io-index" 1427 | checksum = "5c3082ca00d5a5ef149bb8b555a72ae84c9c59f7250f013ac822ac2e49b19c64" 1428 | 1429 | [[package]] 1430 | name = "want" 1431 | version = "0.3.0" 1432 | source = "registry+https://github.com/rust-lang/crates.io-index" 1433 | checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" 1434 | dependencies = [ 1435 | "log", 1436 | "try-lock", 1437 | ] 1438 | 1439 | [[package]] 1440 | name = "wasi" 1441 | version = "0.11.0+wasi-snapshot-preview1" 1442 | source = "registry+https://github.com/rust-lang/crates.io-index" 1443 | checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" 1444 | 1445 | [[package]] 1446 | name = "wasm-bindgen" 1447 | version = "0.2.84" 1448 | source = "registry+https://github.com/rust-lang/crates.io-index" 1449 | checksum = "31f8dcbc21f30d9b8f2ea926ecb58f6b91192c17e9d33594b3df58b2007ca53b" 1450 | dependencies = [ 1451 | "cfg-if", 1452 | "wasm-bindgen-macro", 1453 | ] 1454 | 1455 | [[package]] 1456 | name = "wasm-bindgen-backend" 1457 | version = "0.2.84" 1458 | source = "registry+https://github.com/rust-lang/crates.io-index" 1459 | checksum = "95ce90fd5bcc06af55a641a86428ee4229e44e07033963a2290a8e241607ccb9" 1460 | dependencies = [ 1461 | "bumpalo", 1462 | "log", 1463 | "once_cell", 1464 | "proc-macro2", 1465 | "quote", 1466 | "syn 1.0.109", 1467 | "wasm-bindgen-shared", 1468 | ] 1469 | 1470 | [[package]] 1471 | name = "wasm-bindgen-macro" 1472 | version = "0.2.84" 1473 | source = "registry+https://github.com/rust-lang/crates.io-index" 1474 | checksum = "4c21f77c0bedc37fd5dc21f897894a5ca01e7bb159884559461862ae90c0b4c5" 1475 | dependencies = [ 1476 | "quote", 1477 | "wasm-bindgen-macro-support", 1478 | ] 1479 | 1480 | [[package]] 1481 | name = "wasm-bindgen-macro-support" 1482 | version = "0.2.84" 1483 | source = "registry+https://github.com/rust-lang/crates.io-index" 1484 | checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6" 1485 | dependencies = [ 1486 | "proc-macro2", 1487 | "quote", 1488 | "syn 1.0.109", 1489 | "wasm-bindgen-backend", 1490 | "wasm-bindgen-shared", 1491 | ] 1492 | 1493 | [[package]] 1494 | name = "wasm-bindgen-shared" 1495 | version = "0.2.84" 1496 | source = "registry+https://github.com/rust-lang/crates.io-index" 1497 | checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d" 1498 | 1499 | [[package]] 1500 | name = "web-sys" 1501 | version = "0.3.61" 1502 | source = "registry+https://github.com/rust-lang/crates.io-index" 1503 | checksum = "e33b99f4b23ba3eec1a53ac264e35a755f00e966e0065077d6027c0f575b0b97" 1504 | dependencies = [ 1505 | "js-sys", 1506 | "wasm-bindgen", 1507 | ] 1508 | 1509 | [[package]] 1510 | name = "webpki" 1511 | version = "0.22.0" 1512 | source = "registry+https://github.com/rust-lang/crates.io-index" 1513 | checksum = "f095d78192e208183081cc07bc5515ef55216397af48b873e5edcd72637fa1bd" 1514 | dependencies = [ 1515 | "ring", 1516 | "untrusted", 1517 | ] 1518 | 1519 | [[package]] 1520 | name = "winapi" 1521 | version = "0.3.9" 1522 | source = "registry+https://github.com/rust-lang/crates.io-index" 1523 | checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" 1524 | dependencies = [ 1525 | "winapi-i686-pc-windows-gnu", 1526 | "winapi-x86_64-pc-windows-gnu", 1527 | ] 1528 | 1529 | [[package]] 1530 | name = "winapi-i686-pc-windows-gnu" 1531 | version = "0.4.0" 1532 | source = "registry+https://github.com/rust-lang/crates.io-index" 1533 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 1534 | 1535 | [[package]] 1536 | name = "winapi-x86_64-pc-windows-gnu" 1537 | version = "0.4.0" 1538 | source = "registry+https://github.com/rust-lang/crates.io-index" 1539 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 1540 | 1541 | [[package]] 1542 | name = "windows-sys" 1543 | version = "0.42.0" 1544 | source = "registry+https://github.com/rust-lang/crates.io-index" 1545 | checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" 1546 | dependencies = [ 1547 | "windows_aarch64_gnullvm 0.42.2", 1548 | "windows_aarch64_msvc 0.42.2", 1549 | "windows_i686_gnu 0.42.2", 1550 | "windows_i686_msvc 0.42.2", 1551 | "windows_x86_64_gnu 0.42.2", 1552 | "windows_x86_64_gnullvm 0.42.2", 1553 | "windows_x86_64_msvc 0.42.2", 1554 | ] 1555 | 1556 | [[package]] 1557 | name = "windows-sys" 1558 | version = "0.45.0" 1559 | source = "registry+https://github.com/rust-lang/crates.io-index" 1560 | checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" 1561 | dependencies = [ 1562 | "windows-targets 0.42.2", 1563 | ] 1564 | 1565 | [[package]] 1566 | name = "windows-sys" 1567 | version = "0.48.0" 1568 | source = "registry+https://github.com/rust-lang/crates.io-index" 1569 | checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" 1570 | dependencies = [ 1571 | "windows-targets 0.48.0", 1572 | ] 1573 | 1574 | [[package]] 1575 | name = "windows-targets" 1576 | version = "0.42.2" 1577 | source = "registry+https://github.com/rust-lang/crates.io-index" 1578 | checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" 1579 | dependencies = [ 1580 | "windows_aarch64_gnullvm 0.42.2", 1581 | "windows_aarch64_msvc 0.42.2", 1582 | "windows_i686_gnu 0.42.2", 1583 | "windows_i686_msvc 0.42.2", 1584 | "windows_x86_64_gnu 0.42.2", 1585 | "windows_x86_64_gnullvm 0.42.2", 1586 | "windows_x86_64_msvc 0.42.2", 1587 | ] 1588 | 1589 | [[package]] 1590 | name = "windows-targets" 1591 | version = "0.48.0" 1592 | source = "registry+https://github.com/rust-lang/crates.io-index" 1593 | checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" 1594 | dependencies = [ 1595 | "windows_aarch64_gnullvm 0.48.0", 1596 | "windows_aarch64_msvc 0.48.0", 1597 | "windows_i686_gnu 0.48.0", 1598 | "windows_i686_msvc 0.48.0", 1599 | "windows_x86_64_gnu 0.48.0", 1600 | "windows_x86_64_gnullvm 0.48.0", 1601 | "windows_x86_64_msvc 0.48.0", 1602 | ] 1603 | 1604 | [[package]] 1605 | name = "windows_aarch64_gnullvm" 1606 | version = "0.42.2" 1607 | source = "registry+https://github.com/rust-lang/crates.io-index" 1608 | checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" 1609 | 1610 | [[package]] 1611 | name = "windows_aarch64_gnullvm" 1612 | version = "0.48.0" 1613 | source = "registry+https://github.com/rust-lang/crates.io-index" 1614 | checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" 1615 | 1616 | [[package]] 1617 | name = "windows_aarch64_msvc" 1618 | version = "0.42.2" 1619 | source = "registry+https://github.com/rust-lang/crates.io-index" 1620 | checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" 1621 | 1622 | [[package]] 1623 | name = "windows_aarch64_msvc" 1624 | version = "0.48.0" 1625 | source = "registry+https://github.com/rust-lang/crates.io-index" 1626 | checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" 1627 | 1628 | [[package]] 1629 | name = "windows_i686_gnu" 1630 | version = "0.42.2" 1631 | source = "registry+https://github.com/rust-lang/crates.io-index" 1632 | checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" 1633 | 1634 | [[package]] 1635 | name = "windows_i686_gnu" 1636 | version = "0.48.0" 1637 | source = "registry+https://github.com/rust-lang/crates.io-index" 1638 | checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" 1639 | 1640 | [[package]] 1641 | name = "windows_i686_msvc" 1642 | version = "0.42.2" 1643 | source = "registry+https://github.com/rust-lang/crates.io-index" 1644 | checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" 1645 | 1646 | [[package]] 1647 | name = "windows_i686_msvc" 1648 | version = "0.48.0" 1649 | source = "registry+https://github.com/rust-lang/crates.io-index" 1650 | checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" 1651 | 1652 | [[package]] 1653 | name = "windows_x86_64_gnu" 1654 | version = "0.42.2" 1655 | source = "registry+https://github.com/rust-lang/crates.io-index" 1656 | checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" 1657 | 1658 | [[package]] 1659 | name = "windows_x86_64_gnu" 1660 | version = "0.48.0" 1661 | source = "registry+https://github.com/rust-lang/crates.io-index" 1662 | checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" 1663 | 1664 | [[package]] 1665 | name = "windows_x86_64_gnullvm" 1666 | version = "0.42.2" 1667 | source = "registry+https://github.com/rust-lang/crates.io-index" 1668 | checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" 1669 | 1670 | [[package]] 1671 | name = "windows_x86_64_gnullvm" 1672 | version = "0.48.0" 1673 | source = "registry+https://github.com/rust-lang/crates.io-index" 1674 | checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" 1675 | 1676 | [[package]] 1677 | name = "windows_x86_64_msvc" 1678 | version = "0.42.2" 1679 | source = "registry+https://github.com/rust-lang/crates.io-index" 1680 | checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" 1681 | 1682 | [[package]] 1683 | name = "windows_x86_64_msvc" 1684 | version = "0.48.0" 1685 | source = "registry+https://github.com/rust-lang/crates.io-index" 1686 | checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" 1687 | 1688 | [[package]] 1689 | name = "xmlparser" 1690 | version = "0.13.5" 1691 | source = "registry+https://github.com/rust-lang/crates.io-index" 1692 | checksum = "4d25c75bf9ea12c4040a97f829154768bbbce366287e2dc044af160cd79a13fd" 1693 | 1694 | [[package]] 1695 | name = "zeroize" 1696 | version = "1.6.0" 1697 | source = "registry+https://github.com/rust-lang/crates.io-index" 1698 | checksum = "2a0956f1ba7c7909bfb66c2e9e4124ab6f6482560f6628b5aaeba39207c9aad9" 1699 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "cloud-seed" 3 | version = "0.1.0" 4 | authors = ["Jasper Hugo "] 5 | edition = "2021" 6 | description = "Fetch user-data from a cloud provider and write files described within to the filesystem" 7 | repository = "https://github.com/jbg/cloud-seed" 8 | license = "MIT OR Apache-2.0" 9 | 10 | [dependencies] 11 | anyhow = { version = "1", default-features = false, features = ["std"] } 12 | async-compression = { version = "0.3", default-features = false, features = ["tokio", "gzip"]} 13 | async-trait = { version = "0.1", default-features = false } 14 | aws-config = { optional = true, version = "0.55", default-features = false, features = ["client-hyper", "rustls", "rt-tokio"] } 15 | base64 = { version = "0.21", default-features = false, features = ["std"] } 16 | flate2 = { optional = true, version = "1", default-features = false, features = ["rust_backend"] } 17 | futures-util = { version = "0.3", default-features = false, features = ["std"] } 18 | hostname = { version = "0.3", default-features = false, features = ["set"] } 19 | hyper = { optional = true, version = "0.14", default-features = false, features = ["client", "http1", "tcp", "stream"] } 20 | nix = { version = "0.26", default-features = false, features = ["fs", "user"] } 21 | once_cell = { version = "1", default-features = false, features = ["std"] } 22 | serde = { version = "1", default-features = false, features = ["derive", "std"] } 23 | serde_json = { version = "1", default-features = false, features = ["std"] } 24 | serde_yaml = { version = "0.9", default-features = false } 25 | tokio = { version = "1", default-features = false, features = ["fs", "io-util", "macros", "rt-multi-thread"] } 26 | tokio-util = { version = "0.7", default-features = false, features = ["io"] } 27 | tracing = { version = "0.1", default-features = false, features = ["std", "attributes"] } 28 | tracing-subscriber = { version = "0.3", default-features = false, features = ["std", "env-filter", "fmt", "ansi", "registry", "smallvec", "tracing-log"] } 29 | 30 | [features] 31 | default = [ 32 | "source-alibaba", 33 | "source-amazon", 34 | "source-exoscale", 35 | "source-google", 36 | "source-openstack", 37 | "source-oracle", 38 | "source-vultr", 39 | ] 40 | helper-http = ["hyper", "flate2"] 41 | source-alibaba = ["helper-http"] 42 | source-amazon = ["aws-config"] 43 | source-exoscale = ["helper-http"] 44 | source-google = ["helper-http"] 45 | source-openstack = ["helper-http"] 46 | source-oracle = ["helper-http"] 47 | source-vultr = ["helper-http"] 48 | -------------------------------------------------------------------------------- /LICENSE-APACHE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. -------------------------------------------------------------------------------- /LICENSE-MIT: -------------------------------------------------------------------------------- 1 | Permission is hereby granted, free of charge, to any 2 | person obtaining a copy of this software and associated 3 | documentation files (the "Software"), to deal in the 4 | Software without restriction, including without 5 | limitation the rights to use, copy, modify, merge, 6 | publish, distribute, sublicense, and/or sell copies of 7 | the Software, and to permit persons to whom the Software 8 | is furnished to do so, subject to the following 9 | conditions: 10 | 11 | The above copyright notice and this permission notice 12 | shall be included in all copies or substantial portions 13 | of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF 16 | ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 17 | TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 18 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 19 | SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 20 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 22 | IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 23 | DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # cloud-seed 2 | 3 | ![crates.io](https://img.shields.io/crates/v/cloud-seed.svg) 4 | 5 | **cloud-seed** is a very minimal alternative to cloud-init. It can set the hostname and write files based on directives provided in user data. 6 | 7 | ## Motivation 8 | 9 | Launching a server should be deterministic: launching the same image with the same configuration should have the same result. To that end, server images should include all software and base configuration required for the function of the server. 10 | 11 | Installing software and performing configuration via scripts on startup introduces opportunities for failure or non-determinism. To update software or fundamentally change the configuration of the server, a new image should be built. The image build process should be automated and frictionless to allow for rapid deployment when necessary. 12 | 13 | cloud-seed exists because it is often necessary to provide some "seed" data to an otherwise-ready-to-run image: some values should not be baked into the image due to them varying from server to server. 14 | 15 | Existing solutions like cloud-init go far beyond this basic requirement, with the ability to install packages, run scripts, modify network configuration, modify partitioning and more. All of these goals can be achieved in a safer and more repeatable way either during the image build process or through appropriate configuration contained within the image, in combination with values provided via cloud-seed where necessary. 16 | 17 | ## Building from source 18 | 19 | ``` 20 | cargo build --release 21 | cp target/release/cloud-seed $IMAGE_ROOT/usr/bin/ 22 | cp cloud-seed.service $IMAGE_ROOT/usr/lib/systemd/system/ 23 | ``` 24 | 25 | Pull requests to add packaging scripts are welcomed. 26 | 27 | ## User data format 28 | 29 | The user data consists of `#cloud-seed` followed by a newline and then a JSON object. The entire user data including the `#cloud-seed` header can optionally be compressed with gzip, which is automatically detected. 30 | 31 | Two keys are currently defined for the JSON object: `files`, which is an array of file objects, and `hostname`, which is a string. Both are optional. All other keys are ignored. 32 | 33 | For example: 34 | 35 | ```json 36 | #cloud-seed 37 | { 38 | "hostname": "myserver", 39 | "files": [ 40 | { 41 | "path": "/etc/foobar/foobar.conf", 42 | "content": "Zm9vYmFyCg==", 43 | "encoding": "base64", 44 | "owner": "root:root", 45 | "permissions": "0644", 46 | "append": false 47 | } 48 | ] 49 | } 50 | ``` 51 | 52 | If `hostname` is set, it will be passed to `sethostname(2)` to set the system hostname when **cloud-seed** runs. 53 | 54 | If `files` is set, each object in the array describes a file that will be written by **cloud-seed**. The supported fields are: 55 | 56 | | Field | Description | 57 | | --- | --- | 58 | | `path` | Required. The path to the file to be written. Parent directories are created as needed. Relative paths are interpreted relative to **cloud-seed**'s working directory. | 59 | | `content` | The content to be written, encoded according to the `encoding` key. Defaults to no content. | 60 | | `encoding` | The encoding of the `content` value. Can be `plain` (the default), `base64` or `base64gzip`. Rather than using the `base64gzip` encoding, consider compressing the entire user data with gzip. | 61 | | `owner` | The user and group that should own the file, in the format `user:group`. Defaults to the user that is running **cloud-seed** and their primary group. | 62 | | `permissions` | The mode that files should be created with, specified as an octal string. Defaults to `0644`. If the file already exists, **cloud-seed** will not change its mode. | 63 | | `append` | If `true`, the `content` will be appended to the file if it already exists. If `false` (the default), the file will be truncated before the content is written. | 64 | 65 | ## Note about sensitive data 66 | 67 | The user data on cloud systems is not generally appropriate for the storage of sensitive data, and therefore tools like **cloud-seed** (or cloud-init) should not be used to seed credentials or other sensitive data onto servers. Use functionality such as instance roles and temporary credentials to grant permissions to servers. 68 | 69 | ## Supported data sources 70 | 71 | **cloud-seed** can currently fetch user data from the metadata servers of: 72 | 73 | * Alibaba Cloud 74 | * AWS 75 | * Exoscale 76 | * Google Cloud 77 | * OpenStack 78 | * Oracle Cloud 79 | * Vultr 80 | 81 | Pull requests are welcome to add additional data sources. 82 | 83 | DMI data is used to automatically detect which cloud **cloud-seed** is running in. 84 | 85 | ## Compatibility with cloud-init 86 | 87 | For compatibility with **cloud-init**, YAML is supported, the `#cloud-config` shebang is accepted, `fqdn` is accepted as an alias for `hostname`, and `write_files` is accepted as an alias for `files`. The `encoding` field for each file also supports **cloud-init** values `b64`, `gz+base64`, `gzip+base64`, `gz+b64` and `gzip+b64` as aliases for the corresponding **cloud-seed** values. 88 | 89 | All other **cloud-init** directives are ignored. If **cloud-init** compatibility is not required, it is recommended to use **cloud-seed**'s JSON format described above. 90 | 91 | ## Platform support 92 | 93 | Linux, Windows, macOS, FreeBSD, Android (21+). Other platforms may work. 94 | 95 | ## License 96 | 97 | MIT or Apache 2.0, at your option. 98 | -------------------------------------------------------------------------------- /cloud-seed.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=cloud-seed 3 | Requires=network-online.target 4 | After=network-online.target 5 | 6 | # If cloud-seed fails, try again every 5 seconds for 30 seconds. If it still 7 | # fails, reboot the system. If your use of cloud-seed is not critical to system 8 | # operation, you may consider changing the FailureAction setting. 9 | StartLimitBurst=6 10 | StartLimitIntervalSec=5 11 | FailureAction=reboot 12 | 13 | [Service] 14 | Type=oneshot 15 | RemainAfterExit=true 16 | Restart=on-failure 17 | 18 | ExecStart=/usr/bin/cloud-seed 19 | Environment=RUST_LOG=debug 20 | StandardOutput=journal+console 21 | 22 | # You can set a more restrictive umask here to restrict the permissions that 23 | # cloud-seed can create files with. 24 | UMask=0000 25 | 26 | # cloud-seed can run as a non-root user. In this case, files can only be 27 | # written at paths that this user has permission to write to. 28 | # User= 29 | 30 | [Install] 31 | WantedBy=multi-user.target 32 | -------------------------------------------------------------------------------- /src/execute.rs: -------------------------------------------------------------------------------- 1 | use anyhow::Context; 2 | use async_compression::tokio::write::GzipDecoder; 3 | use base64::{engine::general_purpose::STANDARD as b64, Engine}; 4 | use futures_util::stream::{self, StreamExt as _}; 5 | use nix::unistd::{chown, Group, User}; 6 | use tokio::{fs, io::AsyncWriteExt as _}; 7 | use tracing::error; 8 | 9 | use crate::schema::{Encoding, UserData}; 10 | 11 | #[tracing::instrument(level = "debug")] 12 | pub async fn execute_user_data(user_data: UserData<'_>) { 13 | if let Some(hostname) = user_data.hostname { 14 | if let Err(e) = hostname::set(&*hostname) { 15 | error!("Failed to set hostname: {:?}", e); 16 | } 17 | } 18 | 19 | stream::iter(user_data.files) 20 | .for_each_concurrent(None, |file| async move { 21 | let path = file.path.as_ref(); 22 | let write_file = async move { 23 | if let Some(parent) = path.parent() { 24 | fs::create_dir_all(parent).await?; 25 | } 26 | 27 | let mut writer = fs::OpenOptions::new() 28 | .create(true) 29 | .truncate(!file.append) 30 | .append(file.append) 31 | .mode(u32::from_str_radix(&file.permissions, 8)?) 32 | .write(true) 33 | .read(false) 34 | .open(&path) 35 | .await?; 36 | 37 | if let Some(owner) = file.owner { 38 | if let Some((user, group)) = owner.split_once(':') { 39 | let user = User::from_name(user)?.context("no such user")?; 40 | let group = Group::from_name(group)?.context("no such group")?; 41 | chown(path, Some(user.uid), Some(group.gid))?; 42 | } 43 | } 44 | 45 | match file.encoding { 46 | Encoding::Plain => writer.write_all(file.content.as_bytes()).await?, 47 | Encoding::Base64 => { 48 | let decoded = b64.decode(file.content.as_ref())?; 49 | writer.write_all(&decoded).await?; 50 | }, 51 | Encoding::Base64Gzip => { 52 | let decoded = b64.decode(file.content.as_ref())?; 53 | let mut decompresser = GzipDecoder::new(writer); 54 | decompresser.write_all(&decoded).await?; 55 | decompresser.flush().await?; 56 | writer = decompresser.into_inner(); 57 | }, 58 | } 59 | 60 | writer.flush().await?; 61 | 62 | Ok::<_, anyhow::Error>(()) 63 | }; 64 | 65 | if let Err(e) = write_file.await { 66 | error!("Failed to write file {:?}: {:?}", path, e); 67 | } 68 | }) 69 | .await; 70 | } 71 | -------------------------------------------------------------------------------- /src/main.rs: -------------------------------------------------------------------------------- 1 | mod execute; 2 | mod schema; 3 | mod source; 4 | 5 | use anyhow::{bail, Result}; 6 | use source::Source; 7 | use tracing::{debug, info}; 8 | 9 | use crate::execute::execute_user_data; 10 | 11 | const SOURCES: &[&dyn Source] = &[ 12 | #[cfg(feature = "source-alibaba")] 13 | &source::alibaba::AlibabaSource, 14 | #[cfg(feature = "source-amazon")] 15 | &source::amazon::AmazonSource, 16 | #[cfg(feature = "source-exoscale")] 17 | &source::exoscale::ExoscaleSource, 18 | #[cfg(feature = "source-google")] 19 | &source::google::GoogleSource, 20 | #[cfg(feature = "source-openstack")] 21 | &source::openstack::OpenstackSource, 22 | #[cfg(feature = "source-oracle")] 23 | &source::oracle::OracleSource, 24 | #[cfg(feature = "source-vultr")] 25 | &source::vultr::VultrSource, 26 | ]; 27 | 28 | const ALLOWED_SHEBANGS: [&str; 2] = [ 29 | "#cloud-seed", 30 | // Compatibility with cloud-init's write_files 31 | "#cloud-config", 32 | ]; 33 | 34 | #[tokio::main] 35 | async fn main() -> Result<()> { 36 | tracing_subscriber::fmt::init(); 37 | 38 | for source in SOURCES { 39 | debug!("Trying {:?}", source); 40 | if let Some(user_data) = source.try_fetch().await? { 41 | info!("Got user data from {:?}", source); 42 | if let Some((shebang, content)) = user_data.split_once('\n') { 43 | if ALLOWED_SHEBANGS.contains(&shebang.trim()) { 44 | let user_data = serde_yaml::from_str(content)?; 45 | info!("Executing user data from {:?}", source); 46 | execute_user_data(user_data).await; 47 | return Ok(()); 48 | } 49 | 50 | bail!("Unhandled shebang in user data"); 51 | } 52 | 53 | bail!("Malformed user data"); 54 | } 55 | } 56 | 57 | bail!("No suitable source found"); 58 | } 59 | -------------------------------------------------------------------------------- /src/schema.rs: -------------------------------------------------------------------------------- 1 | use std::{borrow::Cow, path::Path}; 2 | 3 | use serde::Deserialize; 4 | 5 | #[derive(Deserialize, Debug)] 6 | pub struct UserData<'a> { 7 | #[serde(default, borrow, alias = "fqdn")] 8 | pub hostname: Option>, 9 | #[serde(default, borrow, alias = "write_files")] 10 | pub files: Vec>, 11 | } 12 | 13 | fn default_permissions() -> Cow<'static, str> { 14 | "0644".into() 15 | } 16 | 17 | #[derive(Deserialize, Debug)] 18 | pub struct File<'a> { 19 | #[serde(borrow)] 20 | pub path: Cow<'a, Path>, 21 | #[serde(borrow, default)] 22 | pub content: Cow<'a, str>, 23 | #[serde(borrow, default)] 24 | pub owner: Option>, 25 | #[serde(borrow, default = "default_permissions")] 26 | pub permissions: Cow<'a, str>, 27 | #[serde(default)] 28 | pub encoding: Encoding, 29 | #[serde(default)] 30 | pub append: bool, 31 | } 32 | 33 | #[derive(Deserialize, Debug, Clone, Copy, Default)] 34 | #[serde(rename_all = "lowercase")] 35 | pub enum Encoding { 36 | #[serde(alias = "text/plain")] 37 | #[default] 38 | Plain, 39 | #[serde(alias = "b64")] 40 | Base64, 41 | #[serde(alias = "gz+base64")] 42 | #[serde(alias = "gzip+base64")] 43 | #[serde(alias = "gz+b64")] 44 | #[serde(alias = "gzip+b64")] 45 | Base64Gzip, 46 | } 47 | -------------------------------------------------------------------------------- /src/source.rs: -------------------------------------------------------------------------------- 1 | pub mod helpers; 2 | 3 | #[cfg(feature = "source-alibaba")] 4 | pub mod alibaba; 5 | #[cfg(feature = "source-amazon")] 6 | pub mod amazon; 7 | #[cfg(feature = "source-exoscale")] 8 | pub mod exoscale; 9 | #[cfg(feature = "source-google")] 10 | pub mod google; 11 | #[cfg(feature = "source-openstack")] 12 | pub mod openstack; 13 | #[cfg(feature = "source-oracle")] 14 | pub mod oracle; 15 | #[cfg(feature = "source-vultr")] 16 | pub mod vultr; 17 | 18 | #[async_trait::async_trait] 19 | pub trait Source: std::fmt::Debug { 20 | async fn try_fetch(&self) -> anyhow::Result>; 21 | } 22 | -------------------------------------------------------------------------------- /src/source/alibaba.rs: -------------------------------------------------------------------------------- 1 | use anyhow::Context; 2 | 3 | use crate::source::helpers::{get_dmi_id, http_get}; 4 | 5 | #[derive(Debug, Clone, Copy)] 6 | pub struct AlibabaSource; 7 | 8 | #[async_trait::async_trait] 9 | impl super::Source for AlibabaSource { 10 | async fn try_fetch(&self) -> anyhow::Result> { 11 | if get_dmi_id("product_name").await?.as_deref() != Some("Alibaba Cloud ECS") { 12 | return Ok(None); 13 | } 14 | 15 | Ok(Some( 16 | http_get("http://100.100.100.200/latest/user-data", None) 17 | .await? 18 | .context("no user data")?, 19 | )) 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/source/amazon.rs: -------------------------------------------------------------------------------- 1 | use crate::source::helpers::get_dmi_id; 2 | 3 | #[derive(Debug, Clone, Copy)] 4 | pub struct AmazonSource; 5 | 6 | #[async_trait::async_trait] 7 | impl super::Source for AmazonSource { 8 | async fn try_fetch(&self) -> anyhow::Result> { 9 | if get_dmi_id("bios_vendor").await?.as_deref() != Some("Amazon EC2") { 10 | return Ok(None); 11 | } 12 | 13 | let imds_client = aws_config::imds::Client::builder().build().await?; 14 | let user_data = imds_client.get("/latest/user-data").await?; 15 | Ok(Some(user_data)) 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/source/exoscale.rs: -------------------------------------------------------------------------------- 1 | use anyhow::Context; 2 | 3 | use crate::source::helpers::{get_dmi_id, http_get}; 4 | 5 | #[derive(Debug, Clone, Copy)] 6 | pub struct ExoscaleSource; 7 | 8 | #[async_trait::async_trait] 9 | impl super::Source for ExoscaleSource { 10 | async fn try_fetch(&self) -> anyhow::Result> { 11 | if get_dmi_id("product_name").await?.as_deref() != Some("Exoscale Compute Platform") { 12 | return Ok(None); 13 | } 14 | 15 | Ok(Some( 16 | http_get("http://169.254.169.254/latest/user-data", None) 17 | .await? 18 | .context("no user data")?, 19 | )) 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/source/google.rs: -------------------------------------------------------------------------------- 1 | use std::iter; 2 | 3 | use anyhow::Context; 4 | use base64::{engine::general_purpose::STANDARD as b64, Engine}; 5 | use hyper::header::{HeaderMap, HeaderName, HeaderValue}; 6 | use serde::Deserialize; 7 | 8 | use crate::source::helpers::{get_dmi_id, http_get}; 9 | 10 | #[derive(Debug, Clone, Copy)] 11 | pub struct GoogleSource; 12 | 13 | #[derive(Deserialize, Debug, Clone, Copy, PartialEq)] 14 | #[serde(rename_all = "lowercase")] 15 | enum UserDataEncoding { 16 | Base64, 17 | } 18 | 19 | #[async_trait::async_trait] 20 | impl super::Source for GoogleSource { 21 | async fn try_fetch(&self) -> anyhow::Result> { 22 | if get_dmi_id("product_name").await?.as_deref() != Some("Google Compute Engine") { 23 | return Ok(None); 24 | } 25 | 26 | let headers: HeaderMap = iter::once(( 27 | HeaderName::from_static("metadata-flavor"), 28 | HeaderValue::from_static("Google"), 29 | )) 30 | .collect(); 31 | 32 | let encoding = http_get( 33 | "http://metadata.google.internal/computeMetadata/v1/instance/attributes/user-data-encoding", 34 | Some(headers.clone()), 35 | ) 36 | .await?; 37 | let encoding: Option = encoding 38 | .map(|body| serde_json::from_str(&body)) 39 | .transpose()?; 40 | 41 | let mut user_data = http_get( 42 | "http://metadata.google.internal/computeMetadata/v1/instance/attributes/user-data", 43 | Some(headers), 44 | ) 45 | .await? 46 | .context("no user data")?; 47 | if encoding == Some(UserDataEncoding::Base64) { 48 | user_data = String::from_utf8(b64.decode(&user_data)?)?; 49 | } 50 | Ok(Some(user_data)) 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/source/helpers.rs: -------------------------------------------------------------------------------- 1 | use anyhow::Result; 2 | use tokio::io; 3 | 4 | #[tracing::instrument(level = "debug")] 5 | pub async fn get_dmi_id(key: &str) -> Result> { 6 | match tokio::fs::read_to_string(format!("/sys/devices/virtual/dmi/id/{key}")).await { 7 | Ok(value) => Ok(Some(value.trim().into())), 8 | Err(e) if e.kind() == io::ErrorKind::NotFound => Ok(None), 9 | Err(e) => Err(e.into()), 10 | } 11 | } 12 | 13 | #[cfg(feature = "helper-http")] 14 | #[tracing::instrument(level = "debug")] 15 | pub async fn http_get( 16 | url: &str, 17 | maybe_headers: Option>, 18 | ) -> Result> { 19 | use std::io::{Cursor, Read as _}; 20 | 21 | use anyhow::{anyhow, Context}; 22 | use async_compression::tokio::bufread::GzipDecoder; 23 | use base64::{engine::general_purpose::STANDARD as b64, Engine}; 24 | use flate2::read::GzDecoder; 25 | use futures_util::{ 26 | pin_mut, 27 | stream::{StreamExt, TryStreamExt}, 28 | }; 29 | use hyper::{Client, StatusCode}; 30 | use once_cell::sync::Lazy; 31 | use tokio::io::AsyncReadExt as _; 32 | use tokio_util::io::StreamReader; 33 | 34 | static CLIENT: Lazy> = Lazy::new(Client::new); 35 | 36 | let mut builder = hyper::Request::get(url).header("user-agent", "cloud-seed"); 37 | if let Some(headers) = maybe_headers { 38 | *builder.headers_mut().unwrap() = headers; 39 | } 40 | 41 | let response = CLIENT.request(builder.body(hyper::Body::empty())?).await?; 42 | let status = response.status(); 43 | 44 | if status.is_success() { 45 | let body_chunks_stream = response 46 | .into_body() 47 | .map_err(|e| io::Error::new(io::ErrorKind::Other, e)) 48 | .peekable(); 49 | pin_mut!(body_chunks_stream); 50 | 51 | let first_chunk = body_chunks_stream 52 | .as_mut() 53 | .peek() 54 | .await 55 | .context("early EOF")? 56 | .as_ref() 57 | .map_err(|_| anyhow!("failed to read response"))?; 58 | 59 | #[derive(Clone, Copy)] 60 | enum Format { 61 | Plain, 62 | Gzip, 63 | Base64Gzip, 64 | } 65 | 66 | // Check if the first chunk starts with the gzip magic bytes 67 | let format = match first_chunk[0..3] { 68 | [0x1f, 0x8b, _] => Format::Gzip, 69 | [b'H', b'4', b's'] => Format::Base64Gzip, 70 | _ => Format::Plain, 71 | }; 72 | 73 | let mut body_reader = StreamReader::new(body_chunks_stream); 74 | let mut s = String::new(); 75 | match format { 76 | Format::Gzip => { 77 | let mut decoder = GzipDecoder::new(body_reader); 78 | decoder.read_to_string(&mut s).await?; 79 | }, 80 | Format::Base64Gzip => { 81 | body_reader.read_to_string(&mut s).await?; 82 | // TODO: consider ways to do this without buffering + blocking 83 | let decoded = b64.decode(&s)?; 84 | let mut decoder = GzDecoder::new(Cursor::new(decoded)); 85 | s.clear(); 86 | decoder.read_to_string(&mut s)?; 87 | }, 88 | Format::Plain => { 89 | body_reader.read_to_string(&mut s).await?; 90 | }, 91 | } 92 | Ok(Some(s)) 93 | } 94 | else if status == StatusCode::NOT_FOUND { 95 | Ok(None) 96 | } 97 | else { 98 | Err(anyhow!("HTTP {}", status)) 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /src/source/openstack.rs: -------------------------------------------------------------------------------- 1 | use anyhow::Context; 2 | 3 | use crate::source::helpers::{get_dmi_id, http_get}; 4 | 5 | #[derive(Debug, Clone, Copy)] 6 | pub struct OpenstackSource; 7 | 8 | #[async_trait::async_trait] 9 | impl super::Source for OpenstackSource { 10 | async fn try_fetch(&self) -> anyhow::Result> { 11 | if get_dmi_id("sys_vendor").await?.as_deref() != Some("OpenStack Foundation") { 12 | return Ok(None); 13 | } 14 | 15 | Ok(Some( 16 | http_get("http://169.254.169.254/latest/user-data", None) 17 | .await? 18 | .context("no user data")?, 19 | )) 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/source/oracle.rs: -------------------------------------------------------------------------------- 1 | use std::iter; 2 | 3 | use anyhow::Context; 4 | use hyper::header::{HeaderName, HeaderValue}; 5 | 6 | use crate::source::helpers::{get_dmi_id, http_get}; 7 | 8 | #[derive(Debug, Clone, Copy)] 9 | pub struct OracleSource; 10 | 11 | #[async_trait::async_trait] 12 | impl super::Source for OracleSource { 13 | async fn try_fetch(&self) -> anyhow::Result> { 14 | if get_dmi_id("chassis_asset_tag").await?.as_deref() != Some("OracleCloud.com") { 15 | return Ok(None); 16 | } 17 | 18 | let headers = iter::once(( 19 | HeaderName::from_static("authorization"), 20 | HeaderValue::from_static("Bearer Oracle"), 21 | )) 22 | .collect(); 23 | Ok(Some( 24 | http_get( 25 | "http://169.254.169.254/opc/v2/instance/metadata/user_data", 26 | Some(headers), 27 | ) 28 | .await? 29 | .context("no user data")?, 30 | )) 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/source/vultr.rs: -------------------------------------------------------------------------------- 1 | use std::iter; 2 | 3 | use anyhow::Context; 4 | use hyper::header::{HeaderName, HeaderValue}; 5 | use serde::Deserialize; 6 | 7 | use crate::source::helpers::{get_dmi_id, http_get}; 8 | 9 | #[derive(Debug, Clone, Copy)] 10 | pub struct VultrSource; 11 | 12 | #[derive(Deserialize, Debug)] 13 | #[serde(rename_all = "kebab-case")] 14 | struct Metadata { 15 | user_data: Option, 16 | } 17 | 18 | #[async_trait::async_trait] 19 | impl super::Source for VultrSource { 20 | async fn try_fetch(&self) -> anyhow::Result> { 21 | if get_dmi_id("bios_vendor").await?.as_deref() != Some("Vultr") { 22 | return Ok(None); 23 | } 24 | 25 | let headers = iter::once(( 26 | HeaderName::from_static("metadata-token"), 27 | HeaderValue::from_static("cloudinit"), 28 | )) 29 | .collect(); 30 | let body = http_get("http://169.254.169.254/v1.json", Some(headers)) 31 | .await? 32 | .context("no user data")?; 33 | let metadata: Metadata = serde_json::from_str(&body)?; 34 | Ok(metadata.user_data) 35 | } 36 | } 37 | --------------------------------------------------------------------------------