Csf - как открыть порт только для 1IP

Материал из Wiki - Iphoster - the best ever hosting and support. 2005 - 2023
Перейти к:навигация, поиск


Пример1 - для ssh открыть 3333 порт для 178.219.xxx.xxx

# nano /etc/csf/csf.allow
tcp|in|d=3333|d=178.219.xxx.xxx
# csf -r
# csf -g 178.219.xxx.xxx
Chain            num   pkts bytes target     prot opt in     out     source               destination
ALLOWIN          1        0     0 ACCEPT     tcp  --  !lo    *       0.0.0.0/0            178.219.xxx.xxx       tcp dpt:3333

Пример2 - разрешить удаленное подключение с сервера через 3306 порт к серверу с IP: 5.45.xxx.xxx

# vi /etc/csf/csf.allow
tcp|out|d=3306|d=5.45.xxx.xxx
# csf -r
# csf -g 5.45.xxx.xxx
Chain            num   pkts bytes target     prot opt in     out     source               destination
ALLOWOUT         22     100  5890 ACCEPT     tcp  --  *      !lo     0.0.0.0/0            5.45.xxx.xxx       tcp dpt:3306


Пример3 - дать удаленный доступ к базе с IP:

csf -a "tcp|in|d=3306|s=46.211.xx.xx"
Индекс цитирования