Skip to content

Commit 429fcaf

Browse files
committed
Add client_ed25519 tests for MariaDB 10.4.
Signed-off-by: Bradley Grainger <[email protected]>
1 parent fa7271c commit 429fcaf

File tree

10 files changed

+46
-16
lines changed

10 files changed

+46
-16
lines changed

.ci/config/config.compression.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"ConnectionString": "server=127.0.0.1;user id=mysqltest;password='test;key=\"val';port=3306;database=mysqltest;ssl mode=none;UseCompression=true;DefaultCommandTimeout=3600",
44
"PasswordlessUser": "no_password",
55
"SecondaryDatabase": "testdb2",
6-
"UnsupportedFeatures": "RsaEncryption,CachingSha2Password,Tls12,UuidToBin",
6+
"UnsupportedFeatures": "Ed25519,RsaEncryption,CachingSha2Password,Tls12,UuidToBin",
77
"MySqlBulkLoaderLocalCsvFile": "../../../../TestData/LoadData_UTF8_BOM_Unix.CSV",
88
"MySqlBulkLoaderLocalTsvFile": "../../../../TestData/LoadData_UTF8_BOM_Unix.TSV"
99
}

.ci/config/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"ConnectionString": "server=127.0.0.1;user id=mysqltest;password='test;key=\"val';port=3306;database=mysqltest;ssl mode=none;DefaultCommandTimeout=3600",
44
"PasswordlessUser": "no_password",
55
"SecondaryDatabase": "testdb2",
6-
"UnsupportedFeatures": "RsaEncryption,CachingSha2Password,Tls12,UuidToBin",
6+
"UnsupportedFeatures": "Ed25519,RsaEncryption,CachingSha2Password,Tls12,UuidToBin",
77
"MySqlBulkLoaderLocalCsvFile": "../../../../TestData/LoadData_UTF8_BOM_Unix.CSV",
88
"MySqlBulkLoaderLocalTsvFile": "../../../../TestData/LoadData_UTF8_BOM_Unix.TSV"
99
}

.ci/docker-run.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ for i in `seq 1 30`; do
6060
if [ $? -ne 0 ]; then continue; fi
6161
fi
6262

63+
if [[ $OMIT_FEATURES != *"Ed25519"* ]]; then
64+
docker exec -it $NAME bash -c 'mysql -uroot -ptest < /etc/mysql/conf.d/init_ed25519.sql' >/dev/null 2>&1
65+
if [ $? -ne 0 ]; then continue; fi
66+
fi
67+
6368
# exit if successful
6469
docker exec -it $NAME mysql -ussltest -ptest \
6570
--ssl-mode=REQUIRED \

.ci/server/init_ed25519.sql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
INSTALL SONAME 'auth_ed25519';
2+
CREATE USER 'ed25519user'@'%' IDENTIFIED VIA ed25519 USING PASSWORD('Ed255!9');
3+
GRANT ALL PRIVILEGES ON *.* TO 'ed25519user'@'%';

.travis.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,22 @@ services: docker
55
env:
66
- IMAGE=mysql:5.6
77
NAME=mysql
8-
OMIT_FEATURES=Json,Sha256Password,RsaEncryption,LargePackets,CachingSha2Password,SessionTrack,Tls11,Tls12,UuidToBin
8+
OMIT_FEATURES=Ed25519,Json,Sha256Password,RsaEncryption,LargePackets,CachingSha2Password,SessionTrack,Tls11,Tls12,UuidToBin
99
- IMAGE=mysql:5.7
1010
NAME=mysql
11-
OMIT_FEATURES=RsaEncryption,CachingSha2Password,Tls12,UuidToBin
11+
OMIT_FEATURES=Ed25519,RsaEncryption,CachingSha2Password,Tls12,UuidToBin
1212
- IMAGE=mysql:8.0
1313
NAME=mysql
14-
OMIT_FEATURES=None
14+
OMIT_FEATURES=Ed25519
1515
- IMAGE=percona:5.7.22
1616
NAME=percona
17-
OMIT_FEATURES=CachingSha2Password,UuidToBin
17+
OMIT_FEATURES=CachingSha2Password,Ed25519,UuidToBin
1818
- IMAGE=mariadb:10.2
1919
NAME=mariadb
20-
OMIT_FEATURES=Json,Sha256Password,CachingSha2Password,RoundDateTime,UuidToBin
20+
OMIT_FEATURES=Ed25519,Json,Sha256Password,CachingSha2Password,RoundDateTime,UuidToBin
2121
- IMAGE=mariadb:10.3
2222
NAME=mariadb
23-
OMIT_FEATURES=Json,Sha256Password,CachingSha2Password,RoundDateTime,UuidToBin
23+
OMIT_FEATURES=Ed25519,Json,Sha256Password,CachingSha2Password,RoundDateTime,UuidToBin
2424
- IMAGE=mariadb:10.4
2525
NAME=mariadb
2626
OMIT_FEATURES=Json,Sha256Password,CachingSha2Password,RoundDateTime,UuidToBin

tests/README.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,19 @@ Otherwise, set the following options appropriately:
2121
* `Data.MySqlBulkLoaderLocalCsvFile`: (Optional) The path to a test CSV file.
2222
* `Data.MySqlBulkLoaderLocalTsvFile`: (Optional) The path to a test TSV file.
2323
* `Data.UnsupportedFeatures`: A comma-delimited list of `ServerFeature` enum values that your test database server does *not* support
24+
* `CachingSha2Password`: a user named `caching-sha2-user` exists on your server and uses the `caching_sha2_password` auth plugin
25+
* `Ed25519`: a user named `ed25519user` exists on your server and uses the `client_ed25519` auth plugin
26+
* `ErrorCodes`: server returns error codes in error packet (some MySQL proxies do not)
2427
* `Json`: the `JSON` data type (MySQL 5.7 and later)
25-
* `StoredProcedures`: create and execute stored procedures
26-
* `Sha256Password`: a user named `sha256user` exists on your server and uses the `sha256_password` auth plugin
27-
* `RsaEncryption`: server supports RSA public key encryption (for `sha256_password` and `caching_sha2_password`)
2828
* `LargePackets`: large packets (over 4MB)
29-
* `CachingSha2Password`: a user named `caching-sha2-user` exists on your server and uses the `caching_sha2_password` auth plugin
29+
* `RoundDateTime`: server rounds `datetime` values to the specified precision (not implemented in MariaDB)
30+
* `RsaEncryption`: server supports RSA public key encryption (for `sha256_password` and `caching_sha2_password`)
3031
* `SessionTrack`: server supports `CLIENT_SESSION_TRACK` capability (MySQL 5.7 and later)
32+
* `Sha256Password`: a user named `sha256user` exists on your server and uses the `sha256_password` auth plugin
33+
* `StoredProcedures`: create and execute stored procedures
3134
* `Timeout`: server can cancel queries promptly (so timed tests don't time out)
32-
* `ErrorCodes`: server returns error codes in error packet (some MySQL proxies do not)
3335
* `Tls11`: server supports TLS 1.1
3436
* `Tls12`: server supports TLS 1.2
35-
* `RoundDateTime`: server rounds `datetime` values to the specified precision (not implemented in MariaDB)
3637
* `UuidToBin`: server supports `UUID_TO_BIN` (MySQL 8.0 and later)
3738

3839
## Running Tests

tests/SideBySide/ConnectAsync.cs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
using System;
22
using System.Data;
33
using System.Diagnostics;
4-
using System.IO;
54
using System.Security.Authentication;
65
using System.Threading;
76
using System.Threading.Tasks;
87
using MySql.Data.MySqlClient;
8+
#if !BASELINE
9+
using MySqlConnector.Authentication.Ed25519;
10+
#endif
911
using Xunit;
1012

1113
namespace SideBySide
@@ -347,6 +349,23 @@ public async Task CachingSha2WithoutSecureConnection()
347349
}
348350
}
349351

352+
#if !BASELINE
353+
#if !NETCOREAPP1_1_2 && !NETCOREAPP2_0
354+
[SkippableFact(ServerFeatures.Ed25519)]
355+
public async Task Ed25519Authentication()
356+
{
357+
Ed25519AuthenticationPlugin.Install();
358+
359+
var csb = AppConfig.CreateConnectionStringBuilder();
360+
csb.UserID = "ed25519user";
361+
csb.Password = "Ed255!9";
362+
csb.Database = null;
363+
using (var connection = new MySqlConnection(csb.ConnectionString))
364+
await connection.OpenAsync();
365+
}
366+
#endif
367+
#endif
368+
350369
// To create a MariaDB GSSAPI user for a current user
351370
// - install plugin if not already done , e.g mysql -uroot -e "INSTALL SONAME 'auth_gssapi'"
352371
// create MariaDB's gssapi user

tests/SideBySide/ServerFeatures.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,6 @@ public enum ServerFeatures
2020
Tls12 = 2048,
2121
RoundDateTime = 4096,
2222
UuidToBin = 8192,
23+
Ed25519 = 16384,
2324
}
2425
}

tests/SideBySide/SideBySide.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636

3737
<ItemGroup Condition=" '$(Configuration)' != 'Baseline' ">
3838
<ProjectReference Include="..\..\src\MySqlConnector\MySqlConnector.csproj" />
39+
<ProjectReference Include="..\..\src\MySqlConnector.Authentication.Ed25519\MySqlConnector.Authentication.Ed25519.csproj" />
3940
</ItemGroup>
4041

4142
<ItemGroup Condition=" '$(Configuration)' == 'Baseline' ">

tests/SideBySide/config.json.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"Data": {
33
"ConnectionString": "server=127.0.0.1;user id=root;password=pass;port=3306;database=mysqltest",
4-
"UnsupportedFeatures": "CachingSha2Password,RsaEncryption,Sha256Password,UuidToBin"
4+
"UnsupportedFeatures": "CachingSha2Password,Ed25519,RsaEncryption,Sha256Password,UuidToBin"
55
}
66
}

0 commit comments

Comments
 (0)