<?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>Control WebPanel Wiki &#187; csf configuration</title>
	<atom:link href="http://wiki.centos-webpanel.com/tag/csf-configuration/feed" rel="self" type="application/rss+xml" />
	<link>http://wiki.centos-webpanel.com</link>
	<description>CentOS WebPanel Wiki</description>
	<lastBuildDate>Wed, 12 Feb 2025 20:38:16 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=4.1.1</generator>
	<item>
		<title>CSF/LFD Firewall configuration</title>
		<link>http://wiki.centos-webpanel.com/csflfd-firewall-configuration</link>
		<comments>http://wiki.centos-webpanel.com/csflfd-firewall-configuration#comments</comments>
		<pubDate>Sun, 22 Nov 2015 09:08:50 +0000</pubDate>
		<dc:creator><![CDATA[publisher]]></dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[csf configuration]]></category>

		<guid isPermaLink="false">http://wiki.centos-webpanel.com/?p=416</guid>
		<description><![CDATA[With CWP you can simply configure CSF/LFD firewall by using CSF Firewall module. In CWP.admin go to: Left-Menu --> Security --> CSF Firewall Here you can whitelist, block or unblock IPs. For additional configuration you can click on Firewall Configuration button and there you can check or edit CSF firewall configuration. ** Don't forget to [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>With CWP you can simply configure CSF/LFD firewall by using CSF Firewall module.<br />
In CWP.admin go to: Left-Menu --> Security --> CSF Firewall</p>
<p>Here you can whitelist, block or unblock IPs.<br />
For additional configuration you can click on <strong>Firewall Configuration</strong> button and there you can check or edit CSF firewall configuration.</p>
<p>** Don't forget to restart the firewall after you have made configuration changes!</p>
<p><strong>CSF Firewall Open Ports</strong><br />
Open ports are listed as TCP_IN, TCP_OUT, UDP_IN and UDP_OUT<br />
If you need to open a range of ports, for example from 30000 to 50000, you can do that simply by setting: 30000:50000.</p>
<p><strong>Example configuration</strong></p>
<pre># Allow incoming TCP ports
TCP_IN = "20,21,29950,25,53,80,110,143,443,465,587,993,995,2030,2031,30000:50000"

# Allow outgoing TCP ports
TCP_OUT = "20,21,29950,25,53,80,110,113,443,2030,2031,30000:50000,993,995"

# Allow incoming UDP ports
UDP_IN = "20,21,53"

# Allow outgoing UDP ports
# To allow outgoing traceroute add 33434:33523 to this list 
UDP_OUT = "20,21,53,113,123"

# Allow incoming PING
ICMP_IN = "1"</pre>
<p><strong>Video instructions</strong></p>
<p><object width="700" height="425"><param name="movie" value="https://www.youtube.com/v/sB0ORs9RFHE?version=3&amp;showinfo=0&amp;theme=light&amp;fs=1&amp;rel=0&amp;iv_load_policy=3&amp;modestbranding=1"></param><param name="allowScriptAccess" value="always"></param><param name="allowFullScreen" value="true"></param><embed src="https://www.youtube.com/v/sB0ORs9RFHE?version=3&amp;showinfo=0&amp;theme=light&amp;fs=1&amp;rel=0&amp;iv_load_policy=3&amp;modestbranding=1" type="application/x-shockwave-flash" allowScriptAccess="always" allowfullscreen="true" width="700" height="425"></embed></object></p>
<p><strong>How to stop LFD process alerts/notifications</strong><br />
Example alert: Excessive resource usage</p>
<pre>Executable:   /usr/local/bin/php-cgi
Command Line: /usr/local/bin/php-cgi /home/USERNAME/public_html/index.php
PID:          23323 (Parent PID:22635)
Killed:       No</pre>
<p>you can simply white list them in your firewall by adding in the file: <strong>/etc/csf/csf.pignore</strong></p>
<pre>exe:/usr/local/bin/php-cgi</pre>
<p>and then restart lfd: "service lfd restart"</p>
<p><strong>Recommended CSF/LFD Configuration for CWP</strong><br />
Configuration file: /etc/csf/csf.conf</p>
<pre>
LF_SSHD = "7"
LF_SSHD_PERM = "1"

LF_FTPD = "7"
LF_FTPD_PERM = "1"

LF_POP3D = "7"
LF_POP3D_PERM = "1"

LF_IMAPD = "7"
LF_IMAPD_PERM = "1"

LF_SMTPAUTH = "7"
LF_SMTPAUTH_PERM = "1"

LF_HTACCESS = "7"
LF_HTACCESS_PERM = "1"

LF_MODSEC = "7"
LF_MODSEC_PERM = "1"
</pre>
<p>log paths : </p>
<pre>
HTACCESS_LOG = "/usr/local/apache/logs/error_log"
MODSEC_LOG = "/usr/local/apache/logs/error_log"
SSHD_LOG = "/var/log/secure"
FTPD_LOG = "/var/log/messages"
POP3D_LOG = "/var/log/dovecot-info.log"
IMAPD_LOG = "/var/log/dovecot-info.log"
SMTPAUTH_LOG = "/var/log/maillog"
</pre>
<p>Custom regex for mod security, file <strong>/etc/csf/regex.custom.pm</strong> :</p>
<pre>#mod_security
if (($config{LF_MODSEC}) and ($globlogs{MODSEC_LOG}{$lgfile}) and ($line =~ /^\[\S+ \S+ \S+ \S+ \S+\] \[(\w*)?:error\] (\[pid \d+(:tid \d+)\]) \[client \S+:\S+\] \[client (\S+)\] ModSecurity:(( \[[^\]]+\])*)? Access denied/)) {
        my $ip = $4;
        $ip =~ s/^::ffff://;
        if (split(/:/,$ip) == 2) {$ip =~ s/:\d+$//}
        my $ruleid = "unknown";
        if ($line =~ /\[id "(\d+)"\]/) {$ruleid = $1}
        if (checkip(\$ip)) {return ("mod_security (id:$ruleid) triggered by","$ip","mod_security-custom","4","80,443","1")} else {return}
}
      </pre>
]]></content:encoded>
			<wfw:commentRss>http://wiki.centos-webpanel.com/csflfd-firewall-configuration/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
