Commit 1eaba1fb authored by Henrik Henriksson's avatar Henrik Henriksson

Update script

parent c5ee8d17
...@@ -4,11 +4,14 @@ FQDN=$1 ...@@ -4,11 +4,14 @@ FQDN=$1
# Add the host # Add the host
ipa-getkeytab -p host/${FQDN} -k /tmp/${FQDN}.keytab || exit 1 ipa-getkeytab -p host/${FQDN} -k /tmp/${FQDN}.keytab || exit 1
eyaml encrypt --pkcs7-public-key=public_key.pkcs7.pem --output=block --label=ipa_client::keytab_content --file=/tmp/${FQDN}.keytab | tee nodes/${FQDN}.yaml /opt/puppetlabs/puppet/bin/eyaml encrypt --pkcs7-public-key=public_key.pkcs7.pem --output=block --label=ipa_client::keytab_content --file=/tmp/${FQDN}.keytab | tee nodes/${FQDN}.yaml
shred /tmp/${FQDN}.keytab || exit 1 shred /tmp/${FQDN}.keytab || exit 1
rm /tmp/${FQDN}.keytab rm /tmp/${FQDN}.keytab
ROOT_PASSWORD=`pwgen -s 16 -N 1` ROOT_PASSWORD=`pwgen -s 16 -N 1`
echo ${ROOT_PASSWORD} | mkpasswd -R 5000000 -s -m sha-512 | eyaml encrypt --pkcs7-public-key=public_key.pkcs7.pem --output=block --label=root::password --stdin | tee nodes/${FQDN}.yaml echo ${ROOT_PASSWORD} | mkpasswd -R 5000000 -s -m sha-512 | /opt/puppetlabs/puppet/bin/eyaml encrypt --pkcs7-public-key=public_key.pkcs7.pem --output=block --label=profiles::root::password --stdin | tee nodes/${FQDN}.yaml
echo "Generated password for the server: ${ROOT_PASSWORD}" echo ""
echo "Save it or delete it from nodes/${FQDN}.yaml" echo "The output above has been saved to nodes/${FQDN}.yaml."
echo "Please commit the file and push it."
echo -e "\e[32mGenerated password for the server:\e[39m ${ROOT_PASSWORD}"
echo -e "\e[35mSave the password or delete the entry from nodes/${FQDN}.yaml\e[39m"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment