From: "cron2 (Code Review)" Date: Sun, 19 Apr 2026 14:09:11 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., selva.nair@...277..., openvpn-devel@lists.sourceforge.net, antonio@...2726... Message-ID: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="Vk30QhZikGQ="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: Inlined credentials: read missing password from management interface List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: selvanair Cc: plaisthos , openvpn-devel --Vk30QhZikGQ= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/15= 99?usp=3Demail ) Change subject: Inlined credentials: read missing password from management = interface ...................................................................... Inlined credentials: read missing password from management interface When commit 39619b7fab added support for inlining username only, fallback for password was from console. This is not ideal when graphical UI is in use as there is no console. Instead, query the management interface when possible. This patch just extends a similar fix when username is read from a file and password is missing. As before, any username read from file or inlined is not peserved as we currently have no way of locking the username in the management interface prompt. Change-Id: Ieeb2f980330d485739dbf3d722f107c1dbf704fc Signed-off-by: Selva Nair Acked-by: Arne Schwabe Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1599 Message-Id: <20260414055900.17132-1-gert@...1296...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg36= 608.html Signed-off-by: Gert Doering --- M src/openvpn/misc.c 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/src/openvpn/misc.c b/src/openvpn/misc.c index c00a3ce..979293f 100644 --- a/src/openvpn/misc.c +++ b/src/openvpn/misc.c @@ -305,24 +305,6 @@ { strncpy(up->password, password_buf, USER_PASS_LEN); } - /* The auth-file does not have the password: get both user= name - * and password from the management interface if possible. - * Otherwise set to read password from console. - */ -#if defined(ENABLE_MANAGEMENT) - else if (management && (flags & GET_USER_PASS_MANAGEMENT) - && management_query_user_pass_enabled(management)) - { - msg(D_LOW, - "No password found in %s authfile '%s'. Querying t= he management interface", - prefix, auth_file); - if (!auth_user_pass_mgmt(up, prefix, flags, auth_chall= enge)) - { - fclose(fp); - return false; - } - } -#endif else { password_from_stdin =3D 1; @@ -348,7 +330,23 @@ if (username_from_stdin || password_from_stdin || response_from_st= din) { #ifdef ENABLE_MANAGEMENT - if (auth_challenge && (flags & GET_USER_PASS_DYNAMIC_CHALLENGE= ) && response_from_stdin) + /* If management-query-passwords is true, we could be here bec= ause + * of no password present in auth-file or inline. In that case + * query via the management interface instead of stdin/console. + */ + if (management && (flags & GET_USER_PASS_MANAGEMENT) + && management_query_user_pass_enabled(management) + && !(flags & GET_USER_PASS_USERNAME_ONLY)) + { + msg(D_LOW, + "No '%s' password found in authfile or inline. Queryin= g the management interface", + prefix); + if (!auth_user_pass_mgmt(up, prefix, flags, auth_challenge= )) + { + return false; + } + } + else if (auth_challenge && (flags & GET_USER_PASS_DYNAMIC_CHAL= LENGE) && response_from_stdin) { struct auth_challenge_info *ac =3D parse_auth_challenge(au= th_challenge, &gc); if (ac) -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1599?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings?usp=3Demail Gerrit-MessageType: merged Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: Ieeb2f980330d485739dbf3d722f107c1dbf704fc Gerrit-Change-Number: 1599 Gerrit-PatchSet: 2 Gerrit-Owner: selvanair Gerrit-Reviewer: ordex Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel --Vk30QhZikGQ= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 sub= mitted this change.

View Change

Inlined credentials: read missing password from =
management interface

When commit 39619b7fab added support for inlini= ng username only,
fallback for password was from console. This is not id= eal when
graphical UI is in use as there is no console. Instead, query t= he
management interface when possible.

This patch just extends a = similar fix when username is read from
a file and password is missing. A= s before, any username read
from file or inlined is not peserved as we c= urrently have no way
of locking the username in the management interface= prompt.

Change-Id: Ieeb2f980330d485739dbf3d722f107c1dbf704fc
Sig= ned-off-by: Selva Nair <selva.nair@...277...>
Acked-by: Arne Schwa= be <arne-openvpn@...1227...>
Gerrit URL: https://gerrit.openvpn.ne= t/c/openvpn/+/1599
Message-Id: <20260414055900.17132-1-gert@...2132...= .>
URL: https://www.mail-archive.com/openvpn-devel@...290...= net/msg36608.html
Signed-off-by: Gert Doering <gert@...1296...>---
M src/openvpn/misc.c
1 file changed, 17 insertions(+), 19 deleti= ons(-)

diff --git a/src/openvpn/misc.c b/src/openvpn/misc.c
ind= ex c00a3ce..979293f 100644
--- a/src/openvpn/misc.c<= br>+++ b/src/openvpn/misc.c
@@ -305,24 +305,6 @@
{
strncpy= (up->password, password_buf, USER_PASS_LEN);
= }
- = /* The auth-file does not have the password: get both username
= - * and password = from the management interface if possible.
- * Otherwise set to read password from= console.
- = */
-#if defined(EN= ABLE_MANAGEMENT)
- = else if (management && (flags & GET_USER_PASS_MANAGE= MENT)
- = && management_query_user_pass_enabled(management))<= br>- {
<= span style=3D"color: hsl(0, 100%, 40%);">- msg(D_LOW,
- = "No password found in %s authfile '%s'. Querying the managemen= t interface",
- = prefix, auth_file);
- if (!auth_user_pass_mgmt(up, prefix,= flags, auth_challenge))
- return false;
- }
- }
-#endif
else
{
pass= word_from_stdin =3D 1;
@@ -348,7 +330,23 @@
if (username_from_stdin || password_from_stdin || response_from_s= tdin)

{
#ifdef ENABLE_MANAGEMENT<= /span>
- if (auth_c= hallenge && (flags & GET_USER_PASS_DYNAMIC_CHALLENGE) &&= ; response_from_stdin)
+ = * of no password present in auth-file or inline. In that case
+ * query via the mana= gement interface instead of stdin/console.

+ */
+ if (management && (flags & GET_U= SER_PASS_MANAGEMENT)
= + && management_query_user_pass_enabled(management)<= /span>
+ &= ;& !(flags & GET_USER_PASS_USERNAME_ONLY))
+ {
+ msg(D_LOW,
+ "No '%s'= password found in authfile or inline. Querying the management interface&qu= ot;,
+ = prefix);
+ = if (!auth_user_pass_mgmt(up, prefix, flags, auth_challenge))
+ {=
+ return= false;
+ = }
+ }<= /span>
+ else if = (auth_challenge && (flags & GET_USER_PASS_DYNAMIC_CHALLENGE) &a= mp;& response_from_stdin)
{
struct auth_challenge_info *ac =3D parse_auth_challenge(= auth_challenge, &gc);

if (ac)

To view, visit change 1599. To unsubscribe, or for = help writing mail filters, visit settings.

Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ieeb2f980330d485739dbf3d722f= 107c1dbf704fc
Gerrit-Change-Number: 1599
Gerrit-PatchSet: 2
Gerrit-Owner: selvanair <selva.nair@...1354...= ..>
Gerrit-Reviewer: ordex <antonio@...2726...&= gt;
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
= --Vk30QhZikGQ=--