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

Add ldap support to vault container in docker dev environment #14777

Merged
merged 5 commits into from
Feb 9, 2024

Conversation

thedoubl3j
Copy link
Member

@thedoubl3j thedoubl3j commented Jan 17, 2024

SUMMARY

This PR will configure the vault container with LDAP and userpass auth_methods for dev stack.

ISSUE TYPE
  • Bug, Docs Fix or other nominal change
COMPONENT NAME
  • Other
AWX VERSION
devel
ADDITIONAL INFORMATION

To test this change, pull this branch down and run:

COMPOSE_TAG=devel LDAP=true VAULT=true make docker-compose
  1. Once the cluster is up, you will need to unseal vault, you can do that manually with the keys found _sources in docker compose or you can run the unseal playbook.
ansible-playbook tools/docker-compose/ansible/unseal_vault.yml
  1. Next, plumb the vault container. This playbook will also need you to export your admin creds to your awx instance since we are making changes to awx as well
export CONTROLLER_USERNAME=admin
export CONTROLLER_PASSWORD=<password>
ansible-playbook tools/docker-compose/ansible/plumb_vault.yml -e enable_ldap=true
  1. Once those playbooks are done, you will now have credentials to access both Userpass and LDAP credentials in AWX that were created from a custom vault credential. To test these credentials, you will need to either write a dummy playbook that will print the var that is configured for the test creds (the_secret_from_vault) or you can use a test one @djyasin wrote to test original feature which I manipulated for this demo here: https://github.com/thedoubl3j/Playbooks.
  2. Once you have your playbook, create a project with either yours or the test source material and create a job template with the relative playbook and demo inventory selected. For the job template credential, you will need to select "Vault Custom Cred Type" from the type drop down and then select the method you want to test, userpass or ldap.
  3. Save the Job Template and launch it. Given the credential selected, you should see one of two outputs printed to the screen
  • LDAP
TASK [Print HashiVault Secret] *************************************************
ok: [localhost] => {
    "msg": "this_is_the_ldap_secret_value"
}
  • UserPass
TASK [Print HashiVault Secret] *************************************************
ok: [localhost] => {
    "msg": "this_is_the_userpass_secret_value"
}

@djyasin djyasin self-requested a review January 18, 2024 14:56
@thedoubl3j thedoubl3j changed the title [DRAFT] add ldap_auth mount and configure it [DRAFT] add ldap support to vault container in docker dev environment Jan 25, 2024
Copy link
Member

@TheRealHaoLiu TheRealHaoLiu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

linters: commands[2]> yamllint -s .
./tools/docker-compose/ansible/roles/vault/defaults/main.yml
  9:11      warning  too few spaces before comment  (comments)
  9:12      warning  missing starting space in comment  (comments)
  10:11     warning  too few spaces before comment  (comments)
  10:12     warning  missing starting space in comment  (comments)

./tools/docker-compose/ansible/roles/vault/tasks/plumb.yml
  97:16     error    trailing spaces  (trailing-spaces)
  98:16     error    trailing spaces  (trailing-spaces)
  107:48    error    trailing spaces  (trailing-spaces)

./tools/docker-compose/ansible/roles/vault/tasks/initialize.yml
  104:17    error    wrong indentation: expected 14 but found 16  (indentation)
  188:17    error    wrong indentation: expected 14 but found 16  (indentation)
  194:1     error    trailing spaces  (trailing-spaces)
  205:19    error    wrong indentation: expected 16 but found 18  (indentation)

@TheRealHaoLiu
Copy link
Member

@thedoubl3j in your VSCode u can have it automatically trim trailing whitespace

open command pallet and type > Trim Trailing White Spaces

@thedoubl3j thedoubl3j changed the title [DRAFT] add ldap support to vault container in docker dev environment Add ldap support to vault container in docker dev environment Jan 31, 2024
@thedoubl3j thedoubl3j marked this pull request as ready for review January 31, 2024 14:44
Copy link
Member

@djyasin djyasin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was able to successfully retrieve both the userpass and ldap secrets via these steps!

Makefile Outdated Show resolved Hide resolved
@thedoubl3j thedoubl3j merged commit 519fd22 into ansible:devel Feb 9, 2024
21 checks passed
djyasin pushed a commit to djyasin/awx that referenced this pull request Sep 16, 2024
…e#14777)

* add ldap_auth mount and configure it

* added in key engines, userpass auth method, still needs testing

* add policies and fix ldap_user

* start awx automation for vault demo and move ldap

* update docs with new flags/new credentials
djyasin pushed a commit to djyasin/awx that referenced this pull request Nov 11, 2024
…e#14777)

* add ldap_auth mount and configure it

* added in key engines, userpass auth method, still needs testing

* add policies and fix ldap_user

* start awx automation for vault demo and move ldap

* update docs with new flags/new credentials
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants