fix(nodes): restrict Certbot loader to current mounted core revision
Some checks are pending
Docker Build and Publish / build (push) Waiting to run
Some checks are pending
Docker Build and Publish / build (push) Waiting to run
This commit is contained in:
parent
44d1c79bef
commit
6b0ac99d19
@ -1,6 +1,7 @@
|
||||
[Unit]
|
||||
Description=Load existing Certbot AppArmor profiles for DPL certificate operations
|
||||
After=local-fs.target
|
||||
RequiresMountsFor=/snap/core/current /snap/certbot/current /var/lib/snapd/apparmor/profiles
|
||||
Before=snap.certbot.renew.service
|
||||
ConditionPathExists=/var/lib/snapd/apparmor/profiles/snap.certbot.certbot
|
||||
|
||||
|
||||
@ -11,7 +11,10 @@ directory=/var/lib/snapd/apparmor/profiles
|
||||
[[ -z $(find "$directory" -maxdepth 0 -perm /022 -print) ]] || exit 4
|
||||
[[ -f $directory/snap.certbot.certbot && -f $directory/snap.certbot.renew ]] || exit 5
|
||||
shopt -s nullglob
|
||||
profiles=("$directory"/snap.certbot.* "$directory"/snap-update-ns.certbot "$directory"/snap-confine.core.*)
|
||||
core=$(readlink -f /snap/core/current)
|
||||
[[ $core =~ ^/(var/lib/snapd/)?snap/core/([0-9]+)$ ]] || exit 5
|
||||
revision=${BASH_REMATCH[2]}
|
||||
profiles=("$directory"/snap.certbot.* "$directory"/snap-update-ns.certbot "$directory/snap-confine.core.$revision")
|
||||
(( ${#profiles[@]} >= 4 )) || exit 5
|
||||
# Validate every input before loading any profile. Never use complain/disable flags.
|
||||
for profile in "${profiles[@]}"; do
|
||||
|
||||
Loading…
Reference in New Issue
Block a user