Skip to content

Commit e64eea8

Browse files
authored
Merge pull request #14 from orlovmyk/docs
Add Hashicorp Vault docs
2 parents 7128542 + ff6aa2b commit e64eea8

File tree

3 files changed

+89
-2
lines changed

3 files changed

+89
-2
lines changed

SUMMARY.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@
3434
* [Matrix / Synapse](features/openid-connect/proxmox-1.md)
3535
* [Django](features/openid-connect/django.md)
3636
* [MinIO](features/openid-connect/minio.md)
37-
* [Synology DSM](features/openid-connect/synology-dsm.md)
38-
* [WireGuard VPN](features/wireguard/README.md)
37+
* [Vault](features/openid-connect/vault.md)
38+
* [LDAP synchronization](features/ldap-synchronization-setup.md)
39+
* [Wireguard](features/wireguard/README.md)
3940
* [Create your VPN network](features/wireguard/create-your-vpn-network.md)
4041
* [Network overview](community-features/wireguard/network-overview.md)
4142
* [MFA Architecture](features/wireguard/architecture.md)

features/openid-connect/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -166,3 +166,7 @@ On the sidebar or by clicking links below you can find tutorials how to configur
166166
{% content-ref url="minio.md" %}
167167
[minio.md](minio.md)
168168
{% endcontent-ref %}
169+
170+
{% content-ref url="vault.md" %}
171+
[vault.md](vault.md)
172+
{% endcontent-ref %}

features/openid-connect/vault.md

+82
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# Hashicorp Vault
2+
3+
## Example setup
4+
5+
This configuration is an example, which shows how you can connect OpenID Connect with Hashicorp Vault.
6+
7+
Create `vault.json` with the following content:
8+
9+
```json
10+
{
11+
"backend":{
12+
"file":{
13+
"path":"/vault/file"
14+
}
15+
},
16+
"listener":{
17+
"tcp":{
18+
"address":"0.0.0.0:8200",
19+
"tls_disable":1
20+
}
21+
},
22+
"default_lease_ttl":"168h",
23+
"max_lease_ttl":"168h",
24+
"ui":true,
25+
"log_level":"Debug"
26+
}
27+
```
28+
29+
Create `docker-compose.yaml` with the following content:
30+
31+
```yaml
32+
services:
33+
vault:
34+
image: vault:latest
35+
container_name: vault
36+
environment:
37+
VAULT_ADDR: http://127.0.0.1:8200
38+
ports:
39+
- "8200:8200"
40+
volumes:
41+
- ./volumes/vault:/vault/file:rw
42+
- ./vault.json:/vault/config/vault.json:rw
43+
cap_add:
44+
- IPC_LOCK
45+
entrypoint: vault server -config=/vault/config/vault.json -dev
46+
```
47+
48+
Run it using `docker-compose up` command.
49+
50+
Create root token using `docker exec -it vault vault operator init -n 1 -t 1`, write down the root token and unseal key.
51+
52+
## Defguard configuration
53+
54+
1. Go to **OpenID Apps** and click **Add new** button.
55+
2. Use Scopes: `openid email profile`
56+
3. Use `http://127.0.0.1:8200/ui/vault/auth/oidc/oidc/callback` as **Redirect URI**
57+
4. Copy and save **Client ID** and **Client secret**, we will need them later.
58+
59+
## Vault configuration
60+
61+
62+
1. Unseal vault by accessing `http://127.0.0.1:8200/ui` and using unseal key.
63+
2. Login into Vault using method `TOKEN` and using root token.
64+
3. Navigate to **Access -> Auth Methods** and click **Enable new method** button.
65+
4. Enable **OIDC** method.
66+
5. Use values below:
67+
`OIDC discovery URL: https://defguard.company.net/`
68+
`OIDC client ID: <YOUR_CLIENT_ID>`
69+
`OIDC secret ID: <YOUR_CLIENT_SECRET>`
70+
71+
## Creating role in vault
72+
1. Login into vault CLI using root token: `docker exec -it vault vault login <ROOT_TOKEN>`
73+
2. To create role `reader` use command below:
74+
```bash
75+
docker exec -it vault vault write auth/oidc/role/reader \
76+
bound_audiences="<YOUR_CLIENT_ID>" \
77+
allowed_redirect_uris="http://127.0.0.1:8200/ui/vault/auth/oidc/oidc/callback" \
78+
user_claim="sub" \
79+
token_policies="default"
80+
```
81+
82+
Now you can login into vault using Defguard. Use `OIDC` as login method and role `reader`. Please note this role will only allow you to login, to add permissions you need to create policy and assign it to role.

0 commit comments

Comments
 (0)