generated from crossplane/upjet-provider-template
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #50 from m1so/fix-auth-config-options
Fix authentication configuration options
- Loading branch information
Showing
4 changed files
with
78 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/bin/bash | ||
|
||
set -euo pipefail | ||
|
||
VAULT_TOKEN=$(make vault.token) | ||
export VAULT_TOKEN | ||
|
||
# requires Vault to be port-forwarded | ||
VAULT_ADDR="http://127.0.0.1:8200" | ||
export VAULT_ADDR | ||
|
||
if vault auth list | grep -q "approle"; then | ||
echo "Approle auth method already enabled" | ||
else | ||
echo "Enabling approle auth method" | ||
vault auth enable approle | ||
fi | ||
|
||
echo "Creating development admin policy" | ||
curl \ | ||
--request POST \ | ||
--header "X-Vault-Token: $VAULT_TOKEN" \ | ||
--data '{"policy": "path \"*\" { capabilities = [\"create\", \"read\", \"update\", \"delete\", \"list\", \"sudo\"] }"}' \ | ||
"$VAULT_ADDR/v1/sys/policy/dev-admin" | ||
|
||
echo "Creating AppRole role my-role" | ||
vault write auth/approle/role/my-role \ | ||
token_type=batch \ | ||
token_max_ttl=10m \ | ||
bind_secret_id=false \ | ||
secret_id_bound_cidrs="0.0.0.0/0" \ | ||
token_bound_cidrs="0.0.0.0/0" \ | ||
token_policies="dev-admin" | ||
|
||
vault write auth/approle/role/my-role/role-id \ | ||
role_id=my-role | ||
|
||
echo "Authentication set up!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters