Page tree

Welcome to FreeSoftwareServers Confluence Wiki

Skip to end of metadata
Go to start of metadata
cat << 'EOF' >>~/proxy_setup.sh

#VAProxy
ActProxy=127.0.0.1:80


#ActiveProxyVar
ActiveProxyVar=$ActProxy
httpproxyvar=http://$ActiveProxyVar/
httpsproxyvar=http://$ActiveProxyVar/
ftpproxyvar=ftp://$ActiveProxyVar/

#Domain
domainvar=alsglobal.com

cat << 'EOL' >>/etc/environment
no_proxy=localhost, 127.0.0.1, *.$domainvar
NO_PROXY=localhost, 127.0.0.1, *.$domainvar
http_proxy="$httpproxyvar"
HTTP_PROXY="$httpproxyvar"
https_proxy="$httpsproxyvar"
HTTPS_PROXY="$httpsproxyvar"
ftp_proxy="$ftpproxyvar"
FTP_PROXY="$ftpproxyvar"
EOL


cat << 'EOL' >/etc/apt/apt.conf.d/95proxies
Acquire::http::proxy "$httpproxyvar";
Acquire::ftp::proxy "$ftpproxyvar";
Acquire::https::proxy "$httpsproxyvar";
EOL

EOF
chmod +x ~/proxy_setup.sh
~/proxy_setup.sh

cat << 'EOF' >~/crt_import.sh
#!/bin/bash

dirname=zscaler
crtname=ZscalerRootCertificate-2048-SHA256

mkdir /usr/local/share/ca-certificates/$dirname
cat << EOL >/usr/local/share/ca-certificates/$dirname/$crtname.crt
-----BEGIN CERTIFICATE-----
...
-----END CERTIFICATE-----
EOL
update-ca-certificates
EOF
chmod +x ~/crt_import.sh
~/crt_import.sh

echo "reboot or export environment variables before moving forward"




https://serverfault.com/a/561100
##https???

cat << 'EOL' >>/etc/environment
no_proxy=localhost, 127.0.0.1, *.domain.com
http_proxy="http://proxyurl:80/"
https_proxy="httpd://proxyurl:80/"
ftp_proxy="ftp://proxyurl:80/"
EOL
cat << 'EOL' >/etc/apt/apt.conf.d/95proxies
Acquire::http::proxy "http://proxyurl:80/";
Acquire::ftp::proxy "ftp://proxyurl:80/";
Acquire::https::proxy "httpd://proxyurl:80/";
EOL
sudo reboot
sudo apt-get -o Debug::Acquire::http=true update
Acquire::https::test.com {
    Verify-Peer "true";
    Verify-Host "true";

    CaInfo "/tmp/ca.crt";

    SslCert "/tmp/client.crt";
    SslKey  "/tmp/client.key";
    SslForceVersion "SSLv3";
};

The file:

/etc/environment

Is the correct place to specify system-wide environment variables that should be available to all processes.
If you want this for the specified command only, use (as root):

http_proxy=http://10.1.3.1:8080 apt-get update

Proxy Environment Variables:

http_proxy #Proxy server for HTTP Traffic
https_proxy #Proxy server for HTTPS traffic
ftp_proxy #Proxy server for FTP traffic
no_proxy #Patterns for IP addresses or domain names that shouldn’t use the proxy

No_Proxy needs to be configured

no_proxy=localhost, 127.0.0.1, *.my.lan

If you have an authenticating proxy, then the URLs will be different. Instead of:

http_proxy="http://myproxy.server.com:8080/"

You'll have:

http_proxy="http://user_name:password@myproxy.server.com:8080/"

Note that these are still URLs, so passwords (and possibly usernames) will have to be URL encoded.
For example, a username of muru and a password of )qv3TB3LBm7EkP} would look like:

http_proxy="http://muru:)qv3TB3LBm7EkP%7D@myproxy.server.com:8080/"

apt-get, aptitude, etc. will not obey the environment variables when used normally with sudo. So separately configure them; create a file called 95proxies in /etc/apt/apt.conf.d/, and include the following:

Or don't use Sudo

Or use "Sudo -E"

Acquire::http::proxy "http://myproxy.server.com:8080/";
Acquire::ftp::proxy "ftp://myproxy.server.com:8080/";
Acquire::https::proxy "https://myproxy.server.com:8080/";


https://askubuntu.com/questions/158557/setting-proxy-for-apt-from-terminal

https://askubuntu.com/questions/175172/how-do-i-configure-proxies-without-gui

  • No labels