$portvalue = 3390
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -name "PortNumber" -Value $portvalue
New-NetFirewallRule -DisplayName 'RDPPORTLatest-TCP-In' -Profile 'Public' -Direction Inbound -Action Allow -Protocol TCP -LocalPort $portvalue
New-NetFirewallRule -DisplayName 'RDPPORTLatest-UDP-In' -Profile 'Public' -Direction Inbound -Action Allow -Protocol UDP -LocalPort $portvalue
파워쉘 스크립트로, 실행 후 윈도우 재시작시 설정된다.
파워쉘 실행시 UnauthorizedAccess 에러가 발생한다면 Set-ExecutionPolicy Unrestricted를 통해 Policy를 변경 하거나 start powershell -executionpolicy bypass -file .\script.ps1 와 같이 스크립트를 실행해야 한다.
wail2ban은 실시간 audit을 통해 IP ban을 자동화해주는 스크립트이다.
깃헙의 installation을 참고하여 설치하자.
기본 설정을 피하도록 공격하는 경우가 많아 wail2ban.ps1의 constant 부분을 적절히 잘 변경하여 주자.
# Constants
$CHECK_WINDOW = 300 # We check the most recent X seconds of log. Default: 120
$CHECK_COUNT = 5 # Ban after this many failures in search period. Default: 5
$MAX_BANDURATION = 7776000 # 3 Months in seconds
대다수의 brute-force attack은 administrator 계정으로 이루어진다.
net user Administrator /active:no를 통해 비활성화해두었지만... 아예 계정 이름을 변경해두는 것도 괜찮을 것이다.
를 통해 변경하도록 한다.
3rd-party software(Rohos)를 통해 2FA 설정.
원격 시스템 규모가 있다면 인증서 기반 VPN을 구축하거나 라우터 단에서도 보안 설정.
뭐니뭐니해도 복잡한 패스워드 사용....