Browse Source

Add support for user and groups names

pull/31/head
Rodolphe Breard 5 years ago
parent
commit
da12bf93ba
  1. 6
      CHANGELOG.md
  2. 6
      CONTRIBUTING.md
  3. 8
      acmed/src/storage.rs

6
CHANGELOG.md

@ -13,6 +13,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
### Added
- System users and groups can now be specified by name in addition to uid/gid.
## [0.8.0] - 2020-06-12 ## [0.8.0] - 2020-06-12
### Changed ### Changed

6
CONTRIBUTING.md

@ -13,12 +13,6 @@ Since the author is not a native English speaker, some of the texts used in this
## Fix issues in dependencies ## Fix issues in dependencies
### nix
The [nix](https://crates.io/crates/nix) crate does not currently allow to retrieve an UID or GID from a user or group name, which prevents ACMEd to do so. A pull request has been made to `nix` in early 2018 but has not been merged yet.
- https://github.com/nix-rust/nix/pull/864
### rust-openssl ### rust-openssl
The [openssl](https://crates.io/crates/openssl) crate does not expose the Asn1Time in a usable way, which requires ACMEd to parse certificates using an external library in order to get the `not after` field. This is sub-optimal. The [openssl](https://crates.io/crates/openssl) crate does not expose the Asn1Time in a usable way, which requires ACMEd to parse certificates using an external library in order to get the `not after` field. This is sub-optimal.

8
acmed/src/storage.rs

@ -97,8 +97,8 @@ fn set_owner(cert: &Certificate, path: &PathBuf, file_type: FileType) -> Result<
let nix_uid = nix::unistd::Uid::from_raw(raw_uid); let nix_uid = nix::unistd::Uid::from_raw(raw_uid);
Some(nix_uid) Some(nix_uid)
} else { } else {
// TODO: handle username
None
let user = nix::unistd::User::from_name(&u)?;
user.map(|u| u.uid)
} }
} }
None => None, None => None,
@ -110,8 +110,8 @@ fn set_owner(cert: &Certificate, path: &PathBuf, file_type: FileType) -> Result<
let nix_gid = nix::unistd::Gid::from_raw(raw_gid); let nix_gid = nix::unistd::Gid::from_raw(raw_gid);
Some(nix_gid) Some(nix_gid)
} else { } else {
// TODO: handle group name
None
let grp = nix::unistd::Group::from_name(&g)?;
grp.map(|g| g.gid)
} }
} }
None => None, None => None,

Loading…
Cancel
Save