Attention is currently required from: Arne Schwabe, Frank Lichtenheld, Selva 
Nair.

Hello Arne Schwabe, Frank Lichtenheld,

I'd like you to reexamine a change. Please visit

    https://gerrit.openvpn.net/c/openvpn/+/2069?usp=email

to look at the new patch set (#2).

The following approvals got outdated and were removed:
Code-Review-1 by Frank Lichtenheld


Change subject: Optionally indicate username in >PASSWORD 'Auth' prompt
......................................................................

Optionally indicate username in >PASSWORD 'Auth' prompt

When username is included in the config file as inlined or
read from a file, indicate it as a preferred-username in
>PASSWORD Need 'Auth' username/password prompt. The prompt
is appended with "UN:foo64" where foo64 is the pre-defined
username, base64 encoded.

This is treated as a hint, not an enforced value. The management
client still responds with both username and password obtained
from the user. Whether the management client allows the
user to input a different username is left to the client
implementation.

Only clients that announce version >=6 are prompted this way.

This helps to fix user reports on OpenVPN-GUI not respecting username
set in the config file.

Change-Id: Iac23d5141a8c29e239d0f2aeea497d3a002e609b
Signed-off-by: Selva Nair <[email protected]>
---
M doc/management-notes.txt
M src/openvpn/manage.c
2 files changed, 44 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/69/2069/2

diff --git a/doc/management-notes.txt b/doc/management-notes.txt
index eac91a4..2662474 100644
--- a/doc/management-notes.txt
+++ b/doc/management-notes.txt
@@ -394,6 +394,28 @@
   response along with the username and password formatted as described
   in the Challenge/Response Protocol section below

+  Example 10:
+
+    >PASSWORD:Need 'Auth' username/password UN:<user-base64>
+    >PASSWORD:Need 'Auth' username/password UN:<user-base64> SC:1,Please enter 
token PIN
+
+  These work exactly as Examples 3 and 8, respectively, with the following
+  difference. The prompt has an additional word "UN:<user-base64>" where
+  <user-base64> is the base64 encoded form of a pre-defined username. This
+  may be a username inlined in the config file or read from an external
+  user-pass file.
+
+  The management client is expected to show the base64 decoded value to
+  the user. Whether the user can change this username or not is left to
+  the client implementation.
+
+  The response from the management client should follow the same format
+  as in example 3 or example 8, as applicable.
+
+  This prompt is shown only if the management-client announces a
+  version >= 6. Older clients will see the prompt shown in Example 3
+  or 8.
+
 See the "Challenge/Response Protocol" section below for more details
 about examples 8 and 9, including how the management interface client
 should respond.
@@ -530,6 +552,7 @@
     >PK_SIGN:[base64],[alg]     -- version 3 or greater
     >PASSWORD:Need 'Auth' username -- version 4 or greater
     multiline password from client -- version 5 or greater
+    preferred username in >PASSWORD prompt -- version 6 or greater

 COMMAND -- auth-retry
 ---------------------
diff --git a/src/openvpn/manage.c b/src/openvpn/manage.c
index 0fc9ee2..65e2881 100644
--- a/src/openvpn/manage.c
+++ b/src/openvpn/manage.c
@@ -71,6 +71,7 @@
     MCV_PKSIGN_ALG = 3,
     MCV_USERNAME_ONLY = 4,
     MCV_MULTILINE_PASSWORD = 5,
+    MCV_PREFERRED_USERNAME = 6,
 };

 struct management *management; /* GLOBAL */
@@ -3670,6 +3671,26 @@
             buf_printf(&alert_msg, " MSG:%s", up->username);
         }
 
+        if (up_query_mode == UP_QUERY_USER_PASS
+            && (man->connection.client_version >= MCV_PREFERRED_USERNAME)
+            && up->username[0])
+        {
+            /*
+             * The buffer up is prefilled with username from auth-file or 
inline.
+             * Indicate it in the prompt as base64 encoded.
+             */
+            char *user64 = NULL;
+            if (openvpn_base64_encode(up->username, (int)strlen(up->username), 
&user64) != -1)
+            {
+                buf_printf(&alert_msg, " UN:%s", user64);
+            }
+            else
+            {
+                msg(M_NONFATAL, "ERROR: could not base64-encode username");
+            }
+            free(user64);
+        }
+
         if (sc)
         {
             buf_printf(&alert_msg, " SC:%d,%s",

--
To view, visit https://gerrit.openvpn.net/c/openvpn/+/2069?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Iac23d5141a8c29e239d0f2aeea497d3a002e609b
Gerrit-Change-Number: 2069
Gerrit-PatchSet: 2
Gerrit-Owner: Selva Nair <[email protected]>
Gerrit-Reviewer: Arne Schwabe <[email protected]>
Gerrit-Reviewer: Frank Lichtenheld <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: Selva Nair <[email protected]>
Gerrit-Attention: Arne Schwabe <[email protected]>
Gerrit-Attention: Frank Lichtenheld <[email protected]>
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to