Skip to content

Commit 41f6310

Browse files
committed
Allow longer username and password under Dynamic Challenge/Response Protocol.
Based on patches found at https://github.com/samm-git/aws-vpn-client, this updates OpenVPN for compatibility with AWS' (and other vendors) use of the dynamic challenge/response protocol to implement SAML-based authentication. Those vendors submit the password via the management interface, which can be up to 50kb long.
1 parent 7aa3520 commit 41f6310

File tree

4 files changed

+17
-8
lines changed

4 files changed

+17
-8
lines changed

src/openvpn/common.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,11 @@ typedef unsigned long ptr_type;
6464
/*
6565
* This parameter controls the TLS channel buffer size and the
6666
* maximum size of a single TLS message (cleartext).
67-
* This parameter must be >= PUSH_BUNDLE_SIZE
67+
* This parameter must be >= PUSH_BUNDLE_SIZE. It must also be greater than
68+
* the size of a long (>50Kb) password in the dyanmic challenge/response
69+
* protocol,
6870
*/
69-
#define TLS_CHANNEL_BUF_SIZE 2048
71+
#define TLS_CHANNEL_BUF_SIZE 65536
7072

7173
/* TLS control buffer minimum size
7274
*

src/openvpn/manage.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2244,7 +2244,7 @@ man_read(struct management *man)
22442244
/*
22452245
* read command line from socket
22462246
*/
2247-
unsigned char buf[256];
2247+
unsigned char buf[TLS_CHANNEL_BUF_SIZE];
22482248
int len = 0;
22492249

22502250
#ifdef TARGET_ANDROID
@@ -2580,7 +2580,7 @@ man_connection_init(struct management *man)
25802580
* Allocate helper objects for command line input and
25812581
* command output from/to the socket.
25822582
*/
2583-
man->connection.in = command_line_new(1024);
2583+
man->connection.in = command_line_new(TLS_CHANNEL_BUF_SIZE);
25842584
man->connection.out = buffer_list_new();
25852585

25862586
/*

src/openvpn/misc.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,11 @@ struct user_pass
6565
#ifdef ENABLE_PKCS11
6666
#define USER_PASS_LEN 4096
6767
#else
68-
#define USER_PASS_LEN 128
68+
/*
69+
* Increase the username and password length size to 65KB, in order
70+
* to support long passwords under the dynamic challenge/response protocol.
71+
*/
72+
#define USER_PASS_LEN 65536
6973
#endif
7074
/* Note that username and password are expected to be null-terminated */
7175
char username[USER_PASS_LEN];

src/openvpn/options.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,13 @@
5252
#define MAX_PARMS 16
5353

5454
/*
55-
* Max size of options line and parameter.
55+
* Max size of options line and parameter. Note these
56+
* must be able to accomodate large (>50Kb) values in
57+
* order to support long passwords under the dynamic challenge-response
58+
* protocol.
5659
*/
57-
#define OPTION_PARM_SIZE 256
58-
#define OPTION_LINE_SIZE 256
60+
#define OPTION_PARM_SIZE USER_PASS_LEN
61+
#define OPTION_LINE_SIZE OPTION_PARM_SIZE
5962

6063
extern const char title_string[];
6164

0 commit comments

Comments
 (0)