ConfigServerファイアウォール-CSFは、Linuxマシンで利用できる最も一般的で高度なファイアウォールスイートの1つです。より高度な構成オプションがありますが、インストールが簡単で、構成が柔軟です。この記事では、CSFのインストールについて説明します。次のチュートリアルは、VPSまたは専用サーバーのお客様にのみ適用されることに注意してください。
Linux
rootユーザーでSSH経由でサーバーにログインし、wgetコマンドを使用してCSFパッケージファイルを取得します。
wget https://download.configserver.com/csf.tgz
ダウンロードしたアーカイブを解凍します。
tar xfz csf.tgz
圧縮されていないcsfディレクトリに移動します。
cd csf
インストーラーを実行します。
sh install.sh
構成ファイルを作成し、リストを許可するために必要なcPanelサービスを追加します。ファイアウォールをインストールすると、次のようなメッセージが表示されます。
TCP ports currently listening for incoming connections: 21,22,25,53,80,110,143,443,465,993,995,2077,2078,2082,2083,2086, 2087,2095,2096,3306 UDP ports currently listening for incoming connections: 53,123 Note: The port details above are for information only, csf hasn't been auto-configured. Don't forget to: 1. Configure the TCP_IN, TCP_OUT, UDP_IN and UDP_OUT options in the csf configuration to suite your server 2. Restart csf and lfd 3. Set TESTING to 0 once you're happy with the firewall Adding current SSH session IP address to the csf whitelist in csf.allow: Adding 10.30.6.17 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 Installation Completed
次のコマンドで、CSFテストモードを開始します。
systemctl start csf
テストが終了したら、 csf.conf を編集して、CSFをテストモードから解除します。 ファイル。このファイルを任意のエディターで開きます。 nanoエディターを使用して、このファイルを次のように編集しました。
nano /etc/csf/csf.conf
このファイルの上部に、次のテキストブロックがあります。
# 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 TESTING = "1"
このブロックの最後の行を編集して、変更を保存します。
TESTING = "0"
CSFを再起動します。これで、CSFファイアウォールが稼働しています。
systemctl restart csf