[MDEV-31857] enable --ssl-verify-server-cert by default Created: 2023-08-05  Updated: 2024-02-08  Resolved: 2024-02-05

Status: Closed
Project: MariaDB Server
Component/s: SSL
Fix Version/s: 11.4.1

Type: New Feature Priority: Critical
Reporter: Sergei Golubchik Assignee: Sergei Golubchik
Resolution: Fixed Votes: 0
Labels: Preview_11.3

Issue Links:
Blocks
blocks MDEV-28634 Client's --ssl-* options (without --s... Closed
is blocked by MDEV-31856 use ephemeral ssl certificates Closed
PartOf
Problem/Incident
causes MDEV-32473 MariaBackup requires disable-ssl-veri... Closed
Relates
relates to MDEV-33396 main.user_limits fails sporadically w... Open

 Description   

The summary says it all, let's get a secure-by-default connection by enabling --ssl-verify-server-cert by default.



 Comments   
Comment by Daniel Lenski [ 2023-08-10 ]

I wholeheartedly approve of this!

Note that my PR mariadb-connector-c #225 already accomplishes two important related tasks:

  1. Preventing a long-known path for silent SSL→plaintext downgrade (that's MDEV-28634)
  2. Reduction of attack surface, in terms of eliminating other code paths that could allow such downgrades
Comment by Sergei Golubchik [ 2023-08-21 ]

Note that MDEV-31856 is a precondition for --ssl-verify-server-cert. We can only enable it by default (preventing SSL→plaintext downgrade, as you correctly pointed out) if MariaDB servers will have SSL enabled by default, so that clients will continue to work even without SSL→plaintext downgrade.

Comment by Sergei Golubchik [ 2023-09-06 ]

the most time consuming part was to fix mtr tests, as they mostly use passwordless accounts and that makes server cert validation to fail

Comment by Sergei Golubchik [ 2023-09-08 ]

see MDEV-31855 for the list of commits

Comment by Oleksandr Byelkin [ 2023-09-12 ]

OK to push

Comment by Sergei Golubchik [ 2023-09-15 ]

To be more user-friendly in a typical passwordless test environment, mariadb cli, will disable --ssl-verify-server-cert if

  • --ssl-verify-server-cert was not enabled explicitly
  • CA was not specified
  • fingerprint was not specified
  • protocol is TCP
  • no password was provided

It'll also print a warning in this case

Comment by Lena Startseva [ 2024-01-23 ]

Testing done. Ok to push.

Comment by Inada Naoki [ 2024-02-08 ]

`mysql_init()` now set `use_ssl=1` by default . Is this intended?

https://github.com/MariaDB/server/commit/abcd23add20276e4996773f578e77d5733e1b582#diff-b7189447363b2b74ee642549c398c1adcee11e2c8f4e0fa529dfde9d8f9e32faR1442

It makes MariaDB close to MySQL behavior (ssl_mode=PREFERRED by default).
So it reduce confusion of users who don't know difference between libmariadb and libmysql.

But use_ssl by default makes difficult to prohibit plaintext downgrade.

Generated at Thu Feb 08 10:26:59 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.