Cara install CSF

Terus terang sebelumnya saya punya opini bahwa CSF (ConfigServer Security & Firewall) ini hanyalah paket aplikasi tambahan untuk firewall di Linux. Saya anggap berbeda dengan iptables. Ternyata ini salah besar. Ya memang tepat peribahasa tak kenal maka tak sayang. 😛

Jadi CSF ini sebenarnya merupakan alat pembantu untuk setting firewall dan mesin yang dipakai pun tetaplah iptables dibaliknya. Asli saya kira dulu perlu uninstall iptables untuk memakainya dan ini yang membuat enggan mencobanya. Main – main dengan firewall itu bisa membuat servernya terblokir. Nah… kalau iptables bisa dikatakan firewall yang bodoh, maksudnya apa perintahnya ya itu saja yang dilakukan, maka dengan CSF katanya akan dilengkapi dengan analisa trafik, sudah diikutkan peraturan default untuk protokol dan aplikasi populer juga optimasi lainnya.

Tampaknya script instalasi CSF ini otomatis mengenali distro Linux yang digunakan, jadi langkah – langkahnya akan sama saja. Semoga. 😀 Yang saya tahu kalau distro Linux yang dipakai sudah ada firewallnya tapi bukan iptables seperti Ubuntu dengan ufw dan CentOS 7 dengan firewalld. Ini harus dihapus dulu baru diinstall CSFnya.

Pertama mari kita download dulu:

wget https://download.configserver.com/csf.tgz

Kemudian mari kita ekstrak arsipnya:

tar -xzf csf.tgz

Masuk ke direktori hasil ekstrakannya:

cd csf

Dan mari kita eksekusi script installernya:

sh install.sh

Log prosesnya akan seperti ini:

Don't forget to:
1. Configure the following options in the csf configuration to suite your server: TCP_*, UDP_*, IPV6, TCP6_*, UDP6_*
2. Restart csf and lfd
3. Set TESTING to 0 once you're happy with the firewall, lfd will not run until you do so

Adding current SSH session IP address to the csf whitelist in csf.allow:
*WARNING* URLGET set to use LWP but perl module is not installed, reverting to HTTP::Tiny
Adding 192.168.1.94 to csf.allow only while in TESTING mode (not iptables ACCEPT)
*WARNING* TESTING mode is enabled - do not forget to disable it in the configuration
`lfd.sh' -> `/etc/init.d/lfd'
`csf.sh' -> `/etc/init.d/csf'
mode of `/etc/init.d/lfd' retained as 0755 (rwxr-xr-x)
mode of `/etc/init.d/csf' retained as 0755 (rwxr-xr-x)
`csf/LICENSE.txt' -> `webmin/csf/images/LICENSE.txt'
`csf/bootstrap/fonts/glyphicons-halflings-regular.woff' -> `webmin/csf/images/bootstrap/fonts/glyphicons-halflings-regular.woff'
`csf/bootstrap/fonts/glyphicons-halflings-regular.eot' -> `webmin/csf/images/bootstrap/fonts/glyphicons-halflings-regular.eot'
`csf/bootstrap/fonts/glyphicons-halflings-regular.woff2' -> `webmin/csf/images/bootstrap/fonts/glyphicons-halflings-regular.woff2'
`csf/bootstrap/fonts/glyphicons-halflings-regular.ttf' -> `webmin/csf/images/bootstrap/fonts/glyphicons-halflings-regular.ttf'
`csf/bootstrap/fonts/glyphicons-halflings-regular.svg' -> `webmin/csf/images/bootstrap/fonts/glyphicons-halflings-regular.svg'
`csf/bootstrap/js/bootstrap.min.js' -> `webmin/csf/images/bootstrap/js/bootstrap.min.js'
`csf/bootstrap/css/bootstrap.min.css.map' -> `webmin/csf/images/bootstrap/css/bootstrap.min.css.map'
`csf/bootstrap/css/bootstrap.min.css' -> `webmin/csf/images/bootstrap/css/bootstrap.min.css'
`csf/configserver.css' -> `webmin/csf/images/configserver.css'
`csf/csf-loader.gif' -> `webmin/csf/images/csf-loader.gif'
`csf/csf.svg' -> `webmin/csf/images/csf.svg'
`csf/csf_small.png' -> `webmin/csf/images/csf_small.png'
`csf/jquery.min.js' -> `webmin/csf/images/jquery.min.js'
`csf/loader.gif' -> `webmin/csf/images/loader.gif'
`/etc/csf/csfwebmin.tgz' -> `/usr/local/csf/csfwebmin.tgz'

