<?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; Security</title>
	<atom:link href="https://wiki.centos-webpanel.com/category/security/feed" rel="self" type="application/rss+xml" />
	<link>https://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 prevent blocking for your country</title>
		<link>https://wiki.centos-webpanel.com/csflfd-firewall-prevent-blocking-for-your-country</link>
		<comments>https://wiki.centos-webpanel.com/csflfd-firewall-prevent-blocking-for-your-country#comments</comments>
		<pubDate>Sat, 23 Apr 2022 12:09:19 +0000</pubDate>
		<dc:creator><![CDATA[publisher]]></dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[Country Block Ignore]]></category>

		<guid isPermaLink="false">http://wiki.centos-webpanel.com/?p=1809</guid>
		<description><![CDATA[If you have frequent problems with your users getting blocked by the firewall the safest way to prevent that would be by adding your country to the ignore list. In the file /etc/csf/csf.conf under CC_IGNORE = "" add your country, example for Croatia CC_IGNORE = "HR" You can check for your country code here (two-character [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>If you have frequent problems with your users getting blocked by the firewall the safest way to prevent that would be by adding your country to the ignore list.</p>
<p>In the file <strong>/etc/csf/csf.conf</strong> under <strong>CC_IGNORE = ""</strong> add your country, example for Croatia<br />
CC_IGNORE = "HR"</p>
<p>You can check for your country code here (two-character code)<br />
<a href="https://www.iban.com/country-codes">https://www.iban.com/country-codes</a><br />
<a href="https://countrycode.org/">https://countrycode.org/</a></p>
<p>after adding your Country you would need to restart the firewall</p>
<pre>csf -r
service lfd restart</pre>
<p>This will not whitelist or open ports for your country but in the safest way, it will prevent any client from your country to get IP blocked.<br />
We don't recommend having this option enabled for hack-intensive countries like Russia, China, US, and similar.</p>
]]></content:encoded>
			<wfw:commentRss>https://wiki.centos-webpanel.com/csflfd-firewall-prevent-blocking-for-your-country/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ClamAV Issues</title>
		<link>https://wiki.centos-webpanel.com/clamav-issues</link>
		<comments>https://wiki.centos-webpanel.com/clamav-issues#comments</comments>
		<pubDate>Wed, 16 Feb 2022 14:03:49 +0000</pubDate>
		<dc:creator><![CDATA[publisher]]></dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[clamav]]></category>

		<guid isPermaLink="false">http://wiki.centos-webpanel.com/?p=1767</guid>
		<description><![CDATA[ERROR: Can't download daily.cvd from database.clamav.net WARNING: Your ClamAV installation is OUTDATED! WARNING: Local version: 0.101.2 Recommended version: 0.103.5 DON'T PANIC! Read https://www.clamav.net/documents/upgrading-clamav main.cld is up to date (version: 62, sigs: 6647427, f-level: 90, builder: sigmgr) WARNING: getpatch: Can't download daily-26440.cdiff from database.clamav.net WARNING: getpatch: Can't download daily-26440.cdiff from database.clamav.net ERROR: getpatch: Can't download daily-26440.cdiff [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>ERROR: Can't download daily.cvd from database.clamav.net</p>
<pre>WARNING: Your ClamAV installation is OUTDATED!
WARNING: Local version: 0.101.2 Recommended version: 0.103.5
DON'T PANIC! Read https://www.clamav.net/documents/upgrading-clamav
main.cld is up to date (version: 62, sigs: 6647427, f-level: 90, builder: sigmgr)
WARNING: getpatch: Can't download daily-26440.cdiff from database.clamav.net
WARNING: getpatch: Can't download daily-26440.cdiff from database.clamav.net
ERROR: getpatch: Can't download daily-26440.cdiff from database.clamav.net
WARNING: Incremental update failed, trying to download daily.cvd
ERROR: Can't download daily.cvd from database.clamav.net
Giving up on database.clamav.net...
Update failed. Your network may be down or none of the mirrors listed in /etc/freshclam.conf is working. Check https://www.clamav.net/documents/official-mirror-faq for possible reasons.</pre>
<p>Solution:</p>
<pre>yum -y --enablerepo=epel update clam*
freshclam</pre>
<hr />
]]></content:encoded>
			<wfw:commentRss>https://wiki.centos-webpanel.com/clamav-issues/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Defender - Snuffleupagus</title>
		<link>https://wiki.centos-webpanel.com/php-defender-snuffleupagus</link>
		<comments>https://wiki.centos-webpanel.com/php-defender-snuffleupagus#comments</comments>
		<pubDate>Sun, 06 Feb 2022 19:51:55 +0000</pubDate>
		<dc:creator><![CDATA[publisher]]></dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[PHP Defender]]></category>
		<category><![CDATA[Snuffleupagus]]></category>

		<guid isPermaLink="false">http://wiki.centos-webpanel.com/?p=1732</guid>
		<description><![CDATA[PHP Defender - Snuffleupagus This is a PHP security module that has a custom configuration for each PHP version Supported PHP versions are PHP 7 and PHP 8. Configuration locations MAIN PHP-CGI /usr/local/php/php.d/snuffleupagus.ini Configuration locations PHP-FPM /opt/alt/php-fpm70/usr/php/php.d/snuffleupagus.ini /opt/alt/php-fpm71/usr/php/php.d/snuffleupagus.ini /opt/alt/php-fpm72/usr/php/php.d/snuffleupagus.ini /opt/alt/php-fpm73/usr/php/php.d/snuffleupagus.ini /opt/alt/php-fpm74/usr/php/php.d/snuffleupagus.ini /opt/alt/php-fpm80/usr/php/php.d/snuffleupagus.ini /opt/alt/php-fpm81/usr/php/php.d/snuffleupagus.ini Configuration locations PHP-CGI /opt/alt/php70/usr/php/php.d/snuffleupagus.ini /opt/alt/php72/usr/php/php.d/snuffleupagus.ini /opt/alt/php74/usr/php/php.d/snuffleupagus.ini /opt/alt/php71/usr/php/php.d/snuffleupagus.ini /opt/alt/php73/usr/php/php.d/snuffleupagus.ini /opt/alt/php80/usr/php/php.d/snuffleupagus.ini /opt/alt/php81/usr/php/php.d/snuffleupagus.ini Configuration files [&#8230;]]]></description>
				<content:encoded><![CDATA[<p><strong>PHP Defender - Snuffleupagus</strong><br />
This is a PHP security module that has a custom configuration for each PHP version<br />
Supported PHP versions are PHP 7 and PHP 8.</p>
<p><strong>Configuration locations MAIN PHP-CGI</strong><br />
/usr/local/php/php.d/snuffleupagus.ini</p>
<p><strong>Configuration locations PHP-FPM</strong><br />
/opt/alt/php-fpm70/usr/php/php.d/snuffleupagus.ini<br />
/opt/alt/php-fpm71/usr/php/php.d/snuffleupagus.ini<br />
/opt/alt/php-fpm72/usr/php/php.d/snuffleupagus.ini<br />
/opt/alt/php-fpm73/usr/php/php.d/snuffleupagus.ini<br />
/opt/alt/php-fpm74/usr/php/php.d/snuffleupagus.ini<br />
/opt/alt/php-fpm80/usr/php/php.d/snuffleupagus.ini<br />
/opt/alt/php-fpm81/usr/php/php.d/snuffleupagus.ini</p>
<p><strong>Configuration locations PHP-CGI</strong><br />
/opt/alt/php70/usr/php/php.d/snuffleupagus.ini<br />
/opt/alt/php72/usr/php/php.d/snuffleupagus.ini<br />
/opt/alt/php74/usr/php/php.d/snuffleupagus.ini<br />
/opt/alt/php71/usr/php/php.d/snuffleupagus.ini<br />
/opt/alt/php73/usr/php/php.d/snuffleupagus.ini<br />
/opt/alt/php80/usr/php/php.d/snuffleupagus.ini<br />
/opt/alt/php81/usr/php/php.d/snuffleupagus.ini</p>
<p><strong>Configuration files are located in the folder</strong><br />
/usr/local/cwp/.conf/phpdefender</p>
<p><strong>Predefined rules are in the folder</strong><br />
/usr/local/cwp/.conf/phpdefender/rules/</p>
<p><strong>More info about it</strong></p>
<p>https://snuffleupagus.readthedocs.io/</p>
<p><strong>Module file location</strong> (depends on the PHP version)<br />
PHP-FPM: /opt/alt/php-fpm72/usr/lib/php/extensions/no-debug-non-zts-20151012/snuffleupagus.so<br />
PHP-CGI: /opt/alt/php72/usr/lib/php/extensions/no-debug-non-zts-20151012/snuffleupagus.so</p>
]]></content:encoded>
			<wfw:commentRss>https://wiki.centos-webpanel.com/php-defender-snuffleupagus/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CWP Security Advisor Config</title>
		<link>https://wiki.centos-webpanel.com/cwp-security-advisor-config</link>
		<comments>https://wiki.centos-webpanel.com/cwp-security-advisor-config#comments</comments>
		<pubDate>Thu, 13 Jan 2022 20:12:47 +0000</pubDate>
		<dc:creator><![CDATA[publisher]]></dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[Security Advisor]]></category>

		<guid isPermaLink="false">http://wiki.centos-webpanel.com/?p=1685</guid>
		<description><![CDATA[You can managed CWP alerts and notification of security advisor in this file: /usr/local/cwp/.conf/.security_advisor.conf What is listed in the file that has disabled notifications: modsec = 1 lfd = 1 hidepid = 1 * This example disables notifications for mod_security, LFD firewall, and hidden processes. If you want to re-enable notifications just delete that line [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>You can managed CWP alerts and notification of security advisor in this file: <strong>/usr/local/cwp/.conf/.security_advisor.conf</strong></p>
<div class="st-alert st-alert- ">* Note it's a very high risk for your websites, accounts, and server data if you don't follow advisor instructions to improve your server security.</p>
<p>Just remember how recently we saw many big companies got hacked which had very high security so don't think you are an exception!</p></div>
<p>What is listed in the file that has disabled notifications:</p>
<pre>modsec = 1
lfd = 1
hidepid = 1</pre>
<p><em>* This example disables notifications for mod_security, LFD firewall, and hidden processes.</em></p>
<p>If you want to re-enable notifications just delete that line from the file.</p>
]]></content:encoded>
			<wfw:commentRss>https://wiki.centos-webpanel.com/cwp-security-advisor-config/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Policyd - Limit emails per hour</title>
		<link>https://wiki.centos-webpanel.com/policyd-limit-emails-per-hour</link>
		<comments>https://wiki.centos-webpanel.com/policyd-limit-emails-per-hour#comments</comments>
		<pubDate>Thu, 06 Aug 2020 11:18:15 +0000</pubDate>
		<dc:creator><![CDATA[publisher]]></dc:creator>
				<category><![CDATA[E-Mail]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[email-limits]]></category>
		<category><![CDATA[policyd]]></category>

		<guid isPermaLink="false">http://wiki.centos-webpanel.com/?p=1416</guid>
		<description><![CDATA[Policyd is used to limit incoming and outgoing emails per hour. Video instructions Installation instructions Install it from cwp.admin by rebuilding the mail server with option policyd Left Menu->Email->MailServer Manager and select policyd other options is to do the manual installation over ssh command: sh /scripts/install_cbpolicyd * Run this command from the ssh If needed [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>Policyd is used to limit incoming and outgoing emails per hour.</p>
<p><strong>Video instructions</strong></p>
<p><object width="700" height="425"><param name="movie" value="https://www.youtube.com/v/lqdA0K2Tvtk?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/lqdA0K2Tvtk?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>Installation instructions</strong></p>
<p>Install it from cwp.admin by rebuilding the mail server with option policyd<br />
Left Menu->Email->MailServer Manager and select policyd</p>
<p>other options is to do the manual installation over ssh command:</p>
<pre>sh /scripts/install_cbpolicyd</pre>
<p><em>* Run this command from the ssh</em></p>
<p>If needed to set a policy for all currently installed packages, the installer already does that.<br />
Based on the user package this command will set limit per domain:</p>
<pre>/scripts/cwp_api account update_policyd_all</pre>
<p>The default limit for all incoming and outgoing mail domains is 250 per hour.<br />
Default policy is in use only if the domain has no other policies configured, this policy will be also in use for all incoming emails meaning that you can receive for example only 250 emails per hour from Gmail.</p>
<p><strong>Manage System Service</strong><br />
service cbpolicyd status<br />
Options: start/stop/restart/status</p>
<p><strong>MySQL Database name</strong><br />
postfix_policyd<br />
<em>* This database is in use for configuration and to track and count emails.</em></p>
<p><strong>Log file:</strong> /var/log/maillog</p>
<p>Example policy status using default package when sending email:</p>
<pre>Jul  2 12:13:32 cwp7 cbpolicyd[29870]: module=Quotas, mode=update, host=127.0.0.1, helo=localhost, from=webmail@centos-webpanel.info, to=test@test.com, reason=quota_update, policy=6, quota=3, limit=4, track=Sender:@centos-webpanel.info, counter=MessageCount, quota=3.87/250 (1.5%)</pre>
<p>Example policy status using custom package when sending email:</p>
<pre>Jul  2 12:53:58 cwp7 cbpolicyd[30994]: module=Quotas, mode=create, host=127.0.0.1, helo=localhost, from=webmail@centos-webpanel.info, to=test@test.com, reason=quota_create, policy=9, quota=6, limit=7, track=Sender:@centos-webpanel.info, counter=MessageCount, quota=1.00/120 (0.8%)</pre>
<p><strong>POLICIES explained</strong><br />
PRIORITY, lower priority is always in use, you can check in policyd module in cwp.admin which policy domain is using.<br />
Default policy: this policy is always in use if the user has no any others configured.</p>
<p><strong>We have 4 levels of email policy:</strong><br />
- the default for all incoming / outgoing (priority:20)<br />
- per package (priority:19)<br />
- per user (priority:18)<br />
- per domain (priority:17)</p>
<p>DEFAULT POLICY<br />
PackageID 0  with the name "Default Server Limit" and priority 20</p>
<p>PACKAGE POLICY<br />
PackageID is the same ID as in the packages module, the name is from packages shown as package_PACKAGE-NAME with priority 19</p>
<p>USER POLICY<br />
user policy has the packageID over 1000 and name starts with user_USERNAME with priority 18</p>
<p>DOMAIN POLICY<br />
domain policy has the packageID over 10000 and name starts with domain_DOMAIN with priority 17</p>
<p><strong>Tracking status per domain:</strong></p>
<pre>Jul  2 14:47:05 vps cbpolicyd[4061]: module=Quotas, mode=update, host=209.85.216.66, helo=mail-pj1-f66.google.com, from=recaudacion.satrim2020@gmail.com, to=juanpinto@heladosrizo.com, reason=quota_update, policy=6, quota=3, limit=4, track=Sender:@gmail.com, counter=MessageCount, quota=3.58/250 (1.4%)</pre>
<p>You can see here that this is a server default policy by policy ID (policy=6) and status is for domain (track=Sender:@gmail.com) having quota 3.5/250.</p>
<p>Incoming emails for example coming from Gmail will be limited by the default policy per domain.<br />
For example, incoming emails from Gmail will be limited to 250 per hour, and from yahoo, there will be also separated limit on 250 per hour.</p>
<p><strong>Error in the RoundCube when the limit is reached</strong><br />
SMTP Error (450): Failed to add recipient "email@gmail.com" (4.7.1 <email@gmail.com>: Recipient address rejected: 0).</p>
<p>Jul  2 19:34:11 cwp7 cbpolicyd[23990]: module=Quotas, action=defer, host=127.0.0.1, helo=localhost, from=webmail@centos-webpanel.info, to=email@gmail.com, reason=quota_match, policy=28, quota=25, limit=26, track=Sender:@centos-webpanel.info, counter=MessageCount, quota=2.98/1 (298.1%)</p>
<p>Setting the limit to 0 would fully block send/receive email from/to that domain.<br />
This is only possible to be set manually using PHPMyAdmin or custom queries.</p>
<p><strong>ERRORS POLICYD</strong><br />
 "postfix / smtpd: NOQUEUE: reject: RCPT from: 450 4.7.1 Recipient address rejected: Access denied"</p>
<p>Check in the policyd module limits set per hour, if the limit for some domain is set to 0 then it will not allow email sending at all.</p>
<p><strong>Checking Policyd REQUIREMENTS</strong></p>
<p>- check that service is working<br />
service cbpolicyd status</p>
<p>- check if the port 10031 is up<br />
netstat -tulpn|grep 10031</p>
<p>- check postfix having active configuration in /etc/postfix/main.cf, starting as:<br />
smtpd_recipient_restrictions = check_policy_service inet:127.0.0.1:10031, permit_sasl_authenticated...</p>
<p>Important configuration is: check_policy_service inet:127.0.0.1:10031</p>
<p>To disable policyd simply remove the following from /etc/postfix/main.cf<br />
check_policy_service inet:127.0.0.1:10031</p>
<hr />
<p><strong>Another option is also limit in the</strong> /etc/postfix/main.cf</p>
<pre># Limit 500 emails per hour per email address
anvil_rate_time_unit = 3600s
smtpd_client_message_rate_limit = 500</pre>
<p>* info: <a href="http://www.postfix.org/postconf.5.html" rel="noopener" target="_blank">http://www.postfix.org/postconf.5.html</a><br />
<code>The maximal number of message delivery requests that any client is allowed to make to this service per time unit, regardless of whether or not Postfix actually accepts those messages. The time unit is specified with the anvil_rate_time_unit configuration parameter.</p>
<p>By default, a client can send as many message delivery requests per time unit as Postfix can accept.</p>
<p>To disable this feature, specify a limit of 0.</p>
<p>WARNING: The purpose of this feature is to limit abuse. It must not be used to regulate legitimate mail traffic. </code></p>
<p><strong>Change Default policy limit</strong></p>
<p>Example for setting default policy limit to 500 emails per hour:</p>
<pre>mysql postfix_policyd --defaults-extra-file=/root/.my.cnf -e 'UPDATE `quotas_limits` SET `CounterLimit` = '500' WHERE `quotas_limits`.`ID` = 4;'
</pre>
<p><strong>Uninstall policyd</strong><br />
* We recommend to use uninstall option from MailServer Manager in cwp</p>
<pre>/scripts/install_cbpolicyd remove</pre>
<p><strong>Reinstall policyd</strong><br />
* this will do a clean install of policyd files and database.</p>
<pre>/scripts/install_cbpolicyd reinstall</pre>
]]></content:encoded>
			<wfw:commentRss>https://wiki.centos-webpanel.com/policyd-limit-emails-per-hour/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to install KernelCare on CWP servers</title>
		<link>https://wiki.centos-webpanel.com/how-to-install-kernelcare-on-cwp-servers</link>
		<comments>https://wiki.centos-webpanel.com/how-to-install-kernelcare-on-cwp-servers#comments</comments>
		<pubDate>Wed, 05 Aug 2020 20:48:30 +0000</pubDate>
		<dc:creator><![CDATA[publisher]]></dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[KernelCare]]></category>

		<guid isPermaLink="false">http://wiki.centos-webpanel.com/?p=1407</guid>
		<description><![CDATA[KernelCare is a service that provides automated kernel security updates to your running kernel alleviating the need to reboot the server. It promptly delivers the latest security patches for different Linux distributions applied automatically to the running kernel in just nanoseconds. KernelCare works in both, live and staging environments, and for servers located behind the [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>KernelCare is a service that provides automated kernel security updates to your running kernel alleviating the need to reboot the server. It promptly delivers the latest security patches for different Linux distributions applied automatically to the running kernel in just nanoseconds. </p>
<p>KernelCare works in both, live and staging environments, and for servers located behind the firewall, there is an ePortal to help you manage it.</p>
<p>KernelCare is compatible with 64-bit versions of CloudLinuxOS/CentOS/RHEL 6,7 and 8, Oracle Linux 6 and 7, Amazon Linux 1 and 2, Virtuozzo/PCS/OpenVZ 2.6.32, Debian 8,9 and 10, Proxmox VE 5 and 6, Virt-SIG/Xen4CentOS 6 and 7, Ubuntu 14.04, 15.04 and 16.04 kernels. </p>
<p>The list of compatible kernels can be found on the following link: </p>
<p>https://patches.kernelcare.com</p>
<p>To check current kernel compatibility with KernelCare, use the following script by running:</p>
<pre>curl -s -L https://kernelcare.com/checker | python</pre>
<p>You can try KernelCare absolutely free for 30 days on an unlimited number of servers. After the trial period is over, you can purchase licenses through CloudLinux Network (CLN) by logging in to cln.cloudlinux.com.</p>
<p>To install KernelCare run:</p>
<pre>curl -s -L https://kernelcare.com/installer | bash</pre>
<p>or:</p>
<pre>wget -qq -O - https://kernelcare.com/installer | bash</pre>
<p>If you are using IP-based license, nothing else required to be done.</p>
<p>If you are using a key-based license, run:</p>
<pre>/usr/bin/kcarectl --register KEY</pre>
<p>KEY is the registration key code string provided when you sign up for purchase or trial of the product.<br />
If you are experiencing Key limit reached error after the end of the trial period you should first unregister the server by running:</p>
<pre>kcarectl --unregister</pre>
<p>To check if patches applied run:</p>
<pre>/usr/bin/kcarectl --info</pre>
<p>The software will automatically check for new patches every 4 hours.<br />
If you would like to run update manually:</p>
<pre>/usr/bin/kcarectl --update</pre>
]]></content:encoded>
			<wfw:commentRss>https://wiki.centos-webpanel.com/how-to-install-kernelcare-on-cwp-servers/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cgroups - Limits per User</title>
		<link>https://wiki.centos-webpanel.com/cgroups-limits-per-user</link>
		<comments>https://wiki.centos-webpanel.com/cgroups-limits-per-user#comments</comments>
		<pubDate>Thu, 21 May 2020 21:42:58 +0000</pubDate>
		<dc:creator><![CDATA[publisher]]></dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[cgroups]]></category>

		<guid isPermaLink="false">http://wiki.centos-webpanel.com/?p=1378</guid>
		<description><![CDATA[This module in CWP allows you to Limit Server Resources per User using cgroups. Video instructions Example of cgroups in action on CWP servers Dedicated Servers Limits Available - CPU, Memory, Disk VPS: KVM Limits Available - CPU, Memory, Disk VPS: OpenVZ Limits Available - Memory Please note that some Cloud/VPS providers have a custom [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>This module in CWP allows you to Limit Server Resources per User using cgroups.</p>
<p><strong>Video instructions</strong></p>
<p><object width="700" height="425"><param name="movie" value="https://www.youtube.com/v/ocgRqy9whtg?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/ocgRqy9whtg?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>Example of cgroups in action on CWP servers</strong></p>
<p><object width="700" height="425"><param name="movie" value="https://www.youtube.com/v/g0MK061KFNI?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/g0MK061KFNI?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>Dedicated Servers Limits Available</strong><br />
- CPU, Memory, Disk</p>
<p><strong>VPS: KVM Limits Available</strong><br />
- CPU, Memory, Disk</p>
<p><strong>VPS: OpenVZ Limits Available</strong><br />
- Memory</p>
<p>Please note that some Cloud/VPS providers have a custom kernel that doesn't work with cgroups or some limits are no supported.</p>
<p><strong>Requirements</strong><br />
- Default CentOS 7 kernel 3.10, possible to work with some others<br />
- CloudLinux is NOT supported</p>
<hr />
<strong>CPU Limit</strong><br />
Limit 100% is one CPU core fully used, all user processes are sharing this limit.<br />
For example, two user processes will have a CPU power of 50% each.</p>
<p>Limit range: 1 ~ (Number of cores) x 100, example for 4 cores: 1~400.<br />
Result: User websites might have a slower response if the user has higher demanding scripts.</p>
<p><strong>RMEM (Real Memory RAM)</strong><br />
RAM limit in MB, the value of 1024 MB will limit shared RAM for the user to 1GB.</p>
<p><strong>VMEM (Virtual Memory = RAM + swap)</strong><br />
Swap limit in MB, the value of 2048 MB will limit swap for the user to 2GB.<br />
It's recommended to have swap (VMEM) higher than RAM (RMEM).</p>
<p>Result: When the ram limit is reached system will kill the most memory demanding process.<br />
In case of killed script webserver could return server error 5xx on the active process.</p>
<p><strong>Disk Limit (read / write)</strong><br />
Set the limit in KB per second, you can monitor this limit with iotop.</p>
<p>Result: User websites might have a slower response if the user has higher demanding scripts.</p>
<p><strong>Useful commands</strong><br />
cgdelete cpu:USERNAME <em>(delete cpu limit for USERNAME)</em><br />
cgdelete memory:USERNAME <em>(delete memory limit for USERNAME)</em><br />
cgdelete blkio:USERNAME <em>(delete disk IO limit for USERNAME)</em></p>
<hr />
<strong>Check Also: Process, Inode and Open files Limits per User</strong></p>
<p><object width="700" height="425"><param name="movie" value="https://www.youtube.com/v/w-uc6Sta9NE?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/w-uc6Sta9NE?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>
]]></content:encoded>
			<wfw:commentRss>https://wiki.centos-webpanel.com/cgroups-limits-per-user/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to disable dangerous php functions</title>
		<link>https://wiki.centos-webpanel.com/how-to-disable-dangerous-php-functions</link>
		<comments>https://wiki.centos-webpanel.com/how-to-disable-dangerous-php-functions#comments</comments>
		<pubDate>Wed, 06 May 2020 10:56:21 +0000</pubDate>
		<dc:creator><![CDATA[publisher]]></dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[disable dangerous php functions]]></category>

		<guid isPermaLink="false">http://wiki.centos-webpanel.com/?p=1363</guid>
		<description><![CDATA[These functions can be potentially dangerous in some scenarios for the security of your scripts and server you can always disable them. Run the below command for the PHP versions you need to disable those functions. PHP switcher : echo "disable_functions = exec, system, popen, proc_open, shell_exec, passthru, show_source" > /usr/local/php/php.d/disabled_function.ini PHP-CGI selector : echo [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>These functions can be potentially dangerous in some scenarios for the security of your scripts and server you can always disable them.<br />
Run the below command for the PHP versions you need to disable those functions.</p>
<p><strong>PHP switcher :</strong></p>
<pre>
echo "disable_functions = exec, system, popen, proc_open, shell_exec, passthru, show_source" > /usr/local/php/php.d/disabled_function.ini
</pre>
<p><strong>PHP-CGI selector :</strong></p>
<pre>
echo "disable_functions = exec, system, popen, proc_open, shell_exec, passthru, show_source" > /opt/alt/php53/usr/php/php.d/disabled_function.ini

echo "disable_functions = exec, system, popen, proc_open, shell_exec, passthru, show_source" > /opt/alt/php54/usr/php/php.d/disabled_function.ini

echo "disable_functions = exec, system, popen, proc_open, shell_exec, passthru, show_source" > /opt/alt/php55/usr/php/php.d/disabled_function.ini

echo "disable_functions = exec, system, popen, proc_open, shell_exec, passthru, show_source" > /opt/alt/php56/usr/php/php.d/disabled_function.ini

echo "disable_functions = exec, system, popen, proc_open, shell_exec, passthru, show_source" > /opt/alt/php70/usr/php/php.d/disabled_function.ini

echo "disable_functions = exec, system, popen, proc_open, shell_exec, passthru, show_source" > /opt/alt/php71/usr/php/php.d/disabled_function.ini

echo "disable_functions = exec, system, popen, proc_open, shell_exec, passthru, show_source" > /opt/alt/php72/usr/php/php.d/disabled_function.ini

echo "disable_functions = exec, system, popen, proc_open, shell_exec, passthru, show_source" > /opt/alt/php73/usr/php/php.d/disabled_function.ini
</pre>
<p><strong>PHP_FPM Selector :</strong><br />
<em>** Don't forget to restart php-fpm after changes</em></p>
<pre>
echo "disable_functions = exec, system, popen, proc_open, shell_exec, passthru, show_source" > /opt/alt/php-fpm53/usr/php/php.d/disabled_function.ini &#038;& service php-fpm53 restart

echo "disable_functions = exec, system, popen, proc_open, shell_exec, passthru, show_source" > /opt/alt/php-fpm54/usr/php/php.d/disabled_function.ini &#038;& service php-fpm54 restart

echo "disable_functions = exec, system, popen, proc_open, shell_exec, passthru, show_source" > /opt/alt/php-fpm55/usr/php/php.d/disabled_function.ini &#038;& service php-fpm55 restart

echo "disable_functions = exec, system, popen, proc_open, shell_exec, passthru, show_source" > /opt/alt/php-fpm56/usr/php/php.d/disabled_function.ini &#038;& service php-fpm56 restart

echo "disable_functions = exec, system, popen, proc_open, shell_exec, passthru, show_source" > /opt/alt/php-fpm70/usr/php/php.d/disabled_function.ini &#038;& service php-fpm70 restart

echo "disable_functions = exec, system, popen, proc_open, shell_exec, passthru, show_source" > /opt/alt/php-fpm71/usr/php/php.d/disabled_function.ini &#038;& service php-fpm71 restart

echo "disable_functions = exec, system, popen, proc_open, shell_exec, passthru, show_source" > /opt/alt/php-fpm72/usr/php/php.d/disabled_function.ini &#038;& service php-fpm72 restart

echo "disable_functions = exec, system, popen, proc_open, shell_exec, passthru, show_source" > /opt/alt/php-fpm73/usr/php/php.d/disabled_function.ini &#038;& service php-fpm73 restart
</pre>
<p>To enable it back, simply delete disabled_function.ini file for the PHP version you want and restart apache/php-fpm.</p>
]]></content:encoded>
			<wfw:commentRss>https://wiki.centos-webpanel.com/how-to-disable-dangerous-php-functions/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>suPHP Detailed info</title>
		<link>https://wiki.centos-webpanel.com/suphp-detailed-info</link>
		<comments>https://wiki.centos-webpanel.com/suphp-detailed-info#comments</comments>
		<pubDate>Wed, 25 Jul 2018 10:48:50 +0000</pubDate>
		<dc:creator><![CDATA[publisher]]></dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[suPHP]]></category>

		<guid isPermaLink="false">http://wiki.centos-webpanel.com/?p=1000</guid>
		<description><![CDATA[suPHP Detailed info Configuration files: /usr/local/etc/suphp.conf (Detailed suPHP configuration) /usr/local/apache/conf.d/suphp.conf (suPHP configuration for Apache) There is also suphp configuration in the vhost files for each vhost. /usr/local/apache/conf.d/vhosts/DOMAIN.COM.conf /usr/local/apache/conf.d/vhosts/DOMAIN.COM.ssl.conf If you don't want to allow users to modify and use custom php.ini per folder you can do that by placing an empty php.ini file into users [&#8230;]]]></description>
				<content:encoded><![CDATA[<p><strong>suPHP Detailed info</strong></p>
<p>Configuration files:<br />
/usr/local/etc/suphp.conf (Detailed suPHP configuration)<br />
/usr/local/apache/conf.d/suphp.conf (suPHP configuration for Apache)</p>
<p>There is also suphp configuration in the vhost files for each vhost.<br />
/usr/local/apache/conf.d/vhosts/DOMAIN.COM.conf<br />
/usr/local/apache/conf.d/vhosts/DOMAIN.COM.ssl.conf</p>
<p>If you don't want to allow users to modify and use custom php.ini per folder you can do that by placing an empty php.ini file into users home folder. The empty file will use default server php.ini and will not allow users to load any custom changes and other php.ini files.</p>
<p>Example:
<pre>
touch /home/USERNAME/php.ini</pre>
<p>Now secure it so users can't change/disable it</p>
<pre>
chown root.root /home/USERNAME/php.ini
chmod 555 /home/USERNAME/php.ini</pre>
<p>Default php.ini<br />
/usr/local/php/php.ini</p>
<p>Note that each version of PHP in PHP selector has a different php.ini file.<br />
You can edit php.ini files for each version from the php selector in cwp.admin</p>
]]></content:encoded>
			<wfw:commentRss>https://wiki.centos-webpanel.com/suphp-detailed-info/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP open_basedir</title>
		<link>https://wiki.centos-webpanel.com/php-open_basedir</link>
		<comments>https://wiki.centos-webpanel.com/php-open_basedir#comments</comments>
		<pubDate>Tue, 24 Jul 2018 13:18:36 +0000</pubDate>
		<dc:creator><![CDATA[publisher]]></dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[open_basedir]]></category>

		<guid isPermaLink="false">http://wiki.centos-webpanel.com/?p=988</guid>
		<description><![CDATA[How to enabled PHP open_basedir in CWP ** Note this is only for PHP-CGI We have two options - global config, one config file in the include folder /usr/local/php/php.d/ and in PHP selector include folders - per-user config, the securest option as it restricts the user to his /home/USERNAME folder and also disables users from [&#8230;]]]></description>
				<content:encoded><![CDATA[<p><strong>How to enabled PHP open_basedir in CWP</strong><br />
** Note this is only for PHP-CGI</p>
<p><strong>We have two options</strong><br />
- global config, one config file in the include folder /usr/local/php/php.d/ and in PHP selector include folders<br />
- per-user config, the securest option as it restricts the user to his /home/USERNAME folder and also disables users from using custom php.ini files.</p>
<p><strong>Global Configuration </strong><br />
The securest method do this correctly and to prevent users from overriding this is to place the config into the include file. Please note that if you set this into /usr/local/php/php.ini then custom user php.ini will be able to disable it. Please note that global config allows full /home folder access while per user restricts users to /home/USERNAME folder which is much more secure.</p>
<p>One line command to create a file and config:</p>
<pre>echo "open_basedir = /home:/tmp:/var/tmp:/usr/local/lib/php/" > /usr/local/php/php.d/open_basedir.ini</pre>
<p>You can also do it by yourself by creating a file: /usr/local/php/php.d/open_basedir.ini with the following content:</p>
<pre>open_basedir = /home:/tmp:/var/tmp:/usr/local/lib/php/</pre>
<p>To enable it for other php versions from the PHP selector you can create this config files with the same content:</p>
<pre>
/opt/alt/php44/usr/php/php.d/open_basedir.ini
/opt/alt/php52/usr/php/php.d/open_basedir.ini
/opt/alt/php53/usr/php/php.d/open_basedir.ini
/opt/alt/php54/usr/php/php.d/open_basedir.ini
/opt/alt/php55/usr/php/php.d/open_basedir.ini
/opt/alt/php56/usr/php/php.d/open_basedir.ini
/opt/alt/php70/usr/php/php.d/open_basedir.ini
/opt/alt/php71/usr/php/php.d/open_basedir.ini
/opt/alt/php72/usr/php/php.d/open_basedir.ini
/opt/alt/php7/usr/php/php.d/open_basedir.ini</pre>
<p><strong>Testing:</strong><br />
Create a phpinfo file on some account/domain/subdomain ... and open it with a browser.<br />
open_basedir value should show info from the config</p>
<p>PHP info file example phpinfo.php</p>
<pre>
&lt;?php phpinfo(); ?&gt;
</pre>
<p><strong>Per User open_basedir</strong><br />
To enable per-user open_basedir you can create a php.ini file in the users /home folder.<br />
Example: /home/USERNAME/php.ini ,make sure the file is owned by root so that the user can't disable it.</p>
<pre>
echo "open_basedir = /home/USERNAME:/tmp:/var/tmp:/usr/local/lib/php/" > /home/USERNAME/php.ini
chown root.root /home/USERNAME/php.ini
chmod 555 /home/USERNAME/php.ini</pre>
<p><em>** Don't forget to replace the USERNAME.</em></p>
<p>Please note that this option will also disable all further custom users php.ini files per folder, for example: /home/USERNAME/public_html/php.ini will not be loaded.</p>
<p>You can also place it into public_html folder but then users will be able to run custom php.ini files per folder and they can disable open_basedir.</p>
<p><strong>RECOMMENDATION</strong><br />
We recommend using the per-user configuration of open_basedir as it will provide much higher security and isolate each client.</p>
<hr />
<strong>NGINX + PHP-FPM</strong><br />
configuration files are:<br />
/etc/nginx/conf.d/vhosts/DOMAIN.conf<br />
/etc/nginx/conf.d/vhosts/DOMAIN.ssl.conf</p>
<p>under fastcgi_param add one more line and reload/restart nginx</p>
<pre>fastcgi_param   PHP_ADMIN_VALUE "open_basedir =/home/USERNAME:/tmp:";</pre>
<p>** Note that manual editing of the webserver vhost files is not recommended as those files get rebuilt from the template on each change.<br />
<a href="/webservers-vhost-templates" title="How to create a webserver template file" target="_blank">Try checking the instructions here for the custom template build.</a></p>
<hr />
<strong>APACHE + PHP-FPM</strong><br />
Configuration files are all user existing php-fpm configuration files, to get the list of files you can use this</p>
<pre>ls -la /opt/alt/php-fpm*/usr/etc/php-fpm.d/users/USERNAME.conf</pre>
<p>Add at the bottom</p>
<pre>php_admin_value[open_basedir] = /home/USERNAME:/tmp</pre>
<p>** Note that editing any of those files requires to restart php-fpm version you edited.</p>
<p>** Note that manual editing of the webserver vhost files is not recommended as those files get rebuilt from the template on each change.<br />
<a href="/webservers-vhost-templates" title="How to create a webserver template file" target="_blank">Try checking the instructions here for the custom template build.</a></p>
]]></content:encoded>
			<wfw:commentRss>https://wiki.centos-webpanel.com/php-open_basedir/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
