Coder Social home page Coder Social logo

dbanon's Introduction

dbanon

Build Status

A run-anywhere, dependency-less database anonymizer.

Installation

Download the latest release from GitHub.

Usage

dbanon reads from stdin and writes to stdout.

mysqldump --complete-insert mydb | dbanon -config=myconfig.yml | gzip > mydb.sql.gz

The -config flag can use bundled configurations or point to the path of a custom configuration file.

Configuration

Magento 2

dbanon bundles a default Magento 2 configuration file. However you almost certainly won't use it directly.

At minimum, you'll first need to run the map-eav subcommand. This translates EAV attribute codes to their respective attribute ids.

You must feed it a mysqldump of eav_entity_type and eav_attribute (in that order).

mysqldump --complete-insert mydb eav_entity_type eav_attribute | dbanon -config=magento2 map-eav > ~/magento2-mapped.yml

map-eav will replace the attribute codes in the config file with attribute ids and print an updated config to stdout.

Next you'd run dbanon with the config generated by map-eav.

mysqldump --complete-insert mydb | dbanon -config=~/magento2-mapped.yml | gzip > mydb.sql.gz

Most Magento 2 databases, however, will have additional data that needs to be anonymized beyond the default bundled file.

For this you'll first want to create a new configuration file based off the bundled configuration. Instructions on customizing the configuration file are included in the "Custom Configuration" section.

Custom Configuration

Specify the path to your config file via the -config flag

mysqldump --complete-insert mydb | dbanon -config=myconfig.yml | gzip > mydb.sql.gz

See the etc directory for examples.

Columns are specified as key / value pairs. The value string winds up getting passed to this function, which gets random values from dmgk/faker

Limitations

  • Currently only supports MySQL
  • Currently requires mysqldump be run with --complete-insert flag.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.