A library for writing host-specific, single-binary configuration management and deployment tools
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
1021 B

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
  1. use std::path::{Path, PathBuf};
  2. use command_runner::CommandRunner;
  3. use symbols::acme::AcmeAccountKey;
  4. use symbols::dir::Dir;
  5. use symbols::file::File;
  6. use symbols::list::List;
  7. use symbols::owner::Owner;
  8. use symbols::Symbol;
  9. pub fn new<'a, R: CommandRunner, C: 'a + AsRef<str>, U: 'a + AsRef<str> + Clone, H: AsRef<Path>>(
  10. command_runner: &'a R,
  11. cert: C,
  12. user_name: U,
  13. home: H,
  14. ) -> impl Symbol + 'a {
  15. let path = |rel: &str| [home.as_ref(), rel.as_ref()].iter().collect::<PathBuf>();
  16. let account_key_file = path("account.key");
  17. List::from((
  18. AcmeAccountKey::new(account_key_file.clone(), command_runner),
  19. Owner::new(
  20. account_key_file,
  21. user_name.clone(),
  22. command_runner,
  23. ),
  24. Dir::new(path("challenges")),
  25. Owner::new(
  26. path("challenges"),
  27. user_name.clone(),
  28. command_runner,
  29. ),
  30. Dir::new("/etc/ssl/local_certs"),
  31. Owner::new("/etc/ssl/local_certs", user_name, command_runner),
  32. File::new(path("lets_encrypt_x3_cross_signed.pem"), cert),
  33. ))
  34. }