
あなたが十分に保護されていないことをパラノイアが示唆し、手元に安全のための無料のツールしかない場合、この気持ちを満たす必要があります! カットの下で、PowerShellを含む標準のWindowsファイアウォールを使用してネットワークにアクセスするためのプログラムのホワイトリストを作成します。
はじめに
サイバー脅威の世界のほとんどのエンコーダー、トロイの木馬、その他の悪いものは、彼らの暗いトリックのために、被害者のデバイスからネットワークにアクセスする機能を使用します。ファイルを暗号化するためのキーの受信、機密情報の送信など。 アンチウイルス企業は、そのような敵との戦いで、プロアクティブな技術を引きずり、暗号化のために個別の製品をリリースしていますが、無料の保護の一般ユーザーにとっては、境界を個別に微調整するだけです。 Vista以降、Windowsのビルトインファイアウォールは非常に優れたものになりましたが、ほとんどの場合、アイドル状態でアイドル状態になっており、書き込まれていない着信接続のみを拒否します。 誰もが知っているわけではありませんが、彼はもう少しできることがあります-発信接続をフィルタリングし、このモードを有効にして正しく設定するだけです
それでは始めましょう
最初のステップは、すべての発信接続を禁止することです(着信は、すでに禁止されています-必要なソフトウェア自体は、原則として、それ自体の例外を規定しています)。 これを行うには、[コントロールパネル]-> [システムとセキュリティ]-> [Windowsファイアウォール]-> [詳細設定]に移動します。 次に、「セキュリティが強化されたWindowsファイアウォール」を選択し、マウスの右ボタンを使用してプロパティを開きます。 ネットワークプロファイル(プライベート-ルーターを備えたローカルネットワーク、一般-インターネットに直接、ドメイン-ドメインネットワーク)に応じて、プロファイルタブが選択され、発信接続に対して「ブロック」モードが選択されます(すべてのプロファイルに同じ設定を行います)。
スクリーンショット


現時点では、プログラムをオンラインにすることはできません(既にルールが設定されているプログラムを除く)。 これは、任意のサイトでブラウザーを開くことで簡単に確認できます。ネットワークエラーが発生します。 ページをロードするには、対応するルールを作成する必要があります。 Internet Explorerを検討してください-誰もがWindowsに持っています。 [送信接続のルール]を右クリックし、[ルールの作成]をクリックします。 ウィンドウには、4種類のルールが表示されます。IEの場合、最初のルールが適切です-「プログラムの場合」。 次に、プログラムへのパスを指定する必要があります。この場合、
C:\Program Files\Internet Explorer\iexplore.exe
です。 64ビットシステムの所有者は、
Program Files (x86)
のみに別の同じルールを作成することを忘れないでください(IEもそこにインストールされます)。 ファイルを選択した後、「接続を許可する」項目を選択し、必要なネットワークプロファイルをdawsでマークします。 私たちのルールの名前を思い付くだけです。 同じ単語/記号からすべてのルールを書くことをお勧めします。そうすれば、検索がより便利になります。 作成されたルールは、一般リストに表示されます。
スクリーンショット




プログラムについては、彼らはルールを実行することを学びましたが、サービスについてはどうですか? Mozilla Maintenance Serviceを例外に追加してください。 新しいルールを作成し、「カスタム」タイプを選択します。 次に、「構成」をクリックし、「サービスに適用」を選択してリストから目的のサービスを探すか、サービスの名前を手動で入力します。 次に、プロトコルとポートを構成することを提案しますが、この場合はデフォルトのままにしておくことができます-プログラムは信頼され、Buffoonは更新プログラムを配信およびインストールするときに使用するものを知っています。 IPアドレスも同様に影響を受けません。 次に、接続を有効にし、プロファイルを選択して、ルールの名前を設定します。
スクリーンショット


