Sign inSign up

mtsmfm/vanir

By mtsmfm

•Updated over 9 years ago

Vanir is a database masking tool.

Image
0

914

mtsmfm/vanir repository overview

⁠Vanir

Vanir is a database masking tool.

$ cat example.sql
INSERT INTO `users` (name, email) VALUES ("Fumiaki MATSUSHIMA", "[email protected]");
$ cat example.yml
users: # Table name
  name: "AAA" # Simply replace all name with "AAA"
  email: "{{.First 6}}.{{.Hashed}}.{{.Last 3}}@example.com" # You can use go template here
$ cat example.sql | vanir --config example.yml > masked.sql
Masking `users`...
$ cat masked.sql
insert into users(name, email) values ('AAA', '[email protected]');

⁠Usage

  1. Write config file:
users: # Table name
  name: "AAA" # Simply replace all name with "AAA"
  email: "{{.Raw}}+{{.Hashed}}@example.com" # You can use go template here
  1. Pipe the dumped SQL:

At this time, vanir can mask SQL dumped with --complete-insert option only.

    mysqldump --complete-insert | vanir -c path/to/config.yml
⁠Formatting

You can use Go templates⁠ to format output.

FunctionConfigurationInputOutput
Hashed{{.Hashed}}@example.com[email protected]⁠[email protected]⁠
First(n){{.First 3}}@example.com[email protected]⁠[email protected]⁠
Last(n){{.Last 3}}@example.com[email protected]⁠[email protected]⁠
Raw{{.Raw}}@example.com[email protected]⁠[email protected]⁠@example.com
Salt{{.Salt}}@example.com[email protected]⁠[email protected]⁠

⁠Installation

Donwload an executable binary for your platform:

https://github.com/mtsmfm/vanir/releases⁠

⁠Development

⁠Requirements
  • docker
  • docker-compose
⁠Setup
git clone https://github.com/mtsmfm/vanir
cd vanir
docker-compose run app go-wrapper download
⁠Compile
docker-compose run app go-wrapper install
⁠Run
docker-compose run app go-wrapper run

Tag summary

Content type

Image

Digest

Size

250.5 MB

Last updated

over 9 years ago

docker pull mtsmfm/vanir