cerebrate-project / cerebrate

Cerebrate is an open-source platform meant to act as a trusted contact information provider and interconnection orchestrator for other security tools.
https://www.cerebrate-project.org/
GNU Affero General Public License v3.0
82 stars 16 forks source link

Using Proxy for Importer #49

Open ghost opened 3 years ago

ghost commented 3 years ago

I followed the wiki to import data from ENISA https://github.com/cerebrate-project/cerebrate/wiki/CLI-Tools-usage#importing-new-data-from-the-enisa-csirt-inventory but I'm failing on the proxy configuration

sebastianw@cerebrate:~$ sudo -u www-data https_proxy=http://proxy.cert.at:8080 http_proxy=http://proxy.cert.at:8080 /var/www/cerebrate/bin/cake Importer --yes /var/www/cerebrate/config-enisa-csirts-inventory.json https://www.enisa.europa.eu/topics/csirts-in-europe/csirt-inventory/certs-by-country-interactive-map/tool_data.json
[sudo] password for sebastianw:
Exception: fopen(https://www.enisa.europa.eu/topics/csirts-in-europe/csirt-inventory/certs-by-country-interactive-map/tool_data.json): failed to open stream: Connection timed out
In [/var/www/cerebrate/vendor/cakephp/cakephp/src/Http/Client/Adapter/Stream.php, line 329]

2021-05-17 08:38:49 Error: [Cake\Http\Client\Exception\RequestException] fopen(https://www.enisa.europa.eu/topics/csirts-in-europe/csirt-inventory/certs-by-country-interactive-map/tool_data.json): failed to open stream: Connection timed out in /var/www/cerebrate/vendor/cakephp/cakephp/src/Http/Client/Adapter/Stream.php on line 329
Stack Trace:
- /var/www/cerebrate/vendor/cakephp/cakephp/src/Http/Client/Adapter/Stream.php:255
- /var/www/cerebrate/vendor/cakephp/cakephp/src/Http/Client/Adapter/Stream.php:82
- /var/www/cerebrate/vendor/cakephp/cakephp/src/Http/Client.php:501
- /var/www/cerebrate/vendor/cakephp/cakephp/src/Http/Client.php:471
- /var/www/cerebrate/vendor/cakephp/cakephp/src/Http/Client.php:426
- /var/www/cerebrate/vendor/cakephp/cakephp/src/Http/Client.php:289
- /var/www/cerebrate/src/Command/ImporterCommand.php:358
- /var/www/cerebrate/src/Command/ImporterCommand.php:335
- /var/www/cerebrate/src/Command/ImporterCommand.php:107
- /var/www/cerebrate/vendor/cakephp/cakephp/src/Console/BaseCommand.php:179
- /var/www/cerebrate/vendor/cakephp/cakephp/src/Console/CommandRunner.php:336
- /var/www/cerebrate/vendor/cakephp/cakephp/src/Console/CommandRunner.php:172
- /var/www/cerebrate/bin/cake.php:12

It looks like the program tries to directly access the resource and does not use the proxy. Can the use of the proxy be enforced or configured somehow?

ghost commented 3 years ago

I tried to circumvent this by providing the file as local file and on the local webserver, but I just got in both cases:

[
    {
        "url": "The provided value is invalid"
    }
]

Do you know any other workaround?