Commit 704f4366 authored by Henrik Henriksson's avatar Henrik Henriksson

Write a script that might work

parent 42fc9f11
#!/bin/bash
FQDN=$1
# Add the host
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
shred /tmp/${FQDN}.keytab || exit 1
rm /tmp/${FQDN}.keytab
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 "Generated password for the server: ${ROOT_PASSWORD}"
echo "Save it or delete it from nodes/${FQDN}.yaml"
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