Lock Down the DAS CMD API
Only let programs on your own computer connect to DAS, so nobody else on your network can try to log in to your account
The Trade Client places orders through the DAS Trader CMD API. Out of the box, DAS lets any computer that can reach it connect to that API. The API login is then the only thing standing between a stranger and your account.
One setting in DAS closes this: Allowed IP Mask. Set it to 127.000.000.001 and only programs on the same computer as DAS can connect. The Trade Client keeps working, because it always connects to DAS on the same computer.
Why this matters
DAS listens for CMD API connections on every network connection your computer has, on port 9800 by default. Windows Firewall also has rules for DAS that let other computers reach DAS on both Private and Public networks. So on hotel or coffee shop Wi-Fi, anyone on that network can reach your DAS API.
With Allowed IP Mask at its default of 255.255.255.255, any computer that reaches the port is greeted with:
#Welcome to DAS Command API
#Please login to continue.
From there, all they need is your API login.
Step 1: Set Allowed IP Mask
- In DAS, open the CMD API settings (the same place where the API port is set).
- Set Allowed IP Mask to exactly
127.000.000.001. - Save, then close and restart DAS.
127.000.000.001.
Use this value and nothing else. Other values can fail to save, and when they do, DAS
quietly puts the mask back to 255.255.255.255, which lets everyone connect.
Step 2: Confirm the setting stuck
After DAS restarts, open the CMD API settings again and look at Allowed IP Mask.
127.000.000.001: the setting was saved.255.255.255.255: DAS rejected the value and the API is still open to everyone. Go back to step 1 and type the value exactly as shown.
Step 3: Test it from another computer (optional)
If you have a second computer on the same network, you can check that DAS turns it away.
First, find the IP address of the computer running DAS: run ipconfig in a Command Prompt there and look for the IPv4 Address, such as 192.168.1.25.
On the second computer, open PowerShell, replace <DAS PC IP> with that address, and run:
$c = New-Object System.Net.Sockets.TcpClient
$c.Connect('<DAS PC IP>', 9800)
$s = $c.GetStream()
$s.ReadTimeout = 3000
$b = New-Object byte[] 4096
$n = $s.Read($b, 0, 4096)
[Text.Encoding]::ASCII.GetString($b, 0, $n)
$c.Close()
If you changed the API port in DAS, use your port instead of 9800. Then check the reply:
| Reply | What it means |
|---|---|
#IP not in the allow IP mask. |
Locked down. Other computers are turned away. |
#Welcome to DAS Command API |
Still open. Go back to step 1. |
You can also connect with telnet (telnet <DAS PC IP> 9800) and read the same reply.
Test-NetConnection. It reports
TcpTestSucceeded : True even when the mask is working, because DAS accepts
the connection first and only then turns it away. You have to read DAS's reply to know.
The Trade Client keeps working
The Trade Client always connects to DAS at 127.0.0.1, the computer it is running on, so this setting doesn't affect it. That is true as long as the Trade Client runs on the same computer as DAS, which is the only setup we support.
Optional: block DAS on public networks in Windows Firewall
For extra protection on public Wi-Fi, you can switch off the firewall rules that let other computers reach DAS on public networks:
- Open Windows Defender Firewall with Advanced Security (search for it from the Start menu).
- Click Inbound Rules.
- Find the rules named DASTrader Pro whose Profile column says Public.
- Right-click each one and choose Disable Rule.
This doesn't affect the Trade Client either, since it connects on the same computer.