Do not include auth-token in pulled option digest
PATCH 1/1 Do not include auth-token in pulled option digest
From: Selva Nair <[email protected]...>
As change in auth-token is common on restart and does not require tun-reopen, exclude it from the "pulled options digest" calculation. Without this tun is always re-opened on SIGUSR1 if auth-token is in use which breaks persist-tun.
Fixes #200
--- src/openvpn/push.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
src/openvpn/push.c +2 -2
@@ -989,8 +989,8 @@ push_update_digest(md_ctx_t *ctx, struct buffer *buf, const struct options *opt)char line[OPTION_PARM_SIZE ];while (buf_parse (buf,',' , line,sizeof (line))) { -/* peer-id might change on restart and this should not trigger reopening tun */ -if (strprefix (line,"peer-id " )) +/* peer-id and auth-token might change on restart and this should not trigger reopening tun */ +if (strprefix (line,"peer-id " ) ||strprefix (line,"auth-token" )) {continue ; }
Signature · 1 line
2.34.1
Am 18.12.22 um 20:22 schrieb [email protected]...:
Quoted 7 lines
From: Selva Nair <[email protected]...>
As change in auth-token is common on restart and does not require tun-reopen, exclude it from the "pulled options digest" calculation. Without this tun is always re-opened on SIGUSR1 if auth-token is in use which breaks persist-tun.
Makes sense
Quoted 19 lines · On Sun, Dec 18, 2022 at 02:22:03PM -0500, [email protected]... wrote:
From: Selva Nair <[email protected]...>
As change in auth-token is common on restart and does not require tun-reopen, exclude it from the "pulled options digest" calculation. Without this tun is always re-opened on SIGUSR1 if auth-token is in use which breaks persist-tun.
Fixes #200
Signed-off-by Selva Nair <[email protected]...>--- src/openvpn/push.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)src/openvpn/push.c +0
-0
src/openvpn/push.c push_update_digest(md_ctx_t *ctx, struct buffer *buf, const struct options *opt) · line 993
Quoted 7 lines
src/openvpn/push.c +2
-2@@ -989,8 +989,8 @@ push_update_digest(md_ctx_t *ctx, struct buffer *buf, const struct options *opt)char line[OPTION_PARM_SIZE ];while (buf_parse (buf,',' , line,sizeof (line))) { -/* peer-id might change on restart and this should not trigger reopening tun */ -if (strprefix (line,"peer-id " )) +/* peer-id and auth-token might change on restart and this should not trigger reopening tun */ +if (strprefix (line,"peer-id " ) ||strprefix (line,"auth-token" ))
If I interpret this correctly, this will also exclude auth-token-user, because you didn't add the space after the option name like for peer-id. This should either be reflected in the comment above or changed.
Regards,
Signature · 1 line
Frank Lichtenheld
Hi,
Quoted 6 lines · Frank Lichtenheld
src/openvpn/push.c push_update_digest(md_ctx_t *ctx, struct buffer *buf, const struct options *opt) · line 993
Quoted 2 lines
src/openvpn/push.c +2
-0+/* peer-id and auth-token might change on restart and this should not trigger reopening tun */ +if (strprefix (line,"peer-id " ) ||strprefix (line,"auth-token" ))If I interpret this correctly, this will also exclude auth-token-user, because you didn't add the space after the option name like for peer-id. This should either be reflected in the comment above or changed.
Well spotted. For "less magic, easier understanding" reasons I'd actually include it explicitly
+ if (strprefix(line, "peer-id ")
|| strprefix(line, "auth-token ")
|| strprefix(line, "auth-token-user "))(with blank) - yes, Selva's original code does that, but more magically.
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]...PATCH v2 1/1 Do not include auth-token in pulled option digest
In reply to [email protected]...From: Selva Nair <[email protected]...>
As change in auth-token is common on restart and does not require tun-reopen, exclude it from the "pulled options digest" calculation. Without this tun is always re-opened on SIGUSR1 if auth-token is in use which breaks persist-tun.
Fixes #200
v2: explcitly filter auth-token and auth-token-user
--- src/openvpn/push.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
src/openvpn/push.c +4 -2
@@ -989,8 +989,10 @@ push_update_digest(md_ctx_t *ctx, struct buffer *buf, const struct options *opt)char line[OPTION_PARM_SIZE ];while (buf_parse (buf,',' , line,sizeof (line))) { -/* peer-id might change on restart and this should not trigger reopening tun */ -if (strprefix (line,"peer-id " )) +/* peer-id and auth-token might change on restart and this should not trigger reopening tun */ +if (strprefix (line,"peer-id " ) + ||strprefix (line,"auth-token " ) + ||strprefix (line,"auth-token-user " )) {continue ; }
Signature · 1 line
2.34.1
(v2 is sufficiently different from v1 that I'm not taking Arne's ACK but adding my own)
Only very lightly client-side tested, not doing actual SIGUSR1 restarts with --persist-tun - but I'm fairly sure that this does what it attempts to do, as it just extends the existing exception.
Your patch has been applied to the master, release/2.6 and release/2.5 branch (bugfix, same code, auth-token + auth-token-user both exist in 2.5).
commit f778f4f88e56851c0a68205e95110c021f3032b3 commit f922298ca5784577a1309334dafeb16f738ae46a (release/2.6) commit 1d81df042eae416a4e83e6a433ae2b937c5a10a4 (release/2.5)
Author: Selva Nair Date: Mon Dec 19 09:04:05 2022 -0500
Do not include auth-token in pulled option digest
Signed-off-by: Selva Nair <[email protected]...>
Acked-by: Gert Doering <[email protected]...>
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg25768.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering