WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: http proxy issues  (Read 6851 times)

Offline godiedelriver

  • Newbie
  • *
  • Posts: 4
http proxy issues
« on: September 23, 2016, 03:38:58 PM »
Hi everybody, I've just installed dCore with jessie images (base and kernel).
To begin with, I set http_proxy with
export http_proxy=http://...
Next I searched for some software with sce-import but something went wrong as it shown in the attached image.
Digging into the sce-import source code I think the problem is when debGetEnv is called with sudo, as the environment variables are not propagated.
Does anyone know a workaround for this?
Thanks in advance

Offline Jason W

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 9730
Re: http proxy issues
« Reply #1 on: September 23, 2016, 10:25:03 PM »
dCore uses busybox wget, which at least does not seem to use the same syntax of the http_proxy variable. 
I will look into how this can be supported.

Offline godiedelriver

  • Newbie
  • *
  • Posts: 4
Re: http proxy issues
« Reply #2 on: September 26, 2016, 09:10:04 AM »
Hi Jason, I've managed to get google.com index page using dCore wget, however. Please, look at the attached image.

Offline Jason W

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 9730
Re: http proxy issues
« Reply #3 on: September 26, 2016, 11:48:38 AM »
Ok, thanks, I see the variable is the same for busybox wget.  I remember having to export the shell variable to sudo in another function, and it will probably work in this case too.  I will aim to test it tonight.

Offline Jason W

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 9730
Re: http proxy issues
« Reply #4 on: September 26, 2016, 01:39:35 PM »
I see that using the command "sudo -E" passes the user environment to sudo.  But when using the command "sudo -E debGetEnv" it says file not found by wget trying to download something from repo.tinycorelinux.net when a web proxy is specified with http_proxy=.  Other commands used with "sudo -E" work as far as the preserved environment variables.  I will look into it a little more.

Offline Jason W

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 9730
Re: http proxy issues
« Reply #5 on: September 26, 2016, 09:53:28 PM »
godiedelriver - Are you able to download specific files via a proxy server with wget, ie http://www.google.com/index.html?  (Works with wget and no proxy).  I can't with the free proxies I have tried but it works with just http://www.google.com:

Code: [Select]
jason@box:~$ ash
jason@box:~$ export http_proxy='http://yavz.xyz'
jason@box:~$ echo $http_proxy
http://yavz.xyz
jason@box:~$ /bb/wget http://www.google.com/index.html
Connecting to yavz.xyz (104.171.115.66:80)
wget: server returned error: HTTP/1.1 404 Not Found
jason@box:~$ /bb/wget http://www.google.com
Connecting to yavz.xyz (104.171.115.66:80)
index.html           100% |*******************************| 16868   0:00:00 ETA
jason@box:~$

The inability to download specified files would be why the proxy is not working in the dCore scripts.  I can export the http_proxy variable to the dCore parent and child scripts that do or don't use sudo, but if a free proxy breaks it, then I can't work it in as it will not work for many folks.  The standard dCore scripts work even with http_proxy exported, I had sce-import quit just before the select menu to be able to post it, but the import follows through:

Code: [Select]
jason@box:~$ ash
jason@box:~$ export http_proxy='http://yavz.xyz'
jason@box:~$ echo $http_proxy
http://yavz.xyz
jason@box:~$ sce-import file
* Using nice level 19.
* Using the -u option.
* Using the -s option.
* Fetching DEBINX update.
* Distro: ubuntu
* Syncing Debian Index: ubuntu_xenial_main_i386_Packages
* Syncing Debian Security Index: ubuntu_xenial_security_i386_Packages
* Using the repo http://us.archive.ubuntu.com/ubuntu/ xenial-backports main
* Using the repo http://us.archive.ubuntu.com/ubuntu/ xenial-backports multiverse
* Using the repo http://us.archive.ubuntu.com/ubuntu/ xenial-backports restricted
* Using the repo http://us.archive.ubuntu.com/ubuntu/ xenial-backports universe
* Using the repo http://security.ubuntu.com/ubuntu xenial main
jason@box:~$

What I can do is to make sure the if http_proxy is exported in the shell, that the dCore scripts will work as expected pulling from the Debian/Ubuntu and Tinycore servers.  That way it fails for no one.

« Last Edit: September 26, 2016, 10:28:41 PM by Jason W »

Offline godiedelriver

  • Newbie
  • *
  • Posts: 4
Re: http proxy issues
« Reply #6 on: September 27, 2016, 08:45:23 AM »
Hi Jason, perhaps it's a matter of how google generates index.html. I've tried again getting index.html from both http://www.google.com/index.html and http://www.google.com with and without http_proxy set and got the same results as shown in my previous post. To be sure, I've also tried getting http://distro.ibiblio.org/tinycorelinux/dCore/x86/README/README-1st.txt with and without http_proxy set and the same happens. Please, look at the attached image. (The connection refused errors are sporadically generated by the corporate proxy server I am behind of).
Thank you very much for hacking dCore.

Offline Jason W

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 9730
Re: http proxy issues
« Reply #7 on: September 27, 2016, 08:53:03 PM »
I am testing some approaches to this, hope to settle on something in the coming days.

Offline Jason W

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 9730
Re: http proxy issues
« Reply #8 on: September 28, 2016, 10:44:31 PM »
Now preserving the user environment in dCore scripts that are called with sudo or in those that call wget with sudo.  Many normal web proxies will not work with the dCore routeines and wget, but I did test with one that did.  It is assumed if this variable is exported across the user's terminals that one knows what one is doing.  I tested with a proxy that supports this use, please test and let me know if it is good now.

Offline godiedelriver

  • Newbie
  • *
  • Posts: 4
Re: http proxy issues
« Reply #9 on: September 29, 2016, 10:26:43 AM »
It's working Jason! And I believe it should work with any proxy. I dont't really understand your concerns about some proxies failing. If that happened it should be a proxy problem, not a dCore misfunction.
Now I'm getting permission errors when the script calls chown over files in /etc/sysconfig/tcedir/import/debinx. Please, look at the attached image.
Should sce-import be run with sudo to overcome the error? My tcedir is mounted on a vfat partition.

Offline Jason W

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 9730
Re: http proxy issues
« Reply #10 on: September 29, 2016, 12:42:06 PM »
Great, glad to hear it is working!

The chown error is called from debGetEnv which is run with sudo already, the errors are there because vfat does not support Unix file permissions.  But what I can do is quiet the output as to not cause confusion.  Now in the latest RC.