| ||
If you want to list all files in a directory that doesn’t use an index.html (or index.php) file, you can create an .htaccess file with the following contents:
This will tell apache that you want to list all files in the directory. |
dino
Securing CPanel
Running a WHM like Cpanel can sure make hosting easy, but unfortunately running a WHM often makes your server much less secure than it was before!
We do not guaranty that the following steps will make your server hack proof, but it will greatly reduce your chances of compromise. Also note that Layered Technologies does not manage your server and if you do not feel comfortable making system level changes to your server we recommend you open a level2 support ticket (for a fee) or hire a third party sysadmin service to help you.
Basic Steps to Securing CPanel (Linux based OS):
These are items inside of WHM/Cpanel that should be changed to secure your server.
Goto Server Setup =>> Tweak Settings
Check the following items…
Under Domains
Prevent users from parking/adding on common internet domains. (ie hotmail.com, aol.com)
Under Mail
Attempt to prevent pop3 connection floods
Default catch-all/default address behavior for new accounts – blackhole
Under System
Use jailshell as the default shell for all new accounts and modified accounts
Goto Server Setup =>> Tweak Security
Enable php open_basedir Protection
Enable mod_userdir Protection
Disabled Compilers for unprivileged users.
Goto Server Setup =>> Manage Wheel Group Users
Remove all users except for root and your main account from the wheel group.
Goto Server Setup =>> Shell Fork Bomb Protection
Enable Shell Fork Bomb/Memory Protection
When setting up Feature Limits for resellers in Resellers =>> Reseller Center, under Privileges always disable Allow Creation of Packages with Shell Access and enable Never allow creation of accounts with shell access; under Root Access disable All Features.
Goto Service Configuration =>> FTP Configuration
Disable Anonymous FTP
Goto Account Functions =>> Manage Shell Access
Disable Shell Access for all users (except yourself)
Goto Mysql =>> MySQL Root Password
Change root password for MySQL
Goto Security and run Quick Security Scan and Scan for Trojan Horses often. The following and similar items are not Trojans:
/sbin/depmod
/sbin/insmod
/sbin/insmod.static
/sbin/modinfo
/sbin/modprobe
/sbin/rmmod
These are measures that can be taken to secure your server, with SSH access.
Udate OS, Apache and CPanel to the latest stable versions.
This can be done from WHM/CPanel.
Restrict SSH Access
To restrict and secure SSH access, bind sshd to a single IP that is different than the main IP to the server, and on a different port than port 22.
SSH into server and login as root.
Note: You can download Putty by Clicking Here. It’s a clean running application that will not require installation on Windows-boxes.
At command prompt type: pico /etc/ssh/sshd_config
Scroll down to the section of the file that looks like this:
Code:
#Port 22
#Protocol 2, 1
#ListenAddress 0.0.0.0
#ListenAddress ::
Uncomment and change
#Port 22
to look like
Port 5678 (choose your own 4 to 5 digit port number (49151 is the highest port number)
Uncomment and change
#Protocol 2, 1
to look like
Protocol 2
Uncomment and change
#ListenAddress 0.0.0.0
to look like
ListenAddress 123.123.123.15 (use one of your own IP Addresses that has been assigned to your server)
Note 1: If you would like to disable direct Root Login, scroll down until you find
#PermitRootLogin yes
and uncomment it and make it look like
PermitRootLogin no
Save by pressing Ctrl o on your keyboard, and then exit by pressing Ctrl x on your keyboard.
Now restart SSH
At command prompt type: /etc/rc.d/init.d/sshd restart
Exit out of SSH, and then re-login to SSH using the new IP or nameserver, and the new port.
Disable Telnet
To disable telnet, SSH into server and login as root.
At command prompt type: pico -w /etc/xinetd.d/telnet
change disable = no to disable = yes
Save and Exit
At command prompt type: /etc/init.d/xinetd restart
Server e-mail everytime someone logs in as root
To have the server e-mail you everytime someone logs in as root, SSH into server and login as root.
At command prompt type: pico .bash_profile
Scroll down to the end of the file and add the following line:
echo ‘ALERT – Root Shell Access on:’ `date` `who` | mail -s “Alert: Root Access from `who | awk ‘{print $6}’`” [email protected]
Save and exit.
Set an SSH Legal Message
To an SSH legal message, SSH into server and login as root.
At command prompt type: pico /etc/motd
Enter your message, save and exit.
Note: I use the following message…
Code:
ALERT! You are entering a secured area! Your IP and login information
have been recorded. System administration has been notified.
This system is restricted to authorized access only. All activities on
this system are recorded and logged. Unauthorized access will be fully
investigated and reported to the appropriate law enforcement agencies.
Now everytime someone logs in, they will see this message… go ahead a try it.
Disable Shell Accounts
To disable any shell accounts hosted on your server SSH into server and login as root.
At command prompt type: locate shell.php
Also check for:
locate irc
locate eggdrop
locate bnc
locate BNC
locate ptlink
locate BitchX
locate guardservices
locate psyBNC
locate .rhosts
Note: There will be several listings that will be OS/CPanel related. Examples are
/home/cpapachebuild/buildapache/php-4.3.1/ext/ircg
/usr/local/cpanel/etc/sym/eggdrop.sym
/usr/local/cpanel/etc/sym/bnc.sym
/usr/local/cpanel/etc/sym/psyBNC.sym
/usr/local/cpanel/etc/sym/ptlink.sym
/usr/lib/libncurses.so
/usr/lib/libncurses.a
etc.
Disable identification output for Apache
To disable the version output for proftp, SSH into server and login as root.
At command prompt type: pico /etc/httpd/conf/httpd.conf
Scroll (way) down and change the following line to
ServerSignature Off
Restart Apache
At command prompt type: /etc/rc.d/init.d/httpd restart
These are applications that will help to secure your server.
Install chkrootkit
To install chrootkit, SSH into server and login as root.
At command prompt type: cd /root/
At command prompt type: wget ftp://ftp.pangeia.com.br/pub/seg/pac/chkrootkit.tar.gz
At command prompt type: tar xvzf chkrootkit.tar.gz
At command prompt type: cd chkrootkit-0.44
At command prompt type: make sense
To run chkrootkit
At command prompt type: /root/chkrootkit-0.44/chkrootkit
Make sure you run it on a regular basis, perhaps including it in a cron job.
Creating domain on a freshly added IP address fails in Parallels Panel for Windows
Symptoms
Creating domain with hosting on the IP address that has just been added fails and the following error is returned:
dnsmng::update() failed: dnsmng failed: Unknown error 0x80131501 (COM Error 80131501, Description: Generic failure ) at resetSecondaries ZoneName = '
at (dnsmng::msdns::MsDnsManager::resetSecondaries line 385)
at createPrimaryZone ZoneName = '
at execute "C:\Program Files (x86)\Parallels\Plesk\/admin/bin/dnsmng" update
Cause
As soon as an IP address is added to the system, Microsoft Windows performs the IP verification procedure, Windows checks up if the IP is unique. Until check-up is complete, the IP address is marked as ‘tentative’. If trying to create domain with physical hosting during the verification, creating DNS zone for the domain fails, which prevents from creating the domain.
Resolution
To avoid this issue, delay creating a domain for about 30 seconds after you add new IP address.
Parallels Power Panel show “Forbidden” error for all containers
Parallels Power Panel show “Forbidden” error for all containers,
APPLIES TO:
Virtuozzo Containers for Windows 4.0
Virtuozzo for Linux 3.x
Virtuozzo Containers for Windows 4.5
Virtuozzo Containers for Linux 4.0
Virtuozzo for Windows 3.5.1 SP1
Symptoms
The following error appears for all containers in the Parallels Power Panel:
Forbidden
The IP address of a physical server cannot be used with its Parallels Power Panel port number.
Do one of the following:
* If you want to open the Parallels Virtual Automation Control Center, use the IP address of the management server with the default port number.
* If you want to open the Parallels Power Panel, use the IP address or hostname of the Virtual Environment.
Cause
This issue may appear if the service container has no disk space remaining.
Resolution
To resolve this issue, users must find what has caused the lack of free disk space or increase the service container disk limit by the following command:
vzctl set 1 --diskspace 2000000 --save
cPanel : UPCP error : Undefined subroutine &Cpanel::Update::automatic_updates_enabled called at /scripts/upcp line 273.
I have seen recent cPanel upgrade throwing errors are below :
root@server [~]# /scripts/upcp
/scripts/upcp syntax OK
Running Futex Check/Fix……Done
Undefined subroutine &Cpanel::Update::automatic_updates_enabled called at /scripts/upcp line 273.
This can be fixed using below :
wget -O /root/updatenow.static http://httpupdate.cpanel.net/cpanelsync/RELEASE/scripts/updatenow.static && perl /root/updatenow.static --manual
Upgrade the cPanel :
/scripts/upcp --force
This should fix the issue 🙂
MySQL error ./eximstats/sends’ is marked as crashed
MySQL dies and logs shows error as below :
[ERROR] /usr/sbin/mysqld: Table './eximstats/sends' is marked as crashed and last (automatic?) repair failed
[ERROR] /usr/sbin/mysqld: Table './eximstats/sends' is marked as crashed and last (automatic?) repair failed
A simple fix is to repair the tables using command :
myisamchk -r /var/lib/mysql/eximstats/sends.MYI
- recovering (with sort) MyISAM-table '/var/lib/mysql/eximstats/sends.MYI'
Data records: 1292
- Fixing index 1
- Fixing index 2
- Fixing index 3
Data records: 3265
All should be good.
Exim Remote Memory Corruption Vulnerability Notification (CVE-2010-4344)
Summary
A memory corruption vulnerability exists in Exim versions 4.69 and older (CVE-2010-4344). Exim is the mail transfer agent used by cPanel & WHM.
Security Rating
This update has been rated as Important by the cPanel Security team.
Description
A memory corruption vulnerability has been discovered in Exim. This vulnerability may lead to arbitrary code execution with the privileges of the user executing the Exim daemon. cPanel previously released RPMs that mitigated the severity of the vulnerability on December 9, 2010 (CVE-2010-4345). This notification is for the release of new RPMs which remove the remote memory corruption vulnerability in its entirety. The vulnerability relies upon “rejected_header” being enabled (default setting) in the log_selector configuration.
Solution
To resolve and work around the issue on Linux systems, cPanel has issued new Exim RPMs. Server Owners are strongly urged to upgrade to the following Exim RPM versions:
Systems configured to use Maildir: Exim 4.69-26
Systems configured to use mbox (deprecated): Exim 4.63-5
Exim RPMs will be distributed through cPanel’s package management system. All cPanel & WHM servers receiving updates automatically will receive the updated Exim RPM during normal update and maintenance operations (upcp). To begin an Exim update on cPanel systems immediately, run the following command as root:
/scripts/eximup
FreeBSD systems should be running Exim 4.72 by default, which is not affected by this issue.
FAQ
This notification covers CVE-2010-4344.
The notification release earlier on December 10, 2010 with the summary “A privilege escalation vulnerability exists in Exim, the mail transfer agent used by cPanel & WHM.” covers CVE-2010-4345. At the time of the earlier announcement, the CVE had not been assigned.
Plesk : ProFTPD Remote Code Execution Vulnerability and Exploit
A flaw in the popular ProFTPD FTP server potentially allows unauthenticated attackers to compromise a server. The problem is caused by a buffer overflow in the pr_netio_telnet_gets() function for evaluating TELNET IAC sequences.
ProFTPD bug report: http://bugs.proftpd.org/show_bug.cgi?id=3521
Parallels Plesk Panel 9.x, 9.5x and 10 include this vulnerability. Parallels will issue Micro Updates (hotfixes) for 9.5.2 and 9.5.3 no later than 12:00 GMT (noon) on Thursday November 11, (7:00am EST in the US) to fix this. The patch for Parallels Plesk Panel 10.01 will be released at 17:00 GMT on Thursday November 11, (12:00pm EST in the US). Patches for Plesk 9.0, 9.22, and 9.3 will be posted by 12 noon GMT on Friday November 12, (7am EST in the US). Parallels updates on this will be coming soon.
MORE INFORMATION:
Updating to ProFTPD version 1.3.3c or disabling FTP services is the only current solution to this vulnerability.
ProFTPD is capable of processing TELNET IAC sequences on port 21; the sequences enable or disable certain options not supported by the Telnet or FTP protocol itself. The buffer overflow allows attackers to write arbitrary code to the application’s stack and launch it. Updating to version 1.3.3c of ProFTPD solves the problem.
The update also fixes a directory traversal vulnerability which can only be exploited if the “mod_site_misc” module is loaded. This flaw could allow attackers with write privileges to leave their permitted path and delete directories or create symbolic links outside of the path. The module is not loaded or compiled by default.
A remote root exploit is available:[Full-disclosure]ProFTPD IAC Remote Root Exploit.
A Proftpd update for Plesk has been provided by Atomic Rocket Turtle. To apply the update, execute the commands below.
# wget -O - http://www.atomicorp.com/installers/atomic |sh
# yum upgrade psa-proftpd
CPU/MySQL Usage is blank in WHM
“CPU/Memory/MySQL Usage” page blank
This is a common error across all cPanel releases. The most likely cause of this issue is related to the utility that actually generates the statistics. When cPanel is installed, several entries are added into crontab for the root user. The following is a list of the default crontab entries from a freshly installed cPanel server:
root@testbox [/etc/cron.hourly]# crontab -l | grep dcpumon
*/5 * * * * /usr/local/cpanel/bin/dcpumon >/dev/null 2>&1
root@testbox [/etc/cron.hourly]#
The dcpumon is the daemon that actually compiles the logs for the Usage page. If your Usage page is blank, it is normally because this utility is not running on the schedule that it is supposed to. The above crontab entry for dcpumon is set to run every five minutes, every hour.
Solution:
The most common resolution for this issue is to restart crond:
root@testbox [~]# /etc/init.d/crond restart
Stopping crond:[OK]
Starting crond:[OK]
root@testbox [~]#
The restart of cron should force all crontab entries to be processed normally again. If after this you are still not seeing statistics on the Usage page, you should force a cpanel update from command line with “/scripts/upcp –force”. This should download and install a new copy of the dcpumon binary.
PPP in container
To start the pppd daemon in a container / VPS you need PPP enabled for the container. Then it is possible, for example, to connect to your DSL provider in a VPS.
ppp modules need to be loaded in the HN :
# lsmod | grep ppp
#
# modprobe ppp_async
# modprobe ppp_deflate
# lsmod | grep ppp
ppp_deflate 39168 0
zlib_deflate 52760 1 ppp_deflate
ppp_async 45184 0
ppp_generic 63760 2 ppp_deflate,ppp_async
slhc 39680 1 ppp_generic
crc_ccitt 35200 1 ppp_async
set “ppp” feature for stoppped VE:
vzctl set [VEnumber] --features ppp:on --save
start VE :
# vzctl start [VEnumber]
Prepare /dev/ppp within VE:
# vzctl set [VEnumber] --devices c:108:0:rw --save
# vzctl exec [VEnumber] mknod /dev/ppp c 108 0
# vzctl exec [VEnumber] chmod 600 /dev/ppp
See if it works (as root):
VE# /usr/sbin/pppd
You should see gibberish in the standard output like
~ÿ}#À!}!}!} }4}"}&} } } } }%}&‹ÁöY}
If there is an error message instead, something went wrong.
🙂