summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Falcon <therealfalcon@gmail.com>2021-03-19 15:11:28 -0500
committerJames Falcon <therealfalcon@gmail.com>2021-03-22 12:04:04 -0500
commitff46e74d359cc6ddcd1d86badaf08171baa206cb (patch)
tree9537f9e32382912f88af864f09d5a8bfef7ebcc7
parent5149959e28e6f71c291d35575ef67a21cada2c8c (diff)
downloadcloud-init-git-ff46e74d359cc6ddcd1d86badaf08171baa206cb.tar.gz
debian/cloud-init.postinst: Change output log permissions on upgrade
In b794d426 (#847), we changed log permissions on /var/log/cloud-init.log to be owned by root:adm and have 740 permissions by default. This commit performs that same change on upgrade. LP: #1918303
-rw-r--r--debian/changelog2
-rw-r--r--debian/cloud-init.postinst17
2 files changed, 19 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog
index 8f56f528..3a14c22d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,6 @@
cloud-init (21.1-19-gbad84ad4-0ubuntu1~16.04.1) UNRELEASED; urgency=medium
+ * d/cloud-init.postinst: Change output log permissions on upgrade
+ (LP: #1918303)
* d/cloud-init.manpages: include upstream manpages in package (LP: #1908548)
* drop the following cherry-picks now included:
+ cpick-4f62ae8d-Fix-regression-with-handling-of-IMDS-ssh-keys-760
diff --git a/debian/cloud-init.postinst b/debian/cloud-init.postinst
index 9dd506dc..69f53c0c 100644
--- a/debian/cloud-init.postinst
+++ b/debian/cloud-init.postinst
@@ -318,6 +318,22 @@ fix_lp1889555() {
db_set grub-pc/install_devices_empty "false"
}
+change_cloud_init_output_log_permissions() {
+ # As a consequence of LP: #1918303
+ local oldver="$1" last_bad_ver="20.4.1-0ubuntu1~16.04.1"
+ dpkg --compare-versions "$oldver" le-nl "$last_bad_ver" || return 0
+
+ output_file="/var/log/cloud-init-output.log"
+ if [ -f "$output_file" ]; then
+ if getent group adm > /dev/null; then
+ chown root:adm $output_file
+ else
+ chown root $output_file
+ fi
+ chmod 640 $output_file
+ fi
+}
+
if [ "$1" = "configure" ]; then
# disable ureadahead (LP: #499520)
@@ -351,6 +367,7 @@ EOF
fix_azure_upgrade_1611074 "$2"
fix_lp1889555 "$2"
+ change_cloud_init_output_log_permissions "$2"
fi
#DEBHELPER#