Change API port

Started by xenios, October 13, 2026, 12:24:45 PM

Previous topic - Next topic

xenios

Hello,
is it possible to change API port, since default port is used to hack server?

overseer

Editing /usr/local/cwpsrv/conf/cwpsrv.conf allows you to change the admin port, but I've never changed the API port.
You can use /etc/csf/csf.redirect to setup port redirection:
# DNAT (redirect from one IP address to a different one):
# IPx|*|IPy|*|tcp/udp          - To IPx redirects to IPy
# IPx|portA|IPy|portB|tcp/udp  - To IPx to portA redirects to IPy portB
#
# DNAT examples:
# 192.168.254.62|*|10.0.0.1|*|tcp
# 192.168.254.62|666|10.0.0.1|25|tcp
#
# REDIRECT (redirect from port to a different one):
# IPx|portA|*|portB|tcp/udp    - To IPx to portA redirects to portB
# *|portA|*|portB|tcp/udp      - To portA redirects to portB
#
# REDIRECT examples:
# 192.168.254.60|666|*|25|tcp
# *|666|*|25|tcp[code]

Starburst

Don't forget to chattr +i the file so a future update doesn't overwrite it.

xenios

But port redirection will also work for potential hackers too

Quote from: overseer on October 13, 2026, 02:25:36 PM
Editing /usr/local/cwpsrv/conf/cwpsrv.conf allows you to change the admin port, but I've never changed the API port.
You can use /etc/csf/csf.redirect to setup port redirection:
# DNAT (redirect from one IP address to a different one):
# IPx|*|IPy|*|tcp/udp          - To IPx redirects to IPy
# IPx|portA|IPy|portB|tcp/udp  - To IPx to portA redirects to IPy portB
#
# DNAT examples:
# 192.168.254.62|*|10.0.0.1|*|tcp
# 192.168.254.62|666|10.0.0.1|25|tcp
#
# REDIRECT (redirect from port to a different one):
# IPx|portA|*|portB|tcp/udp    - To IPx to portA redirects to portB
# *|portA|*|portB|tcp/udp      - To portA redirects to portB
#
# REDIRECT examples:
# 192.168.254.60|666|*|25|tcp
# *|666|*|25|tcp[code]


Starburst

Best plan is to leave it alone, and control access to that port via CSF and edge firewalls.

overseer

Set up a gsocket so you have access from anywhere, even behind a firewall!