RDPアクセス範囲が広いAzure NSG

Azure NSGのRDPアクセスを承認済みの管理経路に限定し、VMの実際の接続・認証設定も確認してください。

説明

Azure NSG の受信 TCP 3389 は、承認済みの管理者アドレスか、VPN、Azure Bastion など実際の RDP 管理経路に限定します。

想定される影響

すべての送信元を許可し、VM までの経路があると、不要なサインイン試行が増える場合があります。ホストのファイアウォール、認証、セキュリティ更新も確認してください。

対処方法

先に別の管理経路を確保します。NIC とサブネットで有効な IPv4・IPv6 ルールを確認し、必要な送信元に限った許可には一括拒否より小さい優先順位番号を付けます。許可する経路と拒否する経路から新規接続を試し、VM のログを確認してください。

例

例で変えるのは同じ NSG のルールです。NIC またはサブネットへの関連付け、VM のアドレス、ルーティングは別途確認します。

変更前

bicep
resource security_group 'Microsoft.Network/networkSecurityGroups@2020-11-01' = {
  name: 'rdp-security-group'
  location: resourceGroup().location
  tags: {}
  properties: {
    securityRules: [
      {
        properties: {
          description: 'access to RDP'
          protocol: 'Tcp'
          sourcePortRange: '*'
          destinationPortRange: '3389'
          sourceAddressPrefix: '*'
          destinationAddressPrefix: '*'
          access: 'Allow'
          priority: 301
          direction: 'Inbound'
        }
        name: 'rdp-rule'
      }
    ]
  }
}

優先順位 301 の Allow は、先に他のルールと一致しなければ全送信元からの RDP を許可します。

変更後

bicep
resource security_group 'Microsoft.Network/networkSecurityGroups@2020-11-01' = {
  name: 'rdp-security-group'
  location: resourceGroup().location
  tags: {}
  properties: {
    securityRules: [
      {
        properties: {
          description: 'access to RDP'
          protocol: 'Tcp'
          sourcePortRange: '*'
          destinationPortRange: '3389'
          sourceAddressPrefix: '*'
          destinationAddressPrefix: '*'
          access: 'Deny'
          priority: 301
          direction: 'Inbound'
        }
        name: 'rdp-rule'
      }
    ]
  }
}

同じルールを Deny に変えると、より優先順位の高い許可に一致しない RDP の新規接続は拒否されます。

参考資料