diff options
author | Guilhem Moulin <guilhem@fripost.org> | 2021-02-24 13:19:21 +0100 |
---|---|---|
committer | Guilhem Moulin <guilhem@fripost.org> | 2021-02-24 13:19:21 +0100 |
commit | 539e3a8b8a2baf6746716125e99231da14a153a9 (patch) | |
tree | 7dda1ac83b12c8c3261e5eeabbf5cf5401329326 | |
parent | c96f887e5d8a1625f7dfb76d7f646499aead8eed (diff) |
tests/cert-install: Include tests for failing chown(2).
Due to unknown user/group name.
-rw-r--r-- | Changelog | 2 | ||||
-rw-r--r-- | tests/cert-install | 18 |
2 files changed, 20 insertions, 0 deletions
@@ -9,6 +9,8 @@ lacme (0.8.1) upstream; messages. - tests/drop-privileges: ensure failure to drop privileges yields an error instead of retaining root priviliges. + - tests/cert-install: include tests for failing chown(2) due to unknown + user/group name. -- Guilhem Moulin <guilhem@fripost.org> Mon, 22 Feb 2021 12:04:28 +0100 diff --git a/tests/cert-install b/tests/cert-install index afc86c3..39110f4 100644 --- a/tests/cert-install +++ b/tests/cert-install @@ -120,6 +120,15 @@ st="$(stat -c "%U:%G %#a" /etc/lacme/test4.pem)" st="$(stat -c "%U:%G %#a" /etc/lacme/test4.crt)" [ "$st" = "nobody:root 0644" ] +rm -f /etc/lacme/test4.pem /etc/lacme/test4.crt +sed -ri "s/^chown\\s*=.*/chown = nonexistent-user/" /etc/lacme/lacme-certs.conf.d/test4.conf +! lacme newOrder test4 2>"$STDERR" || fail newOrder test4 +grepstderr -Fxq "getpwnam(nonexistent-user)" +st="$(stat -c "%U:%G %#a" /etc/lacme/test4.pem)" +[ "$st" = "root:root 0644" ] +st="$(stat -c "%U:%G %#a" /etc/lacme/test4.crt)" +[ "$st" = "root:root 0644" ] + # chown user:group openssl genpkey -algorithm RSA -out /etc/lacme/test5.key cat >"/etc/lacme/lacme-certs.conf.d/test5.conf" <<- EOF @@ -137,6 +146,15 @@ st="$(stat -c "%U:%G %#a" /etc/lacme/test5.pem)" st="$(stat -c "%U:%G %#a" /etc/lacme/test5.crt)" [ "$st" = "nobody:nogroup 0644" ] +rm -f /etc/lacme/test5.pem /etc/lacme/test5.crt +sed -ri "s/^chown\\s*=.*/chown = nobody:nonexistent-group/" /etc/lacme/lacme-certs.conf.d/test5.conf +! lacme newOrder test5 2>"$STDERR" || fail newOrder test5 +grepstderr -Fxq "getgrnam(nonexistent-group)" +st="$(stat -c "%U:%G %#a" /etc/lacme/test5.pem)" +[ "$st" = "root:root 0644" ] +st="$(stat -c "%U:%G %#a" /etc/lacme/test5.crt)" +[ "$st" = "root:root 0644" ] + # chmod openssl genpkey -algorithm RSA -out /etc/lacme/test6.key cat >"/etc/lacme/lacme-certs.conf.d/test6.conf" <<- EOF |