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 | a23ce0c | 2018-11-06 21:50:23 +0100 | [diff] [blame] | 16 | .. _DFC: ../../sections/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 | |
Chengkai Yan | 1c85755 | 2019-02-01 16:10:46 +0100 | [diff] [blame^] | 120 | 1. First, convert your certificate in a DER format : |
Chengkai Yan | 54d8a3b | 2018-11-01 12:06:26 +0100 | [diff] [blame] | 121 | |
| 122 | .. code:: bash |
| 123 | |
| 124 | openssl x509 -outform der -in ftp.crt -out ftp.der |
| 125 | |
Chengkai Yan | 1c85755 | 2019-02-01 16:10:46 +0100 | [diff] [blame^] | 126 | 2. And after, import it in the keystore : |
Chengkai Yan | 54d8a3b | 2018-11-01 12:06:26 +0100 | [diff] [blame] | 127 | |
| 128 | .. code:: bash |
| 129 | |
| 130 | keytool -import -alias ftp -keystore ftp.jks -file ftp.der |
| 131 | |
| 132 | **For KeyManager:** |
| 133 | |
| 134 | 1. First, create a jks keystore: |
| 135 | |
| 136 | .. code:: bash |
| 137 | |
| 138 | keytool -keystore dfc.jks -genkey -alias dfc |
| 139 | |
| 140 | 2. 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 | |
| 158 | 3. Finished |
| 159 | |
| 160 | 4. Configure vsftpd: |
| 161 | -------------------- |
Chengkai Yan | 285e47c | 2018-10-18 10:40:14 +0200 | [diff] [blame] | 162 | update /etc/vsftpd/vsftpd.conf: |
Chengkai Yan | 54d8a3b | 2018-11-01 12:06:26 +0100 | [diff] [blame] | 163 | |
Donald Hunter | 1e7e2ef | 2018-11-21 14:17:28 +0000 | [diff] [blame] | 164 | .. code-block:: bash |
Chengkai Yan | 54d8a3b | 2018-11-01 12:06:26 +0100 | [diff] [blame] | 165 | |
Chengkai Yan | 285e47c | 2018-10-18 10:40:14 +0200 | [diff] [blame] | 166 | 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 Yan | 54d8a3b | 2018-11-01 12:06:26 +0100 | [diff] [blame] | 184 | 5. Configure config/datafile_endpoints.json: |
| 185 | -------------------------------------------- |
Chengkai Yan | 285e47c | 2018-10-18 10:40:14 +0200 | [diff] [blame] | 186 | Update the file accordingly: |
Chengkai Yan | 54d8a3b | 2018-11-01 12:06:26 +0100 | [diff] [blame] | 187 | |
| 188 | .. code-block:: javascript |
| 189 | |
Chengkai Yan | 285e47c | 2018-10-18 10:40:14 +0200 | [diff] [blame] | 190 | "ftpesConfiguration": { |
| 191 | "keyCert": "/config/dfc.jks", |
| 192 | "keyPassword": "[yourpassword]", |
| 193 | "trustedCA": "/config/ftp.jks", |
| 194 | "trustedCAPassword": "[yourpassword]" |
| 195 | } |
Chengkai Yan | 54d8a3b | 2018-11-01 12:06:26 +0100 | [diff] [blame] | 196 | |
Chengkai Yan | 285e47c | 2018-10-18 10:40:14 +0200 | [diff] [blame] | 197 | 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] | 198 | --------------------------------------------------------------------------- |
| 199 | In real deployment, we should use ONAP-CA signed certificate for DFC, and vendor-CA signed certificate for xNF |