Skip to content

Conversation

@Praveen2112
Copy link
Member

No description provided.

@cla-bot cla-bot bot added the cla-signed label Sep 15, 2019
@Praveen2112 Praveen2112 force-pushed the keystore_credentials_provider branch 2 times, most recently from fd292c0 to 26d8ff0 Compare September 16, 2019 01:27
@Praveen2112 Praveen2112 force-pushed the keystore_credentials_provider branch from 26d8ff0 to fc6c236 Compare October 3, 2019 12:23
Copy link
Member

@kokosing kokosing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will merge it once the release goes out.

@kokosing kokosing merged commit 0b72879 into trinodb:master Oct 16, 2019
@kokosing
Copy link
Member

Merged, thanks!

@Praveen2112 Praveen2112 deleted the keystore_credentials_provider branch October 16, 2019 07:18
@kokosing kokosing mentioned this pull request Oct 16, 2019
5 tasks
@kokosing kokosing added this to the 322 milestone Oct 16, 2019
@optimus-kart
Copy link
Member

Had a hard time figuring out how to enable this on my trinodb deployment, adding the details here for people who might be looking for the same
Requirement: keytool, this must be pre-installed on your system if you have a valid java installation

if your MySQL username is root and MySQL password is password ( I am sure I don't have to explain why that's a bad password )
use the following command to store the username under mysql-user alias

keytool -importpassword -alias mysql-user -keystore credentials.jcek -storetype jceks

You will see the following o/p

Enter keystore password: <enter password for keystore>  
Re-enter new password:  <re-enter the above password>
Enter the password to be stored:   <username for mysql server (since we are storing username) "root" in this case>
Re-enter password:  <re-enter the above value>
Enter key password for <mysql-user> : <set a password for this key>
	(RETURN if same as keystore password):  
Re-enter new password:  <re-enter the above value>

With this, you would have successfully store the username in the keystore,
now to store the password in the same file, use the following command

keytool -importpassword -alias mysql-password -keystore credentials.jcek -storetype jceks

You will see the following prompt

Enter keystore password:  <enter the keystore-password used while creating the keystore file earlier>
Enter the password to be stored: <enter mysql-password>  
Re-enter password:  <enter mysql-password (password in this case)>
Enter key password for <mysql-password>: <enter the password for storing this key>
	(RETURN if same as keystore password):

Once this is done, you would have a credentials.jcek file with both the username and password for your MySQL server.
Now you can update the catalog.properties as below

connector.name=mysql #you can use any other supported connector
connection-url=jdbc:<mysql-endpoint>:3306
credential-provider.type=KEYSTORE
keystore-file-path=/path/to/credentials.jcek <created above using keytool>
keystore-type=JCEKS
keystore-password=<keystore-level-password>
keystore-user-credential-password=<password for alias mysql-user>
keystore-password-credential-password=<password for alias mysql-password>
keystore-user-credential-name=mysql-user <alias name used to store the MySQL user name>
keystore-password-credential-name=mysql-password <alias name used to store the MySQL password>

Hope this helps

@kokosing
Copy link
Member

@mosabua Can capture the above as part of the documentation?

@mosabua
Copy link
Member

mosabua commented Jul 20, 2021

@kokosing I am missing context here.. what is that provider? Is there any existing docs for it or the related properties? Does this apply to all JDBC connectors (and hence needs to be done as imported fragment or so)? Are there other credential providers?

@kokosing
Copy link
Member

That is the point. It is not documented.

By default we are using (for all JDBC connectors):

credential-provider.type=INLINE

Which allows users to define

connection-user=ala
connection-password=hasło

Other option is to use:

credential-provider.type=FILE

Then user has to define the below in connector properties file:

connection-credential-file=jdbc_connector_credentials.properties

Then in jdbc_connector_credentials.properties file they can provide:

connection-user=ala
connection-password=hasło

And the last is credential-provider.type=KEYSTORE which is explained above.

Thanks to credential-provider.type users are able store credentials to their remote data sources encrypted. In some cases it may increase the security, in other it is just security theater. To make it reasonable, only the that runs Trino process should be able to read credential files and no sudo access for anyone. So typical admin user can see Trino configuration but not credentials.

@kokosing
Copy link
Member

CC: @Praveen2112 anything to add?

@mosabua
Copy link
Member

mosabua commented Jul 23, 2021

@Ordinant @jhlodin @rosewms @m57lyra - please create a github issue for the above and assist @Jessie212 with implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

4 participants