<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>CSF Archives - LinuxTuto</title>
	<atom:link href="https://www.linuxtuto.com/tag/csf/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.linuxtuto.com/tag/csf/</link>
	<description>Linux Sysadmin and DevOps blog</description>
	<lastBuildDate>Mon, 03 Apr 2023 14:30:04 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://www.linuxtuto.com/wp-content/uploads/2022/01/cropped-LT_faveicon-32x32.png</url>
	<title>CSF Archives - LinuxTuto</title>
	<link>https://www.linuxtuto.com/tag/csf/</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">201456972</site>	<item>
		<title>How to Install and Configure CSF on AlmaLinux 9</title>
		<link>https://www.linuxtuto.com/how-to-install-and-configure-csf-on-almalinux-9/</link>
					<comments>https://www.linuxtuto.com/how-to-install-and-configure-csf-on-almalinux-9/#comments</comments>
		
		<dc:creator><![CDATA[LinuxTuto]]></dc:creator>
		<pubDate>Mon, 03 Apr 2023 14:30:04 +0000</pubDate>
				<category><![CDATA[CentOS]]></category>
		<category><![CDATA[AlmaLinux]]></category>
		<category><![CDATA[CSF]]></category>
		<category><![CDATA[LFD]]></category>
		<category><![CDATA[Perl]]></category>
		<guid isPermaLink="false">https://www.linuxtuto.com/?p=1214</guid>

					<description><![CDATA[<p>ConfigServer Security &#38; Firewall (CSF) is an iptables-based firewall that provides high-level security to the Linux system. CSF includes a wide range of features, such...</p>
<p>The post <a href="https://www.linuxtuto.com/how-to-install-and-configure-csf-on-almalinux-9/">How to Install and Configure CSF on AlmaLinux 9</a> appeared first on <a href="https://www.linuxtuto.com">LinuxTuto</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>ConfigServer Security &amp; Firewall (CSF) is an iptables-based firewall that provides high-level security to the Linux system.</p>
<p>CSF includes a wide range of features, such as IP blocking, port blocking, and DoS protection. It also supports advanced security measures, such as rate limiting, connection tracking, and SSH login detection. In addition to its firewall features, CSF includes tools for system and file integrity checking, as well as email and login tracking.</p>
<h2><span class="has-inline-color has-vivid-purple-color">Step 1: Update Operating System</span></h2>
<p>Update your <strong>AlmaLinux 9</strong> operating system to make sure all existing packages are up to date:</p>
<pre><code># dnf update</code></pre>
<p>Also, install:</p>
<pre><code># dnf install wget nano tar</code></pre>
<h2><span class="has-inline-color has-vivid-purple-color">Step 2: Disable firewalld and any other iptables firewall</span></h2>
<p>Run the following command below to sto p and disable the <strong>firewalld </strong>service:</p>
<pre><code># systemctl stop firewalld
# systemctl disable firewalld</code></pre>
<h2><span class="has-inline-color has-vivid-purple-color">Step 3: Install Required Perl Modules for CSF</span></h2>
<p>Install the following Perl modules required by CSF.</p>
<pre><code># dnf install perl-libwww-perl.noarch perl-LWP-Protocol-https.noarch perl-GDGraph</code></pre>
<p>If some modules are not available in the default repository install the epel repository using the following command:</p>
<pre><code># dnf install epel-release</code></pre>
<p>Then try to install the modules again.</p>
<h2><span class="has-inline-color has-vivid-purple-color">Step 4: Download CSF</span></h2>
<p>By default, CSF is not available in the AlmaLinux standard repository, so you will need to download it from their official website.</p>
<pre><code># wget https://download.configserver.com/csf.tgz</code></pre>
<p>Once downloaded, extract file with the following command:</p>
<pre><code># tar xzf csf.tgz</code></pre>
<p>Change the directory to the extracted directory:</p>
<pre><code># cd csf</code></pre>
<p>Install the CSF by running the installation script:</p>
<pre><code># sh install.sh</code></pre>
<p>Then you can check the iptables mode using below command.</p>
<pre><code># perl /usr/local/csf/bin/csftest.pl</code></pre>
<p>You should see the following output:</p>
<pre><code>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</code></pre>
<h2><span class="has-inline-color has-vivid-purple-color">Step 5: Configuring the CSF</span></h2>
<p>CSF runs in TEST mode by default. To disable it, you need to edit the <code>/etc/csf/csf.conf</code> file.</p>
<pre><code># nano /etc/csf/csf.conf</code></pre>
<p>Locate the line <code>TESTING = 1</code> and change the value to <code>0</code> or else LFD daemon fail to start.</p>
<pre><code>TESTING = "0"</code></pre>
<p>Locate the line <code>RESTRICT_SYSLOG = 0</code> and change its value to <code>3</code>. This means only members of the <code>RESTRICT_SYSLOG_GROUP</code> can access the <code>syslog/rsyslog</code> files.</p>
<pre><code>RESTRICT_SYSLOG = "3"</code></pre>
<p>Also, you can allow incoming and outgoing port as per your requirement:</p>
<pre><code># Allow incoming TCP ports
TCP_IN = "20,21,22,25,53,80,110,143,443,465,587,993,995"

# Allow outgoing TCP ports
TCP_OUT = "20,21,22,25,53,80,110,113,443,587,993,995"</code></pre>
<p>Once your done all the configuration, restart and enable CSF:</p>
<pre><code># systemctl restart csf &amp;&amp; systemctl restart lfd
# systemctl enable csf &amp;&amp; systemctl enable lfd
# systemctl status csf &amp;&amp; systemctl status lfd</code></pre>
<h2><span class="has-inline-color has-vivid-purple-color">Step 6: Enable CSF GUI</span></h2>
<p>By default, it is disabled in the CSF default configuration file, so you will need to enable it first. For enabling <code>CSF GUI</code> you need to setup <strong>Integrated User Interface</strong> section in <code>csf.conf</code> configuration file.</p>
<p>Open the <code>CSF</code> main configuration file with the following command:</p>
<pre><code># nano /etc/csf/csf.conf</code></pre>
<p>Change the following lines:</p>
<pre><code>###############################################################################
# SECTION:Integrated User Interface
###############################################################################

# 1 to enable, 0 to disable web ui 
UI = "1"

# Set port for web UI. The default port is 6666. 
UI_PORT = "8888"

# Leave blank to bind to all IP addresses on the server 
UI_IP = ""

# Set username for authetnication 
UI_USER = "admin"

# Set a strong password for authetnication 
UI_PASS = "Test@12345"</code></pre>
<p>Next you need to allow the IP from where you are going to access <code>CSF GUI</code>. You can either allow the entire subnet or you can also choose to allow some specific IP Address like below.</p>
<pre><code># echo "YOUR_PUBLIC_IP_ADDRESS" &gt;&gt;  /etc/csf/ui/ui.allow</code></pre>
<p>Then restart the <code>CSF</code> and <code>LFD</code> service to apply the changes.</p>
<pre><code># systemctl restart csf
# systemctl restart lfd</code></pre>
<h2><span class="has-inline-color has-vivid-purple-color">Step 7: Access CSF Web Interface</span></h2>
<p>Open your web browser and type the URL https://your-server-IP:8888. You will be redirected to the <code>CSF</code> login page:</p>
<p><img fetchpriority="high" decoding="async" class="size-large wp-image-1240 aligncenter" src="https://www.linuxtuto.com/wp-content/uploads/2023/04/csf_admin-900x194.jpg" alt="CSF Admin Login" width="900" height="194" srcset="https://www.linuxtuto.com/wp-content/uploads/2023/04/csf_admin-900x194.jpg 900w, https://www.linuxtuto.com/wp-content/uploads/2023/04/csf_admin-300x65.jpg 300w, https://www.linuxtuto.com/wp-content/uploads/2023/04/csf_admin-768x166.jpg 768w, https://www.linuxtuto.com/wp-content/uploads/2023/04/csf_admin-897x193.jpg 897w, https://www.linuxtuto.com/wp-content/uploads/2023/04/csf_admin-684x148.jpg 684w, https://www.linuxtuto.com/wp-content/uploads/2023/04/csf_admin.jpg 955w" sizes="(max-width: 900px) 100vw, 900px" /></p>
<p>Provide your admin username and password and click on the Enter button. You should see the dashboard:</p>
<p><img decoding="async" class="size-large wp-image-1241 aligncenter" src="https://www.linuxtuto.com/wp-content/uploads/2023/04/csf_dashboard-900x458.jpg" alt="CSF Dashboard" width="900" height="458" srcset="https://www.linuxtuto.com/wp-content/uploads/2023/04/csf_dashboard-900x458.jpg 900w, https://www.linuxtuto.com/wp-content/uploads/2023/04/csf_dashboard-300x153.jpg 300w, https://www.linuxtuto.com/wp-content/uploads/2023/04/csf_dashboard-768x391.jpg 768w, https://www.linuxtuto.com/wp-content/uploads/2023/04/csf_dashboard-1536x781.jpg 1536w, https://www.linuxtuto.com/wp-content/uploads/2023/04/csf_dashboard-1222x622.jpg 1222w, https://www.linuxtuto.com/wp-content/uploads/2023/04/csf_dashboard-897x456.jpg 897w, https://www.linuxtuto.com/wp-content/uploads/2023/04/csf_dashboard-684x348.jpg 684w, https://www.linuxtuto.com/wp-content/uploads/2023/04/csf_dashboard.jpg 1899w" sizes="(max-width: 900px) 100vw, 900px" /></p>
<h2><span class="has-inline-color has-vivid-purple-color">Step: 8: Manage CSF with Command Line</span></h2>
<p>To list all firewall rules, run the following command:</p>
<pre><code># csf -l</code></pre>
<p>To stop <code>CSF</code>, run the following command:</p>
<pre><code># csf -s</code></pre>
<p>To allow a specific IP address, run the following command:</p>
<pre><code># csf -a IP-address</code></pre>
<p>To deny an IP address, run the following command:</p>
<pre><code># csf -d IP-address</code></pre>
<p>To remove blocked IP address from a <code>CSF</code> rule, run the following command:</p>
<pre><code># csf -dr IP-address</code></pre>
<p>To verify whether the IP address is blocked or not, run the following command:</p>
<pre><code># csf -g IP-address</code></pre>
<p>To flush the <code>CSF</code> firewall rules, run the following command:</p>
<pre><code># csf -f</code></pre>
<p>To disable <code>CSF</code>, run the following command:</p>
<pre><code># csf -x</code></pre>
<h2><span class="has-inline-color has-vivid-purple-color">Step 9: Uninstall CSF and LFD on AlmaLinux</span></h2>
<p>Run the following script to remove <code>CSF</code> and <code>LFD</code> from your system.</p>
<pre><code># sh /etc/csf/uninstall.sh</code></pre>
<h2><span class="has-inline-color has-vivid-purple-color">List of Important CSF Configuration Files</span></h2>
<p>Below are the important configuration files that control the most of the rules in the <code>CSF</code>.</p>
<ul>
<li><code>csf.conf</code> – the main configuration file, it has helpful comments explaining what each option does</li>
<li><code>csf.allow</code> – a list of IP’s and CIDR addresses that should always be allowed through the firewall</li>
<li><code>csf.deny</code> – a list of IP’s and CIDR addresses that should never be allowed through the firewall</li>
<li><code>csf.ignore</code> – a list of IP’s and CIDR addresses that lfd should ignore and not not block if detected</li>
<li><code>csf.*ignore</code> – various ignore files that list files, users, IP’s that lfd should ignore. See each file for their specific purpose and tax</li>
</ul>
<p>If you manually modify these files, you will need to restart csf and then lfd them to take effect.</p>
<h2><span class="has-inline-color has-vivid-purple-color">Conclusion</span></h2>
<p>Congratulations! You have successfully installed <code>CSF</code> Firewall. Thanks for using this tutorial for installing ConfigServer Security &amp; Firewall <code>(CSF)</code> on your AlmaLinux 9 OS. For additional help or useful information, you can check <a href="https://www.configserver.com/cp/csf.html" target="_blank" rel="noopener">the official CSF Firewall website</a>.</p>
<p>&nbsp;</p>
<p>The post <a href="https://www.linuxtuto.com/how-to-install-and-configure-csf-on-almalinux-9/">How to Install and Configure CSF on AlmaLinux 9</a> appeared first on <a href="https://www.linuxtuto.com">LinuxTuto</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.linuxtuto.com/how-to-install-and-configure-csf-on-almalinux-9/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1214</post-id>	</item>
	</channel>
</rss>
