Hướng dẫn cài đặt ConfigServer Security & Firewall (CSF)

ConfigServer Security & Firewall (CSF). Ứng dụng bảo mật và phát hiện đăng nhập / xâm nhập và bảo mật tường lửa Stateful Packet (SPI) dành cho máy chủ Linux.

1. Hướng dẫn cài đặt

cd /usr/src
rm -fv csf.tgz
wget https://download.configserver.com/csf.tgz
tar -xzf csf.tgz
cd csf
sh install.sh

2. Sau khi cài đặt các bạn chỉnh sửa lại file cấu hình csf.conf thay đổi giá trị TESTING = "1" Thành TESTING = "0"

vi /etc/csf/csf.conf

3. Restart lại service CSF

csf -r

4. Lưu ý nếu không thực hiện được lệnh csf -r các bạn cài thêm gói perl vào server nhé

yum install perl -y

5. Các option csf thường dùng

-s,  --start
       Start the firewall rules
-f,  --stop
       Flush/Stop firewall rules (Note: lfd may restart csf)
-r,  --restart
       Restart firewall rules (csf)
-q,  --startq
       Quick restart (csf restarted by lfd)
-sf, --startf
       Force CLI restart regardless of LFDSTART setting
-ra, --restartall
       Restart firewall rules (csf) and then restart lfd daemon. Both csf and then lfd should be restarted  after  making  any
changes to the configuration files
--lfd [stop|start|restart|status]
       Actions to take with the lfd daemon
-a,  --add ip [comment]
       Allow an IP and add to /etc/csf/csf.allow
-ar, --addrm ip
       Remove an IP from /etc/csf/csf.allow and delete rule
-d,  --deny ip [comment]
       Deny an IP and add to /etc/csf/csf.deny
-dr, --denyrm ip
       Unblock an IP and remove from /etc/csf/csf.deny
-c,  --check
       Check for updates to csf but do not upgrade
-u,  --update
       Check for updates to csf and upgrade if available
-uf    Force an update of csf whether and upgrade is required or not
-x,  --disable
       Disable csf and lfd completely
-e,  --enable
       Enable csf and lfd if previously disabled
-v,  --version
       Show csf version

Có thể yêu cầu các mẫu regex tùy chỉnh cho một số chức năng trên các hệ diều hành sau:

RedHat Enterprise v7 to v8
CentOS v7 to v8
CloudLinux v7 to v8
Fedora v30
*openSUSE v10, v11, v12
*Debian v8 - v10
*Ubuntu v18 to v20
*Slackware v12

Allow outgoing TCP ports all port csf firewall

Các bạn mở file /etc/csf/csf.conf và khai báo

TCP_OUT ="1:65535"
UDP_OUT ="1:65535"

sau đó restart lại csf nhé

csf -r

Chúc các bạn thành công.

Bình luận