Last active
May 12, 2018 02:29
-
-
Save vishalnayak/d23d78a4a2976e86386db7514de4c375 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -aex | |
cat > ldapConfig -<<EOF | |
{ | |
"url": "ldap://ldap.forumsys.com", | |
"userattr": "uid", | |
"userdn": "dc=example,dc=com", | |
"groupdn": "dc=example,dc=com", | |
"binddn": "cn=read-only-admin,dc=example,dc=com" | |
} | |
EOF | |
vault auth enable -local ldap | |
vault write auth/ldap/config @ldapConfig | |
vault write auth/ldap/groups/testgroup1 policies=testgroup1-policy | |
vault write auth/ldap/users/tesla policies=default groups=testgroup1 | |
clientToken=$(vault write -format json auth/ldap/login/tesla password=password | jq -r .auth.client_token) | |
vault token lookup $clientToken |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment