Skip to content

Clear the expiry Debian 13 sets on the clamav account - #110

Merged
AndrewSav merged 1 commit into
mailserver2:masterfrom
AndrewSav:fix-clamav-account-expiry
Dec 1, 2026
Merged

AndrewSav merged 1 commit into
mailserver2:masterfrom
AndrewSav:fix-clamav-account-expiry

Conversation

@AndrewSav

@AndrewSav AndrewSav commented Nov 29, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Note

TLDR: clamav 1.4.6 that the image gets from apt sets clamav as expired. This breaks signature updates. This PR unsets it and adds a test for this.

  • What is the current behavior (you can also link to an open issue here) ?

    Debian 13 now ships clamav-base 1.4.6+dfsg-1~deb13u1 as a stable update. It creates its user from /usr/lib/sysusers.d/clamav-base.conf:

    u! clamav - - /var/lib/clamav /bin/false
    

    The u! makes it a locked account, and it also sets the shadow file's account-expiry field to 1, which means 1970-01-02:

    Image clamav-base /etc/shadow line chage -l clamav: Account expires
    1.2.2 1.4.3+dfsg-1 clamav:!:20773:::::: never
    built from master today 1.4.6+dfsg-1~deb13u1 clamav:!*:20786:::::1: Jan 02, 1970

    The image runs the clamav-unofficial-sigs update as clamav in two places:

    • Startup: services/_parent/run uses s6-setuidgid clamav. That doesn't go through PAM, so it still works.

    • Hourly: the cron entry from clamav-unofficial-sigs.sh --install-cron. cron checks the account through PAM (/etc/pam.d/cron includes common-account, which uses pam_unix), and pam_unix refuses an expired account. I checked this in a container from the image with the expiry set and a cron job for clamav that runs every minute. The job did not run, and the log shows:

      CRON[69]: pam_unix(cron:account): account clamav has expired (account expired)
      CRON[69]: Authentication failure
      

      After clearing the expiry, the job ran the next minute: CRON[175]: (clamav) CMD (touch /tmp/ran).

    So an image built now gets the clamav-unofficial-sigs signatures once at startup and never updates them until the container restarts. ClamAV's own signatures are not affected: freshclam and clamd run as services, not through cron.

    The test suite catches this indirectly. Its clamav-unofficial-sigs tests use su -s /bin/sh clamav, so 8 tests in the default suite (109–113, 137–139) fail on any fresh build with Your account has expired; please contact your system administrator. / su: Authentication failure, whatever the branch.

  • What is the new behavior (if this is a feature change) ?

    The Dockerfile runs usermod -e '' clamav right after installing the packages, which clears the expiry. The password stays locked (!*), so nobody can log in as clamav. Root can still switch to it with su, and cron can still run jobs as it, as on 1.2.2. The rebuilt image's line is clamav:!*:20786::::::.

    A new test in the default suite checks that chage -l clamav shows Account expires: never, so a future package that does the same thing fails with the cause in the test name, not only as su errors in other tests.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Test (adding missing tests or correcting existing ones)

Status

  • Ready

Todo List

  • Implementation
  • Tests

How has this been tested ?

  • Default suite, on a fresh build of this branch (master 1f66fe0 + this commit): 140/140, including the 8 clamav-unofficial-sigs tests that fail on a fresh build of master, and the new expiry test.
  • A fresh build without this change (on another branch from master, with no changes to the Dockerfile): the default suite is 131/139. The 8 failures are the tests listed above.
  • cron, by hand, in a container from this branch's image: with usermod -e 1 clamav a once-a-minute clamav job was refused as shown above. With usermod -e '' clamav it ran at the next minute.

clamav-base 1.4.6+dfsg-1~deb13u1 creates its user from sysusers.d as a
locked system account ("u!"), which also sets it to expire on
1970-01-02. Images built since then have an expired clamav account, and
su to it fails with "Your account has expired". cron checks the account
through the same PAM account stack, so the hourly clamav-unofficial-sigs
update is refused as well. The startup update is not affected, since it
drops to clamav with s6-setuidgid.

Clear the expiry after the packages are installed. The password stays
locked. A new test checks that the account does not expire.
@AndrewSav
AndrewSav merged commit 23a7bc2 into mailserver2:master Dec 1, 2026
9 checks passed
@AndrewSav
AndrewSav deleted the fix-clamav-account-expiry branch December 1, 2026 00:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants