Skip to content

Commit 18a7ce2

Browse files
committed
Refactor authentication as plugin, in order to add MariaDB parsec and PAM authentication + permit multiple authentication switch.
multiple authentication switch are permit in MariaDB using OR (https://mariadb.com/kb/en/create-user/#identified-viawith-authentication_plugin) and in MySQL using multi authenticator (https://dev.mysql.com/doc/refman/8.0/en/multifactor-authentication.html)
1 parent 98f445c commit 18a7ce2

23 files changed

+1670
-498
lines changed

.github/workflows/test.yml

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ jobs:
3939
'8.4', # LTS
4040
'8.0',
4141
'5.7',
42+
'mariadb-11.7', # in order to test parsec
4243
'mariadb-11.4', # LTS
4344
'mariadb-11.2',
4445
'mariadb-11.1',

AUTHORS

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ Daniel Montoya <dsmontoyam at gmail.com>
3737
Daniel Nichter <nil at codenode.com>
3838
Daniël van Eeden <git at myname.nl>
3939
Dave Protasowski <dprotaso at gmail.com>
40+
Diego Dupin <diego.dupin at gmail.com>
4041
Dirkjan Bussink <d.bussink at gmail.com>
4142
DisposaBoy <disposaboy at dby.me>
4243
Egor Smolyakov <egorsmkv at gmail.com>

README.md

+33
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,16 @@ Default: false
172172

173173
`allowCleartextPasswords=true` allows using the [cleartext client side plugin](https://dev.mysql.com/doc/en/cleartext-pluggable-authentication.html) if required by an account, such as one defined with the [PAM authentication plugin](http://dev.mysql.com/doc/en/pam-authentication-plugin.html). Sending passwords in clear text may be a security problem in some configurations. To avoid problems if there is any possibility that the password would be intercepted, clients should connect to MySQL Server using a method that protects the password. Possibilities include [TLS / SSL](#tls), IPsec, or a private network.
174174

175+
##### `AllowDialogPasswords`
176+
177+
```
178+
Type: bool
179+
Valid Values: true, false
180+
Default: false
181+
```
182+
183+
`AllowDialogPasswords=true` allows using the [PAM client side plugin](https://mariadb.com/kb/en/authentication-plugin-pam/) if required by an account, such as one defined with the PAM authentication plugin. Sending passwords in clear text may be a security problem in some configurations. To avoid problems if there is any possibility that the password would be intercepted, clients should connect to Server using a method that protects the password. Possibilities include [TLS / SSL](#tls), IPsec, or a private network.
184+
175185

176186
##### `allowFallbackToPlaintext`
177187

@@ -453,6 +463,16 @@ Default: none
453463

454464
[Connection attributes](https://dev.mysql.com/doc/refman/8.0/en/performance-schema-connection-attribute-tables.html) are key-value pairs that application programs can pass to the server at connect time.
455465

466+
467+
##### `OtherPasswd`
468+
469+
```
470+
Type: comma-delimited string of password for MariaDB PAM authentication, if requiring more than one password
471+
Valid Values: (<password2>,<password3>,...)
472+
Default: none
473+
```
474+
475+
456476
##### System Variables
457477

458478
Any other parameters are interpreted as system variables:
@@ -534,6 +554,19 @@ See [context support in the database/sql package](https://golang.org/doc/go1.8#d
534554
> The `QueryContext`, `ExecContext`, etc. variants provided by `database/sql` will cause the connection to be closed if the provided context is cancelled or timed out before the result is received by the driver.
535555
536556

557+
### Authentication Plugin System
558+
559+
The driver implements a pluggable authentication system that supports various authentication methods used by MySQL and MariaDB servers. The built-in authentication plugins include:
560+
561+
- `mysql_native_password` - The default MySQL authentication method
562+
- `caching_sha2_password` - Default authentication method in MySQL 8.0+
563+
- `mysql_clear_password` - Cleartext authentication (requires `allowCleartextPasswords=true`)
564+
- `mysql_old_password` - Old MySQL authentication (requires `allowOldPasswords=true`)
565+
- `sha256_password` - SHA256 authentication
566+
- `parsec` - MariaDB 11.6+ PARSEC authentication
567+
- `client_ed25519` - MariaDB Ed25519 authentication
568+
- `dialog` - MariaDB PAM authentication (requires `AllowDialogPasswords=true`)
569+
537570
### `LOAD DATA LOCAL INFILE` support
538571
For this feature you need direct access to the package. Therefore you must change the import path (no `_`):
539572
```go

0 commit comments

Comments
 (0)