WindmillWWindmill
Powered by
CuBiCC
Windmill•15mo ago•
13 replies
CuBiC

Permission denied to set role "windmill_admin" on Postgres without superuser

I'm running into issues on an self-hosted instance. I did read the self-host part of the docs regarding Postgres usage without superuser. I'm running Windmill (CE v1.441.2) on Kubernetes and Postgres 17.2 in a cluster provided by Crunchy Postgres Operator.

What I did:
- Created a database
windmill
windmill
and a user
windmill
windmill
which owns the database and applied https://raw.githubusercontent.com/windmill-labs/windmill/main/init-db-as-superuser.sql as a superuser.
- Granted
windmill_user
windmill_user
and
windmill_admin
windmill_admin
to
windmill
windmill
role.
- Granted usage on
public
public
to
windmill_user
windmill_user
and
windmill_admin
windmill_admin
in the
windmill
windmill
database.
windmill=# \du
                                 List of roles
     Role name     |                         Attributes
-------------------+------------------------------------------------------------
 _crunchypgbouncer |
 _crunchyrepl      | Replication
 ccp_monitoring    |
 postgres          | Superuser, Create role, Create DB, Replication, Bypass RLS
 windmill          |
 windmill_admin    | Cannot login, Bypass RLS
 windmill_user     | Cannot login
windmill=# \du
                                 List of roles
     Role name     |                         Attributes
-------------------+------------------------------------------------------------
 _crunchypgbouncer |
 _crunchyrepl      | Replication
 ccp_monitoring    |
 postgres          | Superuser, Create role, Create DB, Replication, Bypass RLS
 windmill          |
 windmill_admin    | Cannot login, Bypass RLS
 windmill_user     | Cannot login

windmill=# \z
                                            Access privileges
 Schema |          Name           | Type |        Access privileges        | Column privileges | Policies
--------+-------------------------+------+---------------------------------+-------------------+----------
 public | pg_stat_statements      | view | postgres=arwdDxtm/postgres     +|                   |
        |                         |      | =r/postgres                    +|                   |
        |                         |      | windmill_user=arwdDxtm/postgres |                   |
 public | pg_stat_statements_info | view | postgres=arwdDxtm/postgres     +|                   |
        |                         |      | =r/postgres                    +|                   |
        |                         |      | windmill_user=arwdDxtm/postgres |                   |
windmill=# \z
                                            Access privileges
 Schema |          Name           | Type |        Access privileges        | Column privileges | Policies
--------+-------------------------+------+---------------------------------+-------------------+----------
 public | pg_stat_statements      | view | postgres=arwdDxtm/postgres     +|                   |
        |                         |      | =r/postgres                    +|                   |
        |                         |      | windmill_user=arwdDxtm/postgres |                   |
 public | pg_stat_statements_info | view | postgres=arwdDxtm/postgres     +|                   |
        |                         |      | =r/postgres                    +|                   |
        |                         |      | windmill_user=arwdDxtm/postgres |                   |

windmill=# \drg
                         List of role grants
   Role name    |         Member of         |   Options    | Grantor
----------------+---------------------------+--------------+----------
 ccp_monitoring | pg_execute_server_program | INHERIT, SET | postgres
 ccp_monitoring | pg_monitor                | INHERIT, SET | postgres
 windmill       | windmill_admin            | INHERIT, SET | postgres
 windmill       | windmill_user             | INHERIT, SET | postgres
 windmill_admin | windmill_user             | INHERIT, SET | postgres
windmill=# \drg
                         List of role grants
   Role name    |         Member of         |   Options    | Grantor
----------------+---------------------------+--------------+----------
 ccp_monitoring | pg_execute_server_program | INHERIT, SET | postgres
 ccp_monitoring | pg_monitor                | INHERIT, SET | postgres
 windmill       | windmill_admin            | INHERIT, SET | postgres
 windmill       | windmill_user             | INHERIT, SET | postgres
 windmill_admin | windmill_user             | INHERIT, SET | postgres

windmill=# \dt
Did not find any relations.
windmill=# \dt
Did not find any relations.


I also tried to
GRANT ALL PRIVILEGES ON DATABASE windmill TO windmill_user
GRANT ALL PRIVILEGES ON DATABASE windmill TO windmill_user
using connections through pgBouncer and primary only (with restart of all components).

App logs when trying to activate "List all workspaces as superadmin":
{"timestamp":"2025-01-03T09:14:08.474363Z","level":"ERROR","message":"Sql error: error returned from database: permission denied to set role \"windmill_admin\"","error":"SqlErr(Database(PgDatabaseError { severity: Error, code: \"42501\", message: \"permission denied to set role \\\"windmill_admin\\\"\", detail: None, hint: None, position: None, where: None, schema: None, table: None, column: None, data_type: None, constraint: None, file: Some(\"guc.c\"), line: Some(6936), routine: Some(\"call_string_check_hook\") }))","target":"windmill_common::error","span":{"email":"admin@windmill.dev","method":"GET","traceId":"32e0fc85-ad29-4c33-858a-fe5858e8da28","uri":"/api/workspaces/list_as_superadmin?per_page=1000","username":"admin@windmill.dev","name":"request"}}          {"timestamp":"2025-01-03T09:14:08.474574Z","level":"ERROR","message":"response","latency":"24","status":400,"target":"windmill_api::tracing_init","span":{"email":"admin@windmill.dev","method":"GET","traceId":"32e0fc85-ad29-4c33-858a-fe5858e8da28","uri":"/api/workspaces/list_as_superadmin?per_page=1000","username":"admin@windmill.dev","name":"request"}}
{"timestamp":"2025-01-03T09:14:08.474363Z","level":"ERROR","message":"Sql error: error returned from database: permission denied to set role \"windmill_admin\"","error":"SqlErr(Database(PgDatabaseError { severity: Error, code: \"42501\", message: \"permission denied to set role \\\"windmill_admin\\\"\", detail: None, hint: None, position: None, where: None, schema: None, table: None, column: None, data_type: None, constraint: None, file: Some(\"guc.c\"), line: Some(6936), routine: Some(\"call_string_check_hook\") }))","target":"windmill_common::error","span":{"email":"admin@windmill.dev","method":"GET","traceId":"32e0fc85-ad29-4c33-858a-fe5858e8da28","uri":"/api/workspaces/list_as_superadmin?per_page=1000","username":"admin@windmill.dev","name":"request"}}          {"timestamp":"2025-01-03T09:14:08.474574Z","level":"ERROR","message":"response","latency":"24","status":400,"target":"windmill_api::tracing_init","span":{"email":"admin@windmill.dev","method":"GET","traceId":"32e0fc85-ad29-4c33-858a-fe5858e8da28","uri":"/api/workspaces/list_as_superadmin?per_page=1000","username":"admin@windmill.dev","name":"request"}}


Appreciate any help.
Screenshot_2025-01-03_102125.png
WindmillJoin
3,388Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements
Recent Announcements
henri-c

We're live here https://discord.com/channels/930051556043276338/1278977038430240813

henri-c · 2d ago

rubenf

Infrastructure as code

rubenf · 3w ago

rubenf

As we're preparing for a new Windmill sandbox SDK, we took the opportunity **to open-source NSJAIL sandboxing** and make it available in CE and easier to set. In 1.634.0, just set nsjail to benefit from the tightest security and isolation per job. It's constraining so no need to use it unless you need but now you won't be restricted in security for CE if you need to.

rubenf · 4w ago

Similar Threads

Permission denied error with windmill and supabase
sangle69Ssangle69 / help
3y ago
permission denied
TreyTTrey / help
3d ago
Permission Denied Error, while windmill is trying to access table
VivekVVivek / help
6d ago
Windmill on Windows without a Docker
քʀօʄɛֆօʀՔքʀօʄɛֆօʀ / help
16mo ago