Merge "[DOC] Few changes and uninstall steps added in VES-Mapper Installation documen...
[dcaegen2.git] / docs / sections / services / dfc / certificates.rst
1 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
2 .. http://creativecommons.org/licenses/by/4.0
3
4 Certificates (From AAF)
5 =======================
6 DCAE service components will use common certifcates generated from AAF/test instance and made available during deployment of DCAE TLS init container.
7
8 DCAE has a generalized process of certificate distribution as documented here - https://docs.onap.org/projects/onap-dcaegen2/en/latest/sections/tls_enablement.html
9
10 The updated certificates are located in https://git.onap.org/dcaegen2/deployments/tree/tls-init-container/tls
11
12 Certificates (Manual configuration of self-signed certifcates)
13 ==============================================================
14
15 Configuration of Certificates in test environment(For FTP over TLS):
16
17 DFC supports two protocols: FTPES and SFTP.
18 For FTPES, it is mutual authentication with certificates.
19 In our test environment, we use vsftpd to simulate xNF, and we generate self-signed
20 keys & certificates on both vsftpd server and DFC.
21
22 1. Generate key/certificate with openssl for DFC:
23 -------------------------------------------------
24 .. code:: bash
25
26     openssl genrsa -out dfc.key 2048
27     openssl req -new -out dfc.csr -key dfc.key
28     openssl x509 -req -days 365 -in dfc.csr -signkey dfc.key -out dfc.crt
29
30 2. Generate key & certificate with openssl for vsftpd:
31 ------------------------------------------------------
32 .. code:: bash
33
34    openssl genrsa -out ftp.key 2048
35    openssl req -new -out ftp.csr -key ftp.key
36    openssl x509 -req -days 365 -in ftp.csr -signkey ftp.key -out ftp.crt
37
38 3. Configure java keystore in DFC:
39 ----------------------------------
40 We have two keystore files, one for TrustManager, one for KeyManager.
41
42 **For TrustManager:**
43
44 1. First, convert your certificate in a DER format :
45
46  .. code:: bash
47
48    openssl x509 -outform der -in ftp.crt -out ftp.der
49
50 2. And after copy existing keystore and password from container:
51
52  .. code:: bash
53
54   kubectl cp <DFC pod>:/opt/app/datafile/etc/cert/trust.jks trust.jks
55   kubectl cp <DFC pod>:/opt/app/datafile/etc/cert/trust.pass trust.pass
56
57 3. Import DER certificate in the keystore :
58
59  .. code:: bash
60
61    keytool -import -alias ftp -keystore trust.jks -file ftp.der
62
63 **For KeyManager:**
64
65 1. Import dfc.crt and dfc.key to dfc.jks. This is a bit troublesome.
66
67  Convert x509 Cert and Key to a pkcs12 file
68
69  .. code:: bash
70
71     openssl pkcs12 -export -in dfc.crt -inkey dfc.key -out cert.p12 -name dfc
72
73  Note: Make sure you put a password on the p12 file - otherwise you'll get a null reference exception when you try to import it.
74
75 2. Create password files for cert.p12
76     .. code:: bash
77
78     printf "[your password]" > p12.pass
79
80 4. Update existing KeyStore files
81 ---------------------------------
82
83 Copy the new trust.jks and cert.p12 and password files from local environment to the DFC container.
84
85  .. code:: bash
86    mkdir mycert
87    cp cert.p12 mycert/
88    cp p12.pass mycert/
89    cp trust.jks mycert/
90    cp trust.pass mycert/
91    kubectl cp mycert/ <DFC pod>:/opt/app/datafile/etc/cert/
92
93 5. Update configuration in consul
94 -----------------------------------
95 Change path in consul:
96  .. code:: bash
97   dmaap.ftpesConfig.keyCert": "/opt/app/datafile/etc/cert/mycert/cert.p12
98   dmaap.ftpesConfig.keyPasswordPath": "/opt/app/datafile/etc/cert/mycert/p12.pass
99   dmaap.ftpesConfig.trustedCa": "/opt/app/datafile/etc/cert/mycert/trust.jks
100   dmaap.ftpesConfig.trustedCaPasswordPath": "/opt/app/datafile/etc/cert/mycert/trust.pass
101
102 Consul's address: http://<worker external IP>:<Consul External Port>
103  .. code:: bash
104   kubectl -n onap get svc | grep consul
105
106 .. image:: ./consule-certificate-update.png
107
108 6. Configure vsftpd:
109 --------------------
110     update /etc/vsftpd/vsftpd.conf:
111
112   .. code-block:: bash
113
114       rsa_cert_file=/etc/ssl/private/ftp.crt
115       rsa_private_key_file=/etc/ssl/private/ftp.key
116       ssl_enable=YES
117       allow_anon_ssl=NO
118       force_local_data_ssl=YES
119       force_local_logins_ssl=YES
120
121       ssl_tlsv1=YES
122       ssl_sslv2=YES
123       ssl_sslv3=YES
124
125       require_ssl_reuse=NO
126       ssl_ciphers=HIGH
127
128       require_cert=YES
129       ssl_request_cert=YES
130       ca_certs_file=/home/vsftpd/myuser/dfc.crt
131
132 7. Other conditions
133 ---------------------------------------------------------------------------
134    This has been tested with vsftpd and dfc, with self-signed certificates.
135    In real deployment, we should use ONAP-CA signed certificate for DFC, and vendor-CA signed certificate for xNF