restore multiple account via ssh+cpanel
You must run the "/scripts/restorepkg" command to restore from a full
account backup; to avoid having to do this manually for each account
backup you may want to script the shell command so that it runs
"/scripts/restorepkg" in a loop from a list of users that you provide.
Here is an example, assuming the list of users is stored in a text file at "/root/list_of_users.txt":
==============================
# for x in $(cat /root/list_of_users.txt); do /scripts/restorepkg /home/cpbackup-$x.tar.gz; done;
==============================
Alternatively, if the filename of the full backups varied, you could store a list of the full paths to each backup in a text file, such as a text file at "/root/list_of_backups.txt" and then the command could be altered as follows:
============================== ===
==============================
Alternatively, if the filename of the full backups varied, you could store a list of the full paths to each backup in a text file, such as a text file at "/root/list_of_backups.txt" and then the command could be altered as follows:
==============================
# for x in $(cat /root/list_of_backups.txt); do echo /scripts/restorepkg $x; done; ======================================
MYSQL SHOWING AS OFFLINE IN CPANEL
FIX: Reset password of cpanel account, but ensure that "Sync MySQL password with account password" is enabled before reset the password.
ACCESS AWSTATS OUTSIDE CPANEL
Problem
Allowing access to Awstats without requiring a cPanel login
Solution
- Download Awstats: http://awstats.sourceforge.net
- Extract the contents of the file to your computer.
- Use an FTP client to upload the contents of the /cgi-bin and /icon folders into the root of your domain (both are located in the "wwwroot" folder).
- Change the permissions of the awredir.pl and awstats.pl files to 755 (in the /cgi-bin directory).
- Download the Awstats configuration file created by cPanel: /tmp/awstats/awstats.yourdomain.com.conf.
- Open this file with a text editor, search for the "DirIcons" line, and change it to show: DirIcons="/icon/".
- Upload the modified file to the /cgi-bin folder.
- You may now access your statistics at http://www.yourdomain.com/cgi-bin/awstats.pl?config=yourdomain.com
Fix for postgresql connection issues
Refer: http://pilhuhn.blogspot.in/2008/06/postgres-local-is-not-local-or-how-to.html
Eximstat
eximstats - generates statistics from Exim mainlog files.
Reason for large eximststat DB
=====================
If the server has heavy email activity or if there is an abuse activity on server or if the server eximstat log rotation interval is too high then the DB can grow large in size. Whcih is the main cause behind eximstats db crashing
-- > You can run command cat /var/log/exim_mainlog | eximstats . This will Generate and display Exim stats from a logfile
Firstly check for any abuse attempts happening on server
Only if the DB is very large that is in GB size, attempt below or else the normal repair should work
Fix
===
1 ) Updating log rotation value in whm
WHM> tweak setting > “The interval, in days, to retain Exim stats in the database” , suggested log rotation is 30days
2)
Remove eximstats:If you would like to remove and recreate eximstats database,
==============
# mysql
> DROP DATABASE eximstats;>
CREATE DATABASE eximstats;> quit
mysql eximstats < /var/cpanel/sql/eximstats.sql
==============
3) Truncsating/deleting the DB values
=========disable eximstats from whm >> service managerLogin to mysql
#mysql
mysql> use eximstats
mysql> delete from sends;
mysql> delete from smtp;
mysql> delete from failures;
mysql> delete from defers;
or if it is to Truncate
run truncate
>>truncate table smtp;
>>truncate table send; etc
root@server [~]# mysqlcheck -c eximstats
eximstats.defers OK
eximstats.failures OK
eximstats.sends OK
eximstats.smtp OK
root@jupiter [~]#
restart mysql and exim
Refer: http://sachinpradeeplinux.wordpress.com/2012/07/27/how-to-clear-eximstats-db/
=================================================================
Error while removing addon domain in cPanel
Error: Sorry, you do not control the domain domain2.com while removing the addon domain "domain2.com" from cPanel
If you are getting the above mentioned error, follow the below steps:
1. Check whether any main domain is created with the same name
2. Else follow the below steps:
# /scripts/killdns <domain>
# grep -ir <domain> /var/cpanel/users
remove the domain name from the listed files.
# grep -r <domain> /var/cpanel/userdata
remove the domain name from the listed files.
#/scripts/updateuserdomains
Also, remove the domain entry from apache configuration file.
Restart apache.
/etc/init.d/httpd restart
====================================================
Web Server Security & Firewall (ModSecurity)
Our choice for Mod Security rules is the Comodo Web Application Firewall (CWAF) agent. The cPanel\WHM plugin automate the installation & configuration of CWAF on the server and the deployment of periodically published predefined firewall rules set updates.
1) To get access to Comodo Mod Security rules and CWAF free sign up is needed: https://waf.comodo.com
2) To download the comodo client agent login to the web administration console and click the “Download latest installer” link (top right of the screen) “cwaf_client_install.sh”.
3) Copy the agent setup file to a local directory in the server E.g. /root
4) Run the installation script as root via SSH:
bash /root/cwaf_client_install.shFollow the instructions in the setup wizard!
Next edit mod_security conf file and include the CWAF Rules.
vi /usr/local/apache/conf/modsec2.confAnd add this line:
Include "/var/cpanel/cwaf/etc/cwaf.conf"The file should look like this:
LoadFile /opt/xml2/lib/libxml2.so # LoadFile /opt/lua/lib/liblua.so LoadModule security2_module modules/mod_security2.so <IfModule mod_security2.c> SecRuleEngine On SecTmpDir /tmp SecDataDir /tmp SecRequestBodyAccess On SecAuditEngine RelevantOnly SecPcreMatchLimitRecursion 250000 SecDebugLog logs/modsec_debug_log SecPcreMatchLimit 250000 SecAuditLog logs/modsec_audit.log SecDebugLogLevel 0 Include "/var/cpanel/cwaf/etc/cwaf.conf" </IfModule>
5) Now login to WHM as root and navigate to:
Home » Plugins » Comodo WAF
At the “Main” tab you can run updates if needed,
At the “Catalog” tab you can set or unset rules for all vhosts or for a singel domain.
6) Restart Apache
service httpd restart
7) Set new Apache configuration:
Home » Service Configuration » Apache Configuration » Global Configuration
Change to:
SSL Cipher Suite = (PCI recommended)
Trace Enable = Off
Server Signature = Off
Server Tokens = ProductOnly
File ETag = None
Then clicking on “Save”
8) Set new PHP configuration:
Home » Service Configuration » PHP Configuration Editor
Select the “Advanced Mode” and set the following settings:
allow_url_fopen = off
expose_php = Offenable_dl= Off
register_globals = off
display_errors = off
disable_functions = show_source, system, shell_exec, passthru, exec, popen, proc_open, eval, symlink, link, readlink, dl, escapeshellarg, escapeshellcmd, ini_restore, apache_get_modules, ini_get_all, get_cfg_var
9) Restart Apache
service httpd restart
10) Enable failure detection of repeated Apache mod_security rule triggers
Navigate to:
Home » Plugins » ConfigServer Security & Firewall » Firewall Configuration
And set the number of failures between 3 and 5 by changing the value:
LF_MODSEC = 3
No comments:
Post a Comment