Skip to content

Feat/pgsodium vault updates #411

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
Dec 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ ENV LC_ALL en_US.UTF-8

COPY ansible/files/pgbouncer_config/pgbouncer_auth_schema.sql /docker-entrypoint-initdb.d/00-schema.sql
COPY ansible/files/stat_extension.sql /docker-entrypoint-initdb.d/01-extension.sql
COPY ansible/files/sodium_extension.sql /docker-entrypoint-initdb.d/02-sodium-extension.sql
# COPY ansible/files/sodium_extension.sql /docker-entrypoint-initdb.d/02-sodium-extension.sql
COPY migrations/db/ /docker-entrypoint-initdb.d/

CMD ["postgres", "-c", "config_file=/etc/postgresql/postgresql.conf"]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Unmodified Postgres with some useful plugins. Our goal with this repo is not to
| [pg_net](https://github.com/supabase/pg_net) | [v0.6.1](https://github.com/supabase/pg_net/releases/tag/v0.6.1) | Expose the SQL interface for async networking. |
| [rum](https://github.com/postgrespro/rum) | [1.3.13](https://github.com/postgrespro/rum/releases/tag/1.3.13) | An alternative to the GIN index. |
| [pg_hashids](https://github.com/iCyberon/pg_hashids) | [commit](https://github.com/iCyberon/pg_hashids/commit/83398bcbb616aac2970f5e77d93a3200f0f28e74) | Generate unique identifiers from numbers. |
| [pgsodium](https://github.com/michelp/pgsodium) | [2.0.0](https://github.com/michelp/pgsodium/releases/tag/2.0.0) | Modern encryption API using libsodium. |
| [pgsodium](https://github.com/michelp/pgsodium) | [3.1.0](https://github.com/michelp/pgsodium/releases/tag/2.0.0) | Modern encryption API using libsodium. |
| [pg_stat_monitor](https://github.com/percona/pg_stat_monitor) | [1.0.1](https://github.com/percona/pg_stat_monitor/releases/tag/1.0.1) | Query Performance Monitoring Tool for PostgreSQL


Expand Down
1 change: 0 additions & 1 deletion ansible/playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
dest: "00-schema.sql",
}
- { source: "stat_extension.sql", dest: "01-extension.sql" }
- { source: "sodium_extension.sql", dest: "02-sodium-extension.sql" }

environment:
PATH: /usr/lib/postgresql/bin:{{ ansible_env.PATH }}
Expand Down
4 changes: 2 additions & 2 deletions ansible/tasks/setup-extensions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@
- name: Install auto_explain
import_tasks: tasks/postgres-extensions/21-auto_explain.yml

# - name: Install vault
# import_tasks: tasks/postgres-extensions/23-vault.yml
- name: Install vault
import_tasks: tasks/postgres-extensions/23-vault.yml

- name: Install PGroonga
import_tasks: tasks/postgres-extensions/24-pgroonga.yml
Expand Down
8 changes: 4 additions & 4 deletions ansible/vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,17 +95,17 @@ vector_arm_deb: "https://packages.timber.io/vector/0.22.3/vector_0.22.3-1_arm64.
libsodium_release: "1.0.18"
libsodium_release_checksum: sha1:795b73e3f92a362fabee238a71735579bf46bb97

pgsodium_release: "3.0.4"
pgsodium_release_checksum: sha1:f08e9ac109ab5e6fc8b15ea21b26f88f451a2070
pgsodium_release: "3.1.0"
pgsodium_release_checksum: sha1:b77c384e2908064dca136f87163d011cd56edd54

pg_graphql_release: "v1.0.0"

pg_jsonschema_release: "v0.1.3"

pg_stat_monitor_release: "1.1.1"

vault_release: "0.0.1"
vault_release_checksum: sha1:a5ea3356c6f41985b2bef67b6a0491d4ffa99816
vault_release: "0.2.3"
vault_release_checksum: sha256:463cea027d19edda1f4e8025180db0a90535233cb9edd850d6d153aad8f609d1

groonga_release: "12.0.8"
groonga_release_checksum: sha1:32aee787efffc2a22760fde946fb6462286074e2
Expand Down
2 changes: 1 addition & 1 deletion common.vars.pkr.hcl
Original file line number Diff line number Diff line change
@@ -1 +1 @@
postgres-version = "15.1.0.2"
postgres-version = "15.1.0.3-rc0"
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
-- migrate:up

create extension if not exists pgsodium;

grant pgsodium_keyiduser to postgres with admin option;
grant pgsodium_keyholder to postgres with admin option;
grant pgsodium_keymaker to postgres with admin option;

do $$
begin
if not exists (select from pg_extension where extname = 'supabase_vault') then
create extension supabase_vault;
-- Creating the extension creates a table and creates a security label on the table.
-- Creating the security label triggers a function that recreates these objects.
-- Since the recreation happens in an extension script, these objects become owned by the `supabase_vault` extension.
-- This is an issue because then we can't recreate these objects without also dropping the extension.
-- Thus we drop the dependency on the `supabase_vault` extension for these objects.
alter extension supabase_vault drop view pgsodium.decrypted_key;
alter extension supabase_vault drop function pgsodium.key_encrypt_secret;
end if;
end;
$$;

-- migrate:down
4 changes: 2 additions & 2 deletions migrations/tests/database/exists.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ SELECT schemas_are(ARRAY[
'public',
'auth',
'extensions',
'graphql',
'graphql_public',
'realtime',
'storage'
'storage',
'vault'
]);