Description
On Azure Database for MySQL Flexible Server, require_secure_transport controls whether clients must use encrypted connections.
Potential impact
Plaintext can expose credentials, queries and results on a private or public network.
Remediation
Set require_secure_transport to ON. Configure applications and administrative tools to use TLS and verify the server certificate. Test a normal application connection and check that a new plaintext connection fails. Restrict network access and database permissions separately.
Examples
The first excerpt disables TLS enforcement on retired Single Server. The second changes a parameter on an existing Flexible Server. Plan server and data migration separately.
Before
hcl
resource "azurerm_mysql_server" "example" {
name = "webflux-mysql-${var.environment}${random_integer.rnd_int.result}"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
administrator_login = "webflux-${var.environment}"
administrator_login_password = random_string.password.result
sku_name = "B_Gen5_2"
storage_mb = 5120
version = "5.7"
auto_grow_enabled = true
backup_retention_days = 7
infrastructure_encryption_enabled = true
public_network_access_enabled = true
ssl_enforcement_enabled = false
}
After
hcl
resource "azurerm_mysql_flexible_server_configuration" "example" {
name = "require_secure_transport"
resource_group_name = azurerm_resource_group.example.name
server_name = azurerm_mysql_flexible_server.example.name
value = "ON"
}