Feature request - Allow comments inside <peer-fingerprint> markers
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Hi,
I think it would useful to allow comment inside the <peer-fingerprint> markers.
EG:
<peer-fingerprint>
# alice 67:1F:A5:CA:26:98:BA:40:D9:EB:6A:5B:C1:64:8C:8E:66:6E:7A:22:26:73:96:6A:5E:9B:B3:17:8F:F8:C6:9C # bob 55:B6:3F:AD:BC:A0:8C:EF:00:B3:2F:A5:46:46:83:82:6F:34:86:8D:23:2B:AC:79:39:E2:26:0B:FC:1A:86:38 </peer-fingerprint>
Thanks
R
-----BEGIN PGP SIGNATURE-----
Version: ProtonMail
wsBzBAEBCAAGBQJgooRFACEJEE+XnPZrkLidFiEECbw9RGejjXJ5xVVVT5ec 9muQuJ2Gxwf+MZsFJKL83UScncpqzPDid2nJnp685JBqS42dmE+XPADUrinU ymZA000r8Q4aqgU/1Ml5TAkFT9yAVUEJK4HJVLenpyL2lP3y2Fel7Wy66caZ K+zUyX82JpBVSyh6O5DwoaEnKG5Er86So4bVrfFvEgYv6xO5eWHaEWfQPwTD 6zw6k5OimLaj+KTPaoL0rDuEt0uTyhAcWFkHmkzskNtNaowNo/u3P5zfT49o ct/9/GpDUx0nY0D6MfM88SIYjcegoaCdVdY0OHIer2sxoRCnDk4r6jgdOj1I 67B/HdKHXSng6sJfRp2teyxFp6+mCsqDdtOjTotZv7rT5+xDA6EGlw== =5Phv
-----END PGP SIGNATURE-----
Hi,
Quoted 1 line · tincantech via Openvpn-devel
I think it would useful to allow comment inside the <peer-fingerprint> markers.
I've run across this as well, and share that sentiment. It would be nice.
That said, I'm not sure how easy it is to implement (the inline-config parser is used for all inline stuff, not only for peer-fingerprint).
Quoted 8 lines
EG:
<peer-fingerprint>
# alice 67:1F:A5:CA:26:98:BA:40:D9:EB:6A:5B:C1:64:8C:8E:66:6E:7A:22:26:73:96:6A:5E:9B:B3:17:8F:F8:C6:9C # bob 55:B6:3F:AD:BC:A0:8C:EF:00:B3:2F:A5:46:46:83:82:6F:34:86:8D:23:2B:AC:79:39:E2:26:0B:FC:1A:86:38 </peer-fingerprint>
As a workaround, you can put "per user" peer-fingerprint lines into the config:
# alice peer-fingerprint 67:1F:A5:CA:26:98:BA:40:D9:EB:6A:5B:C1:64:8C:8E:66:6E:7A:22:26:73:96:6A:5E:9B:B3:17:8F:F8:C6:9C # bob peer-fingerprint 55:B6:3F:AD:BC:A0:8C:EF:00:B3:2F:A5:46:46:83:82:6F:34:86:8D:23:2B:AC:79:39:E2:26:0B:FC:1A:86:38
the config option - and the inline block - can appear multiple times.
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]...-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Hi,
‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
Quoted 11 lines · Gert Doering
Hi,
Quoted 1 line · tincantech via Openvpn-devel
I think it would useful to allow comment inside the <peer-fingerprint> markers.
I've run across this as well, and share that sentiment. It would be nice.
That said, I'm not sure how easy it is to implement (the inline-config parser is used for all inline stuff, not only for peer-fingerprint).
<snip due to protonmail>
Quoted 3 lines
As a workaround, you can put "per user" peer-fingerprint lines into the config:
<snip due to protonmail>
Quoted 3 lines
the config option - and the inline block - can appear multiple times.
Ah nice, I should have thought of that myself !
I can't think of any other reason to allow comments in other inline sections and your work around is perfectly suitable for small setups, consider this resolved.
Thanks
R
-----BEGIN PGP SIGNATURE-----
Version: ProtonMail
wsBzBAEBCAAGBQJgoo8lACEJEE+XnPZrkLidFiEECbw9RGejjXJ5xVVVT5ec 9muQuJ36hQf+Iv76yenMrNbvyi32egQsvjGnIEEHekVr1YLjkm935asSF9NW 7Pe0XsGhcbcVgupPPhYo+KsfX0wnAEmVClDSn6r2jZQ9r5/DFoBHP2fst7UA qPZs5EgLXcaNiBLI3gY6yxaxxrqCiAb4LEoHxdaO4sWGoYUnZxly3H/dkLgE NEdxTarhBYPd0Rr5hg0pXIsz+RTGo/Eb/fzqRN7HzZdgk3isVPhtzm0a3tJM YhPpa8KOuRh23u5/gVtLsGtKP3uyIA51RD22tv+NC6QOoV32+bvIbaXS+NfN tX2sfax7F/Tmhv6EhSWoUSe9GktQyczWGjAQF5Ajv9JkT4j1bTrgig== =Ur8w
-----END PGP SIGNATURE-----
Am 17.05.21 um 17:31 schrieb Gert Doering:
Quoted 10 lines
Hi,
Quoted 1 line · tincantech via Openvpn-devel
I think it would useful to allow comment inside the <peer-fingerprint> markers.
I've run across this as well, and share that sentiment. It would be nice.
That said, I'm not sure how easy it is to implement (the inline-config parser is used for all inline stuff, not only for peer-fingerprint).
We could implement it in the hash parser to skip the lines starting with #.
Arne
Hi,
Quoted 1 line · Arne Schwabe
We could implement it in the hash parser to skip the lines starting with #.
Ah, right. This should be very easy, actually, without affecting anything else that does <inline> stuff.
Let's see if I can find time :-)
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 1/1 Ignore leading whitespace and comment lines for peer-fingerprint.
In reply to tincantechInline peer-fingerprint blocks can benefit from a bit of structuring by indentation or by putting comments ("# this is Alice's key").
--- src/openvpn/options.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
src/openvpn/options.c +7 -2
@@ -1145,8 +1145,13 @@ parse_hash_fingerprint_multiline(const char *str, int nbytes, int msglevel,const char *line;while ((line =strsep (&lines,"\n" ))) { -/* skip empty lines */ -if (strlen (line) ==0 ) +/* ignore leading whitespace */ +while (isspace (*line)) + { + line++; + } +/* skip empty lines and comment lines */ +if (strlen (line) ==0 || *line =='#' ) {continue ; }
Signature · 1 line
2.26.3
Re: [Openvpn-devel] [PATCH] Ignore leading whitespace and comment lines for peer-fingerprint.
Hi,
Quoted 16 lines · Gert Doering
Inline peer-fingerprint blocks can benefit from a bit of structuring by indentation or by putting comments ("# this is Alice's key").
Signed-off-by Gert Doering <[email protected]...>--- src/openvpn/options.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)src/openvpn/options.c +0
-0@@ -1145,8 +1145,13 @@ parse_hash_fingerprint_multiline(const char *str, int nbytes, int msglevel,const char *line;while ((line =strsep (&lines,"\n" )))
src/openvpn/options.c parse_hash_fingerprint_multiline(const char *str, int nbytes, int msglevel, · line 1154
Quoted 10 lines
src/openvpn/options.c +7
-2{ -/* skip empty lines */ -if (strlen (line) ==0 ) +/* ignore leading whitespace */ +while (isspace (*line)) + { + line++; + } +/* skip empty lines and comment lines */ +if (strlen (line) ==0 || *line =='#' )
As we support two comment characters ('#' and ';'), would be better to do the same here too. One could relax the requirement of comment as the first character using parse_line(), but this looks generous enough.
Selva
Re: [Openvpn-devel] [PATCH] Ignore leading whitespace and comment lines for peer-fingerprint.
Hi,
Quoted 12 lines · Selva Nair
src/openvpn/options.c parse_hash_fingerprint_multiline(const char *str, int nbytes, int msglevel, · line 1154
Quoted 11 lines
while ((line = strsep(&lines, "\n"))) {src/openvpn/options.c +7
-2-/* skip empty lines */ -if (strlen (line) ==0 ) +/* ignore leading whitespace */ +while (isspace (*line)) + { + line++; + } +/* skip empty lines and comment lines */ +if (strlen (line) ==0 || *line =='#' )
Quoted 2 lines
As we support two comment characters ('#' and ';'), would be better to do the same here too.
Good point. v2 is on the way.
Quoted 3 lines
One could relax the requirement of comment as
the first character usingparse_line(), but this looks generous enough.
The "ignore leading whitespace" part takes care of this :-) - I looked at parse_line() but it seemed a bit heavy handed to me.
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 1/1 Ignore leading whitespace and comment lines for peer-fingerprint.
In reply to Gert DoeringInline peer-fingerprint blocks can benefit from a bit of structuring by indentation or by putting comments ("# this is Alice's key").
v2: accept ';' and '#' as comment delimiter. Fix tab-indent.
--- src/openvpn/options.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
src/openvpn/options.c +7 -2
@@ -1145,8 +1145,13 @@ parse_hash_fingerprint_multiline(const char *str, int nbytes, int msglevel,const char *line;while ((line =strsep (&lines,"\n" ))) { -/* skip empty lines */ -if (strlen (line) ==0 ) +/* ignore leading whitespace */ +while (isspace (*line)) + { + line++; + } +/* skip empty lines and comment lines */ +if (strlen (line) ==0 || *line =='#' || *line =';' ) {continue ; }
Signature · 1 line
2.26.3
PATCH v2 1/1 Ignore leading whitespace and comment lines for peer-fingerprint.
In reply to Gert DoeringInline peer-fingerprint blocks can benefit from a bit of structuring by indentation or by putting comments ("# this is Alice's key").
v2: accept ';' and '#' as comment delimiter. Fix tab-indent.
--- src/openvpn/options.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
src/openvpn/options.c +7 -2
@@ -1145,8 +1145,13 @@ parse_hash_fingerprint_multiline(const char *str, int nbytes, int msglevel,const char *line;while ((line =strsep (&lines,"\n" ))) { -/* skip empty lines */ -if (strlen (line) ==0 ) +/* ignore leading whitespace */ +while (isspace (*line)) + { + line++; + } +/* skip empty lines and comment lines */ +if (strlen (line) ==0 || *line =='#' || *line =';' ) {continue ; }
Signature · 1 line
2.26.3
Re: [Openvpn-devel] [PATCH v2] Ignore leading whitespace and comment lines for peer-fingerprint.
Hi,
Quoted 18 lines · Gert Doering
Inline peer-fingerprint blocks can benefit from a bit of structuring by indentation or by putting comments ("# this is Alice's key").
v2: accept ';' and '#' as comment delimiter. Fix tab-indent.
Signed-off-by Gert Doering <[email protected]...>--- src/openvpn/options.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)src/openvpn/options.c +0
-0@@ -1145,8 +1145,13 @@ parse_hash_fingerprint_multiline(const char *str, int nbytes, int msglevel,const char *line;while ((line =strsep (&lines,"\n" )))
src/openvpn/options.c parse_hash_fingerprint_multiline(const char *str, int nbytes, int msglevel, · line 1154
Quoted 10 lines
src/openvpn/options.c +7
-2{ -/* skip empty lines */ -if (strlen (line) ==0 ) +/* ignore leading whitespace */ +while (isspace (*line)) + { + line++; + } +/* skip empty lines and comment lines */ +if (strlen (line) ==0 || *line =='#' || *line =';' )
We want == :)
Selva
PATCH v3 1/1 Ignore leading whitespace and comment lines for peer-fingerprint.
In reply to Gert DoeringInline peer-fingerprint blocks can benefit from a bit of structuring by indentation or by putting comments ("# this is Alice's key").
v2: accept ';' and '#' as comment delimiter. Fix tab-indent.
v3: we want ==
--- src/openvpn/options.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
src/openvpn/options.c +7 -2
@@ -1145,8 +1145,13 @@ parse_hash_fingerprint_multiline(const char *str, int nbytes, int msglevel,const char *line;while ((line =strsep (&lines,"\n" ))) { -/* skip empty lines */ -if (strlen (line) ==0 ) +/* ignore leading whitespace */ +while (isspace (*line)) + { + line++; + } +/* skip empty lines and comment lines */ +if (strlen (line) ==0 || *line =='#' || *line ==';' ) {continue ; }
Signature · 1 line
2.26.3
Re: [Openvpn-devel] [PATCH v3] Ignore leading whitespace and comment lines for peer-fingerprint.
Hi
Quoted 22 lines · Gert Doering
Inline peer-fingerprint blocks can benefit from a bit of structuring by indentation or by putting comments ("# this is Alice's key").
v2: accept ';' and '#' as comment delimiter. Fix tab-indent.
v3: we want ==Signed-off-by Gert Doering <[email protected]...>--- src/openvpn/options.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)src/openvpn/options.c +0
-2@@ -1145,8 +1145,13 @@ parse_hash_fingerprint_multiline(const char *str, int nbytes, int msglevel,const char *line;while ((line =strsep (&lines,"\n" ))) { -/* skip empty lines */ -if (strlen (line) ==0 )
src/openvpn/options.c parse_hash_fingerprint_multiline(const char *str, int nbytes, int msglevel, · line 1157
Quoted 10 lines
src/openvpn/options.c +7
-0+/* ignore leading whitespace */ +while (isspace (*line)) + { + line++; + } +/* skip empty lines and comment lines */ +if (strlen (line) ==0 || *line =='#' || *line ==';' ) {continue ; }
I haven't tested it, but looks good to me.
[Openvpn-devel] [PATCH applied] Re: Ignore leading whitespace and comment lines for peer-fingerprint.
In reply to Gert DoeringPatch has been applied to the master branch.
commit de78371ab83f7d533d65ccf966684e31b57d953f
Author: Gert Doering Date: Wed May 19 15:34:15 2021 +0200
Ignore leading whitespace and comment lines for peer-fingerprint.
Signed-off-by: Gert Doering <[email protected]...>
Acked-by: Selva Nair <[email protected]...>
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg22404.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering