Skip to content

Commit

Permalink
TLS-PSK mismatch fix.
Browse files Browse the repository at this point in the history
Produce an error if a TLS-PSK client tries to connect to a broker
that is not configured with TLS-PSK.
  • Loading branch information
ralight committed Aug 19, 2021
1 parent fc4099e commit a37c8e6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
7 changes: 7 additions & 0 deletions ChangeLog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ Broker:
users this is not a risk. Closes #567213.
- Fix `max_connections` option not being correctly counted.

Client library:
- If a client uses TLS-PSK then force the default cipher list to use "PSK"
ciphers only. This means that a client connecting to a broker configured
with x509 certificates only will now fail. Prior to this, the client would
connect successfully without verifying certificates, because they were not
configured.

Clients:
- mosquitto_sub and mosquitto_rr now open stdout in binary mode on Windows
so binary payloads are not modified when printing.
Expand Down
3 changes: 3 additions & 0 deletions lib/net_mosq.c
Original file line number Diff line number Diff line change
Expand Up @@ -857,6 +857,9 @@ static int net__init_ssl_ctx(struct mosquitto *mosq)
#ifdef FINAL_WITH_TLS_PSK
}else if(mosq->tls_psk){
SSL_CTX_set_psk_client_callback(mosq->ssl_ctx, psk_client_callback);
if(mosq->tls_ciphers == NULL){
SSL_CTX_set_cipher_list(mosq->ssl_ctx, "PSK");
}
#endif
}
}
Expand Down

0 comments on commit a37c8e6

Please sign in to comment.