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

update use tls #7

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,19 @@ Check out the [post](https://testdriven.io/managing-secrets-with-vault-and-consu
## Want to use this project?

1. Fork/Clone

1. Build the images and run the containers:
2. Generate ssl
```
apt-get install openssl
openssl genrsa -aes256 -out certificat.key 4096
mv certificat.key certificat.key.lock
openssl rsa -in certificat.key.lock -out certificat.key
openssl req -new -key certificat.key.lock -out certificat.csr
openssl x509 -req -days 365 -in certificat.csr -signkey certificat.key.lock -out certificat.crt
```
4. Build the images and run the containers:

```sh
$ docker-compose up -d --build
```

1. You can now interact with both Vault and Consul. View the UIs at [http://localhost:8200/ui](http://localhost:8200/ui) and [http://localhost:8500/ui](http://localhost:8500/ui).
1. You can now interact with both Vault and Consul. View the UIs at [https://localhost:8200/ui](https://localhost:8200/ui) and [https://localhost:8500/ui](https://localhost:8500/ui).
2 changes: 1 addition & 1 deletion consul/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
FROM alpine:3.14

# set consul version
ENV CONSUL_VERSION 1.10.2
ENV CONSUL_VERSION 1.12.2

# create a new directory
RUN mkdir /consul
Expand Down
4 changes: 4 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ services:
build:
context: ./vault
dockerfile: Dockerfile
container_name: vault
ports:
- 8200:8200
volumes:
- ./vault/ssl-cert:/vault/ssl-cert
- ./vault/config:/vault/config
- ./vault/policies:/vault/policies
- ./vault/data:/vault/data
Expand All @@ -26,6 +28,7 @@ services:
build:
context: ./consul
dockerfile: Dockerfile
container_name: consul
ports:
- 8500:8500
command: agent -server -bind 0.0.0.0 -client 0.0.0.0 -bootstrap-expect 1 -config-file=/consul/config/config.json
Expand All @@ -37,6 +40,7 @@ services:
build:
context: ./consul
dockerfile: Dockerfile
container_name: consul-worker
command: agent -server -join consul -config-file=/consul/config/config.json
volumes:
- ./consul/config/consul-config.json:/consul/config/config.json
Expand Down
4 changes: 2 additions & 2 deletions vault/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
FROM alpine:3.14

# set vault version
ENV VAULT_VERSION 1.8.2
ENV VAULT_VERSION 1.11.0

# create a new directory
RUN mkdir /vault
RUN mkdir /vault && mkdir /vault/ssl-cert

# download dependencies
RUN apk --no-cache add \
Expand Down
3 changes: 2 additions & 1 deletion vault/config/vault-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"listener": {
"tcp":{
"address": "0.0.0.0:8200",
"tls_disable": 1
"tls_cert_file": "/vault/ssl-cert/certificat.crt",
"tls_key_file": "/vault/ssl-cert/key.crt"
}
},
"ui": true
Expand Down
1 change: 1 addition & 0 deletions vault/ssl-cert/certificat.crt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions vault/ssl-cert/key.crt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
key.crt