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.

28 lines
971 B

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(account_key_file, user_name.clone(), command_runner),
  20. Dir::new(path("challenges")),
  21. Owner::new(path("challenges"), user_name.clone(), command_runner),
  22. Dir::new("/etc/ssl/local_certs"),
  23. Owner::new("/etc/ssl/local_certs", user_name, command_runner),
  24. File::new(path("lets_encrypt_x3_cross_signed.pem"), cert),
  25. ))
  26. }