Pages

Saturday, March 29, 2014

Can I Upgrade the Kernel on your VPS

It is generally understood that a server running Linux needs to have a relatively recent kernel version or at least one that has been securely patched to fix any vulnerabilities. For dedicated servers, a kernel upgrade is not big deal; a simple install, reboot and you are done. For a virtual private server, it can differ depending on the technology and method of deployment your provider uses.

On OpenVZ, for example, the virtual OS does not actually use its own kernel. It relies on the host’s kernel. Therefore, upgrading your kernel package will not actually have an effect and might even produce errors. Instead, you can either depend on your hosting provider to update the kernel periodically or you might be able to use some internal method that the host has to update the kernel to latest.

How to Create Cron Jobs with Webmin

Webmin is a web-based system administration tool for Linux and other Unix-like servers. Webmin provides a graphical interface for many of the tasks you would normally have to perform from the command line. Best of all, it is free and open source. One task you might have trouble performing from the Linux shell is creating cron jobs. Fortunately, Webmin has a cron job module.

    Navigate to the cron job module page
    Click “Create a new scheduled cron job”
    Under “Execute cron job as”, enter the username you want to run the cron job
    Select whether you want the cron job to be active (selecting no will create it but leave it inactive until you change this setting)
    Type the command string in the command field
    If you have data you need sent to the command, enter it in the “input to command” field
    Select the time you want for “when to execute”. The dropdown menu will give general times like “hourly”. Alternatively, you can use “Times and dates selected below” and setup your own schedule.
    Optionally, setup “Date range to execute” to limit the cron job to a time period. After it expires, it will not run again.
    Click “create” to finish.

How to backup configuration files on Webmin

Most Linux items that need backing up are stored in user home directories. This usually includes virtual web server directories as well, depending on the web server and settings you are using. One exception to this rule is configuration files. These are stored in /etc and other places. When it comes time to backup, many people backup database files and home directories but forget about configuration files. Webmin has a solution.

How to Setup Reverse DNS in WHM

One of the often overlooked aspects of web hosting is reverse DNS. A website will not connect to users who type in a domain name if the forward DNS does not identify the IP address associated with it, but some domains do not have reverse DNS, despite it being an established Internet standard.

Among other uses, reverse DNS can help security-conscious users and professionals verify that the relationship between a domain and an IP address is valid, which helps prevent spam, phishing, and other nefarious activities.

When you manage your server with WHM from cPanel, it is easy to setup reverse DNS records for your IP addresses. Just follow these steps:

Create a reverse DNS zone file

Friday, March 28, 2014

mod_security best rules

# Deprecated due to security issues so it should be off: http://blog.modsecurity.org/2008/08/transformation.html
SecCacheTransformations Off

# Check Content-Length and reject all non numeric ones
SecRule REQUEST_HEADERS:Content-Length "!^\d+$" "deny,log,auditlog,msg:'Content-Length HTTP header is not numeric', severity:'2',id:'960016'"

# Do not accept GET or HEAD requests with bodies
SecRule REQUEST_METHOD "^(?:GET|HEAD)$" "chain,phase:2,t:none,deny,log,auditlog,status:400,msg:'GET or HEAD requests with bodies', severity:'2',id:'960011',tag:'PROTOCOL_VIOLATION/EVASION'"
SecRule REQUEST_HEADERS:Content-Length "!^0?$" t:none

Cpanel log locations

Apache:
/usr/local/apache/logs/access_log
/usr/local/apache/logs/error_log

MySQL:
/var/lib/mysql/hostname.err

cPanel Installation Logs:
/var/log/cpanel-install-thread0.log

Apache domlogs:
/usr/local/apache/domlogs/example.com