Installation Completed

Selesai. 😀

Aslinya saya cari ada tidak repository untuk install CSF dan tampaknya tidak ada. Bakal agak repot waktu updatenya nanti. Semoga saja tidak.

Tapi yang terpenting sekarang kita harus tahu lebih dulu apakah CSF dapat berfungsi normal pada VPS tersebut.

cd /usr/local/csf/bin/

Dan eksekusi:

perl csftest.pl

Semoga hasilnya seperti ini:

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

Kalau iya ya berarti sukses terinstall.

Ada satu hal menarik yang baru saya tahu setelah menginstall CSF, tampaknya kita tidak perlu menginstall Fail2Ban karena sudah ada LFD (Login Failure Daemon) sepaket dalam instalasinya. Dan ini baru bekerja setelah menghidupkan CSF juga karena secara default masih dalam mode percobaan.

Mari kita edit konfigurasinya dulu:

nano /etc/csf/csf.conf

Kemudian ubah setting didalamnya jadi seperti berikut:

###############################################################################
# SECTION:Initial Settings
###############################################################################
# Testing flag - enables a CRON job that clears iptables incase of
# configuration problems when you start csf. This should be enabled until you
# are sure that the firewall works - i.e. incase you get locked out of your
# server! Then do remember to set it to 0 and restart csf when you're sure
# everything is OK. Stopping csf will remove the line from /etc/crontab
#
# lfd will not start while this is enabled
TESTING = "0"

Intinya kita matikan mode testing.

Setelah itu kita restart:

csf -r

Tutorial kali ini sampai disini dulu karena penjelasan instalasinya sudah habis. 😀 Nanti akan saya lanjutkan dengan pembahasan setting peraturan CSF. Tapi setelan defaultnya sudah cukup bagus kalau saya baca dokumentasinya.

Bagi yang terbiasa menggunakan murni iptables saja (seperti saya) tampaknya sudah patut dipertimbangkan untuk menambahkan CSF karena kerjanya adalah melengkapi dan mengoptimasi. Tapi saat ini saya masih eksperimen mempelajari setting – settingnya yang pas.

