forked from ValFadeev/rundeck-vault-plugin
-
Notifications
You must be signed in to change notification settings - Fork 11
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 #39 from rundeck-plugins/new-namespace-auth
add auth namespace
- Loading branch information
Showing
22 changed files
with
466 additions
and
23 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
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,8 @@ | ||
VAULT_TOKEN=myroot1 | ||
mem_limit=1200000000 | ||
VAULT_IMAGE=hashicorp/vault-enterprise | ||
VAULT_APPROLE_ID=123 | ||
VAULT_APPROLE_SECRET_ID=123 | ||
|
||
RUNDECK_IMAGE=rundeckpro/enterprise:SNAPSHOT | ||
VAULT_LICENSE=xxxxx |
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,2 @@ | ||
data/envs.txt | ||
rundeck/plugins/vault-storage-* |
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 |
---|---|---|
@@ -1,25 +1,28 @@ | ||
all: | ||
|
||
#env vars | ||
DOCKER_COMPOSE_SPEC="docker-compose.yaml" | ||
DOCKER_COMPOSE_SPEC ?= docker-compose.yaml | ||
ENV_FILE ?= .env | ||
|
||
build: | ||
set -e | ||
# re-build docker env | ||
docker-compose -f $(DOCKER_COMPOSE_SPEC) build | ||
docker-compose -f $(DOCKER_COMPOSE_SPEC) --env-file $(ENV_FILE) build | ||
|
||
start: | ||
# run docker | ||
docker-compose -f $(DOCKER_COMPOSE_SPEC) up -d | ||
docker-compose -f $(DOCKER_COMPOSE_SPEC) --env-file $(ENV_FILE) up -d | ||
|
||
clean: | ||
# clean up docker env | ||
docker-compose -f $(DOCKER_COMPOSE_SPEC) down --volumes --remove-orphans | ||
docker-compose -f $(DOCKER_COMPOSE_SPEC) --env-file $(ENV_FILE) down --volumes --remove-orphans | ||
rm data/envs.txt | ||
|
||
build_and_start: | ||
set -e | ||
# re-build docker env | ||
docker-compose -f $(DOCKER_COMPOSE_SPEC) build | ||
docker-compose -f $(DOCKER_COMPOSE_SPEC) --env-file $(ENV_FILE) build | ||
# clean up docker env | ||
docker-compose -f $(DOCKER_COMPOSE_SPEC) down --volumes --remove-orphans | ||
docker-compose -f $(DOCKER_COMPOSE_SPEC) --env-file $(ENV_FILE) down --volumes --remove-orphans | ||
# run docker | ||
docker-compose -f $(DOCKER_COMPOSE_SPEC) up -d | ||
docker-compose -f $(DOCKER_COMPOSE_SPEC) --env-file $(ENV_FILE) up -d |
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
Empty file.
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,66 @@ | ||
version: '2' | ||
|
||
services: | ||
vault: | ||
build: | ||
context: vault-enterprise | ||
args: | ||
IMAGE: ${VAULT_IMAGE} | ||
ports: | ||
- "8200:8200" | ||
cap_add: | ||
- IPC_LOCK | ||
environment: | ||
- VAULT_DEV_ROOT_TOKEN_ID=${VAULT_TOKEN} | ||
- VAULT_DEV_LISTEN_ADDRESS=vault:8200 | ||
- VAULT_ADDR=http://vault:8200 | ||
- VAULT_TOKEN=${VAULT_TOKEN} | ||
- VAULT_LICENSE=${VAULT_LICENSE} | ||
volumes: | ||
- ./data:/data | ||
rundeck: | ||
hostname: rundeck | ||
build: | ||
context: rundeck | ||
args: | ||
IMAGE: ${RUNDECK_IMAGE} | ||
mem_limit: ${mem_limit} | ||
#command: -Dlogging.config=/home/rundeck/server/config/logback.groovy | ||
environment: | ||
- RUNDECK_EXEC_CMD=script/configure.sh | ||
- RUNDECK_GRAILS_URL=http://localhost:4442 | ||
- RUNDECK_DATABASE_DRIVER=org.mariadb.jdbc.Driver | ||
- RUNDECK_DATABASE_USERNAME=rundeck | ||
- RUNDECK_DATABASE_PASSWORD=rundeck | ||
- RUNDECK_DATABASE_URL=jdbc:mariadb://mysql/rundeck?autoReconnect=true&useSSL=false | ||
- RUNDECK_STORAGE_PROVIDER_1_TYPE=vault-storage | ||
- RUNDECK_STORAGE_PROVIDER_1_PATH=keys | ||
- RUNDECK_STORAGE_PROVIDER_1_REMOVEPATHPREFIX=true | ||
- RUNDECK_STORAGE_PROVIDER_1_CONFIG_SECRETBACKEND=secret | ||
- RUNDECK_STORAGE_PROVIDER_1_CONFIG_PREFIX=app | ||
- RUNDECK_STORAGE_PROVIDER_1_CONFIG_ADDRESS=http://vault:8200 | ||
- RUNDECK_STORAGE_PROVIDER_1_CONFIG_BEHAVIOUR=vault | ||
- RUNDECK_STORAGE_PROVIDER_1_CONFIG_ENGINEVERSION=2 | ||
- RUNDECK_STORAGE_PROVIDER_1_CONFIG_MAXRETRIES=10 | ||
- RUNDECK_STORAGE_PROVIDER_1_CONFIG_RETRYINTERVAL=10 | ||
- RUNDECK_STORAGE_PROVIDER_1_CONFIG_OPENTIMEOUT=30 | ||
- RUNDECK_STORAGE_PROVIDER_1_CONFIG_READTIMEOUT=30 | ||
# auth approle | ||
- RUNDECK_STORAGE_PROVIDER_1_CONFIG_AUTHBACKEND=approle | ||
- RUNDECK_STORAGE_PROVIDER_1_CONFIG_AUTHNAMESPACE=rundeck | ||
- RUNDECK_STORAGE_PROVIDER_1_CONFIG_APPROLEID=${VAULT_APPROLE_ID} | ||
- RUNDECK_STORAGE_PROVIDER_1_CONFIG_APPROLESECRETID=${VAULT_APPROLE_SECRET_ID} | ||
- RUNDECK_STORAGE_PROVIDER_1_CONFIG_NAMESPACE=rundeck/demo | ||
ports: | ||
- "4442:4440" | ||
volumes: | ||
- ./data/:/home/rundeck/vault-envs/ | ||
mysql: | ||
image: mysql:5.7 | ||
ports: | ||
- "3306" | ||
environment: | ||
- MYSQL_ROOT_PASSWORD=root | ||
- MYSQL_DATABASE=rundeck | ||
- MYSQL_USER=rundeck | ||
- MYSQL_PASSWORD=rundeck |
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
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,25 @@ | ||
#!/bin/bash | ||
|
||
ls -lrt /home/rundeck/script | ||
|
||
bash /home/rundeck/script/waitforfile.sh /home/rundeck/vault-envs/envs.txt 30 10 | ||
|
||
export $(xargs < /home/rundeck/vault-envs/envs.txt) | ||
|
||
env | grep VAULT | ||
|
||
sed -i "s/^\(rundeck\.storage\.provider\.1\.config\.approleId\s*=\s*\).*\$/\1$VAULT_ROLE_ID/" server/config/rundeck-config.properties | ||
sed -i "s/^\(rundeck\.storage\.provider\.1\.config\.approleSecretId\s*=\s*\).*\$/\1$VAULT_SECRET_ID/" server/config/rundeck-config.properties | ||
|
||
|
||
cat server/config/rundeck-config.properties | ||
|
||
exec java \ | ||
-XX:+UnlockExperimentalVMOptions \ | ||
-Dlog4j.configurationFile="${HOME}/server/config/log4j2.properties" \ | ||
-Dlogging.config="file:${HOME}/server/config/log4j2.properties" \ | ||
-Dloginmodule.conf.name=jaas-loginmodule.conf \ | ||
-Dloginmodule.name=rundeck \ | ||
-Drundeck.jaaslogin=true \ | ||
"${@}" \ | ||
-jar rundeck.war |
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,30 @@ | ||
#!/bin/bash | ||
|
||
syntax_error() { echo >&2 "SYNTAX: $*"; exit 2; } | ||
|
||
(( $# != 3 )) && { | ||
syntax_error "$0 <file> <interval> <maxtry>" | ||
} | ||
|
||
declare -r FILE=$1 INTERVAL=$2 MAXTRY=$3 | ||
|
||
echo "waiting for ${FILE}" | ||
|
||
progress_tic() { if [[ -t 1 ]]; then printf -- "%s" "$@"; else printf -- "%s\n" "$@" ; fi ; } | ||
|
||
echo "Running as user: $(whoami)" | ||
|
||
declare -i attempts=0 | ||
while (( attempts <= MAXTRY )) | ||
do | ||
if ! test -f "$FILE" | ||
then progress_tic "."; # output a progress string. | ||
else break; # file exists | ||
fi | ||
(( attempts += 1 )) ; # increment attempts attemptser. | ||
(( attempts == MAXTRY )) && { | ||
echo "FAIL: Reached max try file exists: $FILE. Exiting." | ||
exit 1 | ||
} | ||
sleep "$INTERVAL"; # wait before trying again. | ||
done |
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,9 @@ | ||
ARG IMAGE | ||
FROM ${IMAGE} | ||
|
||
EXPOSE 8200 | ||
COPY run.sh /usr/local/bin/run.sh | ||
RUN apk --no-cache add curl | ||
RUN apk --no-cache add jq | ||
|
||
CMD ["run.sh"] |
Oops, something went wrong.