DEV Community

Fernando Chagas for Nuvits

Posted on Originally published at nuvits.net

First steps on a Windows Server VPS: secure RDP and firewall

As soon as a Windows Server (2022 or 2025) VPS comes online with a public IPv4 address and port 3389 reachable, automated scanners start trying passwords against Administrator within minutes. What you do in the first 15 minutes determines whether the server stays predictable or locks you out in the middle of the workday.

This guide covers the baseline hardening steps right after your first Remote Desktop (RDP) login: rotating the initial password, verifying Network Level Authentication (NLA), configuring account lockout safely, applying updates and closing port 3389 to the public internet.

Be careful before editing firewall rules or changing the RDP port. On Nuvits Windows plans, you connect over Remote Desktop on port 3389 as Administrator, and there is no self-service rescue mode or OS reinstall in the panel. A bad firewall rule that cuts off your own session requires a support ticket to recover. Always verify the new access path in a second window before closing the old one.

1. First RDP login and immediate password rotation

On Nuvits Windows VPS plans, you do not provide an SSH key when ordering. Once provisioning finishes (RDP usually starts answering about two minutes after first boot), the panel displays the public IPv4 address, the Administrator user and shows the generated initial password once after identity confirmation.

Connect using Remote Desktop Connection on Windows (Win + R → mstsc), Windows App on macOS/iOS/Android or Remmina on Linux:

mstsc /v:203.0.113.10
Enter fullscreen mode Exit fullscreen mode

Replace 203.0.113.10 with your VPS IPv4 address. Accept the initial server certificate, open PowerShell as Administrator and replace the initial password with a unique passphrase stored in your password manager:

$password = Read-Host -AsSecureString "New strong password"
Set-LocalUser -Name "Administrator" -Password $password
Enter fullscreen mode Exit fullscreen mode

Use at least 16 characters mixing letters, digits and symbols, and never reuse your control panel password.

2. Create a dedicated admin account before locking anything down

Logging in daily as Administrator makes brute-force scripts easier to aim, since the username is already known. Create a second local administrator with a non-obvious name and test it before touching the default account:

$adminPassword = Read-Host -AsSecureString "Password for new admin"
New-LocalUser -Name "ops_marina" -Password $adminPassword -FullName "Operations Admin" -PasswordNeverExpires:$false
Add-LocalGroupMember -Group "Administrators" -Member "ops_marina"
Enter fullscreen mode Exit fullscreen mode

Open a second RDP window without closing your current session and sign in as ops_marina. Only after confirming that the new user signs in and can open an elevated PowerShell prompt should you restrict or disable direct sign-ins to Administrator.

3. Verify Network Level Authentication (NLA)

Network Level Authentication (NLA) forces the client to authenticate through CredSSP before Windows Server allocates a full desktop session. Without NLA, unauthenticated connections consume RAM and CPU on the logon screen.

Check the current RDP registry settings in PowerShell against the official Microsoft Remote Desktop Services documentation:

Get-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server' -Name "fDenyTSConnections"
Get-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -Name "UserAuthentication","SecurityLayer","PortNumber"
Enter fullscreen mode Exit fullscreen mode

Healthy defaults look like this:

Registry value Expected value Meaning
fDenyTSConnections 0 RDP connections allowed
UserAuthentication 1 NLA enforced before starting a session
SecurityLayer 1 or 2 1 negotiates TLS/RDP; 2 requires SSL/TLS
PortNumber 3389 Standard RDP TCP/UDP port

If UserAuthentication is 0, enable it with:

Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -Name "UserAuthentication" -Value 1
Enter fullscreen mode Exit fullscreen mode

4. Restrict port 3389 at the firewall

Leaving TCP/UDP 3389 open to 0.0.0.0/0 is the most common source of noisy Event ID 4625 logs, wasted CPU and unexpected account lockouts on Windows VPS hosts. Two clean approaches close that surface:

Recommended: route RDP over a private VPN (Tailscale or WireGuard)

Installing Tailscale or WireGuard on the VPS and your team's devices lets everyone reach Remote Desktop over the private VPN IP (such as 100.x.y.z on Tailscale) while blocking public 3389 traffic completely.

Follow this order so you do not lock yourself out:

  1. Install and sign in to the VPN on both the VPS and your workstation.
  2. Open a fresh RDP session to the VPN private IP and confirm it works.
  3. Only then restrict the Windows Firewall rules to the VPN subnet (or remove public 3389 access in the Nuvits panel's network firewall while keeping the VPN connected).

Fixed-IP alternative: allowlist your office IPv4

If your team connects from a static office IPv4 address, restrict the built-in Windows Firewall rules (RemoteDesktop-UserMode-In-TCP and RemoteDesktop-UserMode-In-UDP) to that address or CIDR range:

# Inspect the built-in Remote Desktop rules first
Get-NetFirewallRule -Name "RemoteDesktop-UserMode-In-*" | Format-Table Name,Enabled,Direction,Action

# Restrict TCP and UDP 3389 to your static IPv4 (documentation example)
Set-NetFirewallRule -Name "RemoteDesktop-UserMode-In-TCP" -RemoteAddress "198.51.100.25"
Set-NetFirewallRule -Name "RemoteDesktop-UserMode-In-UDP" -RemoteAddress "198.51.100.25"
Enter fullscreen mode Exit fullscreen mode

You can layer this with the edge firewall in the Nuvits panel (Rede e firewall), which includes a port 3389 preset for Windows VPS instances and drops unauthorized traffic before it reaches the OS.

Changing port 3389 is not real security. Moving PortNumber to a high port like 49389 cuts down casual bot noise in your logs, but it does not replace a VPN, IP allowlisting or strong passwords. If you still decide to change the port, create the new rule in Windows Firewall (New-NetFirewallRule) and in the Nuvits edge firewall first, restart TermService and confirm the new port connects before closing 3389.

5. Understand Account Lockout on modern Windows Server

Since Microsoft's October 2022 security update (KB5020282) and natively in Windows Server 2022 and 2025, the Allow administrator account lockout policy (AllowAdministratorLockout) removes the built-in Administrator account's old immunity to network brute-force lockouts.

Check your current policy with:

net accounts
Enter fullscreen mode Exit fullscreen mode

If a lockout threshold is active while port 3389 is still open to the internet, bots guessing wrong passwords can lock out your own Administrator account over RDP until the lockout duration expires. Always follow this order:

  1. Restrict the network perimeter first (VPN or static IP allowlist).
  2. Then configure a sensible lockout threshold, such as 10 failed attempts for 15 minutes, through secpol.msc or PowerShell:
net accounts /lockoutthreshold:10 /lockoutduration:15 /lockoutwindow:15
Enter fullscreen mode Exit fullscreen mode

6. Run Windows Update and check failed logon logs

Run Windows Update right away via Settings → Windows Update (or sconfig, option 6) so the server has the latest CredSSP, TLS and RDP security patches before you install business software.

To see whether external bots are hammering your RDP port, query the latest 4625 (failed logon) events in the Security log:

Get-WinEvent -FilterHashtable @{ LogName = 'Security'; Id = 4625 } -MaxEvents 15 |
  Select-Object TimeCreated, @{Name='Account';Expression={$_.Properties[5].Value}}, @{Name='SourceIP';Expression={$_.Properties[19].Value}} |
  Format-Table -AutoSize
Enter fullscreen mode Exit fullscreen mode

A steady stream of unfamiliar IPs confirms that 3389 is still publicly exposed and needs a firewall or VPN restriction.

7. Quick checklist before installing ERP or SQL Server

Confirm four last items before deploying production apps:

  • Time zone: set the server clock to match your operations (tzutil /l lists available IDs; tzutil /s "<ZoneId>" applies one) so scheduled tasks, certificates and logs stay aligned.
  • License status: run slmgr /xpr to confirm Windows Server is activated (Nuvits Windows plans include the license with no 180-day trial).
  • Off-server backups: current VPS plans do not include automated backups, so configure daily database dumps and file copies to external storage from day one.
  • Concurrent RDP sessions: Windows Server includes two simultaneous administrative sessions by default; more concurrent desktop users require the Remote Desktop Services role and matching RDS CALs.

Next steps


Originally published at https://nuvits.net/en/blog/first-steps-windows-server-vps-rdp-firewall

Top comments (0)