Tool to create database dump and anonymize its data.
CLI tool for securely anonymizing personal data from databases according to specified settings.
- PHP 8.1 or higher
- MySQL database access
- PHP
pdo
extension for your DBMS
- Download the latest
antiseptic.phar
from Releases - Make the file executable:
chmod +x antiseptic.phar
- If you want to use the command system wide you can copy it to /usr/local/bin.
sudo mv antiseptic.phar /usr/local/bin/antiseptic
php antiseptic.phar sanitize [OPTIONS] OUTPUT_FILENAME
OUTPUT_FILENAME
- Path to output dump file, if not set, will be used stdout
Option | Description |
---|---|
-c, --config=FILE |
Path to configuration file [ default: .antiseptic_config.yml ] |
-v, --verbose |
Verbose output |
--help |
Show help message |
# Standard cleanup with config
php antiseptic.phar sanitize -c config_magento.yaml sanitized_backup.sql
# With default config run
php antiseptic.phar sanitize sanitized_backup.sql
Create a YAML configuration file (see config.yml.dist
, config_magento.yml.dist
):
locale: 'ru_RU' #default value en_US
source_db:
dsn: 'mysql:host=<host>;port=<port>;dbname=<dbname>'
user: 'dbusername'
pass: 'dbpassword'
table_wheres:
admin_user: "`username` = 'admin'" # leave only one user with name admin
table_limits:
cache: 0 # create empty table
dump_settings:
exclude-tables:
- '/_tmp$/'
tables: #list tables and fields for anonymize data
customer:
email:
formatter: 'email'
unique: true
firstname:
formatter: 'firstName'
lastname:
formatter: 'lastName'
This section of the config is compatible with settings
This section of the config describes which table and fields from the table should be replaced with fake data.
Formatter can be set any formatter from list formatters
You can pass args to the formatter function using the following syntax:
customer_address_entity:
telephone:
formatter:
name: 'numerify'
args:
- '(###) ###-##-##'
- If you set a limit or condition to select some records from a table,
it's not involved in limiting for related records by a foreign key in another table. Be attending with it.
MIT License. See LICENSE file.