Debian 11 Üzerine ConfigServer Security Firewall Nasıl Kurulur?

Genelde cPanel, Directpanel gibi sunucu yönetim araçları içerisinde yer alan firewall yönetimi için kullanılan bir eklentidir, iptables yönetimini basitleştirip işlevselleştirmesi ve yönetim arayüzü olmasıyla bilinir, ayrıca pek çok kendine has özelliği de bulunur. (Blacklist kontrolü ve özel listeler vs)

Unutmayın, yapacağınız yanlış bir yapılandırma sunucunuza erişimi kalıcı olarak kesecektir. Atacağınız adımları dikkatlice atınız.

Bağımlılıkların kurulması

apt-get install e2fsprogs dnsutils libwww-perl libio-socket-ssl-perl libcrypt-ssleay-perl libnet-libidn-perl libio-socket-inet6-perl libsocket6-perl

ConfigServer dosyalarının indirilmesi ve kurulması

cd /opt/
wget http://download.configserver.com/csf.tgz
tar xzf csf.tgz
cd /opt/csf
sh install.sh

Her şey doğru bir şekilde çalıştığına emin olabilmemizi sağlayan perl /usr/local/csf/bin/csftest.pl test betiğini çalıştırıyoruz. Çıktısı aşağıdaki gibi olmalı

Testing ip_tables/iptable_filter...OK
Testing ipt_LOG...OK
Testing ipt_multiport/xt_multiport...OK
Testing ipt_REJECT...OK
Testing ipt_state/xt_state...OK
Testing ipt_limit/xt_limit...OK
Testing ipt_recent...OK
Testing xt_connlimit...OK
Testing ipt_owner/xt_owner...OK
Testing iptable_nat/ipt_REDIRECT...OK
Testing iptable_nat/ipt_DNAT...OK

RESULT: csf should function on this server

Yapılandırma dosyası içerisindeki bütün alarmların kapatılmasını şiddetle öneriyorum, yoksa durup dururken yaptığı her engelleme işleminde mail atacaktır.

sed -i 's/LF_EMAIL_ALERT = "1"/LF_EMAIL_ALERT = "0"/g' /etc/csf/csf.conf
sed -i 's/LF_PERMBLOCK_ALERT = "1"/LF_PERMBLOCK_ALERT = "0"/g' /etc/csf/csf.conf
sed -i 's/LF_NETBLOCK_ALERT = "1"/LF_NETBLOCK_ALERT = "0"/g' /etc/csf/csf.conf
sed -i 's/LF_DISTFTP_ALERT = "1"/LF_DISTFTP_ALERT = "0"/g' /etc/csf/csf.conf
sed -i 's/LF_DISTSMTP_ALERT = "1"/LF_DISTSMTP_ALERT = "0"/g' /etc/csf/csf.conf
sed -i 's/LT_EMAIL_ALERT = "1"/LT_EMAIL_ALERT = "0"/g' /etc/csf/csf.conf
sed -i 's/CT_EMAIL_ALERT = "1"/CT_EMAIL_ALERT = "0"/g' /etc/csf/csf.conf

Değişikliklerin geçerli olması amacıyla yeniden başlatma işlemini yapalım

systemctl restart csf
systemctl restart lfd

Web Arayüzünün Aktif Edilmesi

Yönetim arayüzü ön tanımlı olarak kapalı gelmektedir, aktif etmek amacıyla aşağıdaki işlemleri gerçekleştirin.

nano /etc/csf/csf.conf

dosyasının içerisinde 1995. satırın hemen altında yer alan aşağıdaki ayarları kendinize göre değiştiriniz.

###############################################################################
# SECTION:Integrated User Interface
###############################################################################
# Integrated User Interface. This feature provides a HTML UI to csf and lfd,
# without requiring a control panel or web server. The UI runs as a sub process
# to the lfd daemon
#
# As it runs under the root account and successful login provides root access
# to the server, great care should be taken when configuring and using this
# feature. There are additional restrictions to enhance secure access to the UI
#
# See readme.txt for more information about using this feature BEFORE enabling
# it for security and access reasons
# 
# 1 to enable, 0 to disable
UI = "1"

# Set this to the port that want to bind this service to. You should configure
# this port to be >1023 and different from any other port already being used
#
# Do NOT enable access to this port in TCP_IN, instead only allow trusted IP's
# to the port using Advanced Allow Filters (see readme.txt)
UI_PORT = "7156"

# Optionally set the IP address to bind to. Normally this should be left blank
# to bind to all IP addresses on the server.
#
# If the server is configured for IPv6 but the IP to bind to is IPv4, then the
# IP address MUST use the IPv6 representation. For example 1.2.3.4 must use
# ::ffff:1.2.3.4
#
# Leave blank to bind to all IP addresses on the server
UI_IP = "::ffff:94.130.96.165"

# This should be a secure, hard to guess username
# 
# This must be changed from the default
UI_USER = "mertcan"

# This should be a secure, hard to guess password. That is, at least 8
# characters long with a mixture of upper and lowercase characters plus 
# numbers and non-alphanumeric characters
#
# This must be changed from the default
UI_PASS = "Str0n9_PasSw0rD"

Ardından giriş yapabilmek için IP adresinizi sisteme kayıt edin.

sudo echo "" >> /etc/csf/ui/ui.allow

sudo systemctl restart lfd komutu ile yeniden başlatıp web arayüzüne giriş yapabilirsiniz.

ConfigServerPin

Sistem Uzmanı, Linux Hacısı, El-Kernel

Yorum yapın