go-sql-driver / mysql

Go MySQL Driver is a MySQL driver for Go's (golang) database/sql package
https://pkg.go.dev/github.com/go-sql-driver/mysql
Mozilla Public License 2.0
14.55k stars 2.32k forks source link

Implement dialog auth plugin #803

Open julienschmidt opened 6 years ago

julienschmidt commented 6 years ago

MariaDB and Percona Server use the dialog auth plugin instead of MySQL's mysql_cleartext_password plugin for PAM authentication.

This driver should come with built-in support, as PAM authentication is rather common. The implementation complexity seems low. MariaDB's client implementation can be found here: https://github.com/MariaDB/mariadb-connector-c/blob/master/plugins/auth/dialog.c

buphmin commented 4 years ago

I don't know if this will work in every PAM auth setup with mysql/mariadb (we use mariadb). But simply adding a fallthrough in auth.go to mysql_clear_password allowed authentication to work if you follow the rest of the docs on clear passwords. Maybe this will help someone else.

case "dialog":
    fallthrough
case "mysql_clear_password":