Working Behind a Network Proxy: Difference between revisions

From Yocto Project
Jump to navigationJump to search
(Fixed issue with white spaces for no_proxy)
(Update this very outdated page)
Line 3: Line 3:
== HTTP/HTTPS/FTP Setup ==
== HTTP/HTTPS/FTP Setup ==


Set the following environment variables in your ~/.bashrc file. This example uses the same proxy server and port number for all three protocols.
Set the following environment variables in your <tt>~/.bashrc</tt> file. This example uses the same proxy server and port number for all three protocols.


  export http_proxy='http://myproxy.example.com:1080/'
  export http_proxy='http://myproxy.example.com:1080/'
Line 10: Line 10:
  export no_proxy='.example.com'
  export no_proxy='.example.com'


== Git Setup (with socat)==
== Git Setup==


First make sure you have the socat utility installed on your host (in Ubuntu, this should be a simple command "sudo apt-get install socat")
Copy <tt>scripts/oe-git-proxy</tt> to a directory included in your PATH and set the following in your configuration:


Create a script named ''git-proxy'' and put it in /usr/local/bin:
GIT_PROXY_COMMAND ?= "oe-git-proxy"
# Two possible examples - delete the one that doesn't apply:
ALL_PROXY ?= "socks://socks.example.com:1080"
ALL_PROXY ?= "https://proxy.example.com:8080"


#!/bin/bash
If you wish to use certain hosts without the proxy, specify them in NO_PROXY. See the script for details on syntax.
# $1 = hostname, $2 = port
PROXY=myproxy.example.com
exec socat STDIO SOCKS4:$PROXY:$1:$2
Then run the following command:
 
git config  --global  core.gitProxy git-proxy
 
== Git Setup (with nc)==
 
First make sure you have the netcat utility (nc) installed on your host.
 
Create a script named ''git-proxy'' and put it in /usr/local/bin:
 
#!/bin/bash
PROXY=myproxy.example.com
PORT=1080
case $1 in
        # list internal git servers here that you do not want to use
        # the proxy with, separated by a pipe character '|' as below:
internalgit1.example.com|internalgit2.example.com)
        METHOD="-X connect"
        ;;
*)
        METHOD="-X 5 -x ${PROXY}:${PORT}"
        ;;
esac
/usr/bin/nc $METHOD $*
 
Note that on some Linux distros, the nc binary is in /bin. You can also change the '5' in the second METHOD line to '4' if your proxy server only supports SOCKS v4.
 
Then set the environment variable GIT_PROXY_COMMAND in your ~/.bashrc file and point it to this script:
 
export GIT_PROXY_COMMAND=/usr/local/bin/git-proxy
export GIT_PROXY_IGNORE="example.com"


== Subversion Setup ==
== Subversion Setup ==


You'll need to have the following in your ~/.subversion/servers file:
You'll need to have the following in your <tt>~/.subversion/servers</tt> file:


  [global]
  [global]

Revision as of 01:38, 21 March 2016

This page lists some configuration tips for working behind a proxy.

HTTP/HTTPS/FTP Setup

Set the following environment variables in your ~/.bashrc file. This example uses the same proxy server and port number for all three protocols.

export http_proxy='http://myproxy.example.com:1080/'
export https_proxy='https://myproxy.example.com:1080/'
export ftp_proxy='http://myproxy.example.com:1080/'
export no_proxy='.example.com'

Git Setup

Copy scripts/oe-git-proxy to a directory included in your PATH and set the following in your configuration:

GIT_PROXY_COMMAND ?= "oe-git-proxy"
# Two possible examples - delete the one that doesn't apply:
ALL_PROXY ?= "socks://socks.example.com:1080"
ALL_PROXY ?= "https://proxy.example.com:8080"

If you wish to use certain hosts without the proxy, specify them in NO_PROXY. See the script for details on syntax.

Subversion Setup

You'll need to have the following in your ~/.subversion/servers file:

[global]
http-proxy-exceptions = *.exception.com, www.internal-site.org
http-proxy-host = myproxy.example.com
http-proxy-port = 1080

You can also set http-proxy-username and http-proxy-password if your proxy requires authentication.

CVS Setup (this seems useless since we don't have any recipe requiring cvs now)

For CVS checkouts to work correctly, you need to add some options in your Poky local.conf file.

CVS_PROXY_HOST = "myproxy.example.com"
CVS_PROXY_PORT = "1080"