Skip to content

Commit

Permalink
debian/cloud-init.postinst: Change output log permissions on upgrade
Browse files Browse the repository at this point in the history
In b794d42 (#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
  • Loading branch information
TheRealFalcon committed Mar 22, 2021
1 parent d30cf1d commit bf2ea5e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
2 changes: 2 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -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
Expand Down
17 changes: 17 additions & 0 deletions debian/cloud-init.postinst
Original file line number Diff line number Diff line change
Expand Up @@ -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="21.1-0ubuntu1"
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
Expand Down Expand Up @@ -358,6 +374,7 @@ EOF

cleanup_ureadahead "$2"
fix_lp1889555 "$2"
change_cloud_init_output_log_permissions "$2"
fi

#DEBHELPER#
Expand Down

0 comments on commit bf2ea5e

Please sign in to comment.