Is auth-nocache broken?
Hi,
Using --auth-user-pass, --auth-nocache and --reneg-sec <a small value>, no auth-tokens in use, I see that username/password is prompted on the first connection attempt and at first renegotiation. After that reneg completes without prompting for user/pass.
Looking at the server it shows the previously entered password is passed in.So auth-nocache is no longer effective after the first renegotiation?
A log snippet using a local build that also prints when purge_user_pass() and get_user_pass_cr() are entered is attached.
After reneg, the client progresses beyond AUTH state (as reported on Trac #1471 ( https://community.openvpn.net/openvpn/ticket/1471) which may be related. Unless it has been like this all along.
Selva
(initial connection)
2022-10-19 14:14:36 us=207252 Outgoing Data Channel: Cipher 'AES-256-GCM' initialized with 256 bit key 2022-10-19 14:14:36 us=207261 Incoming Data Channel: Cipher 'AES-256-GCM' initialized with 256 bit key 2022-10-19 14:14:36 us=207272 In purge_user_pass <-- user/pass purged 2022-10-19 14:14:36 us=207277 Initialization Sequence Completed
(first reneg)
2022-10-19 14:15:36 us=913345 TLS: soft reset sec=60/60 bytes=1328/-1 pkts=11/0 2022-10-19 14:15:36 us=948578 In get_user_pass_cr <-- prompt for user/pass
Enter Auth Username:
Enter Auth Password:
2022-10-19 14:15:48 us=429968 VERIFY OK: depth=1, C=CA, ST=****** 2022-10-19 14:15:48 us=430098 VERIFY OK: nsCertType=SERVER 2022-10-19 14:15:48 us=430107 VERIFY OK: depth=0, C=CA, ST=****** 2022-10-19 14:15:48 us=474622 Control Channel: TLSv1.3, cipher TLSv1.3 TLS_AES_256_GCM_SHA384, peer certificate: 384 bit EC, curve secp384r1, signature: RSA-SHA256 2022-10-19 14:15:48 us=474749 Outgoing Data Channel: Cipher 'AES-256-GCM' initialized with 256 bit key 2022-10-19 14:15:48 us=474777 Incoming Data Channel: Cipher 'AES-256-GCM' initialized with 256 bit key
(no user/pass purge)
(second reneg and no prompt for user/pass)
2022-10-19 14:16:48 us=257949 TLS: soft reset sec=60/60 bytes=148/-1 pkts=3/0 2022-10-19 14:16:48 us=333598 VERIFY OK: depth=1, C=CA, ST=ON, L=******* 2022-10-19 14:16:48 us=333945 VERIFY OK: nsCertType=SERVER 2022-10-19 14:16:48 us=333972 VERIFY OK: depth=0, C=CA, ST=******* 2022-10-19 14:16:48 us=382539 Control Channel: TLSv1.3, cipher TLSv1.3 TLS_AES_256_GCM_SHA384, peer certificate: 384 bit EC, curve secp384r1, signature: RSA-SHA256 2022-10-19 14:16:48 us=382624 Outgoing Data Channel: Cipher 'AES-256-GCM' initialized with 256 bit key 2022-10-19 14:16:48 us=382646 Incoming Data Channel: Cipher 'AES-256-GCM' initialized with 256 bit key
Quoted 5 lines
After reneg, the client progresses beyond AUTH state (as reported on Trac #1471 ( https://community.openvpn.net/openvpn/ticket/1471) which may be related. Unless it has been like this all along.
Please Ignore that comment -- Trac# 1471 is a special case and may not be related at all. In this case there is not state stuck at AUTH issue -- just password does not get purged.
Selva
Quoted 1 line
Hi,
Quoted 4 lines · Selva Nair
Using --auth-user-pass, --auth-nocache and --reneg-sec <a small value>, no auth-tokens in use, I see that username/password is prompted on the first connection attempt and at first renegotiation. After that reneg completes without prompting for user/pass.
It's possibly we broke that by trying to repair all the corner cases with either pushing tokens from the server, or *not* using auth-nocache.
I assume you tested with master?
(Unfortunately my automated tests all use "username + passwords are coming from a file", which means "send the same one as before" and "go read the file again" both produce the same effect... having a management-interface driven client test would help here... no time yet to write one)
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]...Hi,
Quoted 12 lines · Gert Doering
Hi,
Quoted 1 line · Selva Nair
Using --auth-user-pass, --auth-nocache and --reneg-sec <a small value>,
no
Quoted 3 lines
auth-tokens in use, I see that username/password is prompted on the first connection attempt and at first renegotiation. After that reneg completes without prompting for user/pass.
It's possibly we broke that by trying to repair all the corner cases with either pushing tokens from the server, or *not* using auth-nocache.
Quoted 7 lines
I assume you tested with master?
(Unfortunately my automated tests all use "username + passwords are coming from a file", which means "send the same one as before" and "go read the file again" both produce the same effect... having a management-interface driven client test would help here... no time yet to write one)
This is broken for a while now -- since commit dfd624b52bce7ddd0eeaab516df9848e432f3242 (*2.4 and 2.5 are also affected*)
That commit changed the earlier delayed purge logic to
- if (!auth_user_pass.wait_for_push)
+ if (!session->opt->pull)
{
purge_user_pass(&auth_user_pass, false);
}In clients that pull, "wait_push" used to be set to false on completing the first
negotiation, but after this change we are not purging user/pass at all at this
point.
Purging still happens on first negotiation in "set_auth_token()" as before, but that will not get called during renegs unless auth-token is in use and a new token gets pushed after expiry.
Not clearing the username has been rejected in the past although, somehow, retaining it with the token has been found acceptable. Instead, we went for a convoluted logic that has proven itself to be hard to get right.
A compromise is to continue to clear username in the auth_user_pass struct for
appearances sake (for nocache contract), but always retain it in the auth_token
struct.That would considerably simplify the logic as well
(see e.g.,
https://github.com/selvanair/openvpn/commit/e9bf3c8227e365099deaadc11d31ac8a0c7668d7
)
Selva