Network Security Group
The presented resiliency recommendations in this guidance include Network Security Group and associated resources and settings.
Summary of Recommendations
Recommendation | Category | Impact | State | ARG Query Available |
---|---|---|---|---|
NSG-1 - Configure Diagnostic Settings for all network security groups | Monitoring | Medium | Preview | No |
NSG-2 - Monitor changes in Network Security Groups with Azure Monitor | Monitoring | Low | Preview | Yes |
NSG-3 - Configure locks for Network Security Groups to avoid accidental changes and/or deletion | Governance | Low | Preview | No |
NSG-4 - Configure NSG Flow Logs | Monitoring | Medium | Preview | Yes |
NSG-5 - The NSG only has Default Security Rules, make sure to configure the necessary rules | Access & Security | Medium | Preview | Yes |
Recommendations Details
NSG-1 - すべてのネットワーク セキュリティ グループの診断設定を構成します
Category: Monitoring
Impact: Medium
Guidance
リソース ログは、診断設定を作成して 1 つ以上の場所にルーティングするまで収集および保存されません。
Resources
Resource Graph Query
// under-development
NSG-2 - Azure Monitor を使用してネットワーク セキュリティ グループの変更を監視します
Category: Monitoring
Impact: Low
Guidance
Azure Monitor を使用したネットワーク セキュリティ グループ規則の作成または更新などの管理操作のアラートを作成する 運用リソースに対する承認されていない/望ましくない変更を検出するために、このアラートは、ファイアウォールのバイパスや外部からのリソースへのアクセスの試みなど、既定のセキュリティの望ましくない変更を特定するのに役立ちます。
Resources
Resource Graph Query
// Azure Resource Graph Query
// Find all Network Security Groups without alerts for modification configured.
resources
| where type =~ "Microsoft.Network/networkSecurityGroups"
| project name, id, tags, lowerCaseNsgId = tolower(id)
| join kind = leftouter (
resources
| where type =~ "Microsoft.Insights/activityLogAlerts" and properties.enabled == true
| mv-expand scope = properties.scopes
| where scope has "Microsoft.Network/networkSecurityGroups"
| project alertName = name, conditionJson = dynamic_to_json(properties.condition.allOf), scope
| where conditionJson has '"Administrative"' and (
// Create or Update Network Security Group
(conditionJson has '"Microsoft.Network/networkSecurityGroups/write"') or
// All administrative operations
(conditionJson !has '"Microsoft.Network/networkSecurityGroups/write"' and conditionJson !has '"Microsoft.Network/networkSecurityGroups/delete"' and conditionJson !has '"Microsoft.Network/networkSecurityGroups/join/action"')
)
| project lowerCaseNsgIdOfScope = tolower(scope)
)
on $left.lowerCaseNsgId == $right.lowerCaseNsgIdOfScope
| where isempty(lowerCaseNsgIdOfScope)
| project recommendationId = "nsg-2", name, id, tags, param1 = "ModificationAlert: Not configured/Disabled"
NSG-3 - 不注意による変更や削除を回避するためにネットワーク セキュリティ グループのロックを構成します
Category: Governance
Impact: Low
Guidance
管理者は、Azure サブスクリプション、リソース グループ、またはリソースをロックして、ユーザーが誤って削除したり変更したりしないように保護できます。ロックは、すべてのユーザー権限よりも優先されます。 削除または変更を禁止するロックを設定できます。ポータルでは、これらのロックは 削除 と 読み取り専用 と呼ばれます。
Resources
Resource Graph Query
// under-development
NSG-4 - NSG フロー ログを構成します
Category: Monitoring
Impact: Medium
Guidance
自社のネットワークを監視、管理、把握し、保護および最適化できるようにすることが重要です。ネットワークの現在の状態、誰が接続しているか、ユーザーがどこから接続しているかを知る必要があります。また、どのポートがインターネットに開かれているか、どのようなネットワーク動作が予想されるか、どのネットワーク動作が不規則であるか、トラフィックの急激な増加がいつ発生するかを知る必要があります。
フローログは、クラウド環境におけるすべてのネットワークアクティビティの信頼できる情報源です。リソースを最適化しようとしているスタートアップ企業でも、侵入を検知しようとしている大企業でも、フローログが役立ちます。これらは、ネットワークフローの最適化、スループットの監視、コンプライアンスの検証、侵入の検出などに使用できます。
Resources
Resource Graph Query
// Azure Resource Graph Query
// Find all Network Security Groups without NSG Flow logs configured or disabled.
resources
| where type =~ "Microsoft.Network/networkSecurityGroups"
| project name, id, tags, lowerCaseNsgId = tolower(id)
| join kind = leftouter (
resources
| where type == "microsoft.network/networkwatchers/flowlogs" and properties.enabled == true
| project flowLogName = name, lowerCaseTargetNsgId = tolower(properties.targetResourceId)
)
on $left.lowerCaseNsgId == $right.lowerCaseTargetNsgId
| where isempty(lowerCaseTargetNsgId)
| project recommendationId = "nsg-4", name, id, tags, param1 = "NSGFlowLog: Not configured/Disabled"
NSG-5 - NSG には既定のセキュリティ規則のみがあり、必要な規則を構成してください
Category: Access & Security
Impact: Medium
Guidance
Azure ネットワーク セキュリティ グループを使用して、Azure 仮想ネットワーク内の Azure リソース間のネットワーク トラフィックをフィルター処理できます。ネットワーク セキュリティ グループには、複数の種類の Azure リソースへの受信ネットワーク トラフィック、または送信ネットワーク トラフィックを許可または拒否するセキュリティ規則が含まれています。ルールごとに、送信元と宛先、ポート、およびプロトコルを指定できます。
Resources
Resource Graph Query
// Azure Resource Graph Query
// This query will return all NSGs that have NO security rules
resources
| where type =~ "microsoft.network/networksecuritygroups"
| extend sr = string_size(properties.securityRules)
| where sr <=2 or isnull(properties.securityRules)
| project recommendationId = "nsg-5", name, id