Closed water5-cmd closed 2 years ago
I may know the reason for the problem.
I checked whether ssl authentication was enabled for the
root
and test
users and found that only the root
user had ssl authentication enabled, which presumably explains why the test
user could use a non-TLS connection.
root@daier:/home/daier/SGX_database# mysql -h127.0.0.1 -utest -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 40
Server version: 5.5.5-10.5.11-MariaDB-debug-log Source distribution
Copyright (c) 2000, 2022, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> select ssl_type from user where user='test' and host='%';
+----------+
| ssl_type |
+----------+
| |
+----------+
1 row in set (0.01 sec)
mysql> select ssl_type from user where user='root' and host='%';
+-----------+
| ssl_type |
+-----------+
| SPECIFIED |
+-----------+
1 row in set (0.01 sec)
mysql>
But EdgelessDB enforces TLS connection, why should I use tls=skip-verify
or tls=custom
to connect via code, while I can use mysql -h127.0.0.1 -utest -p
from the MySQL client under linux?
Hi, We need to distinguish between the TLS connection itself, server authentication, and client authentication here.
EdgelessDB always enforces TLS. Try mysql -h127.0.0.1 -utest -p123 --ssl-mode=DISABLED
. It won't work. (If you don't use any --ssl args, the mysql client will try TLS first and falls back to unencrypted. That's why it works without these args.)
TLS without server auth is not secure. Unfortunately, the mysql client doesn't enforce it by default. You can enforce it by mysql -h127.0.0.1 -utest -p123 --ssl-mode=VERIFY_CA
. It won't work without also using --ssl-ca. (When using --ssl-ca, ssl-mode is implicitly set to VERIFY_CA, so you can omit that one.)
EdgelessDB can't enforce server auth. This can only happen on the client side.
Regarding client auth, EdgelessDB enforces it for users created with REQUIRE ISSUER. Connecting as root without --ssl-cert and --ssl-key won't work.
When connecting as user test, ssl-cert and ssl-key are ignored because the user isn't created with REQUIRE ISSUER.
Hi, @thomasten, I would like to ask you about TLS connection. The
test
user was created inmanifest.json
with the following detailsNow, I can use two ways to connect to the database.
So, I can connect to the database with or without TLS. But EdgelessDB enforces TLS connection, why won't non-tls connections be rejected? And Why does the database print out the correct
test
user when exiting using a non-TLS connection? From what I understand, users who connect non-TLS are initially rejected; even if the connection is successful, the database will get ciphertext data, and parsing the ciphertext data will not result in the correct username. I don't know if I understand it right.