diff options
author | BlackDex <[email protected]> | 2022-11-20 19:15:45 +0100 |
---|---|---|
committer | BlackDex <[email protected]> | 2022-11-27 23:36:34 +0100 |
commit | 2ea9b669438cdff048d74cb49c9f6777e9018371 (patch) | |
tree | e297b122f0f473ddf2750e964aa43926fab5a01b /migrations | |
parent | f3beaea9e95ff7fff679289916232c95621b517c (diff) | |
download | vaultwarden-2ea9b669438cdff048d74cb49c9f6777e9018371.tar.gz vaultwarden-2ea9b669438cdff048d74cb49c9f6777e9018371.zip |
Add Organizational event logging feature
This PR adds event/audit logging support for organizations.
By default this feature is disabled, since it does log a lot and adds
extra database transactions.
All events are touched except a few, since we do not support those
features (yet), like SSO for example.
This feature is tested with multiple clients and all database types.
Fixes #229
Diffstat (limited to 'migrations')
6 files changed, 60 insertions, 0 deletions
diff --git a/migrations/mysql/2022-10-18-170602_add_events/down.sql b/migrations/mysql/2022-10-18-170602_add_events/down.sql new file mode 100644 index 00000000..8b975bc3 --- /dev/null +++ b/migrations/mysql/2022-10-18-170602_add_events/down.sql @@ -0,0 +1 @@ +DROP TABLE event; diff --git a/migrations/mysql/2022-10-18-170602_add_events/up.sql b/migrations/mysql/2022-10-18-170602_add_events/up.sql new file mode 100644 index 00000000..24e1c8cd --- /dev/null +++ b/migrations/mysql/2022-10-18-170602_add_events/up.sql @@ -0,0 +1,19 @@ +CREATE TABLE event ( + uuid CHAR(36) NOT NULL PRIMARY KEY, + event_type INTEGER NOT NULL, + user_uuid CHAR(36), + org_uuid CHAR(36), + cipher_uuid CHAR(36), + collection_uuid CHAR(36), + group_uuid CHAR(36), + org_user_uuid CHAR(36), + act_user_uuid CHAR(36), + device_type INTEGER, + ip_address TEXT, + event_date DATETIME NOT NULL, + policy_uuid CHAR(36), + provider_uuid CHAR(36), + provider_user_uuid CHAR(36), + provider_org_uuid CHAR(36), + UNIQUE (uuid) +); diff --git a/migrations/postgresql/2022-10-18-170602_add_events/down.sql b/migrations/postgresql/2022-10-18-170602_add_events/down.sql new file mode 100644 index 00000000..8b975bc3 --- /dev/null +++ b/migrations/postgresql/2022-10-18-170602_add_events/down.sql @@ -0,0 +1 @@ +DROP TABLE event; diff --git a/migrations/postgresql/2022-10-18-170602_add_events/up.sql b/migrations/postgresql/2022-10-18-170602_add_events/up.sql new file mode 100644 index 00000000..2d107b41 --- /dev/null +++ b/migrations/postgresql/2022-10-18-170602_add_events/up.sql @@ -0,0 +1,19 @@ +CREATE TABLE event ( + uuid CHAR(36) NOT NULL PRIMARY KEY, + event_type INTEGER NOT NULL, + user_uuid CHAR(36), + org_uuid CHAR(36), + cipher_uuid CHAR(36), + collection_uuid CHAR(36), + group_uuid CHAR(36), + org_user_uuid CHAR(36), + act_user_uuid CHAR(36), + device_type INTEGER, + ip_address TEXT, + event_date TIMESTAMP NOT NULL, + policy_uuid CHAR(36), + provider_uuid CHAR(36), + provider_user_uuid CHAR(36), + provider_org_uuid CHAR(36), + UNIQUE (uuid) +); diff --git a/migrations/sqlite/2022-10-18-170602_add_events/down.sql b/migrations/sqlite/2022-10-18-170602_add_events/down.sql new file mode 100644 index 00000000..8b975bc3 --- /dev/null +++ b/migrations/sqlite/2022-10-18-170602_add_events/down.sql @@ -0,0 +1 @@ +DROP TABLE event; diff --git a/migrations/sqlite/2022-10-18-170602_add_events/up.sql b/migrations/sqlite/2022-10-18-170602_add_events/up.sql new file mode 100644 index 00000000..e6b32722 --- /dev/null +++ b/migrations/sqlite/2022-10-18-170602_add_events/up.sql @@ -0,0 +1,19 @@ +CREATE TABLE event ( + uuid TEXT NOT NULL PRIMARY KEY, + event_type INTEGER NOT NULL, + user_uuid TEXT, + org_uuid TEXT, + cipher_uuid TEXT, + collection_uuid TEXT, + group_uuid TEXT, + org_user_uuid TEXT, + act_user_uuid TEXT, + device_type INTEGER, + ip_address TEXT, + event_date DATETIME NOT NULL, + policy_uuid TEXT, + provider_uuid TEXT, + provider_user_uuid TEXT, + provider_org_uuid TEXT, + UNIQUE (uuid) +); |