Chengkai Yan | 54d8a3b | 2018-11-01 12:06:26 +0100 | [diff] [blame] | 1 | ======================== |
elinuxhenrik | b511dbc | 2018-09-20 13:05:18 +0200 | [diff] [blame] | 2 | DFC (DataFile Collector) |
Chengkai Yan | 54d8a3b | 2018-11-01 12:06:26 +0100 | [diff] [blame] | 3 | ======================== |
elinuxhenrik | b511dbc | 2018-09-20 13:05:18 +0200 | [diff] [blame] | 4 | |
| 5 | :Date: 2018-09-21 |
| 6 | |
| 7 | .. contents:: |
| 8 | :depth: 3 |
| 9 | .. |
| 10 | |
| 11 | Overview |
| 12 | ======== |
| 13 | |
Chengkai Yan | 7f278e3 | 2018-11-06 16:32:03 +0100 | [diff] [blame^] | 14 | Component description can be found under `DFC`_. |
elinuxhenrik | b511dbc | 2018-09-20 13:05:18 +0200 | [diff] [blame] | 15 | |
Chengkai Yan | 7f278e3 | 2018-11-06 16:32:03 +0100 | [diff] [blame^] | 16 | .. _DFC: ../../services/dfc/index.html |
elinuxhenrik | b511dbc | 2018-09-20 13:05:18 +0200 | [diff] [blame] | 17 | |
| 18 | |
| 19 | Paths |
| 20 | ===== |
| 21 | |
| 22 | GET /events/unauthenticated.VES_NOTIFICATION_OUTPUT |
Chengkai Yan | 54d8a3b | 2018-11-01 12:06:26 +0100 | [diff] [blame] | 23 | --------------------------------------------------- |
elinuxhenrik | b511dbc | 2018-09-20 13:05:18 +0200 | [diff] [blame] | 24 | |
| 25 | Description |
| 26 | ~~~~~~~~~~~ |
| 27 | |
| 28 | Reads fileReady events from DMaaP (Data Movement as a Platform) |
| 29 | |
| 30 | |
| 31 | Responses |
| 32 | ~~~~~~~~~ |
| 33 | |
Chengkai Yan | 54d8a3b | 2018-11-01 12:06:26 +0100 | [diff] [blame] | 34 | +-----------+---------------------+ |
| 35 | | HTTP Code | Description | |
| 36 | +===========+=====================+ |
| 37 | | **200** | successful response | |
| 38 | +-----------+---------------------+ |
elinuxhenrik | b511dbc | 2018-09-20 13:05:18 +0200 | [diff] [blame] | 39 | |
| 40 | |
| 41 | |
| 42 | POST /publish |
Chengkai Yan | 54d8a3b | 2018-11-01 12:06:26 +0100 | [diff] [blame] | 43 | ------------- |
elinuxhenrik | b511dbc | 2018-09-20 13:05:18 +0200 | [diff] [blame] | 44 | |
| 45 | Description |
| 46 | ~~~~~~~~~~~ |
| 47 | |
| 48 | Publish the collected file/s as a stream to DataRouter |
| 49 | - file as stream |
| 50 | - compression |
| 51 | - fileFormatType |
| 52 | - fileFormatVersion |
| 53 | |
| 54 | |
| 55 | Responses |
| 56 | ~~~~~~~~~ |
| 57 | |
Chengkai Yan | 54d8a3b | 2018-11-01 12:06:26 +0100 | [diff] [blame] | 58 | +-----------+---------------------+ |
| 59 | | HTTP Code | Description | |
| 60 | +===========+=====================+ |
| 61 | | **200** | successful response | |
| 62 | +-----------+---------------------+ |
elinuxhenrik | b511dbc | 2018-09-20 13:05:18 +0200 | [diff] [blame] | 63 | |
| 64 | Compiling DFC |
| 65 | ============= |
| 66 | |
| 67 | Whole project (top level of DFC directory) and each module (sub module directory) can be compiled using |
| 68 | `mvn clean install` command. |
| 69 | |
Chengkai Yan | 285e47c | 2018-10-18 10:40:14 +0200 | [diff] [blame] | 70 | Configuration file: Config/datafile_endpoints.json |
| 71 | |
elinuxhenrik | b511dbc | 2018-09-20 13:05:18 +0200 | [diff] [blame] | 72 | Maven GroupId: |
| 73 | ============== |
| 74 | |
| 75 | org.onap.dcaegen2.collectors |
| 76 | |
| 77 | Maven Parent ArtifactId: |
| 78 | ======================== |
| 79 | |
| 80 | dcae-collectors |
| 81 | |
| 82 | Maven Children Artifacts: |
| 83 | ========================= |
| 84 | |
| 85 | 1. datafile-app-server: DFC server |
| 86 | 2. datafile-dmaap-client: Contains implementation of DmaaP client |
| 87 | 3. datafile-commons: Common code for whole DFC modules |
Chengkai Yan | 285e47c | 2018-10-18 10:40:14 +0200 | [diff] [blame] | 88 | 4. docker-compose: Contains the docker-compose |
elinuxhenrik | b511dbc | 2018-09-20 13:05:18 +0200 | [diff] [blame] | 89 | |
Chengkai Yan | 285e47c | 2018-10-18 10:40:14 +0200 | [diff] [blame] | 90 | Configuration of Certificates in test environment(For FTP over TLS): |
| 91 | ==================================================================== |
Chengkai Yan | 54d8a3b | 2018-11-01 12:06:26 +0100 | [diff] [blame] | 92 | |
Chengkai Yan | 285e47c | 2018-10-18 10:40:14 +0200 | [diff] [blame] | 93 | DFC supports two protocols: FTPES and SFTP. |
| 94 | For FTPES, it is mutual authentication with certificates. |
| 95 | In our test environment, we use vsftpd to simulate xNF, and we generate self-signed |
| 96 | keys & certificates on both vsftpd server and DFC. |
Chengkai Yan | 54d8a3b | 2018-11-01 12:06:26 +0100 | [diff] [blame] | 97 | |
| 98 | 1. Generate key/certificate with openssl for DFC: |
| 99 | ------------------------------------------------- |
| 100 | .. code:: bash |
| 101 | |
Chengkai Yan | 285e47c | 2018-10-18 10:40:14 +0200 | [diff] [blame] | 102 | 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 |
elinuxhenrik | b511dbc | 2018-09-20 13:05:18 +0200 | [diff] [blame] | 105 | |
Chengkai Yan | 54d8a3b | 2018-11-01 12:06:26 +0100 | [diff] [blame] | 106 | 2. Generate key & certificate with openssl for vsftpd: |
| 107 | ------------------------------------------------------ |
| 108 | .. code:: bash |
Chengkai Yan | 285e47c | 2018-10-18 10:40:14 +0200 | [diff] [blame] | 109 | |
Chengkai Yan | 54d8a3b | 2018-11-01 12:06:26 +0100 | [diff] [blame] | 110 | 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 | |
| 114 | 3. Configure java keystore in DFC: |
| 115 | ---------------------------------- |
| 116 | We have two keystore files, one for TrustManager, one for KeyManager. |
| 117 | |
| 118 | **For TrustManager:** |
| 119 | |
| 120 | 1. First, create a jks keystore for TrustManager: |
| 121 | |
| 122 | .. code:: bash |
| 123 | |
| 124 | keytool -keystore ftp.jks -genkey -alias ftp |
| 125 | |
| 126 | 2. 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 | |
| 132 | 3. 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 | |
| 140 | 1. First, create a jks keystore: |
| 141 | |
| 142 | .. code:: bash |
| 143 | |
| 144 | keytool -keystore dfc.jks -genkey -alias dfc |
| 145 | |
| 146 | 2. 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 | |
| 164 | 3. Finished |
| 165 | |
| 166 | 4. Configure vsftpd: |
| 167 | -------------------- |
Chengkai Yan | 285e47c | 2018-10-18 10:40:14 +0200 | [diff] [blame] | 168 | update /etc/vsftpd/vsftpd.conf: |
Chengkai Yan | 54d8a3b | 2018-11-01 12:06:26 +0100 | [diff] [blame] | 169 | |
| 170 | .. code-block:: javascript |
| 171 | |
Chengkai Yan | 285e47c | 2018-10-18 10:40:14 +0200 | [diff] [blame] | 172 | 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 Yan | 54d8a3b | 2018-11-01 12:06:26 +0100 | [diff] [blame] | 190 | 5. Configure config/datafile_endpoints.json: |
| 191 | -------------------------------------------- |
Chengkai Yan | 285e47c | 2018-10-18 10:40:14 +0200 | [diff] [blame] | 192 | Update the file accordingly: |
Chengkai Yan | 54d8a3b | 2018-11-01 12:06:26 +0100 | [diff] [blame] | 193 | |
| 194 | .. code-block:: javascript |
| 195 | |
Chengkai Yan | 285e47c | 2018-10-18 10:40:14 +0200 | [diff] [blame] | 196 | "ftpesConfiguration": { |
| 197 | "keyCert": "/config/dfc.jks", |
| 198 | "keyPassword": "[yourpassword]", |
| 199 | "trustedCA": "/config/ftp.jks", |
| 200 | "trustedCAPassword": "[yourpassword]" |
| 201 | } |
Chengkai Yan | 54d8a3b | 2018-11-01 12:06:26 +0100 | [diff] [blame] | 202 | |
Chengkai Yan | 285e47c | 2018-10-18 10:40:14 +0200 | [diff] [blame] | 203 | 6. This has been tested with vsftpd and dfc, with self-signed certificates. |
Chengkai Yan | 54d8a3b | 2018-11-01 12:06:26 +0100 | [diff] [blame] | 204 | --------------------------------------------------------------------------- |
| 205 | In real deployment, we should use ONAP-CA signed certificate for DFC, and vendor-CA signed certificate for xNF |