4 pemikiran pada “Cara install CSF

  1. sementara pakai yang defaultnya dulu di centos 6 tapi tertarik juga ini sudah include dengan aplikasi semacam fail2ban karna selama ini selalu instal itu juga 😀

    • Saya nyobanya juga di CentOS 6 mbak. 😀 Tampaknya kalau isinya stack standar bisa langsung pasang saja.

      Halaman produknya disini mbak: http://www.configserver.com/cp/csf.html

      Dan secara fitur tampaknya bagus banget:

      This suite of scripts provides:

      • Straight-forward SPI iptables firewall script
      • Daemon process that checks for login authentication failures for:
        • Courier imap, Dovecot, uw-imap, Kerio
        • openSSH
        • cPanel, WHM, Webmail (cPanel servers only)
        • Pure-ftpd, vsftpd, Proftpd
        • Password protected web pages (htpasswd)
        • Mod_security failures (v1 and v2)
        • Suhosin failures
        • Exim SMTP AUTH
        • Custom login failures with separate log file and regular expression matching
      • POP3/IMAP login tracking to enforce logins per hour
      • SSH login notification
      • SU login notification
      • Excessive connection blocking
      • UI Integration for cPanel, DirectAdmin and Webmin
      • Easy upgrade between versions from within cPanel/WHM, DirectAdmin or Webmin
      • Easy upgrade between versions from shell
      • Pre-configured to work on a cPanel server with all the standard cPanel ports open
      • Pre-configured to work on a DirectAdmin server with all the standard DirectAdmin ports open
      • Auto-configures the SSH port if it’s non-standard on installation
      • Block traffic on unused server IP addresses – helps reduce the risk to your server
      • Alert when end-user scripts sending excessive emails per hour – for identifying spamming scripts
      • Suspicious process reporting – reports potential exploits running on the server
      • Excessive user processes reporting
      • Excessive user process usage reporting and optional termination
      • Suspicious file reporting – reports potential exploit files in /tmp and similar directories
      • Directory and file watching – reports if a watched directory or a file changes
      • Block traffic on a variety of Block Lists including DShield Block List and Spamhaus DROP List
      • BOGON packet protection
      • Pre-configured settings for Low, Medium or High firewall security (cPanel servers only)
      • Works with multiple ethernet devices
      • Server Security Check – Performs a basic security and settings check on the server (via cPanel/DirectAdmin/Webmin UI)
      • Allow Dynamic DNS IP addresses – always allow your IP address even if it changes whenever you connect to the internet
      • Alert sent if server load average remains high for a specified length of time
      • mod_security log reporting (if installed)
      • Email relay tracking – tracks all email sent through the server and issues alerts for excessive usage (cPanel servers only)
      • IDS (Intrusion Detection System) – the last line of detection alerts you to changes to system and application binaries
      • SYN Flood protection
      • Ping of death protection
      • Port Scan tracking and blocking
      • Permanent and Temporary (with TTL) IP blocking
      • Exploit checks
      • Account modification tracking – sends alerts if an account entry is modified, e.g. if the password is changed or the login shell
      • Shared syslog aware
      • Messenger Service – Allows you to redirect connection requests from blocked IP addresses to preconfigured text and html pages to inform the visitor that they have been blocked in the firewall. This can be particularly useful for those with a large user base and help process support requests more efficiently
      • Country Code blocking – Allows you to deny or allow access by ISO Country Code
      • Port Flooding Detection – Per IP, per Port connection flooding detection and mitigation to help block DOS attacks
      • DirectAdmin UI integration
      • Updated Webmin UI integration
      • WHM root access notification (cPanel servers only)
      • lfd Clustering – allows IP address blocks to be automatically propagated around a group of servers running lfd. It allows allows cluster-wide allows, removals and configuration changes
      • Quick start csf – deferred startup by lfd for servers with large block and/or allow lists
      • Distributed Login Failure Attack detection
      • Temporary IP allows (with TTL)
      • IPv6 Support with ip6tables
      • Integrated UI – no need for a separate Control Panel or Apache to use the csf configuration
      • Integrated support for cse within the Integrated UI
      • cPanel Reseller access to per reseller configurable options Unblock, Deny, Allow and Search IP address blocks
      • System Statistics – Basic graphs showing the performance of the server, e.g. Load Averages, CPU Usage, Memory Usage, etc
      • ipset support for large IP lists
      • …lots more!

      The reason we have developed this suite is that we have found over the years of providing server services that many of the tools available for the task are either over-complex, not user friendly, or simply aren’t as effective as they could be.

      • Seharusnya ngga mbak. Karena aslinya ya cuma iptables tapi disuntik doping. 😀 Dan saya cek Google sekilas ga ketemu ada yang komplain soal penggunaan memori, setidaknya sampai halaman 5. 😀

        Karena pakai DigitalOcean, itu dibuat snapshotnya saja dulu baru install CSF mbak. Ada apa – apa tinggal direstore saja.

        Tapi kalau mau dihapus juga bisa:

        cd /etc/csf
        sh uninstall.sh

Tinggalkan komentar