Note |
---|
As of Datameer version 6.0, only versions 5.5 and above are supported for MySQL. |
...
There are several ways to assign rights for users with SSL:
- Require X509: Any valid SSL client certificate can be used.
- Require Issuer/Require Subject: The SSL client certificate must come from a specified CA with specific issuer and/or contain a specific subject.
- Require SSL: The connection must be established via SSL encrypted. The authentication can be done either using a password or a SSL client certificate.
In the below example, if the dap
user is required to use SSL and has access to ALL PRIVILEGES
for all tables in dap.*, a limitation to the localhost isn't necessary as encryption on the same server is often not required. Instead, SSL should take the IP from which encrypted access is required.
Note | ||
---|---|---|
| ||
If you have already intialized the Datameer application database and created the tables or a Datameer installation in use, than you might need to change only the granted privileges. |
Initialize the application database
Create the database and the user. REQUIRE SSL
forces the created user to use SSL.
Code Block | ||||
---|---|---|---|---|
| ||||
CREATE DATABASE IF NOT EXISTS dap DEFAULT CHARACTER SET utf8; GRANT ALL PRIVILEGES ON dap.* TO 'dap'@'%' IDENTIFIED BY 'dap' REQUIRE SSL WITH GRANT OPTION; FLUSH PRIVILEGES; |
Test configuration
Test the configuration of the MySQL service from the Datameer application server.
Code Block | ||||
---|---|---|---|---|
| ||||
mysql --ssl-cert etc/client-cert.pem --ssl-key etc/client-key.pem -udap -pdap dap -h<host> |
Create tables
Create MySQL tables required by Datameer.
Code Block | ||||
---|---|---|---|---|
| ||||
mysql --ssl-cert etc/client-cert.pem --ssl-key etc/client-key.pem -udap -pdap dap -h<host> < bin/create-tables.sql |
Enabling SSL on Datameer Client
To create an encrypted connection from Java to the MySQL service, you need to have a trusted certificate and make the Datameer service aware of the encrypted connection.
Trust server certificate
The JVM needs to trust the MySQL service custom certificate.
Add Java truststore to environment
Include truststore
in your Datameer environment to make sure that the JVM is using the correct store. To do so, edit etc/das-env.sh
.
Code Block | ||||
---|---|---|---|---|
| ||||
export JAVA_OPTIONS="$JAVA_OPTIONS -Djavax.etnet.ssl.trustStore=${JAVA_HOME}/jre/lib/security/cacerts -Djavax.net.ssl.trustStorePassword=changeit" |
Modify the connection URL
Make the Datameer service aware that the external MySQL service is using SSL. Edit the connection.url in persistence.xml
and include useSSL=true
.
Code Block | ||||
---|---|---|---|---|
| ||||
<property name="hibernate.connection.url" value="jdbc:jamon:mysql://${db.host}:${db.port}/${db.name}?jamonrealdriver=com.mysql.jdbc.Driver&useSSL=true"/> |
Finally, start the Datameer service.
...