Add support for updating LibreNMS via HTTP proxy

In the environment I’m working in, HTTP(s) proxy usage is being enforced. It would be neat to add support for updating using a proxy. At the moment the fails.

I dont think this is a LibreNMS thing.

It looks like you can achieve this by:

setting http_proxy and https_proxy environment variable.

and setting your git config up to support the proxy.

git config --global http.proxy

1 Like

git pull and composer install --no-dev are working on the command line if I set http_proxy and https_proxy variables. (git config --global http.proxy/https.proxy has also been set)
In /etc/cron.d/librenms I also set the proxy variables.
Nevertheless daily.log shows:

Updating to latest codebase fatal: unable to access '': Failed connect to; Operation now in progress Returned: 1 Updating Composer packages Error: Failed to download installer signature from [...]

Fetching notifications will not work either, I think, because file_get_contents in includes/notifications.php does not honor proxy settings.

Hmm, can you try and git clone anything else? Just to rule out it being an issue with git not connecting, the Failed connect to error makes it sound like that.

This Gist looks pretty handy, you might need something like ssl verify false.

I would have thought file_get_contents runs locally on shell and honors your http proxy, which is odd. Looks like you can run composer diagnose to check to see if your http_proxy is working.

I managed to setup git with the https proxy setting, thank you for the hint.
What still fails is downloading the notifications and
downloading in scripts/composer_wrapper.php. It also uses file_get_contents() which could be instructed to use a proxy.
(See example #4)