From: "ralf_lici (Code Review)" Date: Tue, 17 Feb 2026 08:10:25 +0000 In-Reply-To: References: Reply-To: ralf@...2726..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net Message-ID: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="UmX6C4jZDeM="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: tls: reject incoming reneg request if primary key is not fully valid List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: plaisthos Cc: openvpn-devel --UmX6C4jZDeM= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: plaisthos, ralf_lici. Hello plaisthos, I'd like you to reexamine a change. Please visit http://gerrit.openvpn.net/c/openvpn/+/1478?usp=3Demail to look at the new patch set (#3). The following approvals got outdated and were removed: Code-Review+2 by plaisthos The change is no longer submittable: Code-Review and checks~ChecksSubmitRul= e are unsatisfied now. Change subject: tls: reject incoming reneg request if primary key is not fu= lly valid ...................................................................... tls: reject incoming reneg request if primary key is not fully valid Incoming P_CONTROL_SOFT_RESET_V1 can arrive while the active key is not yet fully valid for renegotiation. This includes the window where we are still waiting for auth_deferred_expire (derived from handshake/reneg timing), as well as cases where deferred or mid-session auth later leaves the key non-authenticated even though state is S_GENERATED_KEYS. This patch keeps read_control_auth as the first gate, then rejects the incoming renegotiation requests unless the primary key is KS_AUTH_TRUE and auth_deferred_expire has passed. Change-Id: I704c560fa23c03237d0f8adc30908a617265a5a1 Signed-off-by: Ralf Lici --- M src/openvpn/ssl.c 1 file changed, 14 insertions(+), 0 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/78/1478/3 diff --git a/src/openvpn/ssl.c b/src/openvpn/ssl.c index 69d0e4e..98641a1 100644 --- a/src/openvpn/ssl.c +++ b/src/openvpn/ssl.c @@ -3747,6 +3747,20 @@ goto error; } + /* + * Do not allow incoming renegotiation unless our primary key = is + * fully authenticated and past the deferred-auth/transition g= ate. + */ + time_t auth_deferred_left =3D ks->auth_deferred_expire - now; + if (ks->authenticated !=3D KS_AUTH_TRUE || auth_deferred_left = > 0) + { + msg(D_TLS_ERRORS, + "TLS Error: rejecting incoming renegotiation request f= or key-id %d: " + "auth=3D%s, auth_deferred_expire in %d seconds", + ks->key_id, ks_auth_name(ks->authenticated), auth_defe= rred_left > 0 ? (int)auth_deferred_left : 0); + goto error; + } + key_state_soft_reset(session); dmsg(D_TLS_DEBUG, "TLS: received P_CONTROL_SOFT_RESET_V1 s=3D%= d sid=3D%s", i, -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1478?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings?usp=3Demail Gerrit-MessageType: newpatchset Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I704c560fa23c03237d0f8adc30908a617265a5a1 Gerrit-Change-Number: 1478 Gerrit-PatchSet: 3 Gerrit-Owner: ralf_lici Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos Gerrit-Attention: ralf_lici --UmX6C4jZDeM= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is cur= rently required from: plaisthos, ralf_lici.

ralf_lici uploaded patch set #3 to this change.

<= a href=3D"http://gerrit.openvpn.net/c/openvpn/+/1478?usp=3Demail">View Chan= ge

The following approvals got outdated and were removed: Code-Review+2 by plaisthos

The change is no longer submittable: Code-= Review and checks~ChecksSubmitRule are unsatisfied now.

tl=
s: reject incoming reneg request if primary key is not fully valid

I= ncoming P_CONTROL_SOFT_RESET_V1 can arrive while the active key is not
y= et fully valid for renegotiation. This includes the window where we are
= still waiting for auth_deferred_expire (derived from handshake/reneg
tim= ing), as well as cases where deferred or mid-session auth later
leaves t= he key non-authenticated even though state is S_GENERATED_KEYS.

This= patch keeps read_control_auth as the first gate, then rejects the
incom= ing renegotiation requests unless the primary key is KS_AUTH_TRUE
and au= th_deferred_expire has passed.

Change-Id: I704c560fa23c03237d0f8adc3= 0908a617265a5a1
Signed-off-by: Ralf Lici <ralf@...2726...>
---<= br>M src/openvpn/ssl.c
1 file changed, 14 insertions(+), 0 deletions(-)<= br>
git pull ssh://gerrit.openvpn.net:29418/openvpn =
refs/changes/78/1478/3
diff --git a/src/openvpn/ssl.c b/src/openvpn=
/ssl.c
index 69d0e4e..98641a1 100644
--- a/= src/openvpn/ssl.c
+++ b/src/openvpn/ssl.c
@= @ -3747,6 +3747,20 @@
goto error; }

+ /*
+ * Do not allow incoming renegotiation unless o= ur primary key is
+ = * fully authenticated and past the deferred-auth/transition gate= .
+ */
+ time_t aut= h_deferred_left =3D ks->auth_deferred_expire - now;
+ if (ks->authenticated != =3D KS_AUTH_TRUE || auth_deferred_left > 0)
+ {
+ msg(D_TLS_ERRORS,
+ "TLS Error: rej= ecting incoming renegotiation request for key-id %d: "
+ "auth=3D%s= , auth_deferred_expire in %d seconds",

+ ks->key_id, ks_auth_name(ks-= >authenticated), auth_deferred_left > 0 ? (int)auth_deferred_left : 0= );
+ g= oto error;
+ = }
+
key_state_soft_reset(session);

<= span> dmsg(D_TLS_DEBUG, "TLS: received P_CONTROL_SOFT_RESE= T_V1 s=3D%d sid=3D%s", i,

To view,= visit c= hange 1478. To unsubscribe, or for help writing mail filters, visit settings.

<= meta itemprop=3D"name" content=3D"View Change"/>
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I704c560fa23c03237d0f8adc309= 08a617265a5a1
Gerrit-Change-Number: 1478
Gerrit-PatchSet: 3
Gerrit-Owner: ralf_lici <ralf@...2726...>= ;
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-Attention: plaisthos <arne-openvpn@...220...= ..1227...>
Gerrit-Attention: ralf_lici <ralf@...2804...= .>
= --UmX6C4jZDeM=--