tonicai / masquerade Goto Github PK
View Code? Open in Web Editor NEWA Postgres Proxy to Mask Data in Realtime
Home Page: https://www.tonic.ai/post/masquerade-a-postgres-proxy/
License: MIT License
A Postgres Proxy to Mask Data in Realtime
Home Page: https://www.tonic.ai/post/masquerade-a-postgres-proxy/
License: MIT License
I am trying to run pg_dump but fails with the message bellow:
pg_dump: error: query failed: server closed the connection unexpectedly This probably means the server terminated abnormally before or while processing the request. pg_dump: error: query was: COPY public.table_name (<COLUMNS_NAMES>) TO stdout;
pg_dump with insert statements works fine.
Because the restore with inserts takes too long, would be nice to have support for COPY statements.
Trying not to be too hideous myself, Is there interest in supporting this?
Thank you.
Hi,
I wanna pass sslmode : "disable" in JSON config file but it seems that proxy is ignoring this line
Hey guys,
Awesome tool you've created here, but I've run into some snags when attempting to dockerize it.
I've gotten the tool itself running successfully within a docker container. It can see my dockerized DB, and it's able to connect according to the following output:
$ docker-compose up proxy
Recreating masquerade-proxy_proxy_1 ... done
Attaching to masquerade-proxy_proxy_1
proxy_1 | Starting Proxy...
proxy_1 | Proxy Running:
proxy_1 | Proxy Port: 20000
proxy_1 | Database Details: [email protected]:5432/test_db_proxy
Docker status while running shows it online and forwarding the proper port:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a7bc6476f7fe masquerade-proxy_proxy "/bin/sh -c ./start.…" About a minute ago Up About a minute 0.0.0.0:20000->20000/tcp masquerade-proxy_proxy_1
Here's my dockerfile:
FROM mcr.microsoft.com/dotnet/core/sdk:2.2
RUN apt-get update && apt-get -y install git
WORKDIR /app
RUN git clone https://github.com/TonicAI/masquerade.git .
COPY start.sh ./
RUN chmod +x start.sh
CMD ./start.sh
the start.sh entrypoint:
#!/bin/bash
# Find the IP of the PG container and use it to populate the config.json file
POSTGRES_IP=`getent hosts postgres | awk '{ print $1 }'`
sed 's/POSTGRES_IP/'"$POSTGRES_IP"'/g' config.sample.json > config.json
dotnet run
docker-compose file:
version: "3"
services:
proxy:
build: .
ports:
- 20000:20000
external_links:
- postgres_db:postgres
volumes:
- "~/Projects/masquerade-proxy/config.sample.json:/app/config.sample.json"
networks:
default:
external:
name: test_default
and config.sample.json as well:
{
"proxy_port":20000,
"db_connection_details": {
"port": 5432,
"ip": "POSTGRES_IP",
"user":"postgres",
"password":"dev",
"database":"test_db_proxy"
},
"masking_options": {
"preserve_keys": false,
"column_masks": [{
"column":"full_name",
"table":"users",
"schema":"public",
"masking_function":"maskx"
}],
"data_type_masks": [
{
"data_type": "text",
"masking_function":"maskcharacters"
}
]
}
}
However, when I try to connect to the proxy, which has port 20000 exposed to the docker host, I get the following:
$ psql "host=127.0.0.1 port=20000 dbname=test_db_proxy sslmode=disable" postgres
psql: server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
When I terminate the proxy, I get the expected error of Connection refused because the PG server cannot be found, like you would if you tried to connect on a random port where nothing is listening. This would indicate that my DB clients (tried psql, Postico, and DBeaver) are able to see the proxy, but they cannot properly connect to it.
Any ideas as to what could be causing this would be appreciated!
Hello, I want to mascarade my DATA with TonicAI / masquerade
i did everything in start guide, and it works, but how to get to know about masarading functions?
is it possible do not mask some columns from my tables?
And here is an answer
go to folder masquerade/Maskers/
analyse namespaces
found mask function :Identity
it returns the same value
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.