Merge ~paelzer/ubuntu/+source/pollinate:lp-1848923-cache-directory-HIRSUTE into ubuntu/+source/pollinate:ubuntu/hirsute-devel

Proposed by Christian Ehrhardt 
Status: Merged
Approved by: Christian Ehrhardt 
Approved revision: 382860ce7ef8eba67bb3539ca7f664f9c2748770
Merge reported by: Christian Ehrhardt 
Merged at revision: 382860ce7ef8eba67bb3539ca7f664f9c2748770
Proposed branch: ~paelzer/ubuntu/+source/pollinate:lp-1848923-cache-directory-HIRSUTE
Merge into: ubuntu/+source/pollinate:ubuntu/hirsute-devel
Diff against target: 43 lines (+10/-4)
3 files modified
debian/changelog (+8/-0)
debian/pollinate.postinst (+0/-4)
debian/pollinate.service (+2/-0)
Reviewer Review Type Date Requested Status
Robie Basak Approve
Martin Pitt (community) Approve
Canonical Server Team Pending
Ubuntu Server Dev import team Pending
Review via email: mp+397719@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :
Revision history for this message
Martin Pitt (pitti) wrote :

That looks great, thanks Christian! (Yay code → declaration)

review: Approve
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

On upgrade (as before) it does not restart as the path exists already:

  Condition: start condition failed at Tue 2021-02-09 10:49:28 UTC; 3s ago
             └─ ConditionPathExists=!/var/cache/pollinate/seeded was not met

The old pre-existing path is NOT killed/removed which is good.

If someone clears /var/cache on next service start (e.g. reboot) the path it
a) recreated as before (same owner)
b) the service runs again as expected

sudo ls -laF /var/cache/pollinate/; systemctl status pollinate
total 8
drwxr-xr-x 2 pollinate daemon 4096 Feb 9 10:51 ./
drwxr-xr-x 13 root root 4096 Feb 9 10:51 ../
-rw-r--r-- 1 pollinate daemon 0 Feb 9 10:51 seeded
● pollinate.service - Pollinate to seed the pseudo random number generator
     Loaded: loaded (/lib/systemd/system/pollinate.service; enabled; vendor preset: enabled)
     Active: inactive (dead) since Tue 2021-02-09 10:51:28 UTC; 14s ago
       Docs: https://launchpad.net/pollinate
    Process: 595 ExecStart=/usr/bin/pollinate (code=exited, status=0/SUCCESS)
   Main PID: 595 (code=exited, status=0/SUCCESS)

Feb 09 10:51:27 h-pol systemd[1]: Starting Pollinate to seed the pseudo random number generator...
Feb 09 10:51:27 h-pol pollinate[661]: client sent challenge to [https://entropy.ubuntu.com/]
Feb 09 10:51:28 h-pol pollinate[708]: client verified challenge/response with [https://entropy.ubuntu.com/]
Feb 09 10:51:28 h-pol pollinate[717]: client hashed response from [https://entropy.ubuntu.com/]
Feb 09 10:51:28 h-pol pollinate[718]: client successfully seeded [/dev/urandom]
Feb 09 10:51:28 h-pol systemd[1]: pollinate.service: Succeeded.
Feb 09 10:51:28 h-pol systemd[1]: Finished Pollinate to seed the pseudo random number generator.

Yet there is a difference in the permissions
old:
drwxr-x--- 2 pollinate daemon 4096 Feb 5 07:57 ./
new:
drwxr-xr-x 2 pollinate daemon 4096 Feb 9 10:51 ./

This should do the trick:
CacheDirectoryMode=0750

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Indeed that works as intended, the recreated path now is:
  drwxr-x--- 2 pollinate daemon 4096 Feb 9 10:55 ./

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

PPA: is rebuilt and ready for the MP review

Revision history for this message
Robie Basak (racb) wrote :

lgtm. However, note that the CacheDirectory directive doesn't appear available in Xenial (at least I don't see it in http://manpages.ubuntu.com/manpages/xenial/en/man7/systemd.directives.7.html but it is in http://manpages.ubuntu.com/manpages/bionic/en/man7/systemd.directives.7.html). The pollinate has been backported from Focal to Xenial before. A decision needs to be made on whether we want to retain backwards compatibility back to Xenial on the packaging in Hirsute, or suffer more backporting pain instead. If the latter, we need to ensure that this doesn't get missed if the package is backported.

review: Approve
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Indeed, I've given this a try on Xenial and there it does nothing which leads to expose the same issue that was initially reported. We can avoid that someone fail-backports it to Xenial though by just keeping the mkdir in the postinst intact. That has no changed behavior going forward, but will work on backports.

When submitting the same to Debian I'll not include it though, but before that is back in Ubunutu there will be no Xenial support anymore.

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

I've modified the code according to the discussion and submitted it to Debian
=> https://salsa.debian.org/alteholz/pollinate/-/merge_requests/1

For Hirsute this is ready and I'll upload it now:

To ssh://git.launchpad.net/ubuntu/+source/pollinate
 * [new tag] upload/4.33-3ubuntu2 -> upload/4.33-3ubuntu2

Uploading to ubuntu (via ftp to upload.ubuntu.com):
  Uploading pollinate_4.33-3ubuntu2.dsc: done.
  Uploading pollinate_4.33-3ubuntu2.debian.tar.xz: done.
  Uploading pollinate_4.33-3ubuntu2_source.buildinfo: done.
  Uploading pollinate_4.33-3ubuntu2_source.changes: done.
Successfully uploaded packages.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index f2001d3..e5ea48d 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,11 @@
6+pollinate (4.33-3ubuntu2) hirsute; urgency=medium
7+
8+ * d/pollinate.postinst, d/pollinate.service: put cache directory creation
9+ under systemd's control avoiding issues on cleaned /var/cache directories
10+ (LP: #1848923)
11+
12+ -- Christian Ehrhardt <christian.ehrhardt@canonical.com> Tue, 09 Feb 2021 10:57:54 +0100
13+
14 pollinate (4.33-3ubuntu1) focal; urgency=medium
15
16 * Merge with Debian unstable. Remaining changes:
17diff --git a/debian/pollinate.postinst b/debian/pollinate.postinst
18index ceea566..b47325c 100644
19--- a/debian/pollinate.postinst
20+++ b/debian/pollinate.postinst
21@@ -7,9 +7,5 @@ PKG="pollinate"
22 if ! getent passwd $PKG >/dev/null; then
23 adduser --disabled-password --quiet --system --home /var/cache/$PKG --ingroup daemon --shell /bin/false $PKG
24 fi
25-mkdir -p /var/cache/$PKG
26-chown -f $PKG /var/cache/$PKG
27-rm -f /var/cache/$PKG/tag
28-
29
30 #DEBHELPER#
31diff --git a/debian/pollinate.service b/debian/pollinate.service
32index 4883f63..a4c9da9 100644
33--- a/debian/pollinate.service
34+++ b/debian/pollinate.service
35@@ -9,6 +9,8 @@ Documentation=https://launchpad.net/pollinate
36 [Service]
37 User=pollinate
38 ExecStart=/usr/bin/pollinate
39+CacheDirectory=pollinate
40+CacheDirectoryMode=0750
41 Type=oneshot
42
43 [Install]

Subscribers

People subscribed via source and target branches