/ip firewall filter add chain=input src-address=$remote-address dst-address=$rdpTarget dst-port=3389 protocol=tcp action=accept comment="$comment" :log info "Opened RDP for $user from $remote-address"
Solution using PPP Profile Script:
/ppp profile set [find name="dynamic-clients"] \ on-up=":log info \"User \$user connected from \$caller-id on \$interface\"" \ on-down=":log info \"User \$user disconnected\"" mikrotik ppp profile script
:if ([:len $user] > 0 && $user ~ "^[a-zA-Z0-9_-]+$") do= ...
MikroTik PPP profile scripts are powerful tools in RouterOS that allow administrators to automate tasks the moment a user connects or disconnects. These scripts are commonly used for dynamic firewall rules, customized bandwidth shaping, and real-time notifications via email or Telegram. Understanding PPP Profile Scripts Understanding PPP Profile Scripts When the script runs,
When the script runs, MikroTik injects several global variables automatically:
Then watch logs: /log print follow where topics~"script" customized bandwidth shaping
/ip firewall filter add chain=forward src-address=$remote-address layer7-protocol=btprotocol action=drop comment="block-bt-$user"