- Enable 2FA to be used with renegotiations
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,
I've been working a bit on a new patch-set which enables third-party user/password authentication mechanisms using two factor authentications [2FA] (such as OTP) and not needing to disable the renegotiation features of OpenVPN.
Currently, if a server is configured with 2FA using for example HOTP/TOTP tokens, each renegotiation of the tunnel would require the user to provide a new OTP code. The current workaround have been to disable the renegotiation (which by default happens once per hour). It is also not considered ideal to disable the renegotiation.
The patch-set I have worked on fixes this by adding a new server side option, --auth-gen-token. This makes use of a feature already found in OpenVPN clients. If a server pushes 'auth-token $TOKENVALUE' to a client, it will replace the currently locally stored password with $TOKENVALUE. Next time the OpenVPN tunnel is rengotiated, the $TOKENVALUE will now be passed instead to the server along with the username.
What the patch-set does is:
- - Add --auth-gen-token, and when used the following steps happens
- - After a successful normal user/password authentication, it will generate a random token for this tunnel and keep a local copy of it. This token is currently set to 256 bits (32 bytes).
- - It will push 'auth-token $RANDOM_TOKEN_VALUE'. The $RANDOM_TOKEN_VALUE sent to the client is BASE64 encoded.
- - When a re-authentication happens, and the server sees it have a token and the token have been sent to the client, it does an authentication of the token alone. Any --auth-user-pass-verify or --plugins enabling OPENVPN_PLUGIN_AUTH_USER_PASS_VERIFY will not be called at this point. On successful token authentication, everything continues as before. On failure the session is considered un-authenticated and a complete new authentication round is required.
If --auth-gen-token is NOT used, OpenVPN will behave as before.
The patch-set can be found here:
<https://gitlab.com/dazo/openvpn/compare/master...dev%2Fauth-gen-token>
And the git tree can be found here:
<https://gitlab.com/dazo/openvpn.git>
(Check out the dev/auth-gen-token branch)
I do not yet consider this patch-set ready for inclusion yet, it needs a lot of testing and reviewing . But it should work. The patch-set is broken into smaller pieces to try to make the overall implementation more transparent, easy to review and easier to git bisect when needing to debug. Each commit level should compile
cleanly. Please feel free to comment inline.
- --
kind regards,
David Sommerseth
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)
iQIcBAEBAgAGBQJXvvZzAAoJEIbPlEyWcf3yLmEQAIDMdZBeiz5lXtRENXGm/fW6 ZUKIYSlw0TITQgeGWc6hFcAXCWLVtj4SiLLmtcZ25UrbXc+do2c8IFuHkoDIVrif mEL8mw/+Cgy6ch2DZrT779KneeuArRsimPyquVq8NLZ3UGIqcwWYpeI9GES51SAe dQVwOmpojStOFLmmxoEC0i4oSpjtm0L2U6o6ytl+140yMVj92ADmH9Vow4G1velF 7lAkfJxabUn6sch/Y87Ny4SG5u0jkgzerikOGSuGAafnWQKejKbdADnxuMhx/3Qb gnDHyrfUeiwgIOtYZ2pNflG8FT4AdJDuXYTcjJQu+yS0N0cXT0w0sBYahQrXcPjY N2Lumk6qq39N+INnS8x310CfUBQ1rO4fxZX8kZEwIZzXPu3VDCSWcqwAcIIWylQZ gx481kO8O04cFyJdlkgr1vb+fgIM2PlXIn/hnxpfjSuJPf+1MHPee0NVS4dcYWPg oMoo7bVOv+UVV85qy3I3TPCt+7fGF3dG+JQEEW/xOT90G+z+o2u4ZuS2uxL9n5fJ 0H0mHd6LkHR3vlxbtJjDOkqOZIdhNwFamkVK3jj5IF7C+v1WaMlK2Vy4ifiCz8p5 C+bHYo9zjA8+Tv3PRNRwpPbVLyFFhV0poe/hFC2ch3/Zq8X/ZHGZNWoXgnNAx7kh ByHclsBZa5kbGqEy2zVr
=Ynjq
-----END PGP SIGNATURE-----
Quoted 6 lines · David Sommerseth
I've been working a bit on a new patch-set which enables third-party user/password authentication mechanisms using two factor authentications [2FA] (such as OTP) and not needing to disable the renegotiation features of OpenVPN.
Hm, you handle the server side of OTP through PAM alone?
Any chance of client-side OTP working automatically using liboath/libstoken and/or being able to use OATH support on hardware like Yubikeys?
Signature · 1 line
dwmw2
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Quoted 9 lines · David Woodhouse
Quoted 6 lines · David Sommerseth
I've been working a bit on a new patch-set which enables third-party user/password authentication mechanisms using two factor authentications [2FA] (such as OTP) and not needing to disable the renegotiation features of OpenVPN.
Hm, you handle the server side of OTP through PAM alone?
This change does not change the initial authentication at all. You still need an authentication plug-in or --auth-user-pass-verify script. But once this first authentication passes successfully, the OpenVPN server takes over the coming authentications required due to re-negotiations.
A very simplistic diagram over the process
Client Server --plugin or
--auth-user-pass-verify
=====================================================================
connects and sends
username + password ----------> passes
username +
password ------> authenticates
user On SUCCESS <------ sends SUCCESS/FAIL
generate auth token
replaces password <--------- push auth-token
with auth-token to client
~~~~ rengotiation happens ~~~~
sends username +
password (auth-token) -------> checks if
clients auth-token matches token stored in session object
=====================================================================
Quoted 3 lines
Any chance of client-side OTP working automatically using liboath/libstoken and/or being able to use OATH support on hardware like Yubikeys?
That is probably doable, but would require extending the plug-in API and a plug-in to actually acquire a new OTP code. For this patch-set this is out of scope, as this change needs to happen inside the authentication plug-in.
- --
kind regards,
David Sommerseth
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)
iQIcBAEBAgAGBQJXvv1kAAoJEIbPlEyWcf3yRpwP/0WFggjQUDdCHLpL5R0mh/Bp YJbWlu89oy8sVoOn6dB/o6D5p+rKqYDsNu0ME3TE6z0tl4bY+k7N1eiYY96EZqlN +N7HAuQGkb38Mpc+/hNUPrNhtt0Xl5NbMFgHCEPGdNrkO38HM1s5Z+sAba2lR04Q aM5RlRlyUOBXIdr+m3k4WcFA6G/KzgcgDNZuztQQ8w7mFNoglVllWybdL+nNIbIL emczNgEpH0/T95UdAvD8rg7rUBquSCYmhkEcWa1VgqcwniLuYShG10FW6DyuglpA ZUMPqlNOoqYNgWzYFgIQe5EerHAGZt06VEBbMjZDcE91sOEp10mUrnnsELhTG9P0 kn4cK43zxtfrTez+J91P3T7ccGiutE4F3y+m/5iaRShuBdFechf+JWA6j3+KLyct MWGIUhlc1wmBhgDToDL/5WaxiS64U78SZXCsBP6mXUbzJGGrUXdfXbdMn0gI5cfk PzsMjKv7r2kEl2Pol/shzHcbRnNiSiqlDadwTA+Cgnlt6oJQn8SbsnKGIExbNWwj 1ldCLSToJHM8mWf63e0hl4RGKBGFIfVt7XMNsVDFy6J01JqWPDG1ggGQ5IhgpGmX xIZv3nXELcE7vWaJLrORiXAfJ9j9K67H1KBH6JK6OueL7DStUXVzypVltlGdg0Ko yit+GYTFBI1mW+d9adKs
=j5fd
-----END PGP SIGNATURE-----
Quoted 9 lines · David Sommerseth
Quoted 8 lines · David Woodhouse
Quoted 6 lines · David Sommerseth
I've been working a bit on a new patch-set which enables third-party user/password authentication mechanisms using two factor authentications [2FA] (such as OTP) and not needing to disable the renegotiation features of OpenVPN.
Quoted 7 lines
Quoted 1 line
Hm, you handle the server side of OTP through PAM alone?
This change does not change the initial authentication at all. You still need an authentication plug-in or --auth-user-pass-verify script. But once this first authentication passes successfully, the OpenVPN server takes over the coming authentications required due to re-negotiations.
Why not let the auth-user-pass-verify script do this verification bypass? The server knows whether its an initial CONNECT or REAUTH and can pass that info to the verify script. Then the script can bypass verification if appropriate. Currently management-client-auth is already capable of doing this as "REAUTH" versus "CONNECT" info is passed to it. Adding that to the env and passing to scripts should be easy.
Selva
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Quoted 23 lines · Selva Nair
On Thu, Aug 25, 2016 at 10:15 AM, David Sommerseth <[email protected]... <mailto:[email protected]...>> wrote:
Quoted 9 lines · David Woodhouse
Quoted 6 lines · David Sommerseth
I've been working a bit on a new patch-set which enables third-party user/password authentication mechanisms using two factor authentications [2FA] (such as OTP) and not needing to disable the renegotiation features of OpenVPN.
Hm, you handle the server side of OTP through PAM alone?
This change does not change the initial authentication at all. You still need an authentication plug-in or --auth-user-pass-verify script. But once this first authentication passes successfully, the OpenVPN server takes over the coming authentications required due to re-negotiations.
Quoted 7 lines
Why not let the auth-user-pass-verify script do this verification bypass? The server knows whether its an initial CONNECT or REAUTH and can pass that info to the verify script. Then the script can bypass verification if appropriate. Currently management-client-auth is already capable of doing this as "REAUTH" versus "CONNECT" info is passed to it. Adding that to the env and passing to scripts should be easy.
This is to avoid needing to modify any third-party authentication mechanisms. But passing information that it is a re-auth is might be a good idea, that isn't too hard to add.
However, it would need to be a flag to --auth-gen-token in addition - otherwise third party authentication mechanisms which have not been updated will fail. On the other hand, if anyone is willing to update an auth-plugin or script to support this, they could just as well implement the auth-token generation themselves independently and not require --auth-gen-token at all; which speaks against such a flag.
Also remember that this implementation covers both --plugin and
- --auth-user-pass-verify. For many it will be quite hard to modify a plug-in compared to updating a script.
I'll grant that the 'auth-token' feature is a well hidden and not documented. But the issue with 2FA and --reneg-* options have been a long standing issue, which have not been fixed in most of the authentication plug-ins used by the community.
In regards to documentation, I'll try to improve that as well - regardless of this patch-set. And there's another benefit if making use of this auth-token feature itself, as the client doesn't need to cache the users password any more. (I do need to verify that though, but there is no reason why it would be needed.)
Also, this patch becomes even more important now when it is recommended to enable --reneg-bytes 64MB if using ciphers using 64 bit cipher blocks.
- --
kind regards,
David Sommerseth
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)
iQIcBAEBAgAGBQJXvxCbAAoJEIbPlEyWcf3yWvAQALnZ4QiwJlUPbPz52aq5tf87 786pgA/m0hUbpHbv969M7RIEDvRW2UnDxrlmtlAHSxIU9NeEReZX1Ux8uQ4OGCKA J0y4qMF3jxAnxop00CKWCMxht/S4kCzSNNIro4ibIGTMWidELIPWvkfG2EXoUsZV U0mQrjBTi07T27g3nov+6VLFIp7gh/F1oN7GsdyjhdqVzK/TsP2WEbvWc2gDkOmk RgS50zWOta7kDU6v2maRPvlxFzN+f4QFbJGWlC4F29wthwt4wSQhi05Yd2nFLUbo HSKjR+KqPrPi9B66acFWABW3y4BpMN4B9CqQPPixA5oMVkpQKtt6tg0O2OUNKHjZ /hdUzYa2lK5iX6MxGVBCp9V0jYZIEfZPGXVrhXzKpyHU1OU3X8oYaVG9fvIr1ORF idRA5EUhdDL6S0aifBJeWxiKsk4RUvgiS4qn7uE0mwBU0AW1i7vAGQTXUYmVP5cU YzEU28ZS2wkfE9r137UuwyIDnfeDq2ZYclXRXd85F3GUZt3+qrQiwxA4YIMB1X6H DAMelsZ7JfnIzIFY/WsyI9eLp/MR2GZkW4gSjV9SFb5jBu5+Sj9D46AQJOA8xiI4 hfnxC7EMqJRC91PVC3uxuEHqH1jpzFmiM2nOLkZPiOioYR3yqhVwIg49swZHd5Qo 2rVcB9smEkQdknLwCibI
=1kcX
-----END PGP SIGNATURE-----
Quoted 53 lines · David Sommerseth
Quoted 23 lines · Selva Nair
On Thu, Aug 25, 2016 at 10:15 AM, David Sommerseth <[email protected]... <mailto:[email protected]...>> wrote:
Quoted 9 lines · David Woodhouse
Quoted 6 lines · David Sommerseth
I've been working a bit on a new patch-set which enables third-party user/password authentication mechanisms using two factor authentications [2FA] (such as OTP) and not needing to disable the renegotiation features of OpenVPN.
Hm, you handle the server side of OTP through PAM alone?
This change does not change the initial authentication at all. You still need an authentication plug-in or --auth-user-pass-verify script. But once this first authentication passes successfully, the OpenVPN server takes over the coming authentications required due to re-negotiations.
Quoted 7 lines
Why not let the auth-user-pass-verify script do this verification bypass? The server knows whether its an initial CONNECT or REAUTH and can pass that info to the verify script. Then the script can bypass verification if appropriate. Currently management-client-auth is already capable of doing this as "REAUTH" versus "CONNECT" info is passed to it. Adding that to the env and passing to scripts should be easy.
This is to avoid needing to modify any third-party authentication mechanisms. But passing information that it is a re-auth is might be a good idea, that isn't too hard to add.
However, it would need to be a flag to --auth-gen-token in addition - otherwise third party authentication mechanisms which have not been updated will fail. On the other hand, if anyone is willing to update an auth-plugin or script to support this, they could just as well implement the auth-token generation themselves independently and not require --auth-gen-token at all; which speaks against such a flag.
Also remember that this implementation covers both --plugin and
- --auth-user-pass-verify. For many it will be quite hard to modify a plug-in compared to updating a script.I'll grant that the 'auth-token' feature is a well hidden and not documented. But the issue with 2FA and --reneg-* options have been a long standing issue, which have not been fixed in most of the authentication plug-ins used by the community.
Quoted 6 lines
In regards to documentation, I'll try to improve that as well - regardless of this patch-set. And there's another benefit if making use of this auth-token feature itself, as the client doesn't need to cache the users password any more. (I do need to verify that though, but there is no reason why it would be needed.)
I was not aware of this auth-token feature. Just scanned through the
implementation: looks like a good way of handling user-auth during reneg. And possibly safer than just distinguishing reauth vs connect in the script. As is, it could be used from a verify-script or a management-client-auth script by setting the token at first connect and verifying it (instead of username/password) during reauth.
Agreed, an option for the server itself to generate the token would be a good addition. And yes, the token could be made the default user-auth mechanism during reneg regardless of 2FA is in use or not. As for caching, either the token will have to be cached unless management is in use in which case the UI/GUI can remember the token and supply it during reneg.
Selva
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Quoted 3 lines · Selva Nair
As for caching, either the token will have to be cached unless management is in use in which case the UI/GUI can remember the token and supply it during reneg.
Right, but I think we both agree that caching a temporary token which is valid for only a single session is far better than actually caching the users password ;-)
- --
kind regards,
David Sommerseth
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)
iQIcBAEBAgAGBQJXvy0UAAoJEIbPlEyWcf3y6fYQAKoKGrGv2v+VgBGNM5BRLGEw 8jIJ1waE0qyFlLXKb6WX6mXzw/oZQVmVx5ldBp7dnTrfoGTP9FTAUDAkMoMdFU6M g/9DjW9iL1f8azgUNY1frHOSaoXtfFCTKJQ0HFzcYFXlzv4QY8fYVnacuzkbbBZu 8y9XcDR6jvCFz5hAozeGjbv+Yqf2uY5C8VCRASqyfhVjZGrKz309dldAjNuoMRJz VM32ImicvZOSuRr3ln9jGbqHKHovq8FuU6DrhnYCg52VYAiOYyWvJgjeiC5aI0WG cgIrIeZUW89KkOndDJquRLcSE1ZoNVhw7QcHLm/XakGn1+n2BVrRsOt+1REo62Bh hFtXVX6iWCYNKZldf8Lf5/KnYeECpFehH65B1gGfjAIVDXrrme399u4Ue+CIKpkh CfO+vhTjFdTIuvMQruyk6vpgHh+6E4MAJATSrerzI2dxiztLlteczj+VHWjLn9tF ViNRQ8PYBKhR8qoVoERQtLm6K3OxcwQz4VO8b9n+o5BWIIfGVq+OR7n2F6OJjyrz BW1dppOkpTcyIyHo6K4B8gMsQ6xl9jj8dsz/+44jOehztl+OthljQIPYsPdA5kOQ 7ep2unfjh38o5o6V078++3w2s4P+8a3ju6aEjaMJSx1l0wpyXpdPt0DLjN6mNyy3 hb9XeQ07cfnyNHGi2ksi
=kOcn
-----END PGP SIGNATURE-----
Quoted 30 lines · David Sommerseth
I've been working a bit on a new patch-set which enables third-party user/password authentication mechanisms using two factor authentications [2FA] (such as OTP) and not needing to disable the renegotiation features of OpenVPN.
Currently, if a server is configured with 2FA using for example HOTP/TOTP tokens, each renegotiation of the tunnel would require the user to provide a new OTP code. The current workaround have been to disable the renegotiation (which by default happens once per hour). It is also not considered ideal to disable the renegotiation.
The patch-set I have worked on fixes this by adding a new server side option, --auth-gen-token. This makes use of a feature already found in OpenVPN clients. If a server pushes 'auth-token $TOKENVALUE' to a client, it will replace the currently locally stored password with $TOKENVALUE. Next time the OpenVPN tunnel is rengotiated, the $TOKENVALUE will now be passed instead to the server along with the username.
What the patch-set does is:
- - Add --auth-gen-token, and when used the following steps happens
- - After a successful normal user/password authentication, it will generate a random token for this tunnel and keep a local copy of it. This token is currently set to 256 bits (32 bytes).
- - It will push 'auth-token $RANDOM_TOKEN_VALUE'. The $RANDOM_TOKEN_VALUE sent to the client is BASE64 encoded.
Quoted 7 lines
- - When a re-authentication happens, and the server sees it have a token and the token have been sent to the client, it does an authentication of the token alone. Any --auth-user-pass-verify or --plugins enabling
OPENVPN_PLUGIN_AUTH_USER_PASS_VERIFYwill not be called at this point. On successful token authentication, everything continues as before. On failure the session is considered un-authenticated and a complete new authentication round is required.
I haven't yet had the chance to look at the code, but the concept makes sense.
One thing I think might be useful is a timeout that forces a client to do a full reauth. I can imagine a company policy that, for example, requires users to perform a 2FA at least every 4 hours. I'd want to implement such a policy without stretching the default 1 hour renegotiate to 4 hours. But that might also be too much of a corner case which is not worth the extra code...
-Steffan
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Quoted 6 lines · Steffan Karger
One thing I think might be useful is a timeout that forces a client to do a full reauth. I can imagine a company policy that, for example, requires users to perform a 2FA at least every 4 hours. I'd want to implement such a policy without stretching the default 1 hour renegotiate to 4 hours. But that might also be too much of a corner case which is not worth the extra code...
Good point!
With the input from Selva on the man page update, I started digging into when such a re-auth really can happen; turns out it's not that obvious. So I'll investigate this further and extend the patch-set accordingly.
- --
kind regards,
David Sommerseth
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)
iQIcBAEBAgAGBQJXv3MKAAoJEIbPlEyWcf3yvb0P/0LBkV8fUSnsPq2Duy4MT/Gl OHgoSpC/NcOBNghJQ3DoJBbumtIVtf/GD48O9SLCPSlqsoIVp5+SWMeuQLaiy9OR kHYW2b3EI8ZOTfnnN1OpTHwSan4m1v792+81SNGp8eaShGsSW7Ib3wxgXnrLWMVy 7vWu7C/giukNI32v0kiAfhfT5L5b8meLCpiGZiqysqejbs5otNWwwLdHK3ZSi/di dCGIhE5nYwPsXrZNXbEdleGjEb+akAONDVXq8PYIyKkAsizVtTFwr6SLOdi/POg0 WfQh9mIKTCHm53WVA42d/37SGSoPormLT6TLDP0rSqZOWYBlUzsKWe93QpNYiaXe hhS7F1Vg366JWUCwNywlTKNHYLRtYkckkEaCFnp2stU8sQytjGfeI3tdwolXyxxy fSwE0FsxZlV0wzCZYwSmhaGcCRconcYOccae2b0ZgSj3n4+RP6P+sFlRgqGVbzjY kYJh+tDUSxk2gpCAF2P+FjgDqe3E91IP1DA7xW7z6iZdIY+8tTP8t3uZPl9Fissh MJvG0cRihaqE8aRiK6TCpqPYcGYbdv4CYcrK6F8GCZwm6hHK1n468R5j2sPMu8sy LysSoTSSCBFVx5EbKRwOJrT4cK3NVUE8Kd+8P2rmKDmv5CaTRlLaFJvvcfs869XS oU0LuW9S5zDEjHTuYKMs
=Bl/d
-----END PGP SIGNATURE-----
Hi,
Quoted 6 lines · Steffan Karger
One thing I think might be useful is a timeout that forces a client to do a full reauth. I can imagine a company policy that, for example, requires users to perform a 2FA at least every 4 hours. I'd want to implement such a policy without stretching the default 1 hour renegotiate to 4 hours. But that might also be too much of a corner case which is not worth the extra code...
You just beat me to typing this :-) - right now, our corporate VPN uses --reneg-sec 28800, because corporate policy says "2FA sessions must be reauthenticated every 8 hours".
So, with the auth token stuff (which I find immensely amazing :-) ), we could renegotiate much more often, but then we'd violate policy - so "generate tokens that are valid for <n> hours" would be a very helpful addition here.
gert
Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
//www.muc.de/~gert/
Gert Doering - Munich, Germany [email protected]...
fax: +49-89-35655025 [email protected]...Hi,
Quoted 7 lines · David Sommerseth
The patch-set can be found here:
<https://gitlab.com/dazo/openvpn/compare/master...dev%2Fauth-gen-token>And the git tree can be found here:
<https://gitlab.com/dazo/openvpn.git>
(Check out the dev/auth-gen-token branch)
I posted some quick comments against the commits in your gitlab repo. Its only the other day I saw the auth-token code for the first time, so I may have more to say after another look when you submit it to the list.
Thanks,
Selva
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Quoted 15 lines · Selva Nair
Hi,
On Thu, Aug 25, 2016 at 9:45 AM, David Sommerseth
<[email protected]...
<mailto:[email protected]...>> wrote:The patch-set can be found here:
<https://gitlab.com/dazo/openvpn/compare/master...dev%2Fauth-gen-tokenAnd the git tree can be found here:
<https://gitlab.com/dazo/openvpn.git> (Check out the dev/auth-gen-token branch)
Quoted 5 lines
I posted some quick comments against the commits in your gitlab repo. Its only the other day I saw the auth-token code for the first time, so I may have more to say after another look when you submit it to the list.
Thank you very much!
I've already responded to most of your comments on gitlab, and others may provide feedback as well too. I am incredibly thankful for your reviews and insightful comments, Selva!
There are quite a few things which should be improved before I post it to the ML. I'll keep this feature branch buildable and up-to-speed to the master branch, so this can truly be tested.
My goal is to have all this sorted out before the next 2.3 release, as I believe this will be important for other changes coming to 2.3 as well.
- --
kind regards,
David Sommerseth
OpenVPN Technologies, Inc
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)
iQIcBAEBAgAGBQJXwWavAAoJEIbPlEyWcf3yvg8P/idH8HwqOGv+TAmvYi3MRgNX 3STktN02ljyXTfdIu1G2xB5fm0+xvaO0brQ811mmTXPb6RXpQe2rnrKmfuJZAUE2 p8f0jm7unkhwQGaPkeByGDU95I/r1gCnX+8EPFRNTgMyQ+CSYtOO8NJYWar9xJPI rNBfIhAiBXay7cReBGm2zHuiOMgymZR3V1vUNQCT+uUa7NcFdo3Kej2fl8MmqbW8 nZghSt5BSkcdzsOko0we0htqqFU445XVOfYqMZAX7sVuo5YvCYBjC9qW+6TYNy4I nx8oxoh2S68FzFUHphaNGko4h5oxD960aSKjiTRuchGlVpTB97Bann325Votf4KK 75hWs0HIPL6/QPc3UmZwgslomrz2JuDVl9P82lE7Cibbljo1vayUUbNIch/mXOR4 izHIXHmqzc5TQ5uZfUBDPFG2oXGOhCia3hOOPLBYiYvpA5RkdYo0wA7S6XGhrqEm 8ljLVBipw2KD1wKiS+yKbXKqewbM+0sp+RMHIq5Zs3b3ReH0TtbutJtM1T052msx h7ZV4yEuovqgmmBkWmNokTRCNzjvhWsM4mrjvGBvDlq2ZJjSUhNlKvNqDbTMfCgb xCfsIghXOXUNUOPnHhCqJCkSTyEGemjXTFubJ7bnFSHi+08qY5SPM59DDFfXo8Ot 8XcgADaXM3bVbt2TqXPk
=pse0
-----END PGP SIGNATURE-----
Quoted 9 lines
The patch-set can be found here:
<https://gitlab.com/dazo/openvpn/compare/master...dev%2Fauth-gen-token <https://gitlab.com/dazo/openvpn/compare/master...dev%2Fauth-gen-token>>And the git tree can be found here:
<https://gitlab.com/dazo/openvpn.git <https://gitlab.com/dazo/openvpn.git>>
(Check out the dev/auth-gen-token branch)I posted some quick comments against the commits in your gitlab repo. Its only the other day I saw the auth-token code for the first time, so I may have more to say after another look when you submit it to the list.
Same here, some comments in gitlab. This might be a good feature to get the unit testing integration.
jens
Quoted 3 lines · David Sommerseth
Hi,
[...snip...]
Quoted 21 lines
What the patch-set does is:
- Add --auth-gen-token, and when used the following steps happens
- After a successful normal user/password authentication, it will generate a random token for this tunnel and keep a local copy of it. This token is currently set to 256 bits (32 bytes).
- It will push 'auth-token $RANDOM_TOKEN_VALUE'. The $RANDOM_TOKEN_VALUE sent to the client is BASE64 encoded.
- When a re-authentication happens, and the server sees it have a token and the token have been sent to the client, it does an authentication of the token alone. Any --auth-user-pass-verify or --plugins enabling
OPENVPN_PLUGIN_AUTH_USER_PASS_VERIFYwill not be called at this point. On successful token authentication, everything continues as before. On failure the session is considered un-authenticated and a complete new authentication round is required.
Quoted 8 lines
If --auth-gen-token is NOT used, OpenVPN will behave as before.
The patch-set can be found here:
<https://gitlab.com/dazo/openvpn/compare/master...dev%2Fauth-gen-token>And the git tree can be found here:
<https://gitlab.com/dazo/openvpn.git> (Check out the dev/auth-gen-token branch)
I've spent some time improving these patches with the input from Selva, Jens, Steffan and Gert.
- The dev/auth-gen-token branch have been updated to latest master
- Properly clear the auth_token from memory before free()ing it Add memset() before clearing the token from memory
- Add additional check that the user name has not changed... Check with tls_lock_username() which verifies username is the same.
- Properly de-authenticate the TLS connection on auth-token failures Call tls_deauthenticate() on authentication failures. This triggers connected client with failure to disconnect properly.
- Enhance option parsing for --auth-gen-token
~ Require OPT_P_GENERAL_FLAGS
~ Dump the auth_generate_token flag on --verb 4 and higher ~ Ensure --auth-gen-token cannot be used in any of the client modes
- Mask/hide generated tokens unless verbose/debug level is >= 7 It was considered that this information is valuable during debugging, but otherwise it can be hidden.
- Implement optional auth token lifetime for generated token This allows an auth-token to only be valid for a certain time period
- man-page: Document the --auth-gen-token feature
Everything can be found here:
<https://gitlab.com/dazo/openvpn/commits/dev/auth-gen-token>
(in the dev/auth-gen-token branch)
Unless the feedback requires more work, I'll squash them a bit and submitt them to the mailing list now. General testing looks good so far.
Signature · 4 lines
kind regards, David Sommerseth OpenVPN Technologies, Inc