Small tools to generate password and merge from a stdin
given template.
From commandline
$ echo "{{ strongPassword }}" | pwmrg
9t6\?78.AZ4_w2(5rP1]VH#30K,b<Yc)
Using a complete template
http:
cookie:
encryption_key: "{{ customPassword 128 20 10 false false | b64 }}"
$ cat definition.yaml | pwmrg
http:
cookie:
encryption_key: "SnlPNyZHY11iaUljZWxVZCp5OHZ6TnR2UDZqLkRAV2hmW2lRQ1FTRkY2MDVmcUl3MEZoN00wZjZKSGlrYVJNbE5NN0B0TENMVml+dHNVaGVnbzJTYkNGR1lLSHpCcDVTZ3NpOWVqaFA3VzJBeUhQVVdJezBMMEw1RSppcHRxdjk="
From template to Vault
Consider this JSON file
{
"cookie-secret": "{{ noSymbolPassword }}",
"random-seed": "{{ strongPassword | json }}",
"key-generation-root": "{{ paranoidPassword | json }}"
}
Pull the secret bundle template, merge with generated password, and publish to vault.
curl https://....../bundle.spec.json | pwmrg | vault kv put app/test/12345678912345678 -
If you need to view passwords :
$ vault kv get -format=json -field="data" app/test/12345678912345678
{
"cookie-secret": "0FR4qR7gT7oj3oTcAIijM4e1Uc2tC4r6",
"random-seed": "eZtV)s\\\\I1%v73=48.2do~up06m9!*\\\"5}",
"key-generation-root": "S4v[8xDkp_HEPOT-BjnNoQrLKyFas9#ZC3tR2V]fe6lJ7qh1A+m@5\\x3Ci0YdUGb~{c"
}
No secrets stored on local provisioner machine.
customPassword
{{ customPassword length numDigits numSymbol noUpper allowRepeat }}
length
int : length of the generated passwordnumDigits
int : digits count in generated passwordnumSymbol
int : symbol count in generated passwordnoUpper
bool : disable uppercase lettersallowRepeat
bool : disable character repetition
paranoidPassword
{{ paranoidPassword }}
noSymbolPassword
Generate a 64
characters length, with 10
digits and 10
symbols, with uppercase and without repetition.
{{ noSymbolPassword }}
Generate a 64
characters length, with 20
digits without symbols
, with uppercase and with
repetition.
strongPassword
{{ strongPassword }}
Generate a 32
characters length, with 10
digits and 10
symbols, with uppercase and without repetition.
b64
{{ strongPassword | b64 }}
Encode a given string using Standard Base64 encoding.
json
{{ strongPassword | json }}
Escape symbols in generated password to be compliant as a JSON string value.
html
{{ strongPassword | html }}
Escape symbols in generated password to be compliant for HTML display.
url
Escape symbols in generated password to be compliant for URL usages.
{{ strongPassword | url }}