Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable Ubuntu Pro's ua-timer.timer job; causing OSSEC alerts #6781

Merged
merged 2 commits into from
May 26, 2023

Conversation

legoktm
Copy link
Member

@legoktm legoktm commented Apr 13, 2023

Status

Ready for review

Description of Changes

Ubuntu Pro's "uaclient" expects the Linux kernel package to be versioned in a specific format that we are not currently compliant with. This error message is triggering spurious OSSEC alerts.

While we do plan to fix our kernel versioning scheme, we really don't need this Ubuntu Pro stuff, so let's disable it the same way we do with fwupd.

Fixes #6773.

Testing

  • Manually run sudo systemctl disable ua-timer.timer && sudo systemctl mask esm-cache
  • Manually reboot your server or wait for the nightly reboot
  • Wait another 24h, observe that you get no OSSEC notifications related to failed to process /proc/version_signature

Note that I did not include the extensive testing plan regarding packages that #6401 had as I think we can trust that the postinst and bash conditional logic is correct since it's the same, just that disabling the timer produces the effect we want.

Deployment

Any special considerations for deployment? Not really.

Checklist

  • Configuration tests pass
  • I have written a test plan and validated it for this PR
  • These changes do not require documentation

@legoktm legoktm added this to the 2.6.0 milestone Apr 13, 2023
@legoktm legoktm requested a review from a team as a code owner April 13, 2023 21:07
@cfm
Copy link
Member

cfm commented Apr 24, 2023

I've begun this test plan, and I'll update this report tomorrow:

  • Manually run sudo systemctl disable ua-timer.timer
amnesia@amnesia:~$ ssh app sudo systemctl disable ua-timer.timer
Removed /etc/systemd/system/timers.target.wants/ua-timer.timer.
amnesia@amnesia:~$ ssh mon sudo systemctl disable ua-timer.timer
Removed /etc/systemd/system/timers.target.wants/ua-timer.timer.
  • Manually reboot your server or wait for the nightly reboot
  • Wait another 24h, observe that you get no OSSEC notifications related to failed to process /proc/version_signature

Note that I did not include the extensive testing plan regarding packages that #6401 had as I think we can trust that the postinst and bash conditional logic is correct since it's the same, just that disabling the timer produces the effect we want.

No concerns from me. If in release QA the postinst doesn't execute this command, or doing so doesn't have the intended result, then that's a bigger problem than just this command!

@cfm cfm self-assigned this Apr 24, 2023
@legoktm
Copy link
Member Author

legoktm commented Apr 24, 2023

I'm still getting the OSSEC alerts, despite the ua-timer job being stopped... :(

via syslog:

Apr 24 02:04:06 app systemd[1]: Starting Daily apt download activities...
Apr 24 02:04:06 app systemd[1]: Starting Update APT News...
Apr 24 02:04:06 app systemd[1]: Starting Update the local ESM caches...
Apr 24 02:04:06 app python3[268123]: failed to process /proc/version_signature.
Apr 24 02:04:06 app python3[268123]: Failed to parse kernel: 5.15.89-grsec-securedrop

So it's one of those...

root@app:/var/log# systemctl cat esm-cache
# /lib/systemd/system/esm-cache.service
# The ESM apt cache will maintain information about what ESM updates are
# available to a system. This information will be presented to users in the apt
# output, or when running pro security-status. These caches are maintained
# entirely outside the system apt configuration to avoid interference with user
# definitions. This service updates those caches. This will only have effect
# on releases where ESM is applicable, starting from Xenial: esm-apps for
# every LTS, and esm-infra for systems in expanded support period after the LTS
# expires.

[Unit]
Description=Update the local ESM caches

[Service]
Type=oneshot
ExecStart=/usr/bin/python3 /usr/lib/ubuntu-advantage/esm_cache.py

Probably that? Though I can't actually figure out what's starting it.

@legoktm
Copy link
Member Author

legoktm commented Apr 24, 2023

Via https://askubuntu.com/questions/1452519/what-are-the-services-apt-news-and-esm-cache-and-how-do-i-disable-them

root@app:/lib/systemd# cat /etc/apt/apt.conf.d/20apt-esm-hook.conf
APT::Update::Pre-Invoke {
        "[ ! -e /run/systemd/system ] || [ $(id -u) -ne 0 ] || systemctl start --no-block apt-news.service esm-cache.service || true";
};

binary::apt::AptCli::Hooks::Upgrade {
        "[ ! -f /usr/lib/ubuntu-advantage/apt-esm-json-hook ] || /usr/lib/ubuntu-advantage/apt-esm-json-hook || true";
};

So we either need to override the hook or mask the units. Sigh.

@airblag
Copy link

airblag commented Apr 25, 2023

Same here. I disabled/masked the ua-timer.timer/ua-timer.service but the osssec error continued.
I just ran manually systemctl start esm-cache and got the ossec mail directly.
I now disabled/mask the esm-cache server on both, I hope it will remove the daily errors

@legoktm
Copy link
Member Author

legoktm commented May 5, 2023

Thanks @airblag - I've updated the PR to also mask esm-cache and applied it to my instance, let's see how it goes...

@cfm cfm self-requested a review May 9, 2023 17:41
@cfm
Copy link
Member

cfm commented May 9, 2023

@legoktm, I've marked this as back in progress until it's ready to review again. :-)

@legoktm
Copy link
Member Author

legoktm commented May 9, 2023

*checks OSSEC notifications*

Looks working as intended to me, my app server hasn't had an alert since I masked esm-cache on Friday, while mon, which doesn't have any of the changes from this PR, is still emitting alerts.

So ready for review @cfm :)

Copy link
Member

@cfm cfm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test plan checks out!

  • Manually run sudo systemctl disable ua-timer.timer && sudo systemctl mask esm-cache
  • Manually reboot your server or wait for the nightly reboot
  • Wait another 24h, observe that you get no OSSEC notifications related to failed to process /proc/version_signature

I have one question (inline) before I approve.

securedrop/debian/securedrop-config.postinst Show resolved Hide resolved
legoktm added 2 commits May 25, 2023 16:10
…lerts

Ubuntu Pro's "uaclient" expects the Linux kernel package to be versioned
in a specific format that we are not currently compliant with. This
error message is triggering spurious OSSEC alerts.

While we do plan to fix our kernel versioning scheme, we really don't need
this Ubuntu Pro stuff, so let's disable it the same way we do with fwupd.

Since ua-timer is started by a timer, simply disabling it is enough.
But for esm-cache, it's invoked by an apt hook, so we need to mask it.

Fixes #6773.
@legoktm
Copy link
Member Author

legoktm commented May 25, 2023

(Rebased to fix static-analysis-and-no-known-cves-1 failure)

Copy link
Member

@cfm cfm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The testinfra check added today confirms yesterday's successful manual testing. Thanks, @legoktm!

@cfm cfm merged commit f3a4e09 into develop May 26, 2023
@legoktm legoktm deleted the mask-ua-timer branch May 26, 2023 03:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Ubuntu Pro CLI tool cannot parse our kernel versions
3 participants