filmov
tv
How to Anonymization and Data Masking for PostgreSQL in Ubuntu 22.04 LTS Server

Показать описание
In this video, I will show you how to remove or mask Personally Identifiable Information or PII, and other sensitive data from a PostgreSQL database.
PLEASE SUBSCRIBE :)
PLEASE HIT LIKE IF IT HELPED :)
This is sometimes required when you want a copy of production data to your development environment. We don't want sensitive data in our development environment.
The solution is to anonymize or mask the data in our development environment.
We will use the postgresql-anonymizer extension of PostgreSQL which is available in postgres repo.
This tutorial assume you already have the latest PostgreSQL installed on Ubuntu server. If you don't, see the follow the link below for installing Ubuntu server and PostgreSQL.
LINKS:
COMMANDS:
1. Installation
sudo apt -y install make gcc postgresql-server-dev-14
cd postgresql_anonymizer/
make extension PG_CONFIG=/usr/lib/postgresql/14/bin/pg_config
sudo make install PG_CONFIG=/usr/lib/postgresql/14/bin/pg_config
sudo su - postgres
psql
ALTER SYSTEM SET shared_preload_libraries = 'anon';
sudo su - postgres
psql
CREATE EXTENSION anon CASCADE;
2. Static Masking
CREATE TABLE customer(
id SERIAL,
full_name TEXT,
birth DATE,
employer TEXT,
zipcode TEXT,
fk_shop INTEGER
);
\dt
INSERT INTO customer
VALUES
(911,'Chuck Norris','1940-03-10','Texas Rangers', '75001',12),
(312,'David Hasselhoff','1952-07-17','Baywatch', '90001',423)
;
SELECT * FROM customer;
SELECT * FROM customer;
select * from customer;
IS 'MASKED WITH VALUE $$CONFIDENTIAL$$';
select * from customer;
3. Dynamic Masking
CREATE TABLE people ( id TEXT, firstname TEXT, lastname TEXT, phone TEXT);
INSERT INTO people VALUES ('T1','Sarah', 'Conor','0609110911');
SELECT * FROM people;
CREATE USER lazy WITH PASSWORD 'Password1';
SECURITY LABEL FOR anon ON ROLE lazy
IS 'MASKED';
select * from people;
postgres postgres lazy
local all lazy md5
sudo su - postgres
psql
\c - lazy
SELECT * FROM people;
\c - postgres
SELECT * FROM people;
Chapters:
00:00 Intro
00:48 Install postgresql_anonymizer Extension
01:36 Load the Extension
02:36 Static Masking
05:45 Dynamic Masking
08:45 Outro
Please enjoy the video and if you have any questions, leave a comment down below.
Remember to Like, Share and Subscribe if you enjoyed the video!
#postgresql
#database
#ubuntu
#thelazysysadmin
PLEASE SUBSCRIBE :)
PLEASE HIT LIKE IF IT HELPED :)
This is sometimes required when you want a copy of production data to your development environment. We don't want sensitive data in our development environment.
The solution is to anonymize or mask the data in our development environment.
We will use the postgresql-anonymizer extension of PostgreSQL which is available in postgres repo.
This tutorial assume you already have the latest PostgreSQL installed on Ubuntu server. If you don't, see the follow the link below for installing Ubuntu server and PostgreSQL.
LINKS:
COMMANDS:
1. Installation
sudo apt -y install make gcc postgresql-server-dev-14
cd postgresql_anonymizer/
make extension PG_CONFIG=/usr/lib/postgresql/14/bin/pg_config
sudo make install PG_CONFIG=/usr/lib/postgresql/14/bin/pg_config
sudo su - postgres
psql
ALTER SYSTEM SET shared_preload_libraries = 'anon';
sudo su - postgres
psql
CREATE EXTENSION anon CASCADE;
2. Static Masking
CREATE TABLE customer(
id SERIAL,
full_name TEXT,
birth DATE,
employer TEXT,
zipcode TEXT,
fk_shop INTEGER
);
\dt
INSERT INTO customer
VALUES
(911,'Chuck Norris','1940-03-10','Texas Rangers', '75001',12),
(312,'David Hasselhoff','1952-07-17','Baywatch', '90001',423)
;
SELECT * FROM customer;
SELECT * FROM customer;
select * from customer;
IS 'MASKED WITH VALUE $$CONFIDENTIAL$$';
select * from customer;
3. Dynamic Masking
CREATE TABLE people ( id TEXT, firstname TEXT, lastname TEXT, phone TEXT);
INSERT INTO people VALUES ('T1','Sarah', 'Conor','0609110911');
SELECT * FROM people;
CREATE USER lazy WITH PASSWORD 'Password1';
SECURITY LABEL FOR anon ON ROLE lazy
IS 'MASKED';
select * from people;
postgres postgres lazy
local all lazy md5
sudo su - postgres
psql
\c - lazy
SELECT * FROM people;
\c - postgres
SELECT * FROM people;
Chapters:
00:00 Intro
00:48 Install postgresql_anonymizer Extension
01:36 Load the Extension
02:36 Static Masking
05:45 Dynamic Masking
08:45 Outro
Please enjoy the video and if you have any questions, leave a comment down below.
Remember to Like, Share and Subscribe if you enjoyed the video!
#postgresql
#database
#ubuntu
#thelazysysadmin
Комментарии