nvme/tcp: handle rejected keys for secure concatnation
PATCH 1/1 nvme/tcp: handle rejected keys for secure concatnation
From: Wilfred Mallawa <[email protected]>
The NVMe-TCP specification [1] states that if the PSK retained or generated is not available on the subsystem, the TLS 1.3 handshake shall be aborted with an unknown_psk_identity alert and the connection be closed.
Currently, when an unknown_psk_identity alert is sent from an endpoint, tlshd returns EACCES as the TLS error. On subsequent reconnection attempts, we fail with the same error because we keep attempting to connect with a stale key. This may occur if the endpoint experienced a full reset and lost its PSK.
With support in tlshd to return -EKEYREJECTED when an unknown_psk_identity alert is received, the kernel can now detect this condition and revoke the current tls_key. This allows the subsequent reconnect to perform re-authentication via DHCHAP to generate a fresh PSK.
--- drivers/nvme/host/tcp.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/nvme/host/tcp.c +11 -0
@@ -1767,6 +1767,17 @@ static int nvme_tcp_start_tls(struct nvme_ctrl *nctrl,dev_err (nctrl->device,"queue %d: TLS handshake complete, error %d\n" , qid, queue->tls_err); + +/* +* Key maybe stale, revoke it such that on a subsequent +* reconnect, we will generate a new PSK. +*/ +if (queue->tls_err ==EKEYREJECTED && qid ==0 && + nctrl->opts->concat && nctrl->opts->tls_key) { +nvme_auth_revoke_tls_key (nctrl); +dev_warn (nctrl->device, +"qid 0: revoking stale key\n" ); + } }else {dev_dbg (nctrl->device,"queue %d: TLS handshake complete\n" , qid);
Signature · 1 line
2.54.0
Christoph Hellwig
maintainers/concatnation/concatenation/ in the subject.
The changes itself look good to me, but I'd rather leave review to someone who knows that code.
Quoted 2 lines · Wilfred Mallawa
From: Wilfred Mallawa <[email protected]>
In the title: s/concatnation/concatenation
Quoted 28 lines
The NVMe-TCP specification [1] states that if the PSK retained or generated is not available on the subsystem, the TLS 1.3 handshake shall be aborted with an
unknown_psk_identityalert and the connection be closed.Currently, when an
unknown_psk_identityalert is sent from an endpoint, tlshd returns EACCES as the TLS error. On subsequent reconnection attempts, we fail with the same error because we keep attempting to connect with a stale key. This may occur if the endpoint experienced a full reset and lost its PSK.With support in tlshd to return
-EKEYREJECTEDwhen anunknown_psk_identityalert is received, the kernel can now detect this condition and revoke the currenttls_key. This allows the subsequent reconnect to perform re-authentication via DHCHAP to generate a fresh PSK.Signed-off-by Wilfred Mallawa <[email protected]>--- drivers/nvme/host/tcp.c | 11 +++++++++++ 1 file changed, 11 insertions(+)drivers/nvme/host/tcp.c +0
-0
drivers/nvme/host/tcp.c static int nvme_tcp_start_tls(struct nvme_ctrl *nctrl, · line 1772
Quoted 6 lines
drivers/nvme/host/tcp.c +3
-0@@ -1767,6 +1767,17 @@ static int nvme_tcp_start_tls(struct nvme_ctrl *nctrl,dev_err (nctrl->device,"queue %d: TLS handshake complete, error %d\n" , qid, queue->tls_err); + +/* +* Key maybe stale, revoke it such that on a subsequent
* If the key is stale, revoke it...
Quoted 11 lines
drivers/nvme/host/tcp.c +8
-0+* reconnect, we will generate a new PSK. +*/ +if (queue->tls_err ==EKEYREJECTED && qid ==0 && + nctrl->opts->concat && nctrl->opts->tls_key) { +nvme_auth_revoke_tls_key (nctrl); +dev_warn (nctrl->device, +"qid 0: revoking stale key\n" ); + } }else {dev_dbg (nctrl->device,"queue %d: TLS handshake complete\n" , qid);
Signature · 2 lines
Damien Le Moal Western Digital Research
Quoted 37 lines · Wilfred Mallawa
From: Wilfred Mallawa <[email protected]>
The NVMe-TCP specification [1] states that if the PSK retained or generated is not available on the subsystem, the TLS 1.3 handshake shall be aborted with an
unknown_psk_identityalert and the connection be closed.Currently, when an
unknown_psk_identityalert is sent from an endpoint, tlshd returns EACCES as the TLS error. On subsequent reconnection attempts, we fail with the same error because we keep attempting to connect with a stale key. This may occur if the endpoint experienced a full reset and lost its PSK.With support in tlshd to return
-EKEYREJECTEDwhen anunknown_psk_identityalert is received, the kernel can now detect this condition and revoke the currenttls_key. This allows the subsequent reconnect to perform re-authentication via DHCHAP to generate a fresh PSK.Signed-off-by Wilfred Mallawa <[email protected]>--- drivers/nvme/host/tcp.c | 11 +++++++++++ 1 file changed, 11 insertions(+)drivers/nvme/host/tcp.c +4
-0@@ -1767,6 +1767,17 @@ static int nvme_tcp_start_tls(struct nvme_ctrl *nctrl,dev_err (nctrl->device,"queue %d: TLS handshake complete, error %d\n" , qid, queue->tls_err); + +/* +* Key maybe stale, revoke it such that on a subsequent +* reconnect, we will generate a new PSK.
drivers/nvme/host/tcp.c static int nvme_tcp_start_tls(struct nvme_ctrl *nctrl, · line 1783
Quoted 10 lines
drivers/nvme/host/tcp.c +7
-0+*/ +if (queue->tls_err ==EKEYREJECTED && qid ==0 && + nctrl->opts->concat && nctrl->opts->tls_key) { +nvme_auth_revoke_tls_key (nctrl); +dev_warn (nctrl->device, +"qid 0: revoking stale key\n" ); + } }else {dev_dbg (nctrl->device,"queue %d: TLS handshake complete\n" , qid);
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke Kernel Storage Architect [email protected] +49 911 74053 688 SUSE Software Solutions GmbH, Frankenstr. 146, 90461 Nürnberg HRB 36809 (AG Nürnberg), GF: I. Totev, A. McDonald, W. Knoblich