Skip to content

Commit 6767a7e

Browse files
Merge pull request #38 from sebix/docs
add missing SQL statements and add more docs
2 parents da1d86f + 42e4765 commit 6767a7e

2 files changed

Lines changed: 25 additions & 2 deletions

File tree

README.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,13 +164,20 @@ createdb --encoding=UTF8 --template=template0 contactdb
164164
psql -f /usr/share/intelmq-certbund-contact/sql/initdb.sql contactdb
165165
```
166166

167-
A database user with the right to select the data in the Contact DB
167+
A database user (`intelmq`) with the right to select the data in the Contact DB
168168
must be created. This is the account, which will be used in the bot's
169169
configuration for accessing the database.
170170

171+
Also, a database user (`fody`) with write permissions on the tables
172+
must be created. This account can be used for the fody backend
173+
configuration (`/etc/intelmq/contactdb_server.conf`) and the RIPE
174+
Update Script.
175+
171176
```bash
172177
createuser intelmq --pwprompt
173-
psql -c "GRANT SELECT ON ALL TABLES IN SCHEMA public TO intelmq;" contactdb
178+
psql -c "GRANT contactdb_ro TO intelmq;" contactdb
179+
createuser fody --pwprompt
180+
psql -c "GRANT contactdb_rw TO intelmq;" contactdb
174181
```
175182

176183
#### Adding default email tags

sql/initdb.sql

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
BEGIN;
22

3+
CREATE ROLE IF NOT EXISTS contactdb_owner
4+
NOLOGIN NOSUPERUSER NOINHERIT NOCREATEDB CREATEROLE;
5+
CREATE ROLE IF NOT EXISTS contactdb_ro
6+
NOLOGIN NOSUPERUSER NOINHERIT NOCREATEDB CREATEROLE;
7+
CREATE ROLE IF NOT EXISTS contactdb_rw
8+
NOLOGIN NOSUPERUSER NOINHERIT NOCREATEDB CREATEROLE;
9+
10+
SET ROLE contactdb_owner;
11+
312
/*
413
Template table containing with elements for automatic tables
514
*/
@@ -485,4 +494,11 @@ CREATE TABLE IF NOT EXISTS audit_log (
485494
"after" JSONB
486495
);
487496

497+
GRANT SELECT, INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA public TO contactdb_rw;
498+
GRANT USAGE ON ALL SEQUENCES IN SCHEMA public TO contactdb_rw;
499+
GRANT SELECT ON ALL TABLES IN SCHEMA public TO contactdb_ro;
500+
501+
GRANT contactdb_ro TO intelmq;
502+
GRANT contactdb_rw TO fody;
503+
488504
COMMIT;

0 commit comments

Comments
 (0)