microsoft / mdatp-xplat

Microsoft Defender for macOS/Linux - config samples, auxiliary tools
MIT License
187 stars 188 forks source link

Avoid using deprecated 'apt-key add' on Debian 12 #114

Open syscrsh opened 10 months ago

syscrsh commented 10 months ago

The official Debian Wiki[1] and the man page for apt-key[2] both mark the addition of signing keys via the apt-key add mechanism as deprecated.

One of the suggested alternatives is to place the key in the /usr/share/keyrings folder. This not only avoids using a deprecated feature, it also fixes a bug that will occur if the script is run as-is on Debian 12.

The bug happens, because the signed-by field in the prod.list file[3] references the signing key as follows

signed-by=/usr/share/keyrings/microsoft-prod.gpg

This location is not where the signing key is found, if it is imported by apt-key add. This causes apt to not find the signing key and thus abort installation.

[1] https://wiki.debian.org/DebianRepository/UseThirdParty [2] https://manpages.debian.org/bookworm/apt/apt-key.8.en.html [3] https://packages.microsoft.com/config/debian/12/prod.list