主なポイントは通過したように見えますが、今はどうですか? そして今、落とし穴。 誰かがTeamViewerリモートコントロールプログラムをアクティビティで使用し、それが彼と一緒にサービスを提供する場合、リスト内でサービスを見つけてそのルールを追加するだけで十分のようです。 しかし、それは機能しません。 サービスの代わりに、「プログラム用」ルールを追加し、サービス
C:\Program Files (x86)\TeamViewer\TeamViewer_Service.exe
実行可能ファイルを選択する必要があります
C:\Program Files (x86)\TeamViewer\TeamViewer_Service.exe
(64ビットシステムのパス)。 これは一般的な状況なので、急いでサービスを追加せず、exeから始めてください。 さらに、pingはシステムで機能しなくなります。 そのためには、「カスタム」タイプのルールを追加し、デフォルトですべてを残し、ICMPv4のみのプロトコルを選択して、「エコー要求」ボックスのみをチェックする必要がある下部の「設定」をクリックする必要があります。 これで、pingとtracertが機能します。 IPv6についても繰り返しますが、ICMPv6プロトコルを使用します。 ルールがすでに作成されているが、その中の何かを変更する必要がある場合、リストで目的のルールを選択し、そのプロパティに移動することにより、これを簡単に行うことができます。 タブでは、すべての好みに合わせてすべてを構成できます-サービスを特定のexeにバインドし、プログラムをポートに制限するなど。
スクリーンショット
作成済みのpingルールのプロパティ

