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

Can't connect using SSL #180

Open
Akhetopnu opened this issue Apr 5, 2017 · 1 comment
Open

Can't connect using SSL #180

Akhetopnu opened this issue Apr 5, 2017 · 1 comment

Comments

@Akhetopnu
Copy link

Akhetopnu commented Apr 5, 2017

I am unable to connect to MariaDB. Here are some info:

app@ubuntu:~$ node -v
v7.8.0
MariaDB [mydb]> status;
--------------
mysql  Ver 15.1 Distrib 10.1.22-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2

Connection id:		4
Current database:	mydb
Current user:		app@localhost
SSL:			Cipher in use is DHE-RSA-AES256-GCM-SHA384
Current pager:		stdout
Using outfile:		''
Using delimiter:	;
Server:			MariaDB
Server version:		10.1.22-MariaDB-1~xenial mariadb.org binary distribution
Protocol version:	10
Connection:		Localhost via UNIX socket
Server characterset:	latin1
Db     characterset:	latin1
Client characterset:	utf8
Conn.  characterset:	utf8
UNIX socket:		/var/run/mysqld/mysqld.sock
Uptime:			4 min 6 sec

Threads: 1  Questions: 6  Slow queries: 0  Opens: 17  Flush tables: 1  Open tables: 11  Queries per second avg: 0.024
--------------
MariaDB [mydb]> SHOW VARIABLES LIKE '%ssl%';
+---------------------+--------------------------------+
| Variable_name       | Value                          |
+---------------------+--------------------------------+
| have_openssl        | YES                            |
| have_ssl            | YES                            |
| ssl_ca              | /etc/mysql/ssl/ca-cert.pem     |
| ssl_capath          |                                |
| ssl_cert            | /etc/mysql/ssl/server-cert.pem |
| ssl_cipher          |                                |
| ssl_crl             |                                |
| ssl_crlpath         |                                |
| ssl_key             | /etc/mysql/ssl/server-key.pem  |
| version_ssl_library | OpenSSL 1.0.2g  1 Mar 2016     |
+---------------------+--------------------------------+

Javascript console output:

20:31:13 0|server   | PRODUCTION
20:31:13 0|server   | config: { db: 'mydb',
20:31:13 0|server   |   protocol: 'tcp',
20:31:13 0|server   |   ssl: 
20:31:13 0|server   |    { ca: '/etc/mysql/ssl/ca-cert.pem',
20:31:13 0|server   |      key: '/etc/mysql/ssl/client-key.pem',
20:31:13 0|server   |      cert: '/etc/mysql/ssl/client-cert.pem',
20:31:13 0|server   |      cipher: 'DHE-RSA-AES256-GCM-SHA384',
20:31:13 0|server   |      rejectUnauthorized: true } }
20:31:13 0|server   | MYSQL encountered an error
20:31:13 0|server   | error: { Error: Access denied for user 'app'@'localhost' (using password: NO) code: 1045 }

Here is the command that I use to log in with all the same parameters as from javascript:

app@ubuntu:~$ mysql --ssl-ca=/etc/mysql/ssl/ca-cert.pem --ssl-key=/etc/mysql/ssl/client-key.pem --ssl-cert=/etc/mysql/ssl/client-cert.pem mydb -h localhost --ssl-cipher=DHE-RSA-AES256-GCM-SHA384 --protocol=tcp
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 7
Server version: 10.1.22-MariaDB-1~xenial mariadb.org binary distribution

Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [mydb]> 

Am I missing something here? I've searched on the internet what's up with both have_openssl=true and have_ssl but nobody seems to have any problem with that. Any help would be appreciated.

@Akhetopnu Akhetopnu reopened this Apr 7, 2017
@ghost
Copy link

ghost commented Mar 11, 2018

I think you need to set a password for the key, when you create it, the password you specify

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