flatpak icon indicating copy to clipboard operation
flatpak copied to clipboard

Proxy configuration not working for build(?) download

Open slwr opened this issue 6 years ago • 6 comments
trafficstars

Debian 9

Flatpak 1.0.6-1

Proxy configuration not working for NVIDIA driver download

Proxy configuration working for flathub: $ env | grep -i proxy https_proxy=http://user:password@proxy-dns-name:8000/ http_proxy=http://user:password@proxy-dns-name:8000/ no_proxy=localhost,127.0.0.1,proxyconf,[…]

Tried also to override proxy configuration for flatpak runtime like following: $ flatpak override --show org.freedesktop.Platform.GL.nvidia-340-106 [Environment] http_proxy=http://user:password@proxy-ip-addr:8000/ https_proxy=http://user:password@proxy-ip-addr:8000/ no_proxy=localhost,127.0.0.1

Issue looks like: $ flatpak update -v org.freedesktop.Platform.GL.nvidia-340-106 F: Opening system flatpak installation at path /var/lib/flatpak F: Opening user flatpak installation at path /home/user/.local/share/flatpak F: No installations directory in /etc/flatpak/installations.d. Skipping Looking for updates... F: Fetching summary file for remote ‘flathub’ F: Transaction: update flathub:runtime/org.freedesktop.Platform.GL.nvidia-340-106/x86_64/1.4[$old] F: Updating remote metadata for flathub F: marking op update:runtime/org.freedesktop.Platform.GL.nvidia-340-106/x86_64/1.4 resolved to 6000f5ace4a68bd29d1bdefea300783f73f0ef4731522998b256b768ceb909bf Updating in system: org.freedesktop.Platform.GL.nvidia-340-106/x86_64/1.4 flathub 6000f5ace4a6 Is this ok [y/n]: y Updating: org.freedesktop.Platform.GL.nvidia-340-106/x86_64/1.4 from flathub F: Loading https://download.nvidia.com/XFree86/Linux-x86_64/340.106/NVIDIA-Linux-x86_64-340.106-no-compat32.run using libsoup [#= ] Downloading files: 1/1 569 bytes Error: Failed to update org.freedesktop.Platform.GL.nvidia-340-106/x86_64/1.4: While downloading https://download.nvidia.com/XFree86/Linux-x86_64/340.106/NVIDIA-Linux-x86_64-340.106-no-compat32.run: Server returned status 407: Proxy Authentication Required error: There were one or more errors

No issue using wget: $ wget https://download.nvidia.com/XFree86/Linux-x86_64/340.106/NVIDIA-Linux-x86_64-340.106-no-compat32.run

Is there a way to workaround the issue? After some googling I expect that using libcurl instead of libsoup may solve the issue?

This is an issue to report to https://github.com/flatpak/flatpak since it does the downloading org.freedesktop.Platform.GL.nvidia component said: see https://github.com/flathub/org.freedesktop.Platform.GL.nvidia/issues/5

slwr avatar Jan 07 '19 16:01 slwr

Having the same issue. On my laptop when I'm at work and try to add flathub using my corporate proxy

# flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
Can't load uri https://flathub.org/repo/flathub.flatpakrepo: Could not connect: Network is unreachable

I have properly set HTTP_PROXY, HTTPS_PROXY and ALL_PROXY and wget/curl works as it should otherwise.

When I'm home and use my home WiFi and unset the env variables without the proxy everything works fine.

Also Debian 9

johan-bjareholt avatar Mar 06 '19 10:03 johan-bjareholt

Similar issue, but not different reasons. It seems that the proxy must be something like http://127.0.0.1:10809 and not 127.0.0.1:10809. The word http:// must be included, although for many other programs, it is not necessary.

saedrna avatar Jan 02 '20 03:01 saedrna

Require a solution fast

OrigMaverick avatar Dec 13 '21 20:12 OrigMaverick

I have the same issue

staeglis avatar May 20 '22 10:05 staeglis

We are facing a similar challenge here. When we install and setup Flatpak, while adding the Flathub repository, this error message is display :

error: Can't load uri https://flathub.org/repo/flathub.flatpakrepo: Server returned status 407: Proxy Authentication Required

Steps to reproduce at https://github.com/flatpak/flatpak/issues/5141

Francewhoa avatar Oct 14 '22 18:10 Francewhoa

We found a potential permanent resolution to this challenge. Which we have not yet tried. If your device is behind a proxy with required authentication, execute this command to add the Flathub repository without error message. sudo flatpak remote-add --authenticator-install flathub https://flathub.org/repo/flathub.flatpakrepo

Instead of sudo flatpak remote-add flathub https://flathub.org/repo/flathub.flatpakrepo

In the command above, the --authenticator-install option automatically install the required proxy authenticator

Details about this in my other comment at https://github.com/flatpak/flatpak/issues/5141#issuecomment-1279371585

Francewhoa avatar Oct 14 '22 19:10 Francewhoa

Part of this issue may be that the retrieval of the https_proxy environment variable seems to be case-sensitive, at least it appears so for me on Linux (Ubuntu 20.04 LTS). Initially I had my HTTP_PROXY variable(s) uppercase, and the proxy was not working. Changing to lowercase seems to have fixed the issue for me.

The following bit of code is the likely culprit.... https://github.com/flatpak/flatpak/blob/be2de97e862e5ca223da40a895e54e7bf24dbfb9/common/flatpak-utils-http.c#L775

This could probably be improved by testing for both upper and lower-case variables.

mpilawa avatar Mar 28 '23 06:03 mpilawa

Initially I had my HTTP_PROXY variable(s) uppercase

It is intentional that general-purpose http libraries don't allow this. The CGI script interface and similar specifications put an attacker-supplied HTTP header Foo: bar in environment variable HTTP_FOO=bar, but nobody wants an attacker to be able to configure a CGI script's web proxy by sending Proxy: http://evil.example.com.

smcv avatar Mar 28 '23 12:03 smcv

Initially I had my HTTP_PROXY variable(s) uppercase

It is intentional that general-purpose http libraries don't allow this. The CGI script interface and similar specifications put an attacker-supplied HTTP header Foo: bar in environment variable HTTP_FOO=bar, but nobody wants an attacker to be able to configure a CGI script's web proxy by sending Proxy: http://evil.example.com.

I see, thank you for the explanation. I also found a nice write-up on the topic here... https://about.gitlab.com/blog/2021/01/27/we-need-to-talk-no-proxy/

So the code is indeed "correct" by current conventions. But this still may explain why some people have trouble getting web proxy to work. Key take-away.... always use the lower-case form(s).

mpilawa avatar Mar 28 '23 23:03 mpilawa

seems this was answered

hfiguiere avatar Feb 10 '24 23:02 hfiguiere