From e2a3410f471cd1426fd84160ea74e952fb7ece91 Mon Sep 17 00:00:00 2001 From: Geoff Wilson Date: Mon, 30 Sep 2024 14:48:35 -0400 Subject: [PATCH] fix lints --- app/lib/clients/vault/certificate.rb | 12 ++++++------ test/lib/clients/vault_test.rb | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/lib/clients/vault/certificate.rb b/app/lib/clients/vault/certificate.rb index d02219b..d5aa153 100644 --- a/app/lib/clients/vault/certificate.rb +++ b/app/lib/clients/vault/certificate.rb @@ -59,9 +59,9 @@ def configure_root_ca root_cert = client.logical.write("#{root_ca_mount}/root/generate/internal", common_name: "astral.internal", issuer_name: root_ca_ref, - ttl: "87600h").data[:certificate] + ttl: "87600h").data # save the root certificate - File.write("tmp/#{root_ca_ref}.crt", root_cert) + File.write("tmp/#{root_ca_mount}.crt", root_cert) client.logical.write("#{root_ca_mount}/config/cluster", path: "#{vault_address}/v1/#{root_ca_mount}", @@ -85,20 +85,20 @@ def sign_cert issuer_name: "astral-intermediate").data[:csr] # save the intermediate CSR - File.write("tmp/pki_intermediate.csr", intermediate_csr) + File.write("tmp/#{intermediate_ca_mount}.csr", intermediate_csr) # sign the intermediate certificate with the root CA intermediate_cert = client.logical.write("#{root_ca_mount}/root/sign-intermediate", issuer_ref: root_ca_ref, csr: intermediate_csr, format: "pem_bundle", - ttl: "43800h").data[:certificate] + ttl: "43800h").data # save the signed intermediate certificate - File.write("tmp/intermediate.cert.pem", intermediate_cert) + File.write("tmp/#{intermediate_ca_mount}.cert.pem", intermediate_cert) # set the signed intermediate certificate - client.logical.write("#{intermediate_ca_mount}/intermediate/set-signed", certificate: intermediate_cert) + client.logical.write("#{intermediate_ca_mount}/intermediate/set-signed", certificate: intermediate_cert[:certificate]) end def configure_ca diff --git a/test/lib/clients/vault_test.rb b/test/lib/clients/vault_test.rb index 49699fc..23f194a 100644 --- a/test/lib/clients/vault_test.rb +++ b/test/lib/clients/vault_test.rb @@ -28,7 +28,7 @@ class VaultTest < ActiveSupport::TestCase @client.stub :intermediate_ca_mount, intermediate_ca_mount do assert @client.configure_pki - [root_ca_mount, intermediate_ca_mount].each do |mount| + [ root_ca_mount, intermediate_ca_mount ].each do |mount| engines = vault_client.sys.mounts assert_equal "pki", engines[mount.to_sym].type