This is an automated email from the ASF dual-hosted git repository.

mykolabodnar pushed a commit to branch DLAB-1835
in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git


The following commit(s) were added to refs/heads/DLAB-1835 by this push:
     new 0f88b87  [DLAB-1835]: step certs disabled fixed
0f88b87 is described below

commit 0f88b8705b9571cc595da85c5ae7ed27ab18c5eb
Author: bodnarmykola <[email protected]>
AuthorDate: Mon May 25 14:05:54 2020 +0300

    [DLAB-1835]: step certs disabled fixed
---
 .../src/general/lib/os/debian/ssn_lib.py            | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/infrastructure-provisioning/src/general/lib/os/debian/ssn_lib.py 
b/infrastructure-provisioning/src/general/lib/os/debian/ssn_lib.py
index f4cda59..64a618f 100644
--- a/infrastructure-provisioning/src/general/lib/os/debian/ssn_lib.py
+++ b/infrastructure-provisioning/src/general/lib/os/debian/ssn_lib.py
@@ -341,13 +341,20 @@ def start_ss(keyfile, host_string, dlab_conf_dir, 
web_path,
                     sudo('keytool -importcert -trustcacerts -alias ssn -file 
/etc/ssl/certs/dlab.crt -noprompt '
                          '-storepass changeit -keystore 
{0}/lib/security/cacerts'.format(java_path))
                 else:
-                    sudo('keytool -genkeypair -alias ssn -keyalg RSA -validity 
730 -storepass {1} -keypass {1} \
-                         -keystore /home/{0}/keys/ssn.keystore.jks -keysize 
2048 -dname "CN=localhost"'.format(
-                         os_user, keystore_passwd))
-                    sudo('keytool -exportcert -alias ssn -storepass {1} -file 
/etc/ssl/certs/dlab.crt \
-                         -keystore 
/home/{0}/keys/ssn.keystore.jks'.format(os_user, keystore_passwd))
-                    sudo('keytool -importcert -trustcacerts -alias ssn -file 
/etc/ssl/certs/dlab.crt -noprompt \
-                         -storepass changeit -keystore 
{1}/lib/security/cacerts'.format(os_user, java_path))
+                    sudo(
+                        'sudo openssl req -x509 -nodes -days 3650 -newkey 
rsa:2048 -keyout /etc/ssl/certs/dlab.key '
+                        '-out /etc/ssl/certs/dlab.crt -subj '
+                        
'"/C=US/ST=US/L=US/O=dlab/CN=localhost/subjectAltName={0}"'.format(hostname))
+                    sudo(
+                        'sudo openssl pkcs12 -export -in 
/etc/ssl/certs/dlab.crt -inkey /etc/ssl/certs/dlab.key '
+                        '-name ssn -out /home/dlab-user/keys/ssn.p12 -password 
pass:{0}'.format(keystore_passwd))
+                    sudo(
+                        'sudo keytool -importkeystore -srckeystore 
/home/dlab-user/keys/ssn.p12 '
+                        '-srcstoretype PKCS12 -alias ssn -destkeystore 
/home/dlab-user/keys/ssn.keystore.jks '
+                        '-deststorepass {0} -srcstorepass 
{0}'.format(keystore_passwd))
+                    sudo('sudo keytool -importcert -trustcacerts -alias ssn 
-file /etc/ssl/certs/dlab.crt '
+                         '-noprompt -storepass changeit '
+                         '-keystore 
/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/security/cacerts')
             except:
                 append_result("Unable to generate cert and copy to java 
keystore")
                 sys.exit(1)


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to