Skip to content

Commit

Permalink
(MODULES-9695) Debian: use modern APT keyring format
Browse files Browse the repository at this point in the history
This updates puppet_agent::osfamily::debian to use modern APT keyrings
instead of the deprecated apt-key method used by apt::key and
apt::source.key without `name`.

This also removes the legacy key, because keys not used for signing
package sources aren't needed.

/etc/pki is not needed anymore (also this directory is a RedHatism)
because keyrings are now stored in the default location of
/etc/apt/keyrings. We don't clean it up though, in case people are using
the files there for something else.
  • Loading branch information
kenyon committed Nov 21, 2023
1 parent bd68744 commit 5ca6bf2
Showing 1 changed file with 3 additions and 32 deletions.
35 changes: 3 additions & 32 deletions manifests/osfamily/debian.pp
Original file line number Diff line number Diff line change
Expand Up @@ -71,44 +71,15 @@
} else {
$source = $puppet_agent::apt_source
}
$legacy_keyname = 'GPG-KEY-puppet'
$legacy_gpg_path = "/etc/pki/deb-gpg/${legacy_keyname}"
$keyname = 'GPG-KEY-puppet-20250406'
$gpg_path = "/etc/pki/deb-gpg/${keyname}"

if getvar('::puppet_agent::manage_pki_dir') == true {
file { ['/etc/pki', '/etc/pki/deb-gpg']:
ensure => directory,
}
}

file { $legacy_gpg_path:
ensure => file,
owner => 0,
group => 0,
mode => '0644',
source => "puppet:///modules/puppet_agent/${legacy_keyname}",
}

apt::key { 'legacy key':
id => '6F6B15509CF8E59E6E469F327F438280EF8D349F',
source => $legacy_gpg_path,
}

file { $gpg_path:
ensure => file,
owner => 0,
group => 0,
mode => '0644',
source => "puppet:///modules/puppet_agent/${keyname}",
}
$keyname = 'GPG-KEY-puppet-20250406'

apt::source { 'pc_repo':
location => $source,
repos => $puppet_agent::collection,
key => {
'id' => 'D6811ED3ADEEB8441AF5AA8F4528B6CD9E61EF26',
'source' => $gpg_path,
'name' => "${keyname}.asc",
'content' => file("${module_name}/${keyname}"),
},
notify => Exec['pc_repo_force'],
}
Expand Down

0 comments on commit 5ca6bf2

Please sign in to comment.