Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
This guide briefly offers a step-by-step process on how to set up key-pair authentication for Snowflake in Talend Studio at Job level
The process can be summarized in three steps:
The .p12 file contains both the private and public keys, along with the owner's details (such as name, email address, etc.), all certified by a trusted third party. With this certificate, a user can authenticate and identify themselves to any organization that recognizes the third-party certification.
Talend tSetKeyStore component itself can only take in .jks or .p12/.pfx format. If you are using PKCS8 format, you need to convert your p8 certs into a supported format.
Generate the key with the following command line prompt:
openssl genpkey -algorithm RSA -out private.key -aes256This will generate a private key (private.key) using the RSA algorithm with AES-256 encryption. You'll be prompted to enter a passphrase to protect the private key.
openssl req -new -x509 -key private.key -out certificate.crt -days 1825This command generates a self-signed certificate (certificate.crt) that is valid for 5 years. You will be prompted to enter details like country, state, and organization when generating the certificate.
openssl pkcs12 -export -out keystore.p12 -inkey private.key -in certificate.crt -name "abe"And check the created .p12 file information with below command:
openssl pkcs12 -info -in keystore.p12 or keytool -v -list -keystore keystore.p12
openssl x509 -pubkey -noout -in certificate.crt > public.key
The USERADMIN
role is required to perform the Snowflake configuration. Open your Snowflake environment and ensure you have a worksheet or query editor ready to execute the following SQL statements. .
-- Drop existing objects if they exist DROP DATABASE IF EXISTS ABE_TALEND_DB; -- Drop the test database DROP WAREHOUSE IF EXISTS ABE_TALEND_WH; -- Drop the test warehouse DROP ROLE IF EXISTS ABE_TALEND_ROLE; -- Drop the test role DROP USER IF EXISTS ABE_TALEND_USER; -- Drop the test user -- Create necessary objects CREATE WAREHOUSE ABE_TALEND_WH; -- Create the warehouse CREATE DATABASE ABE_TALEND_DB; -- Create the test database CREATE SCHEMA ABE_TALEND_DB.ABE; -- Create the schema "ABE" in the test database -- Create the test user CREATE OR REPLACE USER ABE_TALEND_USER PASSWORD = 'pwd!' -- Replace with a secure password LOGIN_NAME = 'ABE_TALEND_USER' FIRST_NAME = 't' LAST_NAME = 'tt' EMAIL = 't.tt@qlik.com' -- Replace with a valid email MUST_CHANGE_PASSWORD = FALSE DEFAULT_WAREHOUSE = ABE_TALEND_WH; -- Grant necessary permissions GRANT USAGE ON WAREHOUSE ABE_TALEND_WH TO ROLE SYSADMIN; -- Grant warehouse access to SYSADMIN CREATE ROLE IF NOT EXISTS ABE_TALEND_ROLE; -- Create the custom role GRANT ROLE ABE_TALEND_ROLE TO USER ABE_TALEND_USER; -- Assign the role to the user GRANT ALL PRIVILEGES ON DATABASE ABE_TALEND_DB TO ROLE ABE_TALEND_ROLE; -- Full access to the database GRANT ALL PRIVILEGES ON ALL SCHEMAS IN DATABASE ABE_TALEND_DB TO ROLE ABE_TALEND_ROLE; -- Full access to all schemas GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA ABE_TALEND_DB.ABE TO ROLE ABE_TALEND_ROLE;-- Full access to all tables in schema GRANT USAGE ON WAREHOUSE ABE_TALEND_WH TO ROLE ABE_TALEND_ROLE; -- Grant warehouse usage to custom role -- Verify user creation SHOW USERS; -- Create a test table and validate setup CREATE TABLE ABE_TALEND_DB.ABE.ABETABLE ( NAME VARCHAR(100) ); -- Test data retrieval SELECT * FROM ABE_TALEND_DB.ABE.ABETABLE;
DESCRIBE USERAnd to verify that the key was successfully added.
ALTER USER ABE_TALEND_USER SET RSA_PUBLIC_KEY=public key '; DESCRIBE USER ABE_TALEND_USER;
DESC USER ABE_TALEND_USER; SELECT SUBSTR((SELECT "value" FROM TABLE(RESULT_SCAN(LAST_QUERY_ID())) WHERE "property" = 'RSA_PUBLIC_KEY_FP'), LEN('SHA256:') + 1);
openssl rsa -pubin -in public.key -outform DER | openssl dgst -sha256 -binary | openssl enc -base64
If the hash matches, proceed to Talend Studio configuration.
Talend-Job-using-key-pair-authentication-for-Snowflake-fails
Talend Studio 8.0.1
Hi @Amar_Belgacem_Qlik some images are not displayed. This is a screenshot example. There are more in the article
@anthonyoctil1 We're looking into it!
Hello @anthonyoctil1
Sorry for late response!
Thanks for letting us know the "images are missing" issue and we've fixed it. Feel free to let us know if there is anything in question.
Best regards
Sabrina
Great article team.
I do a very similar approach but converting from P8 all the way to P12.
Questions:
1. Are you planning to add P8 support in Talend Studio? That would be very much appreciated.
2. Can I use a P12 file as a Resource in an Artifact/Task in Talend Cloud?
I have a Talend Studio Job where I set my P12 file as a Context Resource File - context.resource_file_keystore_encrypted. It works fine in Talend Studio but when I publish it to Talend Cloud things don't go as I expect.
When I create a Task based on the Artifact, I have to upload the P12 file to be used in the tSetKeystore block. However, when executing the task, I have the following error:
tSetKeystore_1 (SnowflakeKeyPair) java.lang.NullPointerException
My complete diagram:
Below the Task Configuration with the P12 and Password Resources highlighted - note that I'm using the Cloud / Cloud exclusive engines. I must not use a Remote Engine (this is a requirement):
And the error message:
Regards,
Mark Costa
I found something to try. I'll keep you posted:
https://community.qlik.com/t5/Official-Support-Articles/Using-a-custom-truststore-or-keystore-for-a-...