Skip to content

Commit

Permalink
fix lints
Browse files Browse the repository at this point in the history
  • Loading branch information
suprjinx committed Sep 30, 2024
1 parent 3b37d3d commit e2a3410
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions app/lib/clients/vault/certificate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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}",
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/lib/clients/vault_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit e2a3410

Please sign in to comment.