Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Suggestion - Add proxy support

オープン
#490 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
powershell

調査の方向性

Prereq スクリプトから始め、その Invoke-WebRequest、Install-PackageProvider、Find-DscResource/Save-Module の呼び出しを調査します。プロキシと資格情報の設定をどのように渡すべきかを判断し、その後、スクリプト外で手動設定を必要とせずに、プロキシ経由で前提モジュールのインストールが機能することを検証します。

索引モデルが issue の本文から書いたものです。

説明

I was behind a proxy here and I had to change the script to add "-Proxy $Proxy -ProxyCredential $MyCreds" at the end of each "Invoke-WebRequest" cmdlet.

Same thing for "Install-PackageProvider -Name NuGet"

But then, i got error with "Find-DscResource -moduleName $modulename -RequiredVersion $moduleversion | Save-Module -Path "$PSScriptRoot\Temp\DSC"

I've search a long time and try these configuration without success :

Setting TLS 1.2 : [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Bypassing the certificate validation : [Net.ServicePointManager]::ServerCertificateValidationCallback = {$true};
Bypassing the certificate validation by code instead of block :
#C# class to create callback
$code = @"
public class SSLHandler
{
public static System.Net.Security.RemoteCertificateValidationCallback GetSSLHandler()
{

    return new System.Net.Security.RemoteCertificateValidationCallback((sender, certificate, chain, policyErrors) => { return true; });
}

}
"@
#compile the class
Add-Type -TypeDefinition $code

#disable checks using new class
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = [SSLHandler]::GetSSLHandler()

No success!! but then i've found way to configure default proxy but i wasnt able to add it to the script, and I had to install the module outside of the "Prereq" script. here what I use for this to work :

$proxy = 'YER PROXY HERE' # update this
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
[system.net.webrequest]::defaultwebproxy = new-object system.net.webproxy($proxy)
[system.net.webrequest]::defaultwebproxy.credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials
[system.net.webrequest]::defaultwebproxy.BypassProxyOnLocal = $true

Install-PackageProvider -Name nuget -Scope AllUsers -Confirm:$false -Force -MinimumVersion 2.8.5.201
Register-PSRepository -Default -verbose

Install-Module -Name xActiveDirectory -Scope AllUsers -Confirm:$false -Force
Install-Module -Name xDHCpServer -Scope AllUsers -Confirm:$false -Force
Install-Module -Name xDNSServer -Scope AllUsers -Confirm:$false -Force
Install-Module -Name NetworkingDSC -Scope AllUsers -Confirm:$false -Force
Install-Module -Name xPSDesiredStateConfiguration -Scope AllUsers -Confirm:$false -Force

Probably there more "code head" people who can help with this since it's ugly but working :)

Thanks again for the great script!

主要言語
PowerShell
スター
1.3k
フォーク
304
PR マージ指標
30日以内にマージされた PR はありません

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

microsoft/MSLab のほかの issue

microsoft/MSLab の issue をすべて見る

似ている issue

DevOps の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。