作成済みのpingルールのプロパティ
システムをWindows 8.1からWindows 10にアップグレードした後、OneDriveの実行可能なルールを作成できませんでした。 これは
%USERPROFILE%\AppData\Local\Microsoft\OneDrive\OneDrive.exe
単純なルールのようで、すべてが機能するはずです。 しかし、数か月を費やした後、直接パス
C:\Users\ProfileName\AppData\Local\Microsoft\OneDrive\OneDrive.exe
を書く必要があることが
C:\Users\ProfileName\AppData\Local\Microsoft\OneDrive\OneDrive.exe
した
C:\Users\ProfileName\AppData\Local\Microsoft\OneDrive\OneDrive.exe
が、同じファミリーの以前のOS最初のオプション(なぞなぞ?)
経験とPowerShell
N回にわたって蓄積されたルールのリストは、PowerShellのコマンドの形式で表示します-自動化する方が簡単です。 PowerShellで実行するスクリプトを実行できるようにするには、システム内の署名されていないスクリプトに対して許可を与える必要があります(偏執的なスクリプトについては、元に戻すことができます)。
Set-ExecutionPolicy Unrestricted Set-ExecutionPolicy Default #
ファイアウォールによるすべての発信接続のブロックは次のようになります。
Set-NetFirewallProfile -All -DefaultOutboundAction Block
explorer.exeのすべてのプロファイルとアウトバウンド方向にルールを追加するコマンドは、Windows 8.1でタイルを更新しています。 私は10-keでそれが使用されていると信じています:
New-NetFirewallRule -Program 'C:\Windows\explorer.exe' -Action Allow -Profile Any -DisplayName ' explorer.exe' -Direction Outbound
最初のセルにルールの名前が含まれ、2番目のセルにプログラムへのパスが格納されているとします。 そして、このような2セルの行がN個あります-ルールの数。 これらはすべて
$programs
保存され
$programs
。 Internet Explorer、Google Chrome、Tor Browser、Yandex.Browser、Notepad ++、Visual Studio 2015、qBittorrent、HWMonitor、OneDrive、PowerShell、PowerShell ISE、Steam、CS GO、TeamViewerなど、シンプルなアプリケーションから始めましょう。ネットワークにアクセスするために1-2個のexeファイルからアクセスする必要がある人。
$プログラムテーブルを埋める
# $env - %USERPROFILE%, %SystemRoot% .. $programs = (' Internet Explorer (x86)', (${env:ProgramFiles(x86)}+'\Internet Explorer\iexplore.exe')), (' Internet Explorer', ($env:ProgramFiles+'\Internet Explorer\iexplore.exe')), (' Google Chrome', (${env:ProgramFiles(x86)}+'\Google\Chrome\Application\chrome.exe')), (' Google Update', (${env:ProgramFiles(x86)}+'\Google\Update\GoogleUpdate.exe')), (' Tor Browser', ($env:USERPROFILE+'\AppData\Local\Tor Browser\Browser\firefox.exe')), (' Tor Browser updater', ($env:USERPROFILE+'\AppData\Local\Tor Browser\Browser\updater.exe')), (' Yandex.Browser', ($env:USERPROFILE+'\AppData\Local\Yandex\YandexBrowser\Application\browser.exe')), (' Notepad++ (GUP)', (${env:ProgramFiles(x86)}+'\Notepad++\updater\GUP.exe')), (' Visual Studio 2015', (${env:ProgramFiles(x86)}+'\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe')), (' Blend (Visual Studio)', (${env:ProgramFiles(x86)}+'\Microsoft Visual Studio 14.0\Common7\IDE\Blend.exe')), (' qBittorrent', (${env:ProgramFiles(x86)}+'\qBittorrent\qbittorrent.exe')), (' HWMonitor', ($env:ProgramFiles+'\CPUID\HWMonitor\HWMonitor.exe')), (' OneDrive', ($env:USERPROFILE+'\AppData\Local\Microsoft\OneDrive\OneDrive.exe')), (' PowerShell ( )', ($env:SystemRoot+'\System32\WindowsPowerShell\v1.0\powershell.exe')), (' PowerShell ISE ( )', ($env:SystemRoot+'\System32\WindowsPowerShell\v1.0\powershell_ise.exe')), (' Steam', (${env:ProgramFiles(x86)}+'\Steam\Steam.exe')), (' steamwebhelper', (${env:ProgramFiles(x86)}+'\Steam\bin\steamwebhelper.exe')), (' Steam CS GO', ('D:\Games\SteamLibrary\steamapps\common\Counter-Strike Global Offensive\csgo.exe')), (' TeamViewer', (${env:ProgramFiles(x86)}+'\TeamViewer\TeamViewer.exe')), (' TeamViewer_Service', (${env:ProgramFiles(x86)}+'\TeamViewer\TeamViewer_Service.exe'))
必要に応じて、unningなアバスト(まだサービスが必要)とFirefox(+サービス)をタブレットに追加することもできます。
$プログラムに追加
(' AvastUI+', ($env:ProgramFiles+'\AVAST Software\Avast\AvastUI.exe')), (' AvastSvc', ($env:ProgramFiles+'\AVAST Software\Avast\AvastSvc.exe')), (' Avast (AvastEmUpdate)', ($env:ProgramFiles+'\AVAST Software\Avast\AvastEmUpdate.exe')), (' Avast (instup)', ($env:ProgramFiles+'\AVAST Software\Avast\setup\instup.exe')), (' Mozilla Firefox', (${env:ProgramFiles(x86)}+'\Mozilla Firefox\firefox.exe'))
テーブルのすべての行は、次のように個別に処理されます。
foreach($prog in $programs) { try { New-NetFirewallRule -Program $prog[1] -Action Allow -Profile Any -DisplayName $prog[0] -Direction Outbound Write-Host ': '$prog[0] } catch { Write-Host ': '$prog[0] } Write-Host }
さらに、非標準のルールとサービスに対処する必要があります。 たとえば、更新センターは、ポート80および443上のTCPを介してsvchost.exeを介して動作します。また、アプリケーションストアは、更新のために別のWSServiceサービスを使用します。 さらに、必要なアプリケーションのpingとサービスを忘れないでください。
try { $i = ' Windows Update/Modern Apps' New-NetFirewallRule -Program ($env:SystemRoot+'\System32\svchost.exe') -Protocol TCP -RemotePort 80, 443 -Action Allow -Profile Any -DisplayName $i -Direction Outbound $i = ' Avast ()' New-NetFirewallRule -Service 'avast! Antivirus' -Action Allow -Profile Any -DisplayName $i -Direction Outbound $i = ' Mozilla Maintenance Service' New-NetFirewallRule -Service 'MozillaMaintenance' -Action Allow -Profile Any -DisplayName $i -Direction Outbound $i = ' ping (v4)' New-NetFirewallRule -Profile Any -Action Allow -DisplayName $i -Protocol ICMPv4 -IcmpType 8 -Direction Outbound $i = ' ping (v6)' New-NetFirewallRule -Profile Any -Action Allow -DisplayName $i -Protocol ICMPv6 -IcmpType 8 -Direction Outbound $i = ' Windows' New-NetFirewallRule -Service 'WSService' -Action Allow -Profile Any -DisplayName $i -Direction Outbound # , ( , ) $i = ' ()' New-NetFirewallRule -Enabled False -Action Allow -Profile Private -DisplayName $i -Direction Outbound Write-Host ' ' } catch { Write-Host ' :' $i } Write-Host
おそらくそれだけです。 この物語は終わらせることができます。 私は今、あなたの手にイニシアチブを渡します、それのために行きます! あなたが何か新しいことを学んだか、少なくとも忘れられていた古いことを思い出したことを願っています。 最終的なスクリプト(.ps1)は、以下のネタバレの下にあります。
最終スクリプト
Set-NetFirewallProfile -All -DefaultOutboundAction Block $programs = (' Internet Explorer (x86)', (${env:ProgramFiles(x86)}+'\Internet Explorer\iexplore.exe')), (' Internet Explorer', ($env:ProgramFiles+'\Internet Explorer\iexplore.exe')), (' Google Chrome', (${env:ProgramFiles(x86)}+'\Google\Chrome\Application\chrome.exe')), (' Google Update', (${env:ProgramFiles(x86)}+'\Google\Update\GoogleUpdate.exe')), (' Tor Browser', ($env:USERPROFILE+'\AppData\Local\Tor Browser\Browser\firefox.exe')), (' Tor Browser updater', ($env:USERPROFILE+'\AppData\Local\Tor Browser\Browser\updater.exe')), (' Yandex.Browser', ($env:USERPROFILE+'\AppData\Local\Yandex\YandexBrowser\Application\browser.exe')), (' Notepad++ (GUP)', (${env:ProgramFiles(x86)}+'\Notepad++\updater\GUP.exe')), (' Visual Studio 2015', (${env:ProgramFiles(x86)}+'\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe')), (' Blend (Visual Studio)', (${env:ProgramFiles(x86)}+'\Microsoft Visual Studio 14.0\Common7\IDE\Blend.exe')), (' qBittorrent', (${env:ProgramFiles(x86)}+'\qBittorrent\qbittorrent.exe')), (' HWMonitor', ($env:ProgramFiles+'\CPUID\HWMonitor\HWMonitor.exe')), (' OneDrive', ($env:USERPROFILE+'\AppData\Local\Microsoft\OneDrive\OneDrive.exe')), (' PowerShell ( )', ($env:SystemRoot+'\System32\WindowsPowerShell\v1.0\powershell.exe')), (' PowerShell ISE ( )', ($env:SystemRoot+'\System32\WindowsPowerShell\v1.0\powershell_ise.exe')), (' Steam', (${env:ProgramFiles(x86)}+'\Steam\Steam.exe')), (' steamwebhelper', (${env:ProgramFiles(x86)}+'\Steam\bin\steamwebhelper.exe')), (' Steam CS GO', ('D:\Games\SteamLibrary\steamapps\common\Counter-Strike Global Offensive\csgo.exe')), (' TeamViewer', (${env:ProgramFiles(x86)}+'\TeamViewer\TeamViewer.exe')), (' TeamViewer_Service', (${env:ProgramFiles(x86)}+'\TeamViewer\TeamViewer_Service.exe')), (' explorer.exe', ($env:SystemRoot+'\explorer.exe')), (' AvastUI+', ($env:ProgramFiles+'\AVAST Software\Avast\AvastUI.exe')), (' AvastSvc', ($env:ProgramFiles+'\AVAST Software\Avast\AvastSvc.exe')), (' Avast (AvastEmUpdate)', ($env:ProgramFiles+'\AVAST Software\Avast\AvastEmUpdate.exe')), (' Avast (instup)', ($env:ProgramFiles+'\AVAST Software\Avast\setup\instup.exe')), (' Mozilla Firefox', (${env:ProgramFiles(x86)}+'\Mozilla Firefox\firefox.exe')) foreach($prog in $programs) { try { New-NetFirewallRule -Program $prog[1] -Action Allow -Profile Any -DisplayName $prog[0] -Direction Outbound Write-Host ': '$prog[0] } catch { Write-Host ': '$prog[0] } Write-Host } try { $i = ' Windows Update/Modern Apps' New-NetFirewallRule -Program ($env:SystemRoot+'\System32\svchost.exe') -Protocol TCP -RemotePort 80, 443 -Action Allow -Profile Any -DisplayName $i -Direction Outbound $i = ' Avast ()' New-NetFirewallRule -Service 'avast! Antivirus' -Action Allow -Profile Any -DisplayName $i -Direction Outbound $i = ' Mozilla Maintenance Service' New-NetFirewallRule -Service 'MozillaMaintenance' -Action Allow -Profile Any -DisplayName $i -Direction Outbound $i = ' ping (v4)' New-NetFirewallRule -Profile Any -Action Allow -DisplayName $i -Protocol ICMPv4 -IcmpType 8 -Direction Outbound $i = ' ping (v6)' New-NetFirewallRule -Profile Any -Action Allow -DisplayName $i -Protocol ICMPv6 -IcmpType 8 -Direction Outbound $i = ' Windows' New-NetFirewallRule -Service 'WSService' -Action Allow -Profile Any -DisplayName $i -Direction Outbound # , ( , ) $i = ' ()' New-NetFirewallRule -Enabled False -Action Allow -Profile Private -DisplayName $i -Direction Outbound Write-Host ' ' } catch { Write-Host ' :' $i } Write-Host