Skip to content

Commit

Permalink
Verbose logging of commands and config files
Browse files Browse the repository at this point in the history
Signed-off-by: Shubhendu Ram Tripathi <[email protected]>
  • Loading branch information
shtripat committed Jan 10, 2024
1 parent 4860420 commit 88caa9c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
20 changes: 17 additions & 3 deletions kesconf/testdata/vault/deploy_vault.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function init_setup() {
sudo chmod a+x /usr/local/bin/yq
wget https://releases.hashicorp.com/vault/1.15.2/vault_1.15.2_linux_amd64.zip

rm -rf /vault/file || sudo rm -rf /vault/file
rm -rf /tmp/vault/file || sudo rm -rf /tmp/vault/file
pkill -9 vault || sudo pkill -9 vault
rm -f client.crt client.key private.key public.crt vault.crt vault.key
}
Expand Down Expand Up @@ -55,17 +55,27 @@ function install_kes() {

function setup_vault() {
# Create vault certs
echo "Run: kes identity new --key vault.key --cert vault.crt --ip \"127.0.0.1\" localhost"
echi ""
kes identity new --key vault.key --cert vault.crt --ip "127.0.0.1" localhost
mkdir -p /vault/file
mkdir -p /tmp/vault/file || sudo mkdir -p /tmp/vault/file
echo ""

# Start vaule server
# Start vault server
echo "Starting vault server...."
echo "Run: vault server -config \"${GITHUB_WORKSPACE}\"/kesconf/testdata/vault/vault-config.json &"
vault server -config "${GITHUB_WORKSPACE}"/kesconf/testdata/vault/vault-config.json &
echo ""

# Generate certs for KES
echo "Run: kes identity new --ip \"127.0.0.1\" localhost --cert public.crt --key private.key"
kes identity new --ip "127.0.0.1" localhost --cert public.crt --key private.key
echo ""

# Generate certs for client application (to be used by test)
echo "Run: kes identity new --key=client.key --cert=client.crt MyApp"
kes identity new --key=client.key --cert=client.crt MyApp
echo ""

client_id=$(kes identity of client.crt | awk '{print $1}')
id="${client_id}" yq e -i '.policy.my-app.identities += [strenv(id)] | ..style="double"' "${GITHUB_WORKSPACE}"/kesconf/testdata/vault/kes-config-vault.yml
Expand Down Expand Up @@ -100,6 +110,10 @@ function setup_vault() {
kes_key="${kes_private_key}" yq e -i '.tls.key = strenv(kes_key)' "${GITHUB_WORKSPACE}"/kesconf/testdata/vault/kes-config-vault.yml
kes_cert="${kes_public_cert}" yq e -i '.tls.cert = strenv(kes_cert)' "${GITHUB_WORKSPACE}"/kesconf/testdata/vault/kes-config-vault.yml
vault_cert="${vault_public_cert}" yq e -i '.keystore.vault.tls.ca = strenv(vault_cert)' "${GITHUB_WORKSPACE}"/kesconf/testdata/vault/kes-config-vault.yml

echo "Content of \"${GITHUB_WORKSPACE}\"/kesconf/testdata/vault/kes-config-vault.yml"
cat "${GITHUB_WORKSPACE}"/kesconf/testdata/vault/kes-config-vault.yml
echo ""
}

main "$@"
2 changes: 1 addition & 1 deletion kesconf/testdata/vault/vault-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"api_addr": "https://127.0.0.1:8200",
"backend": {
"file": {
"path": "/vault/file"
"path": "/tmp/vault/file"
}
},

Expand Down

0 comments on commit 88caa9c

Please sign in to comment.