DCAE doc cleanup warnings
[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, import it in the keystore :
51
52  .. code:: bash
53
54    keytool -import -alias ftp -keystore ftp.jks -file ftp.der
55
56 **For KeyManager:**
57
58 1. First, create a jks keystore:
59
60  .. code:: bash
61
62     keytool -keystore dfc.jks -genkey -alias dfc
63
64 2. Second, import dfc.crt and dfc.key to dfc.jks. This is a bit troublesome.
65
66  1). Step one: Convert x509 Cert and Key to a pkcs12 file
67
68  .. code:: bash
69
70     openssl pkcs12 -export -in dfc.crt -inkey dfc.key -out dfc.p12 -name [some-alias]
71
72  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.
73
74  Note 2: You might want to add the -chainoption to preserve the full certificate chain.
75
76  2). Step two: Convert the pkcs12 file to a java keystore:
77
78  .. code:: bash
79
80     keytool -importkeystore -deststorepass [changeit] -destkeypass [changeit] -destkeystore dfc.jks -srckeystore dfc.p12 -srcstoretype PKCS12 -srcstorepass [some-password] -alias [some-alias]
81
82 4. Update existing jks.b64 files
83 ---------------------------------
84
85 Copy the existing jks from the DFC container to a local environment.
86
87  .. code:: bash
88
89    docker cp <DFC container>:/opt/app/datafile/config/ftp.jks .
90    docker cp <DFC container>:/opt/app/datafile/config/dfc.jks .
91
92  .. code:: bash
93
94    openssl base64 -in ftp.jks -out ftp.jks.b64
95    openssl base64 -in dfc.jks -out dfc.jks.b64
96
97  .. code:: bash
98
99    chmod 755 ftp.jks.b64
100    chmod 755 dfc.jks.b64
101
102 Copy the new jks.64 files from local environment to the DFC container.
103
104  .. code:: bash
105
106    docker cp ftp.jks.b64 <DFC container>:/opt/app/datafile/config/
107    docker cp dfc.jks.b64 <DFC container>:/opt/app/datafile/config/
108
109 Finally
110
111  .. code:: bash
112
113    docker restart <DFC container>
114
115 5. Configure vsftpd:
116 --------------------
117     update /etc/vsftpd/vsftpd.conf:
118
119   .. code-block:: bash
120
121       rsa_cert_file=/etc/ssl/private/ftp.crt
122       rsa_private_key_file=/etc/ssl/private/ftp.key
123       ssl_enable=YES
124       allow_anon_ssl=NO
125       force_local_data_ssl=YES
126       force_local_logins_ssl=YES
127
128       ssl_tlsv1=YES
129       ssl_sslv2=YES
130       ssl_sslv3=YES
131
132       require_ssl_reuse=NO
133       ssl_ciphers=HIGH
134
135       require_cert=YES
136       ssl_request_cert=YES
137       ca_certs_file=/home/vsftpd/myuser/dfc.crt
138
139 6. Configure config/datafile_endpoints.json:
140 --------------------------------------------
141    Update the file accordingly:
142
143   .. code-block:: javascript
144
145             "ftpesConfiguration": {
146                 "keyCert": "/config/dfc.jks",
147                 "keyPassword": "[yourpassword]",
148                 "trustedCA": "/config/ftp.jks",
149                 "trustedCAPassword": "[yourpassword]"
150             }
151
152 7. Other conditions
153 ---------------------------------------------------------------------------
154    This has been tested with vsftpd and dfc, with self-signed certificates.
155    In real deployment, we should use ONAP-CA signed certificate for DFC, and vendor-CA signed certificate for xNF