dcae frankfurt maintenance rls updates
[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 Certificates (From AAF)
4 =======================
5 DCAE service components will use common certifcates generated from AAF/test instance and made available during deployment of DCAE TLS init container.
6
7 DCAE has a generalized process of certificate distribution as documented here - https://docs.onap.org/projects/onap-dcaegen2/en/latest/sections/tls_enablement.html
8
9 The updated certificates are located in https://git.onap.org/dcaegen2/deployments/tree/tls-init-container/tls
10
11 Certificates (Manual configuration of self-signed certifcates)
12 ==============================================================
13
14 Configuration of Certificates in test environment(For FTP over TLS):
15
16 DFC supports two protocols: FTPES and SFTP.
17 For FTPES, it is mutual authentication with certificates.
18 In our test environment, we use vsftpd to simulate xNF, and we generate self-signed
19 keys & certificates on both vsftpd server and DFC.
20
21 1. Generate key/certificate with openssl for DFC:
22 -------------------------------------------------
23 .. code:: bash
24
25     openssl genrsa -out dfc.key 2048
26     openssl req -new -out dfc.csr -key dfc.key
27     openssl x509 -req -days 365 -in dfc.csr -signkey dfc.key -out dfc.crt
28
29 2. Generate key & certificate with openssl for vsftpd:
30 ------------------------------------------------------
31 .. code:: bash
32
33    openssl genrsa -out ftp.key 2048
34    openssl req -new -out ftp.csr -key ftp.key
35    openssl x509 -req -days 365 -in ftp.csr -signkey ftp.key -out ftp.crt
36
37 3. Configure java keystore in DFC:
38 ----------------------------------
39 We have two keystore files, one for TrustManager, one for KeyManager.
40
41 **For TrustManager:**
42
43 1. First, convert your certificate in a DER format :
44
45  .. code:: bash
46
47    openssl x509 -outform der -in ftp.crt -out ftp.der
48
49 2. And after, import it in the keystore :
50
51  .. code:: bash
52
53    keytool -import -alias ftp -keystore ftp.jks -file ftp.der
54
55 **For KeyManager:**
56
57 1. First, create a jks keystore:
58
59  .. code:: bash
60
61     keytool -keystore dfc.jks -genkey -alias dfc
62
63 2. Second, import dfc.crt and dfc.key to dfc.jks. This is a bit troublesome.
64
65  1). Step one: Convert x509 Cert and Key to a pkcs12 file
66
67  .. code:: bash
68
69     openssl pkcs12 -export -in dfc.crt -inkey dfc.key -out dfc.p12 -name [some-alias]
70
71  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.
72
73  Note 2: You might want to add the -chainoption to preserve the full certificate chain.
74
75  2). Step two: Convert the pkcs12 file to a java keystore:
76
77  .. code:: bash
78
79     keytool -importkeystore -deststorepass [changeit] -destkeypass [changeit] -destkeystore dfc.jks -srckeystore dfc.p12 -srcstoretype PKCS12 -srcstorepass [some-password] -alias [some-alias]
80
81 4. Update existing jks.b64 files
82 ---------------------------------
83
84 Copy the existing jks from the DFC container to a local environment.
85
86  .. code:: bash
87
88    docker cp <DFC container>:/opt/app/datafile/config/ftp.jks .
89    docker cp <DFC container>:/opt/app/datafile/config/dfc.jks .
90
91  .. code:: bash
92
93    openssl base64 -in ftp.jks -out ftp.jks.b64
94    openssl base64 -in dfc.jks -out dfc.jks.b64
95
96  .. code:: bash
97
98    chmod 755 ftp.jks.b64
99    chmod 755 dfc.jks.b64
100
101 Copy the new jks.64 files from local environment to the DFC container.
102
103  .. code:: bash
104
105    docker cp ftp.jks.b64 <DFC container>:/opt/app/datafile/config/
106    docker cp dfc.jks.b64 <DFC container>:/opt/app/datafile/config/
107
108 Finally
109
110  .. code:: bash
111
112    docker restart <DFC container>
113
114 5. Configure vsftpd:
115 --------------------
116     update /etc/vsftpd/vsftpd.conf:
117
118   .. code-block:: bash
119
120       rsa_cert_file=/etc/ssl/private/ftp.crt
121       rsa_private_key_file=/etc/ssl/private/ftp.key
122       ssl_enable=YES
123       allow_anon_ssl=NO
124       force_local_data_ssl=YES
125       force_local_logins_ssl=YES
126
127       ssl_tlsv1=YES
128       ssl_sslv2=YES
129       ssl_sslv3=YES
130
131       require_ssl_reuse=NO
132       ssl_ciphers=HIGH
133
134       require_cert=YES
135       ssl_request_cert=YES
136       ca_certs_file=/home/vsftpd/myuser/dfc.crt
137
138 6. Configure config/datafile_endpoints.json:
139 --------------------------------------------
140    Update the file accordingly:
141
142   .. code-block:: javascript
143
144             "ftpesConfiguration": {
145                 "keyCert": "/config/dfc.jks",
146                 "keyPassword": "[yourpassword]",
147                 "trustedCA": "/config/ftp.jks",
148                 "trustedCAPassword": "[yourpassword]"
149             }
150
151 7. Other conditions
152 ---------------------------------------------------------------------------
153    This has been tested with vsftpd and dfc, with self-signed certificates.
154    In real deployment, we should use ONAP-CA signed certificate for DFC, and vendor-CA signed certificate for xNF