From 4c02d064fc6ecf3d5c5b6675fbfbacac81644adc Mon Sep 17 00:00:00 2001 From: ebner Date: Mon, 23 Feb 2026 15:16:01 +0100 Subject: [PATCH] merge documents --- docs/admin-guide/puppet/eyaml.md | 48 ---------------------------- docs/admin-guide/puppet/hiera.md | 54 +++++++++++++++++++++++++------- 2 files changed, 42 insertions(+), 60 deletions(-) delete mode 100644 docs/admin-guide/puppet/eyaml.md diff --git a/docs/admin-guide/puppet/eyaml.md b/docs/admin-guide/puppet/eyaml.md deleted file mode 100644 index 2e635dd0..00000000 --- a/docs/admin-guide/puppet/eyaml.md +++ /dev/null @@ -1,48 +0,0 @@ -# EYAML Secrets in Hiera - -To encrypt data with `eyaml` you need the `hiera-eyaml` tool installed on your system. - -## Encrypt Data -To encrypt data you have to use the public key from your Hiera (`data-*`) git repository named `eyaml_public_key.pem` - -For the lower layers (global, server or data) it is on the Puppet server at `/etc/puppetlabs/keys/eyaml/public_key.pkcs7.pem`. - - -For to encrypt a simple string do -```bash -eyaml encrypt --pkcs7-public-key=eyaml_public_key.pem -s secret_string -``` - -and for a complete file -```bash -eyaml encrypt --pkcs7-public-key=eyaml_public_key.pem -f secret_file -``` -and from pipe - -```bash -eyaml encrypt --pkcs7-public-key=eyaml_public_key.pem --stdin -``` - -#### Example - -To encrypting password for a system you can do like this: - -```bash -# openssl passwd -6 | eyaml encrypt --pkcs7-public-key=eyaml_public_key.pem --stdin -Password: -Verifying - Password: -string: ENC[PKCS7,MIIB2gYJKoZIhvcNAQcDoIIByzCCAccCAQ...sfLHuai6p+Mdukw/TT1BlKA==] - -OR - -block: > - ENC[PKCS7,MIIB2gYJKoZIhvcNAQcDoIIByzCCAccCAQAxggEhMIIBHQIBAD - AFMAACAQEwDQYJKoZIhvcNAQEBBQAEggEA1vyV8J3LYjfBz5zY1PIs9k9zIC - ... - c+MJa+CzicugI0Ptyq/anhhfWeDeBnZza1/9OCxWqqf3wEcnhJCmxYxBEOLR - AxVw2cf3w0wGRuZ0373LHljGTsfLHuai6p+Mdukw/TT1BlKA==] -# -``` - -and place either the string or the block at the required place in your Hiera YAML. - diff --git a/docs/admin-guide/puppet/hiera.md b/docs/admin-guide/puppet/hiera.md index b90ee2f9..2bcfda0a 100644 --- a/docs/admin-guide/puppet/hiera.md +++ b/docs/admin-guide/puppet/hiera.md @@ -45,23 +45,53 @@ Any change to the repo will automatically trigger a redeployment of the new vers ## Configuration ### Secrets -Secrets and clear-text values can be mixed inside the same yaml file, eg.: -```yaml -ntp_client::servers: - - pstime1.psi.ch - - pstime2.psi.ch - - pstime3.psi.ch -secret_key: ENC[PKCS7,MIIBiQYJKoZIhvcNA...AMA==] -``` +To encrypt sensitive data in your hiera configuration you need the `hiera-eyaml` tool installed on your system. + +To encrypt data you have to use the public key from your Hiera (`data-*`) git repository named `eyaml_public_key.pem` + +For the lower hiera layers (global, server or data) it is on the Puppet server at `/etc/puppetlabs/keys/eyaml/public_key.pkcs7.pem`. + + + +For to encrypt a simple string do -The encrypted values can be decrypted transparently from Hiera (on a host having the proper hiera key): ```bash -[root]# hiera secret_key -this is a secret value +eyaml encrypt --pkcs7-public-key=eyaml_public_key.pem -s secret_string ``` -For encrypting data see [EYAML Secrets in Hiera](eyaml) +and for a complete file + +```bash +eyaml encrypt --pkcs7-public-key=eyaml_public_key.pem -f secret_file +``` +and from pipe + +```bash +eyaml encrypt --pkcs7-public-key=eyaml_public_key.pem --stdin +``` + +For example, to encrypt a password for a system you can do like this: + +```bash +# openssl passwd -6 | eyaml encrypt --pkcs7-public-key=eyaml_public_key.pem --stdin +Password: +Verifying - Password: +string: ENC[PKCS7,MIIB2gYJKoZIhvcNAQcDoIIByzCCAccCAQ...sfLHuai6p+Mdukw/TT1BlKA==] + +OR + +block: > + ENC[PKCS7,MIIB2gYJKoZIhvcNAQcDoIIByzCCAccCAQAxggEhMIIBHQIBAD + AFMAACAQEwDQYJKoZIhvcNAQEBBQAEggEA1vyV8J3LYjfBz5zY1PIs9k9zIC + ... + c+MJa+CzicugI0Ptyq/anhhfWeDeBnZza1/9OCxWqqf3wEcnhJCmxYxBEOLR + AxVw2cf3w0wGRuZ0373LHljGTsfLHuai6p+Mdukw/TT1BlKA==] +# +``` + +and place either the string or the block at the required place in your Hiera YAML. + ### Hiera Variable Interpolation