Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added passphrase for SSH Key for Security Params example and E2E tests #734

Merged
merged 1 commit into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app-tests/docker-compose-app-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ services:
- OPAL_POLICY_REPO_WEBHOOK_PARAMS={"secret_header_name":"x-webhook-token","secret_type":"token","secret_parsing_regex":"(.*)","event_request_key":"gitEvent","push_event_value":"git.push"}
- OPAL_AUTH_PUBLIC_KEY=${OPAL_AUTH_PUBLIC_KEY}
- OPAL_AUTH_PRIVATE_KEY=${OPAL_AUTH_PRIVATE_KEY}
- OPAL_AUTH_PRIVATE_KEY_PASSPHRASE=${OPAL_AUTH_PRIVATE_KEY_PASSPHRASE}
- OPAL_AUTH_MASTER_TOKEN=${OPAL_AUTH_MASTER_TOKEN}
- OPAL_AUTH_JWT_AUDIENCE=https://api.opal.ac/v1/
- OPAL_AUTH_JWT_ISSUER=https://opal.ac/
Expand Down
4 changes: 3 additions & 1 deletion app-tests/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@ set -e

export OPAL_AUTH_PUBLIC_KEY
export OPAL_AUTH_PRIVATE_KEY
export OPAL_AUTH_PRIVATE_KEY_PASSPHRASE
export OPAL_AUTH_MASTER_TOKEN
export OPAL_CLIENT_TOKEN
export OPAL_DATA_SOURCE_TOKEN

function generate_opal_keys {
echo "- Generating OPAL keys"

ssh-keygen -q -t rsa -b 4096 -m pem -f opal_crypto_key -N ""
OPAL_AUTH_PRIVATE_KEY_PASSPHRASE="123456"
ssh-keygen -q -t rsa -b 4096 -m pem -f opal_crypto_key -N "$OPAL_AUTH_PRIVATE_KEY_PASSPHRASE"
OPAL_AUTH_PUBLIC_KEY="$(cat opal_crypto_key.pub)"
OPAL_AUTH_PRIVATE_KEY="$(tr '\n' '_' < opal_crypto_key)"
rm opal_crypto_key.pub opal_crypto_key
Expand Down
1 change: 1 addition & 0 deletions docker/docker-compose-with-security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ services:
# private key (used for signing on new JWT tokens).
- OPAL_AUTH_PUBLIC_KEY=${OPAL_AUTH_PUBLIC_KEY}
- OPAL_AUTH_PRIVATE_KEY=${OPAL_AUTH_PRIVATE_KEY}
- OPAL_AUTH_PRIVATE_KEY_PASSPHRASE=${OPAL_AUTH_PRIVATE_KEY_PASSPHRASE}
# the master token is used in only one scenario - when we want to generate a new JWT token.
# the /token api endpoint on the OPAL server is the only endpoint that requires the master token.
- OPAL_AUTH_MASTER_TOKEN=${OPAL_AUTH_MASTER_TOKEN}
Expand Down
3 changes: 2 additions & 1 deletion docker/run-example-with-security.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ echo "keys and run OPAL in *secure mode*."
echo "------------------------------------------------------------------"

echo "generating opal crypto keys..."
ssh-keygen -q -t rsa -b 4096 -m pem -f opal_crypto_key -N ""
export OPAL_AUTH_PRIVATE_KEY_PASSPHRASE="123456"
ssh-keygen -q -t rsa -b 4096 -m pem -f opal_crypto_key -N "$OPAL_AUTH_PRIVATE_KEY_PASSPHRASE"

echo "saving crypto keys to env vars and removing temp key files..."
export OPAL_AUTH_PUBLIC_KEY=`cat opal_crypto_key.pub`
Expand Down
Loading