1 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
2 .. http://creativecommons.org/licenses/by/4.0
7 Configuration of Certificates in test environment(For FTP over TLS):
9 DFC supports two protocols: FTPES and SFTP.
10 For FTPES, it is mutual authentication with certificates.
11 In our test environment, we use vsftpd to simulate xNF, and we generate self-signed
12 keys & certificates on both vsftpd server and DFC.
14 1. Generate key/certificate with openssl for DFC:
15 -------------------------------------------------
18 openssl genrsa -out dfc.key 2048
19 openssl req -new -out dfc.csr -key dfc.key
20 openssl x509 -req -days 365 -in dfc.csr -signkey dfc.key -out dfc.crt
22 2. Generate key & certificate with openssl for vsftpd:
23 ------------------------------------------------------
26 openssl genrsa -out ftp.key 2048
27 openssl req -new -out ftp.csr -key ftp.key
28 openssl x509 -req -days 365 -in ftp.csr -signkey ftp.key -out ftp.crt
30 3. Configure java keystore in DFC:
31 ----------------------------------
32 We have two keystore files, one for TrustManager, one for KeyManager.
36 1. First, convert your certificate in a DER format :
40 openssl x509 -outform der -in ftp.crt -out ftp.der
42 2. And after, import it in the keystore :
46 keytool -import -alias ftp -keystore ftp.jks -file ftp.der
50 1. First, create a jks keystore:
54 keytool -keystore dfc.jks -genkey -alias dfc
56 2. Second, import dfc.crt and dfc.key to dfc.jks. This is a bit troublesome.
58 1). Step one: Convert x509 Cert and Key to a pkcs12 file
62 openssl pkcs12 -export -in dfc.crt -inkey dfc.key -out dfc.p12 -name [some-alias]
64 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.
66 Note 2: You might want to add the -chainoption to preserve the full certificate chain.
68 2). Step two: Convert the pkcs12 file to a java keystore:
72 keytool -importkeystore -deststorepass [changeit] -destkeypass [changeit] -destkeystore dfc.jks -srckeystore dfc.p12 -srcstoretype PKCS12 -srcstorepass [some-password] -alias [some-alias]
74 4. Update existing jks.b64 files
75 ---------------------------------
77 Copy the existing jks from the DFC container to a local environment.
81 docker cp <DFC container>:/opt/app/datafile/config/ftp.jks .
82 docker cp <DFC container>:/opt/app/datafile/config/dfc.jks .
86 openssl base64 -in ftp.jks -out ftp.jks.b64
87 openssl base64 -in dfc.jks -out dfc.jks.b64
94 Copy the new jks.64 files from local environment to the DFC container.
98 docker cp ftp.jks.b64 <DFC container>:/opt/app/datafile/config/
99 docker cp dfc.jks.b64 <DFC container>:/opt/app/datafile/config/
105 docker restart <DFC container>
109 update /etc/vsftpd/vsftpd.conf:
113 rsa_cert_file=/etc/ssl/private/ftp.crt
114 rsa_private_key_file=/etc/ssl/private/ftp.key
117 force_local_data_ssl=YES
118 force_local_logins_ssl=YES
129 ca_certs_file=/home/vsftpd/myuser/dfc.crt
131 6. Configure config/datafile_endpoints.json:
132 --------------------------------------------
133 Update the file accordingly:
135 .. code-block:: javascript
137 "ftpesConfiguration": {
138 "keyCert": "/config/dfc.jks",
139 "keyPassword": "[yourpassword]",
140 "trustedCA": "/config/ftp.jks",
141 "trustedCAPassword": "[yourpassword]"
145 ---------------------------------------------------------------------------
146 This has been tested with vsftpd and dfc, with self-signed certificates.
147 In real deployment, we should use ONAP-CA signed certificate for DFC, and vendor-CA signed certificate for xNF