Sign inSign up

afisme/database-proxy

By afisme

•Updated about 1 month ago

With this proxy, you can encrypt and decrypt data without or minimal changing the application code.

Image
Databases & storage
1

1.7K

afisme/database-proxy repository overview

⁠How to run this image ?

⁠Download demo license
curl -o license.pem https://storage.googleapis.com/afis.me/shared/Licenses/demo_cert.pem
⁠Run image

Write example app.yaml config

cat <<EOF > app.yaml
log:
  level: trace
  format: pretty

tracing:
  provider: none

# enable metrics
# access url /api/metrics
metrics:
  enabled: true
  listen: :9191
  username: admin
  password: admin

encryption:
  provider: env
  pepper: secretPepper
  env:
    key: SECRET_ENC_KEY

proxy:
  postgres:
    enabled: true
    listen: :5433
    host: localhost:5432

# only use for migration
migration:
  limit: 1000
  sleep: 250ms
  setNull: true
  postgres:
    native:
      host: localhost
      port: 5432
      user: root
      pass: root
      name: demo
      maxOpenConn: 100
      maxIdleConn: 20
      connMaxLifetime: 5
      connMaxIdleTime: 1
    proxy:
      host: localhost
      port: 5433
      user: root
      pass: root
      name: demo
      maxOpenConn: 100
      maxIdleConn: 20
      connMaxLifetime: 5
      connMaxIdleTime: 1

rules:
  demo: # database name
    read: # read rules
      general: [username, email, phone, balance, pin, first_name, last_name, address]
      json:
        company: [ip, name]
    write: # insert and update or select, if select in subquery, always use read rules
      users: # users table
        username: # column username
          hash: true # if true, the value will be hashed
        email: # column email
          hash: true
        phone: # column phone
          hash: true
        balance: # column balance
          hash: false
        pin: # column pin
          hash: true
      users_data: # users_data table
        first_name: # column first_name
          hash: true
        last_name: # column last_name
          hash: true
        address: # column address
          hash: false
        company: # column company
          json: true
          fields:
            ip: # column ip
              hash: true
            name: # column name
              hash: false
EOF
docker run --name database-proxy -d --memory=2g --cpus=2 \
-e SECRET_ENC_KEY=MysecretKey \
-e LICENSE=/etc/license.pem \
-v $(pwd)/app.yaml:/etc/app.yaml:ro \
-v $(pwd)/license.pem:/etc/license.pem:ro  \
afisme/database-proxy:latest

Tag summary

Content type

Image

Digest

sha256:9ca35828f…

Size

21.4 MB

Last updated

about 1 month ago

docker pull afisme/database-proxy