Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set_user 3.0 still use superuser_whitelist parameter instead of superuser_allowlist #56

Closed
Jamespsql opened this issue Dec 10, 2021 · 8 comments · Fixed by #67
Closed

Comments

@Jamespsql
Copy link

It's set_user 3.0, we want to leverage set_user to escalate to superuser for individual DBAs IDs. , frollow the readme , shoulde use set_user.superuser_allowlist, but per my test, set_user.superuser_whitelist doest not work, still need to use old version's parameter
set_user.superuser_whitelist.

set_user.superuser_whitelist = '+dbadmin'
#set_user.superuser_allowlist = '+dbadmin'
set_user.block_log_statement=on
set_user.nosuperuser_target_whitelist = ''
#set_user.nosuperuser_target_allowlist = ''

@mpalmi
Copy link
Collaborator

mpalmi commented Dec 14, 2021

Thanks for the report @Jamespsql. Do you mind sharing the configuration you had and the expected functionality/what you saw? The example above does not have any allowlist variables defined (they're all commented out).

@Jamespsql
Copy link
Author

Jamespsql commented Dec 15, 2021 via email

@mpalmi
Copy link
Collaborator

mpalmi commented Dec 15, 2021

Thanks for the detailed response! I've gone ahead and tested this out locally on my 12.9 instance, since it's what I have up at the moment. Your test scenario worked as expected for the allowlist variable.

I'll try to reproduce with your exact setup when I have some time, but in the meantime, I just want to verify some assumptions:

  1. The behavior you're describing could result from an unset allowlist/whitelist after installing set_user. Could you add a SHOW set_user.superuser_allowlist to your test thread prior to the initial attempt to escalate?

  2. Is it possible you did not issue a sighup (or the restart did not actually restart postgres) prior to the initial escalation attempt?

  3. Is it possible you have some settings in postgresql.auto.conf?

  4. What does the output of \du show? (just for grins)

I appreciate your patience. We'll get this sorted out as soon as possible.

@Jamespsql
Copy link
Author

Jamespsql commented Dec 15, 2021 via email

@Yaco312
Copy link

Yaco312 commented Jul 14, 2022

**Hello,

I am having a similar issue with set_user 3,0 running postgresql 14.4 on Windows 2019,

When set_user.superuser_allowlist is used in postgresql.conf it does not load on startup of the database and defaults to "*".
When using pg_reload_conf(), using the same postgresql.conf file it loads the proper value. See TEST CASE 1 below.

When using set_user.superuser_whitelist instead in postgresql.conf, it loads correctly on database startup and also when using pg_reload_conf(); See TEST CASE 2

Test case 1
postgresql.conf (using set_user.superuser_allowlist)
set_user.block_alter_system = on
set_user.block_copy_program = off
set_user.block_log_statement= on
set_user.superuser_allowlist = '+ftier3'

Database instance started or rebounced.

select * from pg_settings where name ~'set_user';
name | setting | unit | category |
---------------------------------------+---------+--------+--------------------+
set_user.block_alter_system | on | (NULL) | Customized Options |
set_user.block_copy_program | off | (NULL) | Customized Options |
set_user.block_log_statement | on | (NULL) | Customized Options |
set_user.exit_on_error | on | (NULL) | Customized Options |
set_user.nosuperuser_target_allowlist | * | (NULL) | Customized Options |
set_user.superuser_allowlist | * | (NULL) | Customized Options |
set_user.superuser_audit_tag | AUDIT | (NULL) | Customized Options |

set_user.superuser_allowlist is set to "*" even if postgresql.conf is set to +ftier3.

show set_user.superuser_allowlist;
set_user.superuser_allowlist
------------------------------+
*

show set_user.superuser_whitelist;
set_user.superuser_whitelist
------------------------------+
*

When reloading instance pg_reload_conf() it used set_user.superuser_allowlist correctly in postgresql.conf

select pg_reload_conf();

select * from pg_settings where name ~'set_user';
name | setting | unit | category |
---------------------------------------+---------+--------+--------------------+
set_user.block_alter_system | on | (NULL) | Customized Options |
set_user.block_copy_program | off | (NULL) | Customized Options |
set_user.block_log_statement | on | (NULL) | Customized Options |
set_user.exit_on_error | on | (NULL) | Customized Options |
set_user.nosuperuser_target_allowlist | * | (NULL) | Customized Options |
set_user.superuser_allowlist | +ftier3 | (NULL) | Customized Options |
set_user.superuser_audit_tag | AUDIT | (NULL) | Customized Options |

show set_user.superuser_allowlist;
set_user.superuser_allowlist
------------------------------+
+ftier3

show set_user.superuser_whitelist;
set_user.superuser_whitelist
------------------------------+
+ftier3

When specifying set_user.superuser_allowlist in postgresql.conf, the parameter is only used when the
configuration file is reloaded using select pg_reload_conf();
If the instance is shutdown and restarted, it defaults to set_user.superuser_whitelist which is not set,
therefore setting it to "*"

Test case 2
postgresql.conf (using set_user.superuser_whitelist)
set_user.block_alter_system = on
set_user.block_copy_program = off
set_user.block_log_statement= on
set_user.superuser_whitelist = '+ftier3'

select * from pg_settings where name ~'set_user';
name | setting | unit | category |
---------------------------------------+---------+--------+--------------------+
set_user.block_alter_system | on | (NULL) | Customized Options |
set_user.block_copy_program | off | (NULL) | Customized Options |
set_user.block_log_statement | on | (NULL) | Customized Options |
set_user.exit_on_error | on | (NULL) | Customized Options |
set_user.nosuperuser_target_allowlist | * | (NULL) | Customized Options |
set_user.superuser_allowlist | +ftier3 | (NULL) | Customized Options |
set_user.superuser_audit_tag | AUDIT | (NULL) | Customized Options |

show set_user.superuser_allowlist;
set_user.superuser_allowlist
------------------------------+
+ftier3

show set_user.superuser_whitelist;
set_user.superuser_whitelist
------------------------------+
+ftier3

When specifying set_user.superuser_whitelist in postgresql.conf, the parameter is always used
either when reloading, select pg_reload_conf();, or when restarting instance (stop/start).

Regards,
Yannick**

@mpalmi
Copy link
Collaborator

mpalmi commented Aug 4, 2022

Sorry for slow replies. Considering the pain that this deprecation has caused, and the lack of support (as far as I'm aware) for deprecation of extension GUCs, I'm considering reverting all of the deprecation changes and just making the allowlist the only GUC.

@Yaco312 @Jamespsql do you see this as an acceptable solution?

@Yaco312
Copy link

Yaco312 commented Aug 17, 2022

Hello Mike,

Yes that's fine with me. @mpalmi, would be the timeline for this fix?

Thanks!

@Jamespsql
Copy link
Author

Jamespsql commented Oct 11, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants