Skip to content

Instantly share code, notes, and snippets.

@kaparora
Last active April 19, 2020 10:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kaparora/1b3d44f3bf28a028ef0bb8b2ded157d2 to your computer and use it in GitHub Desktop.
Save kaparora/1b3d44f3bf28a028ef0bb8b2ded157d2 to your computer and use it in GitHub Desktop.
#!/bin/sh
#enable the transform secret engine at a path of your choice
vault secrets enable -path=/data-protection/transform transform
#Define a role ssn with transformation name ssn
vault write /data-protection/transform/role/ssn transformations=ssn
#create a transformation of type fpe using built in template for social security number
#and assign role ssn to it that we created earlier
vault write /data-protection/transform/transformation/ssn \
type=fpe \
template=builtin/socialsecuritynumber \
tweak_source=internal \
allowed_roles=ssn
#test if you are able to transform a SSN
vault write /data-protection/transform/encode/ssn value=111-22-3333
#test decode with following statements after executing the above statement
#vault write /data-protection/transform/decode/ssn value=
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment