all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [pmg-devel] [PATCH pmg-api] oidc: realm: only autocreate users on primary cluster-node
@ 2025-02-27 11:04 Stoiko Ivanov
  2025-02-27 11:06 ` Mira Limbeck
  2025-02-27 11:09 ` [pmg-devel] applied: " Thomas Lamprecht
  0 siblings, 2 replies; 3+ messages in thread
From: Stoiko Ivanov @ 2025-02-27 11:04 UTC (permalink / raw)
  To: pmg-devel

PMG::RESTEnvironment->check_node_is_master() dies if called on a
secondary node.
It is called in an eval that results in a sensible error-message being
presented to the user.

Reported-by: Lukas Wagner <l.wagner@proxmox.com>
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
---
 src/PMG/API2/OIDC.pm | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/PMG/API2/OIDC.pm b/src/PMG/API2/OIDC.pm
index 2d016f6..c256014 100644
--- a/src/PMG/API2/OIDC.pm
+++ b/src/PMG/API2/OIDC.pm
@@ -192,6 +192,7 @@ __PACKAGE__->register_method ({
 	    # first, check if $username respects our naming conventions
 	    PMG::Utils::verify_username($username);
 	    if ($config->{'autocreate'} && !$rpcenv->check_user_exist($username, 1)) {
+		$rpcenv->check_node_is_master();
 		my $code = sub {
 		    my $usercfg = PMG::UserConfig->new();
 
-- 
2.39.5



_______________________________________________
pmg-devel mailing list
pmg-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pmg-devel


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [pmg-devel] [PATCH pmg-api] oidc: realm: only autocreate users on primary cluster-node
  2025-02-27 11:04 [pmg-devel] [PATCH pmg-api] oidc: realm: only autocreate users on primary cluster-node Stoiko Ivanov
@ 2025-02-27 11:06 ` Mira Limbeck
  2025-02-27 11:09 ` [pmg-devel] applied: " Thomas Lamprecht
  1 sibling, 0 replies; 3+ messages in thread
From: Mira Limbeck @ 2025-02-27 11:06 UTC (permalink / raw)
  To: pmg-devel

On 2/27/25 12:04, Stoiko Ivanov wrote:
> PMG::RESTEnvironment->check_node_is_master() dies if called on a
> secondary node.
> It is called in an eval that results in a sensible error-message being
> presented to the user.
> 
> Reported-by: Lukas Wagner <l.wagner@proxmox.com>
> Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
> ---
>  src/PMG/API2/OIDC.pm | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/PMG/API2/OIDC.pm b/src/PMG/API2/OIDC.pm
> index 2d016f6..c256014 100644
> --- a/src/PMG/API2/OIDC.pm
> +++ b/src/PMG/API2/OIDC.pm
> @@ -192,6 +192,7 @@ __PACKAGE__->register_method ({
>  	    # first, check if $username respects our naming conventions
>  	    PMG::Utils::verify_username($username);
>  	    if ($config->{'autocreate'} && !$rpcenv->check_user_exist($username, 1)) {
> +		$rpcenv->check_node_is_master();
>  		my $code = sub {
>  		    my $usercfg = PMG::UserConfig->new();
>  

Gave the patch a quick try. Secondary node login no longer works.
Login on primary gives the error that no such user exists on the
secondary node until it has synced.

Tested-by: Mira Limbeck <m.limbeck@proxmox.com>


_______________________________________________
pmg-devel mailing list
pmg-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pmg-devel


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [pmg-devel] applied: [PATCH pmg-api] oidc: realm: only autocreate users on primary cluster-node
  2025-02-27 11:04 [pmg-devel] [PATCH pmg-api] oidc: realm: only autocreate users on primary cluster-node Stoiko Ivanov
  2025-02-27 11:06 ` Mira Limbeck
@ 2025-02-27 11:09 ` Thomas Lamprecht
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Lamprecht @ 2025-02-27 11:09 UTC (permalink / raw)
  To: Stoiko Ivanov, pmg-devel

Am 27.02.25 um 12:04 schrieb Stoiko Ivanov:
> PMG::RESTEnvironment->check_node_is_master() dies if called on a
> secondary node.
> It is called in an eval that results in a sensible error-message being
> presented to the user.
> 
> Reported-by: Lukas Wagner <l.wagner@proxmox.com>
> Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
> ---
>  src/PMG/API2/OIDC.pm | 1 +
>  1 file changed, 1 insertion(+)
> 
>

applied, thanks!

As talked off-list I folded in a change to use a dedicated, more telling
error message.


_______________________________________________
pmg-devel mailing list
pmg-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pmg-devel


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-02-27 11:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-02-27 11:04 [pmg-devel] [PATCH pmg-api] oidc: realm: only autocreate users on primary cluster-node Stoiko Ivanov
2025-02-27 11:06 ` Mira Limbeck
2025-02-27 11:09 ` [pmg-devel] applied: " Thomas Lamprecht

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal