Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MySQL Access Denied Error (1045) #5

Open
cisenma opened this issue May 4, 2016 · 0 comments
Open

MySQL Access Denied Error (1045) #5

cisenma opened this issue May 4, 2016 · 0 comments

Comments

@cisenma
Copy link

cisenma commented May 4, 2016

So, I've been trying relentlessly to configure openvpn to use mysql for user/pass authorization with no prevail. First I tried pam-mysql, and that caused way too many issues and I found this and decided to give it a try.

Everything seemed to compile correctly and once it did, I placed my configuration file in /etc/openvpn/auth/mysql-auth.conf

Then I placed this in my openvpn server config:

plugin /etc/openvpn/auth/libopenvpn-mysql-auth.so -c /etc/openvpn/auth/mysql-auth.conf

I try to connect to the server with the config file, and I get the AUTH_FAILED error, so I check my openvpn server log and this is what the mysql-auth plugin is outputting:

MYSQL-AUTH: [ERROR] Failed to connect to database: Error (1045): Access denied for user 'root
'@'199.101.x.x' (using password: YES)
MYSQL-AUTH: [ERROR] Could not prepare MySQL connection in am_mysql_handle_auth_user_pass_verify

Note:
199.101.x.x is not the MySQL server IP I have in the mysql-auth.conf file, it is the openvpn server IP.
I am also 100% sure the password is correct because I manually connected to the server with mysql with the same password.

Here is what my mysql-auth.conf file contains:

hostname 104.192.x.x
login root
password xxxxxx
db xxxx
port 3306
socket /var/run/mysqld/mysqld.sock
debug_sql on
default_pf_rules_clients accept
default_pf_rules_subnets drop

auth_user_pass_verify_query SELECT username FROM db_users  WHERE username='{{escaped_username}}' AND password=SHA1('{{escaped_password}}')

auth_user_pass_verify_user_access_query SELECT username FROM db_users WHERE membership>0 AND active_connections<4

Any ideas that you may have would be very helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant