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 11:53:29 -0500
commit399ffcce2d8fc98e32d360e401f0aae12fde38e0 (patch)
tree2df5765e4004b15a0983870c0235122f9d920619
parentd30cf1d4697ac9b3d25b74a1ebc4f8dd53ba07ac (diff)
downloadcloud-init-git-399ffcce2d8fc98e32d360e401f0aae12fde38e0.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 8deffa31..ad1af64d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,6 @@
cloud-init (21.1-19-gbad84ad4-0ubuntu1~20.10.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 bb1535e8..42677b07 100644
--- a/debian/cloud-init.postinst
+++ b/debian/cloud-init.postinst
@@ -327,6 +327,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~20.10.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
if db_get cloud-init/datasources; then
@@ -358,6 +374,7 @@ EOF
cleanup_ureadahead "$2"
fix_lp1889555 "$2"
+ change_cloud_init_output_log_permissions "$2"
fi
#DEBHELPER#