16 June 2022

proxychains for apt, and proxy socks5 for pip

APT
Jika server berada di belakang transparent proxy, dan komplain certificate tak valid.
Boleh guna proxychains 

Method 1:
1- sudo apt-get install proxychains

2- /etc/proxychains.conf
    socks5 127.0.0.1 1080

3- get ready your socks5 proxy
    ssh user@myremotehost -D 1080

3- sudo proxychains apt-get update

ref: https://yuzhangbit.github.io/tools/use-apt-get-behind-socks5-proxy/


Method 2:
cat /etc/apt/apt.conf.d/proxy.conf
Acquire::http::Proxy "socks5h://127.0.0.1:1080";
ref: https://gist.github.com/wonderbeyond/3448c2f281062d61716efa1d8083a102





PIP
# SOCKS4 proxy creation
ssh -D9999 <remote host URI>
# use pip with the previously created proxy connection (requires pysocks)
python3 -m pip install <package name> --proxy socks5:localhost:9999


ref: https://stackoverflow.com/questions/22915705/how-to-use-pip-with-socks-proxy



#Notes:
Untuk abaikan masalah certificate verifikasi bagi pip, boleh tambah --truster-host

 pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org <package_name>