esm security updates not reported by apt update-notifier
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
update-notifier (Ubuntu) |
Fix Released
|
Undecided
|
Andreas Hasenack | ||
Trusty |
Fix Released
|
Undecided
|
Andreas Hasenack | ||
Xenial |
Fix Released
|
Undecided
|
Unassigned | ||
Bionic |
Fix Released
|
Undecided
|
Unassigned | ||
Focal |
Triaged
|
Undecided
|
Unassigned |
Bug Description
[Impact]
ESM-related Security pocket packages are not reported being classified as security due to a rename in the backend apt suites from esm-security -> esm-infra-security and esm-apps-security.
[Test Case]
* Launch a trusty/
* Run the script that displays the motd bit about available updates:
sudo /usr/lib/
* The output should be something like this, signaling there are only ESM updates available:
"""
UA Infrastructure Extended Security Maintenance (ESM) is not enabled.
0 updates can be installed immediately.
0 of these updates are security updates.
Enable UA Infrastructure ESM to receive 88 additional security updates.
See https:/
"""
* Obtain an UA token for free at https:/
* Run attach:
sudo ua attach <token-
* Confirm that esm-infra was enabled:
sudo ua status
* Run this command again to display the motd banner output about available updates:
sudo /usr/lib/
* You should get something like this without the fix for this bug:
"""
UA Infrastructure Extended Security Maintenance (ESM) is enabled.
89 updates can be installed immediately.
89 of these updates are provided through UA Infrastructure ESM.
0 of these updates are security updates.
To see these additional updates run: apt list --upgradable
"""
* In the output above, which is without the fix, note how none of the available updates are flagged as security
* With the updated update-notifier package, the security updates count correctly includes the ESM security updates:
"""
UA Infrastructure Extended Security Maintenance (ESM) is enabled.
88 updates can be installed immediately.
88 of these updates are provided through UA Infrastructure ESM.
85 of these updates are security updates.
To see these additional updates run: apt list --upgradable
"""
Test Script:
#!/bin/bash
#
# SRU Verification update-notifier + ubuntu=
# Test procedure:
# - launch container Trusty, Xenial or Bionic
# - Install ubuntu-
# - Attach container to UA subscription (which activates the ESM APT repos
# - run apt_check --human-readable to assert ESM pkg counts ARE NOT reported
# - Upgrade update-notifier to -proposed
# - re-run apt_check --human-readable to assert ESM pkg counts ARE reported
set -e
UA_TOKEN=$1
if [ -z "$1" ]; then
echo "Usage: $0 <contractTOKEN>"
exit 1
fi
cat > test-un.yaml <<EOF
#cloud-config
ssh_import_id: [chad.smith]
package_update: true
package_upgrade: true
apt:
sources:
ua.proposed:
source: deb http://
keyid: 6E34E7116C0BC933
EOF
cat > setup_proposed.sh <<EOF
#/bin/bash
mirror=http://
echo deb \$mirror \$(lsb_release -sc)-proposed main | tee /etc/apt/
apt-get update -q
apt-get install -qy update-
EOF
find_substr() {
local needle="$1" haystack="$2"
echo $haystack | grep -q "${needle}" && echo "SUCCESS: found ${needle}" || echo "FAILURE: did not find ${needle}"
}
dont_find_substr() {
local needle="$1" haystack="$2"
echo $haystack | grep -q "${needle}" && echo "FAILURE: found ${needle}" || echo "SUCCESS: did not find ${needle}"
}
wait_for_boot() {
local vm=$1 release=$2
echo "--- Wait for cloud-init to finish"
sleep 5
lxc exec ${vm} -- cloud-init status --wait --long
}
for release in focal; do
echo "--- BEGIN $release update-notifier testing"
vm=test-
echo "--- Launch cloud-init with ppa:ua-
lxc launch ubuntu-
wait_for_boot ${vm} ${release}
echo "--- Attach Ubuntu-Advantage, enabling services"
lxc exec ${vm} -- ua attach ${UA_TOKEN}
case "$release" in
xenial)
bionic)
focal)
groovy)
esac
echo "-- Downgrading package to stable ubuntu release $downrev_pkg"
lxc exec ${vm} -- apt-get install $downrev_pkg --yes -q
lxc exec ${vm} -- dpkg-query --show update-notifier
if [ "$release" = "xenial" ]; then
# Xenial-updates have already included esm package updates.
# Drop the xenial-updates apt source so we can be sure we are seeing only
# available esm updates
lxc exec ${vm} -- sed -e "/xenial-updates/ s/^#*/#/" -i /etc/apt/
lxc exec ${vm} -- sed -e "/xenial-security/ s/^#*/#/" -i /etc/apt/
lxc exec ${vm} -- apt-get update
fi
MOTD=`lxc exec ${vm} -- /usr/lib/
echo -e ${MOTD}
PRE_UPGRADE_
POST_
find_substr "${PRE_
dont_find_substr "${POST_
find_substr "${UPGRADE_MATCH}" "${MOTD}"
echo "--- Upgrade update-notifier from -proposed"
lxc file push setup_proposed.sh ${vm}/
lxc exec ${vm} -- bash /setup_proposed.sh | grep update-notifier
lxc exec ${vm} -- dpkg-query --show update-notifier
MOTD=`lxc exec ${vm} -- /usr/lib/
echo -e $MOTD
find_substr "${POST_
echo "--- Expect non-zero upgradable packages for MOTD from apt_check AFTER upgrade"
find_substr "1 of these updates is a security update" "${MOTD}"
done
[Regression Potential]
The fix is replacing the old incorrect name (<distro>-security) of the ESM security pocket with the correct one (<distro>
[Other Info]
Instead of fixing the pocket's name, we could have *added* a new pocket with the current correct name, since the server part of ESM responds to both trusty-security and trusyt-
The reasons we didn't do that are:
- only the old bash client (version 10) used the old pocket name, and it's not available for trusty anymore (unless you go to https:/
- there was a concern about potentially counting updates twice, if both trusty-security and trusty-
- the upgrade from the bash client (v10) to the current client DOES NOT change the pocket name in the sources.list snippet for ESM, so in that brief moment after an upgrade and before a reattach, the count would be zero just like in this bug. HOWEVER, it's a known process that after upgrading from the bash client to the current one, the machine has to be attached again. See the last paragraph of the description in https:/
"""
On an upgrade, existing users of trusty esm are expected to run "sudo ua attach [<token>]", although not doing it won't disable their existing ESM access. The new ua tool just won't recognize esm as being active in its "ua status" output until the attach operation is complete. The same applies to livepatch, if it was enabled before.
"""
The process of attaching will rewrite the pocket name in the local sources.list file snippet from trusty-security to trusty-
Finally, this update is for trusty only. Xenial doesn't have ESM yet, and updating update-notifier there would be an useless download for users, with a regression risk for no benefit.
[Original Description]
ESM-related Security pocket packages are not reported being classified as security due to a rename in the backend apt suites from esm-security -> esm-infra-security and esm-apps-security.
The customer issue reported catches the symptom well:
"""
I believe there's a problem with "apt_check.py" in the "update-
mrussell@deputy:~$ /usr/lib/
UA Infrastructure Extended Security Maintenance (ESM) is enabled.
8 updates can be installed immediately.
8 of these updates are provided through UA Infrastructure ESM.
0 of these updates are security updates.
To see these additional updates run: apt list --upgradable
Note, these are the packages:
mrussell@deputy:~$ apt list --upgradable
Listing... Done
apt/trusty-
from: 1.0.1ubuntu2.24]
apt-transport-
apt-utils/
libapt-
libapt-
libjson-
libjson0/
If I change "isSecurityUpgr
value in "security_pockets": ("UbuntuESM", "%s-infra-security" % DISTRO),
then, the output is correct:
mrussell@deputy:~$ /usr/lib/
UA Infrastructure Extended Security Maintenance (ESM) is enabled.
8 updates can be installed immediately.
8 of these updates are provided through UA Infrastructure ESM.
8 of these updates are security updates.
To see these additional updates run: apt list --upgradable
"""
Related branches
- git-ubuntu import: Pending requested
-
Diff: 29251 lines (+12561/-0) (has conflicts)173 files modified.bzr-builddeb/default.conf (+5/-0)
.bzrignore (+31/-0)
autogen.sh (+17/-0)
config.h.in (+3/-0)
configure.ac (+11/-0)
data/Makefile.am (+11/-0)
data/apt_check.py (+46/-0)
data/backend_helper.py (+6/-0)
data/com.ubuntu.update-notifier.gschema.xml.in (+4/-0)
data/notify-reboot-required (+3/-0)
data/package-data-downloader (+6/-0)
data/update-motd-fsck-at-reboot (+7/-0)
data/update-motd-hwe-eol (+14/-0)
data/update-motd-updates-available (+3/-0)
debian/90-updates-available (+3/-0)
debian/95-hwe-eol (+3/-0)
debian/changelog (+128/-0)
debian/compat (+4/-0)
debian/control (+28/-0)
debian/rules (+7/-0)
debian/systemd/unicast-local-avahi.override (+1/-0)
debian/systemd/unicast-local-avahi.path (+6/-0)
debian/systemd/unicast-local-avahi.service (+6/-0)
debian/systemd/update-notifier-crash.path (+3/-0)
debian/systemd/update-notifier-crash.service (+6/-0)
debian/tests/control (+4/-0)
debian/unicast-local-avahi.conf (+14/-0)
debian/update-notifier-common.cron.daily (+8/-0)
debian/update-notifier-common.cron.weekly (+15/-0)
debian/update-notifier-common.install (+6/-0)
debian/update-notifier-common.postinst (+7/-0)
debian/update-notifier-common.postrm (+8/-0)
debian/update-notifier-common.preinst (+8/-0)
debian/update-notifier-common.triggers (+4/-0)
debian/update-notifier-crash (+3/-0)
debian/update-notifier.install (+21/-0)
debian/update-notifier.links (+4/-0)
pixmaps/scalable/livepatch-on.svg (+1/-0)
pixmaps/scalable/livepatch-warning.svg (+1/-0)
po/POTFILES.in (+10/-0)
po/ace.po (+93/-0)
po/af.po (+103/-0)
po/am.po (+97/-0)
po/an.po (+100/-0)
po/ar.po (+106/-0)
po/ast.po (+102/-0)
po/az.po (+96/-0)
po/be.po (+103/-0)
po/bem.po (+93/-0)
po/bg.po (+102/-0)
po/bn.po (+102/-0)
po/bo.po (+93/-0)
po/br.po (+102/-0)
po/bs.po (+103/-0)
po/ca.po (+103/-0)
po/ca@valencia.po (+103/-0)
po/ckb.po (+96/-0)
po/crh.po (+103/-0)
po/cs.po (+103/-0)
po/csb.po (+104/-0)
po/cv.po (+93/-0)
po/cy.po (+105/-0)
po/da.po (+103/-0)
po/de.po (+103/-0)
po/de_DE.po (+93/-0)
po/dv.po (+93/-0)
po/el.po (+102/-0)
po/en.po (+93/-0)
po/en_AU.po (+103/-0)
po/en_CA.po (+103/-0)
po/en_GB.po (+103/-0)
po/eo.po (+102/-0)
po/es.po (+102/-0)
po/et.po (+102/-0)
po/eu.po (+103/-0)
po/fa.po (+101/-0)
po/fa_AF.po (+93/-0)
po/fi.po (+103/-0)
po/fil.po (+97/-0)
po/fo.po (+102/-0)
po/fr.po (+103/-0)
po/fr_CA.po (+93/-0)
po/fur.po (+98/-0)
po/fy.po (+102/-0)
po/ga.po (+98/-0)
po/gd.po (+105/-0)
po/gl.po (+103/-0)
po/gu.po (+97/-0)
po/he.po (+102/-0)
po/hi.po (+102/-0)
po/hr.po (+104/-0)
po/hu.po (+103/-0)
po/hy.po (+93/-0)
po/id.po (+102/-0)
po/is.po (+102/-0)
po/it.po (+103/-0)
po/ja.po (+101/-0)
po/jv.po (+93/-0)
po/ka.po (+101/-0)
po/kk.po (+101/-0)
po/km.po (+101/-0)
po/kn.po (+93/-0)
po/ko.po (+101/-0)
po/ku.po (+100/-0)
po/ky.po (+93/-0)
po/lo.po (+93/-0)
po/lt.po (+103/-0)
po/lv.po (+103/-0)
po/mhr.po (+93/-0)
po/mi.po (+93/-0)
po/mk.po (+99/-0)
po/ml.po (+97/-0)
po/mn.po (+102/-0)
po/mr.po (+97/-0)
po/ms.po (+103/-0)
po/mt.po (+93/-0)
po/my.po (+96/-0)
po/nb.po (+103/-0)
po/nds.po (+102/-0)
po/ne.po (+97/-0)
po/nl.po (+103/-0)
po/nn.po (+103/-0)
po/oc.po (+103/-0)
po/pa.po (+100/-0)
po/pl.po (+104/-0)
po/ps.po (+93/-0)
po/pt.po (+103/-0)
po/pt_BR.po (+103/-0)
po/pt_PT.po (+93/-0)
po/qu.po (+93/-0)
po/ro.po (+104/-0)
po/ru.po (+103/-0)
po/sco.po (+93/-0)
po/sd.po (+93/-0)
po/se.po (+93/-0)
po/shn.po (+93/-0)
po/si.po (+100/-0)
po/sk.po (+103/-0)
po/sl.po (+105/-0)
po/sq.po (+103/-0)
po/sr.po (+103/-0)
po/st.po (+93/-0)
po/sv.po (+103/-0)
po/ta.po (+97/-0)
po/te.po (+102/-0)
po/tg.po (+103/-0)
po/th.po (+101/-0)
po/tl.po (+99/-0)
po/tr.po (+102/-0)
po/ug.po (+101/-0)
po/uk.po (+103/-0)
po/ur.po (+93/-0)
po/uz.po (+99/-0)
po/vi.po (+101/-0)
po/xh.po (+93/-0)
po/zh_CN.po (+101/-0)
po/zh_HK.po (+101/-0)
po/zh_TW.po (+101/-0)
src/Makefile.am (+23/-0)
src/avahi.c (+47/-0)
src/avahi.h (+3/-0)
src/crash.c (+13/-0)
src/hooks.c (+6/-0)
src/livepatch-tray.c (+16/-0)
src/livepatch-utils.c (+4/-0)
src/livepatch-utils.h (+9/-0)
src/system-crash.c (+8/-0)
src/update-notifier.c (+43/-0)
src/update-notifier.h (+16/-0)
src/update.c (+8/-0)
tests/pyflakes.exclude (+4/-0)
tests/test_motd.py (+88/-0)
tests/test_pep8.py (+39/-0)
- Brian Murray: Pending requested
-
Diff: 729 lines (+204/-182) (has conflicts)8 files modifiedINSTALL (+159/-161)
config.h.in (+8/-0)
data/apt_check.py (+11/-10)
data/hooks.py (+1/-1)
data/package-data-downloader (+2/-2)
debian/changelog (+15/-0)
tests/test_package-data-downloader.py (+7/-7)
tests/test_pep8.py (+1/-1)
- Brian Murray (community): Approve
-
Diff: 69 lines (+18/-4)2 files modifieddata/apt_check.py (+7/-4)
debian/changelog (+11/-0)
- Brian Murray (community): Approve
-
Diff: 414 lines (+296/-10)4 files modifieddata/apt_check.py (+116/-5)
debian/changelog (+20/-0)
tests/test_motd.py (+151/-0)
tests/test_pep8.py (+9/-5)
- Brian Murray (community): Approve
-
Diff: 428 lines (+326/-5)4 files modifieddata/apt_check.py (+116/-5)
debian/changelog (+20/-0)
tests/test_motd.py (+151/-0)
tests/test_pep8.py (+39/-0)
- Bryce Harrington (community): Approve
- Canonical Server packageset reviewers: Pending requested
-
Diff: 28 lines (+8/-1)2 files modifieddata/apt_check.py (+1/-1)
debian/changelog (+7/-0)
- Bryce Harrington (community): Approve
- Canonical Server Core Reviewers: Pending requested
-
Diff: 69 lines (+18/-4)2 files modifieddata/apt_check.py (+7/-4)
debian/changelog (+11/-0)
information type: | Public → Private Security |
information type: | Private Security → Public Security |
tags: | added: patch |
Changed in update-notifier (Ubuntu): | |
assignee: | nobody → Andreas Hasenack (ahasenack) |
status: | Confirmed → In Progress |
description: | updated |
description: | updated |
Changed in update-notifier (Ubuntu Trusty): | |
status: | New → In Progress |
assignee: | nobody → Andreas Hasenack (ahasenack) |
description: | updated |
description: | updated |
description: | updated |
tags: |
added: verification-failed verification-failed-bionic verification-failed-focal verification-failed-xenial removed: verification-done-focal verification-needed verification-needed-bionic verification-needed-xenial |
Patch suggestion to ensure both ESM Apps and ESM Infra security pockets are properly classified as security type updates
ESM infra pocket: esm-infra-security
ESM apps pocket: esm-apps-security