diff --git a/cookbooks/consul/install.rb b/cookbooks/consul/install.rb index 7f0abd1..244dcf2 100644 --- a/cookbooks/consul/install.rb +++ b/cookbooks/consul/install.rb @@ -1,9 +1,9 @@ -# Install `Consul`: -KEYSRV = "https://apt.releases.hashicorp.com/gpg" -ID = "AA16FCBCA621E701" +# apt source: +SRC = 'https://apt.releases.hashicorp.com/gpg' +DEST = '/usr/share/keyrings/hashicorp-archive-keyring.gpg' -execute "apt-key adv --keyserver #{KEYSRV} --recv-keys #{ID}" do - not_if 'apt-key list | grep HashiCorp' +execute "wget -O- #{SRC} | gpg --dearmor -o #{DEST}" do + not_if "test -e #{DEST}" end # Retrieve the Ubuntu code: diff --git a/cookbooks/consul/templates/etc/apt/sources.list.d/hashicorp.list b/cookbooks/consul/templates/etc/apt/sources.list.d/hashicorp.list index 16f9f11..3ed7565 100644 --- a/cookbooks/consul/templates/etc/apt/sources.list.d/hashicorp.list +++ b/cookbooks/consul/templates/etc/apt/sources.list.d/hashicorp.list @@ -1 +1 @@ -deb [arch=amd64] https://apt.releases.hashicorp.com <%= @distribution %> main +deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com <%= @distribution %> main diff --git a/cookbooks/nomad/install.rb b/cookbooks/nomad/install.rb index fbe61ab..86657b1 100644 --- a/cookbooks/nomad/install.rb +++ b/cookbooks/nomad/install.rb @@ -1,9 +1,9 @@ -# Install `Consul`: -KEYSRV = "https://apt.releases.hashicorp.com/gpg" -ID = "AA16FCBCA621E701" +# apt source: +SRC = 'https://apt.releases.hashicorp.com/gpg' +DEST = '/usr/share/keyrings/hashicorp-archive-keyring.gpg' -execute "apt-key adv --keyserver #{KEYSRV} --recv-keys #{ID}" do - not_if 'apt-key list | grep HashiCorp' +execute "wget -O- #{SRC} | gpg --dearmor -o #{DEST}" do + not_if "test -e #{DEST}" end # Retrieve the Ubuntu code: diff --git a/cookbooks/nomad/templates/etc/apt/sources.list.d/hashicorp.list b/cookbooks/nomad/templates/etc/apt/sources.list.d/hashicorp.list index 16f9f11..3ed7565 100644 --- a/cookbooks/nomad/templates/etc/apt/sources.list.d/hashicorp.list +++ b/cookbooks/nomad/templates/etc/apt/sources.list.d/hashicorp.list @@ -1 +1 @@ -deb [arch=amd64] https://apt.releases.hashicorp.com <%= @distribution %> main +deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com <%= @distribution %> main diff --git a/cookbooks/vault/install.rb b/cookbooks/vault/install.rb index b75704e..ec1e3f7 100644 --- a/cookbooks/vault/install.rb +++ b/cookbooks/vault/install.rb @@ -1,9 +1,9 @@ -# Install `Consul`: -KEYSRV = "https://apt.releases.hashicorp.com/gpg" -ID = "AA16FCBCA621E701" +# apt source: +SRC = 'https://apt.releases.hashicorp.com/gpg' +DEST = '/usr/share/keyrings/hashicorp-archive-keyring.gpg' -execute "apt-key adv --keyserver #{KEYSRV} --recv-keys #{ID}" do - not_if 'apt-key list | grep HashiCorp' +execute "wget -O- #{SRC} | gpg --dearmor -o #{DEST}" do + not_if "test -e #{DEST}" end # Retrieve the Ubuntu code: diff --git a/cookbooks/vault/templates/etc/apt/sources.list.d/hashicorp.list b/cookbooks/vault/templates/etc/apt/sources.list.d/hashicorp.list index 16f9f11..3ed7565 100644 --- a/cookbooks/vault/templates/etc/apt/sources.list.d/hashicorp.list +++ b/cookbooks/vault/templates/etc/apt/sources.list.d/hashicorp.list @@ -1 +1 @@ -deb [arch=amd64] https://apt.releases.hashicorp.com <%= @distribution %> main +deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com <%= @distribution %> main