Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
workspace
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Gaia-X
Trust Services API
workspace
Commits
c6386221
Commit
c6386221
authored
2 years ago
by
Lyuben Penkovski
Browse files
Options
Downloads
Patches
Plain Diff
Make Hashicorp Vault work in dev server mode
parent
d6eece1e
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
README.md
+10
-18
10 additions, 18 deletions
README.md
docker-compose.yml
+13
-3
13 additions, 3 deletions
docker-compose.yml
env/signer.env
+1
-1
1 addition, 1 deletion
env/signer.env
vault/vault-init.sh
+19
-0
19 additions, 0 deletions
vault/vault-init.sh
with
43 additions
and
22 deletions
README.md
+
10
−
18
View file @
c6386221
...
...
@@ -115,24 +115,16 @@ The services access Redis from their containers as `redis:6397`
### Hashicorp Vault
When the vault is first started with docker-compose on your local machine,
it's not yet initialized. To initialize it and get a vault token which can be used
by the
[
signer
](
../signer
)
service, you should open the Vault UI and follow the
initial steps to generate a token. The token then must be set as a value for the
ENV variable VAULT_TOKEN in
[
signer.env
](
./env/signer.env
)
Vault UI is exposed at http://0.0.0.0:8200/ui/vault
Setting Vault __(only for local env)__:
1.
On the first screen of the Vault Web UI enter "Key shares" = 1 and "Key threshold" = 1
1.
Click Initialize
1.
Save key/token
1.
Unseal Vault by using the key
1.
Sign in by using the token (the same one you need for VAULT_TOKEN env variable)
1.
On the "Secrets" tab click "Enable new engine" => "transit" => "next" => "Enable engine"
1.
Click "Create encryption key" enter name "key1"
1.
For "Type" use one of the options in
[
signer.env
](
./env/signer.env
)
for VAULT_SUPPORTED_KEYS
1.
Click "Create encryption key"
The vault in the local docker-compose environment is started in
[
dev
](
https://developer.hashicorp.com/vault/docs/concepts/dev-server
)
server mode.
It starts with a predefined root token with value
`root`
which should be given to the
services which want to interact with the vault. The vault is automatically
unsealed, so once running it should be ready for use.
Vault UI is exposed at http://localhost:8200/ui/vault, and you can sign-in there with
the
`root`
token.
> Warning: Never use Vault DEV mode in production!
### License
...
...
This diff is collapsed.
Click to expand it.
docker-compose.yml
+
13
−
3
View file @
c6386221
...
...
@@ -93,6 +93,7 @@ services:
-
"
2112:2112"
depends_on
:
-
vault
-
vault-init
didresolver
:
container_name
:
didresolver
...
...
@@ -151,9 +152,8 @@ services:
container_name
:
vault
image
:
vault:1.10.3
environment
:
VAULT_ADDR
:
"
:8200"
VAULT_ADDR
:
"
http://0.0.0.0
:8200"
VAULT_API_ADDR
:
"
http://0.0.0.0:8200"
VAULT_DEV_ROOT_TOKEN_ID
:
root
ports
:
-
"
8200:8200"
volumes
:
...
...
@@ -161,7 +161,17 @@ services:
-
./vault:/vault/config:rw
cap_add
:
-
IPC_LOCK
entrypoint
:
vault server -config=/vault/config/config.json
entrypoint
:
vault server -dev -dev-listen-address="0.0.0.0:8200" -dev-root-token-id="root"
vault-init
:
container_name
:
vault-init
image
:
vault:1.10.3
volumes
:
-
./vault/vault-init.sh:/vault-init.sh
depends_on
:
-
vault
restart
:
"
no"
entrypoint
:
sh -c "/vault-init.sh"
nats
:
hostname
:
nats
...
...
This diff is collapsed.
Click to expand it.
env/signer.env
+
1
−
1
View file @
c6386221
...
...
@@ -5,7 +5,7 @@ HTTP_IDLE_TIMEOUT="120s"
HTTP_READ_TIMEOUT="10s"
HTTP_WRITE_TIMEOUT="10s"
VAULT_ADDR="http://vault:8200"
VAULT_TOKEN=
VAULT_TOKEN=
root
VAULT_SIGNING_KEY="key1"
VAULT_SUPPORTED_KEYS="ed25519,ecdsa-p256,ecdsa-p384,ecdsa-p521"
CREDENTIAL_ISSUER="did:web:17a1-2a00-4802-2c0-9295-59ff-6a60-b735-32ea.eu.ngrok.io:policy:policy:example:returnDID:1.0:evaluation"
This diff is collapsed.
Click to expand it.
vault/vault-init.sh
0 → 100755
+
19
−
0
View file @
c6386221
#! /bin/sh
set
-e
export
VAULT_ADDR
=
http://vault:8200
# give some time for Vault to start and be ready
sleep
3
vault login root
# enable vault transit engine
vault secrets
enable
transit
# create key1 with type ed25519
vault write
-f
transit/keys/key1
type
=
ed25519
# create key2 with type ecdsa-p256
vault write
-f
transit/keys/key2
type
=
ecdsa-p256
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment