Bylaw

Gallery › Network › Azure built-in policies

Network interfaces should disable IP forwarding

Converted Policy Deny Mode Indexed Version 1.0.0

This policy denies the network interfaces which enabled IP forwarding. The setting of IP forwarding disables Azure's check of the source and destination for a network interface. This should be reviewed by the network security team.

ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.

Azure Policy JSONNetworkIPForwardingNic_Deny.json · 36 lines
{
  "properties": {
    "displayName": "Network interfaces should disable IP forwarding",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "description": "This policy denies the network interfaces which enabled IP forwarding. The setting of IP forwarding disables Azure's check of the source and destination for a network interface. This should be reviewed by the network security team.",
    "metadata": {
      "version": "1.0.0",
      "category": "Network"
    },
    "version": "1.0.0",
    "parameters": {},
    "policyRule": {
      "if": {
        "allOf": [
          {
            "field": "type",
            "equals": "Microsoft.Network/networkInterfaces"
          },
          {
            "field": "Microsoft.Network/networkInterfaces/enableIpForwarding",
            "equals": "true"
          }
        ]
      },
      "then": {
        "effect": "deny"
      }
    },
    "versions": [
      "1.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/88c0b9da-ce96-4b03-9635-f29a937e2900",
  "name": "88c0b9da-ce96-4b03-9635-f29a937e2900"
}
Bylaw88c0b9da-ce96-4b03-9635-f29a937e2900.bylaw.ps1 · 21 lines
# Converted from NetworkIPForwardingNic_Deny.json by ConvertTo-Bylaw.
Policy '88c0b9da-ce96-4b03-9635-f29a937e2900' {

    Properties @{
        DisplayName   = 'Network interfaces should disable IP forwarding'
        Description   = 'This policy denies the network interfaces which enabled IP forwarding. The setting of IP forwarding disables Azure''s check of the source and destination for a network interface. This should be reviewed by the network security team.'
        Version       = '1.0.0'
        Category      = 'Network'
        PolicyVersion = '1.0.0'
        Mode          = 'Indexed'
    }

    Resource 'Microsoft.Network/networkInterfaces' {

        Require 'enableIPForwarding is not true' {
            Field enableIPForwarding | Must -Not -Be 'true' -IfPresent
        }
    }

    Effect Deny
}

Source: built-in-policies/policyDefinitions/Network/NetworkIPForwardingNic_Deny.json in Azure/azure-policy, under the MIT licence.