Chapter 5. Enable Password based Login In Prestodb

  • by

To make your prestodb access secure, it’s always a good idea to enable password-based login. Here we will be discussing two password-based login methods :
File-based authentication and LDAP authentication.
So let’s get started.

For both the methods, append below in your config.properties file

http-server.process-forwarded=true
http-server.authentication.type=PASSWORD

1.Password Based Login using a file:

Create a file in the same directory where your config.properties file is located.
These changes are to be done in coordinator node.
Below is the default home_path comes with starburst presto ami

$ touch /var/lib/presto/etc/password-authenticator.properties

now paste the below content and save the file.

password-authenticator.na
me=file
file.password-file=/path/to/password.db

Now create password.db file. You can include a list of usernames and passwords, one per line, separated by a colon in the password file.
All the passwords should be securely hashed using bcrypt or PBKDF2.

touch password.db

Now we have created an empty password file, run below to add/update the password for user john; restart presto service and provide user name with — user flag while login.

$htpasswd -B -C 10 password.db john$ presto --server 127.0.0.1:8080 --catalog hive --user <user_name> 
presto> USE default;
USE
presto:default>

2.Password Based Login using LDAP

Create the below file to configure LDAP

password-authenticator.name=ldap
ldap.allow-insecure=true
ldap.url=ldap://<you_ldap_host/url>:<ldap_port>
ldap.user-base-dn=DC=example,DC=com
ldap.user-bind-pattern=uid=${USER},DC=<any_pattern>

once these changes are done restart presto service

service presto restart

Now you can now login to presto using the below command:

presto --server 127.0.0.1:8080 --catalog hive --user <user_name> --password  
Password: <enter your LDAP password>
presto> USE default;
USE
presto:default>

Note: You cannot use both authentication methods together.
To check out previous chapters in this series, you can follow below links:

Introduction to prestodb
Creating Presto Cluster
Query using prestodb
Deploying Presto Cluster Using AWS marketplace Image

Hope this was helpful!
See you in next Chapter!
Happy Learning!
Shivani S.

Leave a Reply

Your email address will not be published. Required fields are marked *