Last active
August 29, 2015 14:19
-
-
Save dustinmm80/5125ce2e7d3ac6148cff to your computer and use it in GitHub Desktop.
Bootstrapping a Conjur identity with host-factory
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 | |
# Creates a host identity using host-factory and places it in /etc/conjur.identity | |
# Requires the Conjur CLI and host-factory plugin to be installed | |
# Usage: | |
# ./hostfactory_bootstrap.sh 92198eb129peh812ue9puihd891 mynewhost1 | |
hostfactory_token=$1 | |
host_name=$2 | |
conjur hostfactory hosts create ${hostfactory_token} ${host_name} > host.json | |
conjur_endpoint=$(cat /etc/conjur.conf | sed -n 2p | cut -d ' ' -f 2)"/authn" | |
# or you could just hardcode ^ if you have one Conjur endpoint | |
cat << IDENTITY > /etc/conjur.identity | |
machine ${conjur_endpoint} | |
login host/$(cat host.json | jsonfield id) | |
password $(cat host.json | jsonfield api_key) | |
IDENTITY |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment