ldap2pg using a non-superuser role is logging "ERROR: permission denied to reassign objects"
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 54/100
Research direction
Start by reading the database cleanup path that runs REASSIGN OWNED and DROP OWNED when a managed role is removed, along with the configuration handling for databases_query. The report establishes the failing non-superuser case and asks for a way to skip cleanup when managed roles own no database objects; done means that case can be configured without weakening the database connection requirement.
Written by the indexing model from the issue text.
Description
Remove managed roles using a non-superuser
I'm running ldap2pg with a non-superuser called ldap2pg. Now, when ldap2pg removes a managed role, it logs:
LOG: statement: REASSIGN OWNED BY "myrole" TO "postgres";
DROP OWNED BY "myrole";
ERROR: permission denied to reassign objects
DETAIL: Only roles with privileges of role "myrole" may reassign objects owned by it.
I tried making the DB User ldap2pg a member of myrole (GRANT myrole TO ldap2pg), but then ldap2pg logs:
LOG: statement: REASSIGN OWNED BY "myrole" TO "postgres";
DROP OWNED BY "myrole";
ERROR: permission denied to reassign objects
DETAIL: Only roles with privileges of role "postgres" may reassign objects to it.
So I would also need to GRANT postgres TO ldap2pg, but then using a non-superuser isn't meaningful anymore.
I realized that I encountered this issue already 4 years ago: #421. My solution back then was to set databases_query: [none], because I'm not using ldap2pg for managing privileges, and because none of my LDAP users is ever owning any DB object.
However, now that I'm finally upgrading to v6.6.0, this isn't possible anymore. If I set databases_query: [none],
ldap2pg exits with:
level=ERROR msg="databases: connected to an unmanaged database"
(And the docs clearly state that the databases_query must return at least the database that ldap2pg is connected to.)
Is there any other way to skip the REASSIGN OWNED and DROP OWNED step?
- Dominant language
- Go
- Stars
- 241
- Forks
- 37
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 2
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from dalibo/ldap2pg
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 3/5 1-2 days Newbie friendliness 72/100
-
privileges loop: Panic (Stack overflow)Possibly taken @vulragrag-star claimed this 30 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 64/100
-
ldap2pg.yml parsing ERROR: 'rules[2].ldapsearch' has invalid keys: subsearchesPossibly taken @pirlgon claimed this 100 days ago. Open
Similar issues
-
ux
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
evcc-io/evcc#35605 · 1 comment ·
Maintainers usually reply within 1 day
-
bug report
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Maintainers usually reply within 1 day
-
type:bug
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
nightgauge/nightgauge#2732 ·
Maintainers usually reply within 1 day
-
fix below CVEsOpenbug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 5 days
-
good first issue help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 78/100