You can provision an ML workspace with TLS enabled, so that it can be accessed via https.
The certificate URL is generally of the form: <workspaceid> .<cluster> .<domain> .com. Assuming an example URL for the certificate of ml-47e0ade8-e0a.cluster.yourcompany.com, check that the certificate correctly shows the corresponding Common Name (CN) and Subject Alternative Names (SAN):
CN: ml-47e0ade8-e0a.cluster.yourcompany.com
SAN: *.ml-47e0ade8-e0a.cluster.yourcompany.com
SAN: ml-47e0ade8-e0a.cluster.yourcompany.com
Given a certificate (ca-cert.pem) and its private key (ca-key.pem), You can use OpenSSL to sign a provided CSR (host.csr) and generate a certificate for ML workspace (host.crt). For the AutoTLS enabled CDP cluster:
ca-cert.pem is /var/lib/cloudera-scm-agent/agent-cert/cm-auto-in_cluster_ca_cert.pem
ca-key.pem is /var/lib/cloudera-scm-server/certmanager/CMCA/private/ca_key.pem, which is hidden in the CM backend database
host.csr is generate by openssl req command with the corresponding Common Name (CN) tag
host.crt is the target ML Workspace certificate
3. Export AutoTLS CMCA package from CM database
3.1 PostgreSQL
Blob data can be easily exported by the copy command.
psql -U scm -h cb01.ecs.ycloud.com -p 5432 -d scm -c"\copy (SELECT encode(CERTTAR, 'hex') from CERTIFICATES) to STDOUT" | while read-N2 code;do printf"\x$code";done> ~/cmca.tar.gz
mkdir-p /var/lib/cloudera-scm-server/certmanager
tar zxvf ~/cmca.tar.gz -C /var/lib/cloudera-scm-server/certmanager
3.2 Oracle
Open SSH terminal for Oracle server and create a directory for export BLOB data.
su - oracle
mkdir-p /home/oracle/blobs
sqlplus / as sysdba
SQL>create or replace directory BLOBS as '/home/oracle/blobs/';
SQL>grant read,write on directory BLOBS to scm;
SQL>grant create procedure to scm;
SQL>exit
Open SSH terminal for Oracle client (e.g. CM server). Please create a procedure and execute it.
su - oracle
sqlplus scm/password@orcl
SQL>CREATE OR REPLACE PROCEDURE blob_to_file (p_blob IN BLOB,
p_dir IN VARCHAR2,
p_filename IN VARCHAR2)
AS
l_file UTL_FILE.FILE_TYPE;
l_buffer RAW(32767);
l_amount BINARY_INTEGER := 32767;
l_pos INTEGER := 1;
l_blob_len INTEGER;
BEGIN
l_blob_len := DBMS_LOB.getlength(p_blob);-- Open the destination file.
l_file := UTL_FILE.fopen(p_dir, p_filename,'wb', 32767);-- Read chunks of the BLOB and write them to the file until complete.
WHILE l_pos <= l_blob_len LOOP
DBMS_LOB.read(p_blob, l_amount, l_pos, l_buffer);
UTL_FILE.put_raw(l_file, l_buffer, TRUE);
l_pos := l_pos + l_amount;
END LOOP;-- Close the file.
UTL_FILE.fclose(l_file);
EXCEPTION
WHEN OTHERS THEN
-- Close the file if something goes wrong.
IF UTL_FILE.is_open(l_file) THEN
UTL_FILE.fclose(l_file);
END IF;
RAISE;
END blob_to_file;
/
SQL>DECLARE
l_blob BLOB;
BEGIN
-- Get LOB locator
select CERTTAR
INTO l_blob
from scm.CERTIFICATES
where CERTIFICATE_ID=1546340689;
blob_to_file(p_blob => l_blob,
p_dir =>'BLOBS',
p_filename =>'cmca.tar.gz');
END;
/
SQL>exit
Open SSH terminal for Oracle server and copy file ‘cmca.tar.gz’ to CM server.
Open SSH terminal for ECS server node and create a Kubernetes secret inside the previously provisioned ML workspace namespace, and name the secret cml-tls-secret.
In Site Administration > Security > Root CA configuration, paste the root CA certificate (/var/lib/cloudera-scm-agent/agent-cert/cm-auto-in_cluster_ca_cert.pem) to the workspace.