management: add multi-line base64 input for passwords
PATCH 1/1 management: add multi-line base64 input for passwords
From: Luca Boccassi <[email protected]...>
Allow management clients to send long passwords via the usual multi-line base64 encoded protocol.
A client sends a 'password <type>' line, followed by as many lines (each up to 1024 bytes) as needed, in base64 encoded format, terminated by 'END'.
This is useful when a password is a JIT-generated use-once token.
---
As suggested by:
I have kept the same keyword 'password'. Currently sending 'password <type>' without a third field results in an hard error, so I hope this is ok, but can of course use a different token if preferred/needed.
doc/management-notes.txt | 14 ++++++++ src/openvpn/manage.c | 76 ++++++++++++++++++++++++++++++++++++++-- src/openvpn/manage.h | 1 + 3 files changed, 89 insertions(+), 2 deletions(-)
doc/management-notes.txt +14 -0
@@ -313,6 +313,20 @@ COMMAND -- password and username The escaping rules are the same as for the config file. See the "Command Parsing" section below for more info. + If the password is too long to fit in a single command line + (longer than 256 bytes), the management interface client should + use the multi-line base64 format instead: + + password "Auth" + [BASE64_PASSWORD_LINE] + ... + END + + In this format, the password is base64-encoded and split across + multiple lines, followed by END. Each line can be at most 1024 + bytes. This is the same format used by pk-sig and certificate + commands. + The PASSWORD real-time message type can also be used to indicate password or other types of authentication failure:
src/openvpn/manage.c +74 -2
107 lines not on this page · raw message
src/openvpn/manage.h +1 -0
@@ -296,6 +296,7 @@ struct man_connection#define IEC_RSA_SIGN 3#define IEC_CERTIFICATE 4#define IEC_PK_SIGN 5 +#define IEC_PASSWORD 6int in_extra_cmd;struct buffer_list *in_extra;unsigned long in_extra_cid;
Signature · 1 line
2.47.3
Quoted 5 lines · On Sat, Mar 21, 2026 at 9:47 PM <[email protected]...> wrote:
From: Luca Boccassi <[email protected]...>
Allow management clients to send long passwords via the usual multi-line base64 encoded protocol.
Quoted 9 lines
A client sends a 'password <type>' line, followed by as many lines (each up to 1024 bytes) as needed, in base64 encoded format, terminated by 'END'.
This is useful when a password is a JIT-generated use-once token.
Signed-off-by Luca Boccassi <[email protected]...>
I think this is a step in the right direction: allows arbitrary long passwords to be passed via the management interface bringing it in line with stdin/console input. No other intrusive changes like option parsing. Until now, the largish USER_PASS_LEN = 4096 was mostly a waste of space as it was often not possible to use it even locally within the client because of the 255 byte restriction in the management interface.
I have only skimmed through the patch, but reusing "password" with no argument could break existing UI clients, hypothetically. If any UI client is currently using an empty password to quit the dialog, it will get into a stalemate. I guess a new keyword or an extra token after 'Auth' to indicate multi-line input would be required.
SelvaP.S.
Next version could go into gerrit for a more thorough review.
Quoted 17 lines · Selva Nair
Quoted 6 lines · On Sat, Mar 21, 2026 at 9:47 PM <[email protected]...> wrote:
From: Luca Boccassi <[email protected]...>
Allow management clients to send long passwords via the usual multi-line base64 encoded protocol.
Quoted 8 lines
A client sends a 'password <type>' line, followed by as many lines (each up to 1024 bytes) as needed, in base64 encoded format, terminated by 'END'.
This is useful when a password is a JIT-generated use-once token.
Signed-off-by Luca Boccassi <[email protected]...>
Quoted 7 lines
I think this is a step in the right direction: allows arbitrary long passwords to be passed via the management interface bringing it in line with stdin/console input. No other intrusive changes like option parsing. Until now, the largish
USER_PASS_LEN= 4096 was mostly a waste of space as it was often not possible to use it even locally within the client because of the 255 byte restriction in the management interface.I have only skimmed through the patch, but reusing "password" with no argument could break existing UI clients, hypothetically. If any UI client is currently using an empty password to quit the dialog, it will get into a stalemate. I guess a new keyword or an extra token after 'Auth' to indicate multi-line input would be required.
Selva
P.S.
Next version could go into gerrit for a more thorough review.
Ok, changed to add a new "password-base64" (I don't think we want a new third token for "password", as that might be, well, a password?), and pushed to gerrit:
Hi,
Quoted 5 lines · Selva Nair
I have only skimmed through the patch, but reusing "password" with no argument could break existing UI clients, hypothetically. If any UI client is currently using an empty password to quit the dialog, it will get into a stalemate. I guess a new keyword or an extra token after 'Auth' to indicate multi-line input would be required.
Bump the mgmt version, query it?
gert
Signature · 6 lines
"If was one thing all people took for granted, was conviction that if you
feed honest figures into a computer, honest figures come out. Never doubted
it myself till I met a computer with a sense of humor."
Robert A. Heinlein, The Moon is a Harsh Mistress
Gert Doering - Munich, Germany [email protected]...