Skip to content

Commit 8062cc7

Browse files
authored
Merge pull request #57 from devopshobbies/final-test
BVSTACK End-to-End test
2 parents 0536a1c + b2a389a commit 8062cc7

20 files changed

Lines changed: 104 additions & 44 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,5 @@ jobs:
3535
- name: Create Release
3636
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844
3737
with:
38-
body: ${{ steps.github_release.outputs.changelog }}
38+
body: ${{ steps.bump.outputs.changelog }}
3939
tag_name: ${{ steps.bump.outputs.new_tag }}

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,6 @@ to-research
5151
*VBox*.log
5252
**/bin/boundary**
5353
**test-play**
54-
virtualenv
54+
virtualenv
55+
56+
**boundary*creds*.txt

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ This project provides a comprehensive, hands-on experience in Infrastructure as
3737
# Run in development:
3838
./start.sh -e development
3939
```
40-
40+
> you'll be prompted to choose which NIC you want to bridge to by Vagrant.
4141
4242
4. **Enter Vault Password**: You will be prompted to enter the Vault password four times to decrypt Ansible Vault-encrypted files (e.g., `inventory.ini`) unless the related [issue](https://github.com/devopshobbies/boundary-vault-stack/issues/24) is resolved.
4343

ansible/handlers/container_healthcheck.yml

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,21 @@
1010
- "{{ INFO.results }}"
1111
loop_control:
1212
label: "{{ item.container.Name | default('Unknown Container', true ) }}"
13-
when: item.container.State.Running and item.container.State.Restarting != true
13+
when:
14+
- item is defined
15+
- item.container.State.Running | bool
16+
- item.container.State.Restarting != true
1417

18+
- name: handle errors if occurred
19+
include_tasks: "{{handlers}}/fail_task.yml"
20+
vars:
21+
message: "Container {{ item.container.Name }} is NOT healthy"
22+
with_items :
23+
- "{{ INFO.results }}"
24+
loop_control:
25+
label: "ID : {{ item.container.Id | default('Unknown Container ID', true ) }} , NAME: {{ item.container.Name | default('Unknown Container ID', true ) }}"
26+
when :
27+
- item is not defined or item.container.State.Running != true
1528

1629
- name: handle errors if container not healthy
1730
include_tasks: "{{handlers}}/service_healthcheck.yml"
@@ -20,7 +33,10 @@
2033
PATH: "{{ service_path }}"
2134
with_items :
2235
- "{{ INFO.results }}"
23-
when: item.exists != true and item.container.Name != '/vault'
36+
when:
37+
- item is defined
38+
- item.exists != true
39+
- item.container.Name != '/vault'
2440

2541
- name: fetch the logfile for the unhealthy container(s)
2642
# become: true
@@ -35,12 +51,3 @@
3551
label: "{{ item.container.LogPath | default('Unknown Container', true ) }}"
3652
when: item.container.State.Running != true
3753

38-
- name: handle errors if occurred
39-
include_tasks: "{{handlers}}/fail_task.yml"
40-
vars:
41-
message: "Container {{ item.container.Name }} is NOT healthy"
42-
with_items :
43-
- "{{ INFO.results }}"
44-
loop_control:
45-
label: "ID : {{ item.container.Id | default('Unknown Container ID', true ) }} , NAME: {{ item.container.Name | default('Unknown Container ID', true ) }}"
46-
when : item.container.State.Running != true

ansible/handlers/fail_task.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
- name: Fail if a task failed
22
fail:
33
msg: "{{ output.stderr | default(output.stdout, true) | default(message, true) }}"
4-
when: output.rc|default(1) != 0
4+
when: output.rc != 0

ansible/host_vars/localhost

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ vault_addr: "127.0.0.1:8200"
66
boundary_addr: "127.0.0.1:9200"
77
handlers: "{{ playbook_dir }}/handlers"
88
log_dir: "{{ playbook_dir | dirname }}/logs"
9+
secret_dir : "{{stack_dir}}/secrets"
910

1011
# environment variables
1112
STACK_ENV: "{{ lookup('env', 'STACK_ENV') }}"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
---
22
STACK_INIT: true
33
STACK_ENV: development
4+
SSH_INJECTION: false

artifacts/wiki/index.html

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
<ul>
3030
<li><a href="#getting-started">Getting Started</a></li>
3131
<li><a href="#about-hashicorp-vault-and-boundary">About Hashicorp Vault and Boundary</a></li>
32-
<li><a href="#workflows">Workflows</a>
32+
<li><a href="#workflow">Workflow</a>
3333
<ul>
3434
<li><a href="#vault">Vault</a></li>
3535
<li><a href="#boundary">Boundary</a></li>
@@ -84,12 +84,37 @@ <h2 id="about-hashicorp-vault-and-boundary" class="section-header">About Hashico
8484
</div>
8585

8686
<div class="workflows section">
87-
<h2 id="workflows" class="section-header">Workflows</h2>
87+
<h2 id="workflow" class="section-header">Workflow</h2>
88+
<p>After the environment is prepared, Ansible deploys Vault using Docker Compose. The Vault server is
89+
first initialized by the <span class="bold">vault-init</span> service, which runs the `init.sh`
90+
script and calls the `init_vault_setup` function. This process unseals Vault, creates the necessary
91+
secret engines, policies, tokens, and other basic configurations. Once the deployment is complete, the
92+
<span class="bold">Transit-token</span> and <span class="bold">secrets.txt</span> file, containing
93+
all the essential tokens and keys, are generated and stored in the `secrets/secrets.txt` file on the
94+
controller machine.
95+
96+
Next, the Terraform role is applied to configure Vault, utilizing the generated tokens and
97+
variables. Following this, the deployment shifts focus to Boundary. To enable Boundary to use
98+
Vault's Transit Engine for Encryption as a Service (EaaS), the Transit token (already stored in
99+
`secrets.txt`) is passed to the Boundary role. Once the Boundary database (PostgreSQL) is up and
100+
running, it is initialized using the <span class="bold">db-init</span> service. Finally, Boundary is
101+
deployed with the initial credentials saved in <span
102+
class="bold">secrets/boundary-init-creds.txt</span>. Terraform resources are then applied using
103+
the <span class="bold">Vault Transit recovery key</span> and <span class="bold">Transit
104+
token</span>.
105+
106+
To use the stack, you need to install the Boundary and Vault clients (ensure the server and client
107+
versions match). Once installed, you can start using BVSTACK.
108+
109+
You can checkout the boundary UI at <span class="bold"><a href="http://192.168.1.15:9200">http://192.168.1.15:9200</a> </span> and Vault at <span class="bold"><a href="http://192.168.1.15:8200">http://192.168.1.15:8200</a> .</span>
110+
111+
</p>
112+
88113
<h3 id="vault" class="section-header">Vault</h3>
89114
<p>Vault workflow involves setting up authentication methods, secret engines, and policies. The key
90115
components of Vault server setup include:</p>
91116
<img src="./vault.png" alt="vault diagram">
92-
117+
93118
<h3 id="boundary" class="section-header">Boundary</h3>
94119
<p>Boundary workflow involves managing sessions, targets, and credentials. The key
95120
components of Boundary server setup include:
@@ -137,7 +162,9 @@ <h4>SSH_INJECTION (optional)</h4>
137162
<p class="default">default : false</p>
138163

139164
<h4>STACK_SERVER (optional)</h4>
140-
<p>If set to false, vagrant and virtualbox won't be used to spin up BVSTACK. Instead you must create both Controller, BVSTACK and Client machines <span class="bold">manually</span> using your prefered method; ensure to address them in the inventory file accordingly.</p>
165+
<p>If set to false, vagrant and virtualbox won't be used to spin up BVSTACK. Instead you must create
166+
both Controller, BVSTACK and Client machines <span class="bold">manually</span> using your prefered
167+
method; ensure to address them in the inventory file accordingly.</p>
141168
<ul class="options">
142169
<li>true</li>
143170
<li>false</li>
@@ -276,6 +303,11 @@ <h3>Exit Code 4: Arguments and Options are Invalid.</h3>
276303
<h2 id="bear-in-mind">Bear In Mind</h2>
277304
<p>Keep the following in mind when working with the Boundary-Vault stack:</p>
278305
<ul>
306+
<li>Since Boundary Terraform uses Vault recovery transit key you must export the transit-token as
307+
VAULT_TOKEN
308+
<span class="bold">(secrets/secrets.txt)</span> before planning/applying the code. Otherwise,
309+
you should use auth-method credentials to communicate with the boundary api.
310+
</li>
279311
<li>If you have issues with DockerHub make sure you change the image registry in deployments and
280312
`prepare_env` role.</li>
281313
<li>If the target node(s) get restarted, the <span class="bold">vault</span> gets sealed and <span

boundary/config/boundary.hcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ worker {
2020
type = ["prod", "servers"]
2121
}
2222

23-
public_addr = "127.0.0.1"
23+
public_addr = "192.168.1.15"
2424
}
2525

2626
listener "tcp" {

boundary/terraform/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ data "boundary_user" "global_scope_admin" {
99
#----------
1010

1111
resource "boundary_scope" "global" {
12+
name = "Global"
1213
global_scope = true
1314
description = "highest-level Scope for administrators"
1415
scope_id = "global"

0 commit comments

Comments
 (0)