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 daily.sh 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 'https://github.com/librenms/librenms.git/': Failed connect to github.com:443; Operation now in progress Returned: 1 Updating Composer packages Error: Failed to download installer signature from https://composer.github.io/installer.sig [...]

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 github.com:443 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 https://composer.github.io/installer.sig in scripts/composer_wrapper.php. It also uses file_get_contents() which could be instructed to use a proxy.
(See http://php.net/manual/en/function.file-get-contents.php example #4)