설명
Azure NSG에서 인바운드 TCP 22를 허용할 때 sourceAddressPrefix에 SSH를 사용하는 관리자 IP나 서브넷을 지정하세요.
잠재적 영향
출발지 *는 주소를 제한하지 않습니다. 외부에서 VM까지 경로가 있으면 불필요한 SSH 로그인 시도를 받을 수 있습니다.
해결 방법
직접 SSH가 필요하지 않다면 Azure Bastion 같은 관리 경로로 제한하세요. NIC와 서브넷의 유효 규칙과 우선순위를 확인하고 승인된 경로에서만 새 SSH 연결이 성공하는지 시험하세요.
예시
두 번째 예시는 같은 우선순위 301의 허용 규칙에서 출발지만 203.0.113.10/32로 바꿉니다. 문서용 주소이므로 실제 관리 주소를 지정하세요.
변경 전
bicep
resource security_group 'Microsoft.Network/networkSecurityGroups@2020-11-01' = {
name: 'security-group'
location: resourceGroup().location
properties: {
securityRules: [
{
properties: {
protocol: 'Tcp'
sourcePortRange: '*'
destinationPortRange: '22'
sourceAddressPrefix: '*'
destinationAddressPrefix: '*'
access: 'Allow'
priority: 301
direction: 'Inbound'
}
name: 'security-rule'
}
]
}
}
변경 후
bicep
resource security_group 'Microsoft.Network/networkSecurityGroups@2020-11-01' = {
name: 'security-group'
location: resourceGroup().location
properties: {
securityRules: [
{
properties: {
protocol: 'Tcp'
sourcePortRange: '*'
destinationPortRange: '22'
sourceAddressPrefix: '203.0.113.10/32'
destinationAddressPrefix: '*'
access: 'Allow'
priority: 301
direction: 'Inbound'
}
name: 'security-rule'
}
]
}
}