Debian: How to add an external repository to unattended upgrades

In this post, we’ll be using Rspamd as an example.

ls /var/lib/apt/lists/

look for repository ending with _InRelease

e.g.: rspamd:

cat /var/lib/apt/lists/rspamd.com_apt-stable_dists_stretch_InRelease

result:

[...]
Origin: Rspamd
Label: Rspamd
Codename: stretch
Date: Wed, 13 Dec 2017 21:02:14 UTC
Architectures: amd64 i386
Components: main
Description: Apt repository for rspamd stable builds
[...]

Save “Origin” and “Suite” or “Codename” (you can use both Suite or Codename matching)

In this case: Codename:

Add to:

sudo nano /etc/apt/apt.conf.d/50unattended-upgrades
Unattended-Upgrade::Origins-Pattern {
"o=Rspamd,n=${distro_codename}";

In Debian 10 ‘Buster’ and later versions, in addition to this, the site keyword may also be used.

sudo nano /etc/apt/sources.list
"o=Rspamd,n=${distro_codename},site=rspamd.com";