blob: 57e2914c44c7c23fc304420bf77fbdf1eca9ced6 [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 Yana23ce0c2018-11-06 21:50:23 +010016.. _DFC: ../../sections/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
Chengkai Yan1c857552019-02-01 16:10:46 +01001201. First, convert your certificate in a DER format :
Chengkai Yan54d8a3b2018-11-01 12:06:26 +0100121
122 .. code:: bash
123
124 openssl x509 -outform der -in ftp.crt -out ftp.der
125
Chengkai Yan1c857552019-02-01 16:10:46 +01001262. And after, import it in the keystore :
Chengkai Yan54d8a3b2018-11-01 12:06:26 +0100127
128 .. code:: bash
129
130 keytool -import -alias ftp -keystore ftp.jks -file ftp.der
131
132**For KeyManager:**
133
1341. First, create a jks keystore:
135
136 .. code:: bash
137
138 keytool -keystore dfc.jks -genkey -alias dfc
139
1402. Second, import dfc.crt and dfc.key to dfc.jks. This is a bit troublesome.
141
142 1). Step one: Convert x509 Cert and Key to a pkcs12 file
143
144 .. code:: bash
145
146 openssl pkcs12 -export -in dfc.crt -inkey dfc.key -out dfc.p12 -name [some-alias]
147
148 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).
149
150 Note 2: You might want to add the -chainoption to preserve the full certificate chain.
151
152 2). Step two: Convert the pkcs12 file to a java keystore:
153
154 .. code:: bash
155
156 keytool -importkeystore -deststorepass [changeit] -destkeypass [changeit] -destkeystore dfc.jks -srckeystore dfc.p12 -srcstoretype PKCS12 -srcstorepass [some-password] -alias [some-alias]
157
1583. Finished
159
1604. Configure vsftpd:
161--------------------
Chengkai Yan285e47c2018-10-18 10:40:14 +0200162 update /etc/vsftpd/vsftpd.conf:
Chengkai Yan54d8a3b2018-11-01 12:06:26 +0100163
Donald Hunter1e7e2ef2018-11-21 14:17:28 +0000164 .. code-block:: bash
Chengkai Yan54d8a3b2018-11-01 12:06:26 +0100165
Chengkai Yan285e47c2018-10-18 10:40:14 +0200166 rsa_cert_file=/etc/ssl/private/ftp.crt
167 rsa_private_key_file=/etc/ssl/private/ftp.key
168 ssl_enable=YES
169 allow_anon_ssl=NO
170 force_local_data_ssl=YES
171 force_local_logins_ssl=YES
172
173 ssl_tlsv1=YES
174 ssl_sslv2=YES
175 ssl_sslv3=YES
176
177 require_ssl_reuse=NO
178 ssl_ciphers=HIGH
179
180 require_cert=YES
181 ssl_request_cert=YES
182 ca_certs_file=/home/vsftpd/myuser/dfc.crt
183
Chengkai Yan54d8a3b2018-11-01 12:06:26 +01001845. Configure config/datafile_endpoints.json:
185--------------------------------------------
Chengkai Yan285e47c2018-10-18 10:40:14 +0200186 Update the file accordingly:
Chengkai Yan54d8a3b2018-11-01 12:06:26 +0100187
188 .. code-block:: javascript
189
Chengkai Yan285e47c2018-10-18 10:40:14 +0200190 "ftpesConfiguration": {
191 "keyCert": "/config/dfc.jks",
192 "keyPassword": "[yourpassword]",
193 "trustedCA": "/config/ftp.jks",
194 "trustedCAPassword": "[yourpassword]"
195 }
Chengkai Yan54d8a3b2018-11-01 12:06:26 +0100196
Chengkai Yan285e47c2018-10-18 10:40:14 +02001976. This has been tested with vsftpd and dfc, with self-signed certificates.
Chengkai Yan54d8a3b2018-11-01 12:06:26 +0100198---------------------------------------------------------------------------
199 In real deployment, we should use ONAP-CA signed certificate for DFC, and vendor-CA signed certificate for xNF