「.NET 開発基盤部会 Wiki」は、「Open棟梁Project」,「OSSコンソーシアム .NET開発基盤部会」によって運営されています。
Linux環境でプロキシを設定する方法。
プロキシURLの設定方法
プロキシURLの設定方法
※ <USERID> や <PASSWORD> に @ や : などの記号が含まれる場合は、URLエンコードが必要。
sudo cp server-cert.pem /usr/local/share/ca-certificates/server-cert.crt
$ sudo update-ca-certificates textUpdating certificates in /etc/ssl/certs... 1 added, 0 removed; done.
ls /etc/ssl/certs | grep server-cert
※ システム全体のCA証明書バンドルとは別のユーザー向けの証明書ストア
シェル単位・ユーザー単位でプロキシ設定する最も一般的な方法
export http_proxy=http://proxy.example.com:8080 export https_proxy=http://proxy.example.com:8080 export ftp_proxy=http://proxy.example.com:8080 export no_proxy=localhost,127.0.0.1,.example.com
echo 'export http_proxy=http://proxy.example.com:8080' >> ~/.bashrc echo 'export https_proxy=http://proxy.example.com:8080' >> ~/.bashrc echo 'export no_proxy=localhost,127.0.0.1,.example.com' >> ~/.bashrc
source ~/.bashrc
以下は、ツールごとの話。
sh や bash、ksh など。
export http_proxy="http://proxy.example.com:8080" export https_proxy=$http_proxy
csh や tcshなど、レガシー環境の場合
setenv http_proxy "http://proxy.example.com:8080" setenv https_proxy $http_proxy
sudo vi /etc/apt/apt.conf
Acquire::http::proxy "http://proxy.example.com:8080"; Acquire::https::proxy "http://proxy.example.com:8080";
sudo tee /etc/apt/apt.conf.d/95proxies <<EOF Acquire::http::proxy "http://proxy.example.com:8080"; Acquire::https::proxy "http://proxy.example.com:8080";
sudo vi /etc/yum.conf
proxy=http://proxy.example.com:8080 proxy_username=<USERID> proxy_password=<PASSWORD>
Webブラウザの種類やデスクトップ環境(GNOME, KDEなど)によって異なる。
(w3m, lynx, curl, wget)
(Firefox, Chromium, Chrome)
個別に調査すべし。
基本的に、環境変数を使用するが、ツール毎に専用の設定I/Fがあるものもある。
curl --cacert /path/to/server-cert.pem https://your-server.com
wget --ca-certificate=/path/to/server-cert.pem https://your-server.com
sudo keytool -import -trustcacerts -file server-cert.pem -keystore /path/to/java/lib/security/cacerts -alias server-cert
WSL2上のUbuntuの手順
sudo vi /etc/apt/apt.conf
Acquire::http::proxy "http://@を%40にエスケープしたメールアドレス:パスワード@プロキシURL:8080/"; Acquire::https::proxy "http://@を%40にエスケープしたメールアドレス:パスワード@プロキシURL:8080/";
※ アカウントがメアドのケースで、ポート番号が8080の場合(笑)
環境変数の設定方法を参考に、ユーザー単位で .bashrc に追加する。
echo 'export http_proxy="http://@を%40にエスケープしたメールアドレス:パスワード@プロキシURL:8080/"' >> ~/.bashrc echo 'export https_proxy="http://@を%40にエスケープしたメールアドレス:パスワード@プロキシURL:8080/"' >> ~/.bashrc echo 'export HTTP_PROXY="http://@を%40にエスケープしたメールアドレス:パスワード@プロキシURL:8080/"' >> ~/.bashrc echo 'export HTTPS_PROXY="http://@を%40にエスケープしたメールアドレス:パスワード@プロキシURL:8080/"' >> ~/.bashrc source ~/.bashrc
※ アカウントがメアドのケースで、ポート番号が8080の場合(笑)
※ 環境変数の大文字・小文字は区別され、ツールによっては大文字・小文字を参照するため。
復号中継「&パススルー機能付きの」プロキシを経由する場合で、xxxxx.cerはPEM形式である前提で。
sudo cp /mnt/c/xxxxx.cer /usr/local/share/ca-certificates/server-cert.crt
$ sudo update-ca-certificates textUpdating certificates in /etc/ssl/certs... 1 added, 0 removed; done.
ls /etc/ssl/certs | grep server-cert