Update kvmd-certbot: fix cp -a to catch dotfiles (#127)

Second pull request for this bug. Apparently, in bash `cp -a <dir>/*` ignores dotfiles, which are often how authfiles get named, notably as per the documentation for SSL cert management for certbot plugins in the PiKVM Wiki. Using `cp -a <dir>/.` instead should catch dotfiles and all files and subdirectories correctly.
This commit is contained in:
vipergts450 2023-04-13 16:12:32 -04:00 committed by GitHub
parent 99e4615d38
commit 5863004441
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -108,7 +108,7 @@ case "$1" in
renew) renew)
shift shift
create_tmp create_tmp
cp -a "$cur"/* "$tmp" cp -a "$cur"/. "$tmp"
chown -R "$user:" "$tmp" chown -R "$user:" "$tmp"
sed -s -i -e "s| = $cur/| = $tmp/|g" "$tmp/config/renewal/"* sed -s -i -e "s| = $cur/| = $tmp/|g" "$tmp/config/renewal/"*
sudo --preserve-env -u "$user" certbot renew "$@" \ sudo --preserve-env -u "$user" certbot renew "$@" \
@ -120,7 +120,7 @@ case "$1" in
sudo --preserve-env -u "$user" kvmd-pstrun -- bash -c " sudo --preserve-env -u "$user" kvmd-pstrun -- bash -c "
set -ex set -ex
rm -rf '$new' rm -rf '$new'
cp -a '$tmp' '$new' cp -a '$tmp'/. '$new'
rm '$new/updated' rm '$new/updated'
chmod 755 '$new/config/'{archive,live} chmod 755 '$new/config/'{archive,live}
chmod 640 '$new'/config/archive/*/privkey*.pem chmod 640 '$new'/config/archive/*/privkey*.pem