Description
For a public Redis endpoint, start_ip and end_ip allow every address between them. Check the combined ranges of all rules against the public source addresses Azure sees for approved clients, including any NAT translation.
Potential impact
Unneeded clients may be able to try connecting. Leaked credentials or excessive permissions can then expose cached data to reads, changes or excessive use.
Remediation
If public access is needed, narrow the rules to approved sources. For private-only access on a supported tier, test the private endpoint, DNS and client routes before setting public_network_access_enabled = false. Review the Terraform plan before applying. Test approved and unapproved clients, and verify TLS, authentication and data permissions.
Examples
The AzureRM v4.50.0 excerpts require the resource group and random_id.server. Both keep the non-TLS port disabled with non_ssl_port_enabled = false.
Before
resource "azurerm_redis_cache" "example" {
name = "redis${random_id.server.hex}"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
capacity = 1
family = "P"
sku_name = "Premium"
non_ssl_port_enabled = false
}
resource "azurerm_redis_firewall_rule" "public_rule" {
name = "someIPrange"
redis_cache_name = azurerm_redis_cache.example.name
resource_group_name = azurerm_resource_group.example.name
start_ip = "1.2.3.4"
end_ip = "2.3.4.5"
}
After
resource "azurerm_redis_cache" "example" {
name = "redis${random_id.server.hex}"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
capacity = 1
family = "P"
sku_name = "Premium"
non_ssl_port_enabled = false
}
resource "azurerm_redis_firewall_rule" "public_rule" {
name = "someIPrange"
redis_cache_name = azurerm_redis_cache.example.name
resource_group_name = azurerm_resource_group.example.name
start_ip = "203.0.113.10"
end_ip = "203.0.113.10"
}
Explanation:
- Before: The rule permits
1.2.3.4through2.3.4.5on the Premium cache. - After: The same
public_rulenow allows one address. Replace203.0.113.10with the approved client’s actual public source. This change does not create a private endpoint.