-
Hello, Technical env
What am I trying to achieve?
From my understanding (and reading the documentation), I see a limitation to what I'm trying to achieve.
But I have not been able to make that work when initiating a mysql connection. Maybe the solution is to create two roles (one with So my question is, what is the best way to achieve what I'm trying to do? Thanks! :-) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
This is what I end-up having with two roles (using apiVersion: resources.teleport.dev/v1
kind: TeleportRoleV7
metadata:
name: tests-psql
spec:
allow:
db_labels:
engine:
- aurora-postgresql
- postgres
db_names:
- '{{internal.db_names}}'
db_permissions:
- match:
database:
- '{{internal.db_names}}'
name:
- '!pg_statistic'
object_kind:
- table
permissions:
- SELECT
- INSERT
- UPDATE
- DELETE
- TRUNCATE
- REFERENCES
- TRIGGER
...
deny: {}
options:
create_db_user: true
create_db_user_mode: keep Then, in addition to what is in the MySQL Automatic User Provisioning Guide I create a role named CREATE ROLE IF NOT EXISTS 'read-only', 'admin'@'%' ;
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, PROCESS, REFERENCES, INDEX, ALTER, SHOW DATABASES, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER ON *.* TO 'admin' ; (please do not be alarmed by the extend of the GRANTs, it's for my testing purpose. And then, the role for MySQL apiVersion: resources.teleport.dev/v1
kind: TeleportRoleV7
metadata:
name: tests-mysql
spec:
allow:
db_labels:
engine:
- aurora-mysql
- mariadb
db_names:
- '{{internal.db_names}}'
db_roles:
- read-write
...
deny: {}
options:
create_db_user: true
create_db_user_mode: keep Is this the correct way to do this? Thanks! |
Beta Was this translation helpful? Give feedback.
Yes, this looks correct to me. Having two roles which target different databases is perfectly fine and will
work as you expect.