Quick Rust BootUp behind Proxy

Praveen Ray
2 min readAug 21, 2022

--

Rust — not the programming Language!

Deploying Rust toolchain is fairly straightforward on a machine with unrestricted Internet Access. However, doing the same on a corporate node behind corporate proxy will almost certainly require few hours at the the University of Google — that is assuming you know what questions to ask. Here are my notes in making it work on a vanilla dockerized Ubuntu behind our corporate proxy.

Setup Proxy:

$ export http_proxy=http://<username>:<password>@proxyip:proxyPort$ export https_proxy=$http_proxy

For example, this could look like:

export http_proxy=http://foo:bar@10.10.10.10:8080assuming your corporate proxy is at 10.10.10.10:8080 and your username/password is foo/bar !

Start Docker

$ docker run -d --rm --name ubuntu -t ubuntu
$ docker exec -it ubuntu bash

Once Inside container:

$ apt-get update -y
$ apt-get install build-essential vim curl git -y
$ apt-get install pkg-config libssl-dev -y

Add following to ~/.gitconfig

[http]
sslVerify = false

Download and run rust initializer:

$ curl -o rustup-init.sh 'https://static.rust-lang.org/rustup/rustup-init.sh'
$ chmod +x rustup-init.sh
$ ./rustup-init.sh
Pick 1 to proceed with installation with defaults

Add following to ~/.cargo/config:

[http]
proxy = "http://foo:bar@10.10.10.10:8080" # replace with your proxy
timeout = 30
check-revoke = false
multiplexing = false
[target.x86_64-unknown-linux-musl]
linker = "rust-lld"
[https]
check-revoke = false
[net]
git-fetch-with-cli = true

Time to try it :

$ cargo new myFirstProject
$ cd myFirstProject
$ echo "log = "0.4.17" >> Cargo.toml # just for fun
$ cargo build
$ ./target/debug/myFirstProject

--

--

Praveen Ray
Praveen Ray

Written by Praveen Ray

System Design, Leading High Performance Teams

No responses yet