Задание 2: Инициализация расширения
-
Убедитесь, что расширение
anonустановлено:postgres@prod=# \dxList of installed extensions┌─────────┬────────────┬────────────┬──────────────────────────────┐│ Name │ Version │ Schema │ Description │├─────────┼────────────┼────────────┼──────────────────────────────┤│ anon │ 1.3.1-psql │ public │ Data anonymization tools ││ plpgsql │ 1.1 │ pg_catalog │ PL/pgSQL procedural language │└─────────┴────────────┴────────────┴──────────────────────────────┘(2 rows) -
Выполните запрос:
postgres@prod=# SELECT * FROM anon.address;┌─────┬─────┐│ oid │ val │├─────┼─────┤└─────┴─────┘(0 rows)Таблицы пустые.
-
Осуществите инициализацию таблиц:
postgres@prod=# SELECT * FROM anon.init();┌──────┐│ init │├──────┤│ t │└──────┘(1 row)При инициализации загружаются таблицы подстановок, а также случайно генерируются заполнение таблиц ИНН, ОГРН, СНИЛС, случайно выбираются до 2500 значений ФИО по соответствию пола.
-
Проверьте содержимое таблиц:
postgres@prod=# SELECT * FROM anon.address limit 5;┌─────┬───────────────────────────────────────────────────────────┐│ oid │ val │├─────┼───────────────────────────────────────────────────────────┤│ 0 │ 3110 Mary Forge Suite 065, Port Sarah, KY 77260 ││ 1 │ 17545 Latoya Estate, East Emily, IL 11377 ││ 2 │ USNS Solis, FPO AA 13761 ││ 3 │ 775 Smith Spurs, Hayesmouth, LA 09012 ││ 4 │ 7412 Gilbert Forks Suite 846, South Seanchester, ID 11052 │└─────┴───────────────────────────────────────────────────────────┘(5 rows)postgres@prod=# SELECT * FROM anon.city limit 5;┌─────┬──────────────────┐│ oid │ val │├─────┼──────────────────┤│ 0 │ Christopherview ││ 1 │ Jasonland ││ 2 │ Port Anthonybury ││ 3 │ Robinsonton ││ 4 │ Mcguirebury │└─────┴──────────────────┘(5 rows)postgres@prod=# SELECT * FROM anon.company limit 5;┌─────┬─────────────────┐│ oid │ val │├─────┼─────────────────┤│ 0 │ Miller-Scott ││ 1 │ Arroyo Inc ││ 2 │ Rasmussen Group ││ 3 │ Baker Group ││ 4 │ Allen-Spears │└─────┴─────────────────┘(5 rows)postgres@prod=# SELECT * FROM anon.email limit 5;┌─────┬───────────────────────────┐│ oid │ val │├─────┼───────────────────────────┤│ 0 │ christopher45@example.org ││ 1 │ garciaanthony@example.org ││ 2 │ drobinson@example.com ││ 3 │ john49@example.com ││ 4 │ jamesgarcia@example.com │└─────┴───────────────────────────┘(5 rows) -
Словари должны лежать в следующей директории:
[postgres@ServerName ~]$ ls -la /usr/pangolin-6.7/share/extension/anontotal 152drwx------. 5 postgres postgres 4096 Sep 15 17:03 .drwx------. 3 postgres postgres 32768 Sep 15 17:03 ..-rw-------. 1 postgres postgres 92373 Jul 3 23:29 anon--1.3.1-psql.sqldrwx------. 3 postgres postgres 4096 Sep 15 17:03 en_USdrwx------. 3 postgres postgres 4096 Sep 15 17:03 fr_FR-rw-------. 1 postgres postgres 6757 Jul 3 23:29 identifier.csv-rw-------. 1 postgres postgres 1121 Jul 3 23:29 identifiers_category.csvdrwx------. 3 postgres postgres 4096 Sep 15 17:03 ru_RU -
Набор несуществующих (фейковых) данных для обфускации хранится соответствующем каталоге:
[postgres@ServerName ~]$ ls -la /usr/pangolin-6.7/share/extension/anon/en_US/total 12drwx------. 3 postgres postgres 4096 Sep 15 17:03 .drwx------. 5 postgres postgres 4096 Sep 15 17:03 ..drwx------. 2 postgres postgres 4096 Sep 15 17:03 fake[postgres@ServerName ~]$ ls -la /usr/pangolin-6.7/share/extension/anon/en_US/fake/total 508drwx------. 2 postgres postgres 4096 Sep 15 17:03 .drwx------. 3 postgres postgres 4096 Sep 15 17:03 ..-rw-------. 1 postgres postgres 50734 Jul 3 23:29 address.csv-rw-------. 1 postgres postgres 17913 Jul 3 23:29 city.csv-rw-------. 1 postgres postgres 22706 Jul 3 23:29 company.csv-rw-------. 1 postgres postgres 3944 Jul 3 23:29 country.csv-rw-------. 1 postgres postgres 27677 Jul 3 23:29 email.csv-rw-------. 1 postgres postgres 9614 Jul 3 23:29 first_name.csv-rw-------. 1 postgres postgres 27890 Jul 3 23:29 iban.csv-rw-------. 1 postgres postgres 14002 Jul 3 23:29 last_name.csv-rw-------. 1 postgres postgres 280647 Jul 3 23:29 lorem_ipsum.csv-rw-------. 1 postgres postgres 10 Jul 3 23:29 middle_name.csv-rw-------. 1 postgres postgres 10890 Jul 3 23:29 postcode.csv-rw-------. 1 postgres postgres 22890 Jul 3 23:29 siret.csv