blob: d7892a1454717beb6e46834862c2fbbc10ee4541 [file] [log] [blame]
Chengkai Yan54d8a3b2018-11-01 12:06:26 +01001========================
elinuxhenrikb511dbc2018-09-20 13:05:18 +02002DFC (DataFile Collector)
Chengkai Yan54d8a3b2018-11-01 12:06:26 +01003========================
elinuxhenrikb511dbc2018-09-20 13:05:18 +02004
5:Date: 2018-09-21
6
7.. contents::
8 :depth: 3
9..
10
11Overview
12========
13
Chengkai Yan7f278e32018-11-06 16:32:03 +010014Component description can be found under `DFC`_.
elinuxhenrikb511dbc2018-09-20 13:05:18 +020015
Chengkai Yan7f278e32018-11-06 16:32:03 +010016.. _DFC: ../../services/dfc/index.html
elinuxhenrikb511dbc2018-09-20 13:05:18 +020017
18
19Paths
20=====
21
22GET /events/unauthenticated.VES_NOTIFICATION_OUTPUT
Chengkai Yan54d8a3b2018-11-01 12:06:26 +010023---------------------------------------------------
elinuxhenrikb511dbc2018-09-20 13:05:18 +020024
25Description
26~~~~~~~~~~~
27
28Reads fileReady events from DMaaP (Data Movement as a Platform)
29
30
31Responses
32~~~~~~~~~
33
Chengkai Yan54d8a3b2018-11-01 12:06:26 +010034+-----------+---------------------+
35| HTTP Code | Description |
36+===========+=====================+
37| **200** | successful response |
38+-----------+---------------------+
elinuxhenrikb511dbc2018-09-20 13:05:18 +020039
40
41
42POST /publish
Chengkai Yan54d8a3b2018-11-01 12:06:26 +010043-------------
elinuxhenrikb511dbc2018-09-20 13:05:18 +020044
45Description
46~~~~~~~~~~~
47
48Publish the collected file/s as a stream to DataRouter
49 - file as stream
50 - compression
51 - fileFormatType
52 - fileFormatVersion
53
54
55Responses
56~~~~~~~~~
57
Chengkai Yan54d8a3b2018-11-01 12:06:26 +010058+-----------+---------------------+
59| HTTP Code | Description |
60+===========+=====================+
61| **200** | successful response |
62+-----------+---------------------+
elinuxhenrikb511dbc2018-09-20 13:05:18 +020063
64Compiling DFC
65=============
66
67Whole project (top level of DFC directory) and each module (sub module directory) can be compiled using
68`mvn clean install` command.
69
Chengkai Yan285e47c2018-10-18 10:40:14 +020070Configuration file: Config/datafile_endpoints.json
71
elinuxhenrikb511dbc2018-09-20 13:05:18 +020072Maven GroupId:
73==============
74
75org.onap.dcaegen2.collectors
76
77Maven Parent ArtifactId:
78========================
79
80dcae-collectors
81
82Maven Children Artifacts:
83=========================
84
851. datafile-app-server: DFC server
862. datafile-dmaap-client: Contains implementation of DmaaP client
873. datafile-commons: Common code for whole DFC modules
Chengkai Yan285e47c2018-10-18 10:40:14 +0200884. docker-compose: Contains the docker-compose
elinuxhenrikb511dbc2018-09-20 13:05:18 +020089
Chengkai Yan285e47c2018-10-18 10:40:14 +020090Configuration of Certificates in test environment(For FTP over TLS):
91====================================================================
Chengkai Yan54d8a3b2018-11-01 12:06:26 +010092
Chengkai Yan285e47c2018-10-18 10:40:14 +020093DFC supports two protocols: FTPES and SFTP.
94For FTPES, it is mutual authentication with certificates.
95In our test environment, we use vsftpd to simulate xNF, and we generate self-signed
96keys & certificates on both vsftpd server and DFC.
Chengkai Yan54d8a3b2018-11-01 12:06:26 +010097
981. Generate key/certificate with openssl for DFC:
99-------------------------------------------------
100.. code:: bash
101
Chengkai Yan285e47c2018-10-18 10:40:14 +0200102 openssl genrsa -out dfc.key 2048
103 openssl req -new -out dfc.csr -key dfc.key
104 openssl x509 -req -days 365 -in dfc.csr -signkey dfc.key -out dfc.crt
elinuxhenrikb511dbc2018-09-20 13:05:18 +0200105
Chengkai Yan54d8a3b2018-11-01 12:06:26 +01001062. Generate key & certificate with openssl for vsftpd:
107------------------------------------------------------
108.. code:: bash
Chengkai Yan285e47c2018-10-18 10:40:14 +0200109
Chengkai Yan54d8a3b2018-11-01 12:06:26 +0100110 openssl genrsa -out ftp.key 2048
111 openssl req -new -out ftp.csr -key ftp.key
112 openssl x509 -req -days 365 -in ftp.csr -signkey ftp.key -out ftp.crt
113
1143. Configure java keystore in DFC:
115----------------------------------
116We have two keystore files, one for TrustManager, one for KeyManager.
117
118**For TrustManager:**
119
1201. First, create a jks keystore for TrustManager:
121
122 .. code:: bash
123
124 keytool -keystore ftp.jks -genkey -alias ftp
125
1262. Second, convert your certificate in a DER format :
127
128 .. code:: bash
129
130 openssl x509 -outform der -in ftp.crt -out ftp.der
131
1323. And after, import it in the keystore :
133
134 .. code:: bash
135
136 keytool -import -alias ftp -keystore ftp.jks -file ftp.der
137
138**For KeyManager:**
139
1401. First, create a jks keystore:
141
142 .. code:: bash
143
144 keytool -keystore dfc.jks -genkey -alias dfc
145
1462. Second, import dfc.crt and dfc.key to dfc.jks. This is a bit troublesome.
147
148 1). Step one: Convert x509 Cert and Key to a pkcs12 file
149
150 .. code:: bash
151
152 openssl pkcs12 -export -in dfc.crt -inkey dfc.key -out dfc.p12 -name [some-alias]
153
154 Note: Make sure you put a password on the p12 file - otherwise you'll get a null reference exception when yy to import it. (In case anyone else had this headache).
155
156 Note 2: You might want to add the -chainoption to preserve the full certificate chain.
157
158 2). Step two: Convert the pkcs12 file to a java keystore:
159
160 .. code:: bash
161
162 keytool -importkeystore -deststorepass [changeit] -destkeypass [changeit] -destkeystore dfc.jks -srckeystore dfc.p12 -srcstoretype PKCS12 -srcstorepass [some-password] -alias [some-alias]
163
1643. Finished
165
1664. Configure vsftpd:
167--------------------
Chengkai Yan285e47c2018-10-18 10:40:14 +0200168 update /etc/vsftpd/vsftpd.conf:
Chengkai Yan54d8a3b2018-11-01 12:06:26 +0100169
170 .. code-block:: javascript
171
Chengkai Yan285e47c2018-10-18 10:40:14 +0200172 rsa_cert_file=/etc/ssl/private/ftp.crt
173 rsa_private_key_file=/etc/ssl/private/ftp.key
174 ssl_enable=YES
175 allow_anon_ssl=NO
176 force_local_data_ssl=YES
177 force_local_logins_ssl=YES
178
179 ssl_tlsv1=YES
180 ssl_sslv2=YES
181 ssl_sslv3=YES
182
183 require_ssl_reuse=NO
184 ssl_ciphers=HIGH
185
186 require_cert=YES
187 ssl_request_cert=YES
188 ca_certs_file=/home/vsftpd/myuser/dfc.crt
189
Chengkai Yan54d8a3b2018-11-01 12:06:26 +01001905. Configure config/datafile_endpoints.json:
191--------------------------------------------
Chengkai Yan285e47c2018-10-18 10:40:14 +0200192 Update the file accordingly:
Chengkai Yan54d8a3b2018-11-01 12:06:26 +0100193
194 .. code-block:: javascript
195
Chengkai Yan285e47c2018-10-18 10:40:14 +0200196 "ftpesConfiguration": {
197 "keyCert": "/config/dfc.jks",
198 "keyPassword": "[yourpassword]",
199 "trustedCA": "/config/ftp.jks",
200 "trustedCAPassword": "[yourpassword]"
201 }
Chengkai Yan54d8a3b2018-11-01 12:06:26 +0100202
Chengkai Yan285e47c2018-10-18 10:40:14 +02002036. This has been tested with vsftpd and dfc, with self-signed certificates.
Chengkai Yan54d8a3b2018-11-01 12:06:26 +0100204---------------------------------------------------------------------------
205 In real deployment, we should use ONAP-CA signed certificate for DFC, and vendor-CA signed certificate for xNF