vpslinux

Reseller should be signed up for the VPS Linux US or VPS Linux IN Product.

WHM Initial Setup

Note

All necessary information regarding the WHM Setup is available in the setup guide below:

WHM Initial Setup Wizard

A few important points about the Initial setup.

Setup Networking (Step 2)

  • Hostname: This should be a sub-domain name. e.g. server.abc.com or vps.server.com.

  • Resolvers: The resolver IP addresses here will be auto-populated with values 206.127.15.36 & 174.122.47.81. You should only use these IPs, which are the DNS resolver’s IPs at the Data Center.

  • Main Network/Ethernet Device: Always keep this as “venet0:0?

Nameservers (Step 4)

Choose which nameservers your domain’s hosted on this server will use. These will be used as the default NS records for all the domain’s Zone hosted on the server.

  • Add A Entries for Nameservers & Hostname.
  • Add “A Entries” for all Nameservers.

    Note

    If your order has just one IP address, use same IP for all Nameservers. Use different IPs if multiple IPs are added to the order.

  • Add “A Entries” for Hostname

    Note

    This creates a Zone for the primary domain name [used in the Hostname (on Step 2)], and creates its A record. If the Hostname used was vps.server.com, the Zone will be added automatically for server.com with the A record for vps.server.com pointing to the IP address mentioned.

Services (Step 5)

  • Covert Mailbox Format:
    It converts every mailbox to the current server’s mail format, during the migration of an account from another server.

  • Configure cPHulk: cPHulk is recommended for Brute Force Protection.

Enabling SSL or a Dedicated IP Address

Note
  • You may enable SSL for only that domain name, for which you have purchased your Single Domain Hosting Order.

  • You may enable SSL for only one domain name - either the primary domain name or one of the Addon domains for your Multi Domain Hosting Order.

  • You may enable SSL for every domain name hosted through your Reseller Hosting Order. Multiple dedicated IP addresses may be purchased through your Reseller Hosting Order.

To Purchase a Dedicated IP Address

  1. Login to your Control Panel, Search for the domain name for which you have purchased this Order and go to the
    Order Information view. See details

  2. Click the Dedicated IPs link.

  3. Click the Add Dedicated IP button.

  4. On the next page, you would be displayed the cost of enabling SSL or purchasing a Dedicated IP Address. Click the Buy Now button.

  5. Continue to pay for the generated Invoice.

To Associate an IP Address With a Domain Name

Once a Dedicated IP Address has been purchased, you need to associate it with a specific domain name.

To Delete a Dedicated IP Address (Anchor: deleteip)

If required, you may delete a Dedicated IP Address as explained below.

Note

Before deleting a Dedicated IP Address, you need to have the Account/website associated with it mapped to another IP Address.

  1. Login to your Control Panel, Search for the domain name for which you have purchased this Order and go to the
    Order Information view. See details

  2. Click the Dedicated IPs link.

  3. Click the Delete link, next to the IP Address you wish to delete.

  4. Confirm the deletion by clicking the Delete Dedicated IP button.

Managing Add-ons

firstfoot Interactive Pvt Ltd. offers several Add-ons alongwith an Order. These can be purchased and managed from the Order Information view of the Order.

Note
  • Add-ons currently offered are:

    • Dedicated IP

    • cPanel License

    • WHMCS

    • Dedicated Server and Managed Server specific Add-ons:

      • 50GB SAN Storage

      • 100GB SAN Storage

      • 200GB SAN Storage

      • 300GB SAN Storage

      • 500GB SAN Storage

To Purchase an Add-on

  1. Login to your Control Panel, Search for the domain name for which you have purchased this Order and go to the
    Order Information view. See details

  2. Click the Manage Add-ons link.

  3. Select the Add-on you wish to purchase from the Available Add-ons menu and click the Add button.

  4. On the next page, you would be displayed the cost of purchasing the Add-on. Click the Buy Now button.

    Note

    You cannot specify the duration of an Add-on. The duration will the same as that of the Order.

  5. Continue to pay for the generated Invoice.

To Delete an Add-on (Anchor: delete)

If required, you may delete an Add-on as explained below.

Note

Before deleting an Add-on, you need to ensure that the functionality offered by that Add-on is no longer in use on your Server.

  1. Login to your Control Panel, Search for the domain name for which you have purchased this Order and go to the
    Order Information view. See details

  2. Click the Manage Add-ons link.

  3. Click the Delete link, next to the Add-on you wish to delete.

  4. Confirm the deletion by clicking the Delete Add-on button.

Upgrading / Downgrading an Order

After purchasing an Order under a specific Plan should your requirements change, you may choose to switch to another Plan.

Note
  • If while switching to another Plan, you choose a Plan of a lower pricing, then the credit available to you, needs to be immediately utilized towards
    extending the duration of the new Plan.

  • If your Order has Expired, you will not be able to switch Plans, until you have Renewed your existing Order.

  • The upgrade / downgrade functionality is not available for Orders under the following products:

    • Enterprise Email

    • Enterprise Email Lite

    • Dedicated Server

    • Managed Server


Impact of Switching Plans

Switching from an existing Email Hosting Plan

When you select another Email Hosting Plan or a Website Builder Plan, your existing Email Hosting Order will not get affected under any circumstance:

New Plan Category Impact
Another Email Hosting Plan No change to existing Order
Website Builder Plan No change to existing Order

Switching from an existing Website Builder Plan

When you select another Website Builder Plan or an Email Hosting Plan, your existing Website Builder Order may get affected, depending upon the Plan you chose to switch to:

New Plan Category Impact
Email Hosting Plan Website Builder would be Deleted
Another Website Builder Plan No change to existing Order

To Switch to Another Plan

  1. Login to your Control Panel, Search for the domain name for which you have purchased this Order and go to the
    Order Information view. See details

  2. Click the See Plans & Pricing button.

  3. Click the Switch Plan button under the Plan you wish to switch to and proceed.

    Note

    If the cost of the new Plan is lower than your existing Plan, you would be displayed the arrears. To utilize this credit, you need to select a longer duration of this new Plan, before switching Plans.

    Resellers: The option to extend the duration of the new Plan would be available only if you have added Pricing Slabs of higher duration.

  4. Proceed to pay for the Invoice generated, in case you are switching to a Plan of higher Pricing.

Ports required for cPanel

Ports that must be open to run cPanel behind a firewall are listed below:

Port

Service

Protocol

Direction

20

FTP

TCP

Inbound / Outbound

21

FTP

TCP/UDP

Inbound / Outbound

22

SSH

TCP

Inbound

25

SMTP

TCP

Inbound / Outbound

26

SMTP

TCP

Inbound / Outbound

37

rdate

TCP

Outbound

43

whois

TCP

Outbound

53

DNS

TCP/UDP

Inbound / Outbound

80

HTTP

TCP

Inbound / Outbound

110

POP3

TCP

Inbound

113

ident

TCP

Outbound

143

IMAP4

TCP

Inbound

443

HTTPS

TCP

Inbound / Outbound

465

SMTP (TLS/SSL)

TCP/UDP

Inbound / Outbound

783

SpamAssassin

TCP/UDP

Inbound

873

rsync

TCP/UDP

Outbound

953

DNS/RNDC

TCP

Inbound

993

IMAP4 (SSL)

TCP

Inbound

995

POP3 (SSL)

TCP

Inbound

2082

cPanel

TCP

Inbound

2083

cPanel (SSL)

TCP

Inbound

2086

WHM

TCP

Inbound

2087

WHM (SSL)

TCP

Inbound

2089

cPanel license

TCP

Outbound

2095

Webmail

TCP

Inbound

2096

Webmail (SSL)

TCP

Inbound

3306

MySQL

TCP

Inbound

cPanel / WHM Directory Structure and Scripts

Apache

  • Configuration files (httpd.conf, php.conf) - /usr/local/apache/conf

  • Apache binaries (httpd, apachectl, apxs) - /usr/local/apache/bin

  • CGI files - /usr/local/apache/cgi-bin

  • Domain access and stat log files (for all domains) - /usr/local/apache/domlogs

  • Default Apache DocumentRoot location - /usr/local/apache/htdocs

  • Header files - /usr/local/apache/include

  • Apache logs - /usr/local/apache/logs:

    • access_log (all http requests)

    • error_log (all Apache errors)

    • suexec_log (all suEXEC transactions and errors are logged here)

  • Apache manual pages - /usr/local/apache/man

  • Icon files (png, gif files) - /usr/local/apache/icons

  • Shared object (.so) files - /usr/local/apache/modules

  • Apache modules - /opt

  • Init script - /usr/local/apache/bin/apachectl (or /etc/rc.d/init.d/httpd)

  • cPanel script to restart Apache - /scripts/restartsrv httpd or /scripts/restartsrv apache

Exim

  • Conf - /etc/exim.conf (Exim's main configuration file. It is recommended that you do not edit this manually.)

  • List of domains allowed to relay/receive mail - /etc/localdomains

  • Log - /var/log/exim_mainlog (Incoming/Outgoing mails are logged here)

  • Log - /var/log/exim_rejectlog - (Exim rejected mails are reported here)

  • Log - /var/log/exim_paniclog - (Exim errors are logged here)

  • Mail queue - /var/spool/exim/input

  • Email forwarders and Catchall address file - /etc/valiases/<domain_name>

  • Email filters file - /etc/vfilters/<domain_name>

  • POP user authentication file - /home/<username>/etc/<domain_name>/passwd

  • Catchall inbox - /home/<username>/mail/new

  • POP user inbox - /home/<username>/mail/<domain_name>/<pop_username>/new

  • POP user spambox - /home/<username>/mail/<domain_name>/<pop_username>/spam

  • Program - /usr/sbin/exim (suid - -rwsr-xr-x 1 root root)

  • Init Script - /etc/rc.d/init.d/exim

  • cPanel script to restart Exim - /scripts/restartsrv exim

ProFTPD

  • Conf - /etc/proftpd.conf

  • Program - /usr/sbin/proftpd

  • Init Script - /etc/rc.d/init.d/proftpd

  • cPanel script to restart ProFTP - /scripts/restartsrv proftpd

  • Accounts file - /etc/proftpd/<username> (all ftp accounts are stored here)

  • Log - /var/log/messages, /var/log/xferlog

Pure-FTPD

  • Conf - /etc/pure-ftpd.conf

  • Program - /usr/sbin/pure-ftpd

  • Init script - /etc/rc.d/init.d/pure-ftpd

  • cPanel script to restart Pure-FTP - /scripts/restartsrv pureftpd

  • Accounts file - /etc/proftpd/<username> (all ftp accounts are stored here)

  • Log - /var/log/messages

  • Anonymous ftp document root - /etc/pure-ftpd/<ip_address>

MySQL

  • Conf - /etc/my.cnf (includes global values for the server), /root/.my.cnf (addendum to the main my.cnf file)

  • Program - /usr/sbin/mysqld (Daemon), /usr/bin/mysqld_safe (Startup script)

  • Init script : /etc/rc.d/init.d/mysql

  • cPanel script to restart MySQL - /scripts/restartsrv mysql

  • Log - /var/lib/mysql/<hostname>.err (Startup errors)

  • Data directory - /var/lib/mysql (All databases are stored here)

  • Database naming convention - <username>_<dbname> (Example: testcp_dbmysql)

    Additional Information

    Database Mapping

  • Socket file - /var/lib/mysql/mysql.sock, /tmp/mysql.sock

PostgreSQL

  • Conf - /var/lib/pgsql/data/postgresql.conf and /var/lib/pgsql/data/pg_hba.conf (Client authentication)

  • cPanel script to restart PostgreSQL - /scripts/restartsrv postgresql

  • Log - /var/lib/pgsql

  • Data Directory - /var/lib/pgsql/data (all databases are stored here)

SSHD

  • Conf - /etc/ssh/sshd_config

  • Program - /usr/local/sbin/sshd

  • Init script - /etc/rc.d/init.d/sshd

  • cPanel script to restart SSHD - /scripts/restartsrv sshd

  • Log - /var/log/secure, /var/log/messages or /var/log/auth

Perl

  • Program - /usr/local/bin/perl (Symlink: /usr/bin/perl)

  • Directory - /usr/lib/perl5 (installed via yum or up2date) or /usr/local/lib/perl5 (installed by the Perl installer)

    Additional Information

    Perl Installation Troubleshooting

  • Version - /usr/bin/perl -v or /usr/local/bin/perl -v

  • Module Installer - /scripts/perlinstaller <module_name>

    Additional Information

    Using /scripts/perlinstaller

  • Build - /home/.cpan and /home/.cpcpan (Perl module sources and information for connection mirrors)

PHP

System PHP

  • Program - /usr/local/bin/php, /usr/bin/php

  • ini file - /usr/local/lib/php.ini

  • Recompile PHP using EasyApache - /scripts/easyapache (/usr/local/cpanel/scripts/easyapache)

Internal PHP

  • Program - /usr/local/cpanel/3rdparty/bin/php, /var/cpanel/3rdparty/bin/php

  • ini file - /usr/local/cpanel/3rdparty/etc/php.ini

Named (BIND)

  • Conf - /etc/named.conf

  • Program - /usr/sbin/named

  • Init script - /etc/rc.d/init.d/named

  • cPanel script to restart named - /scripts/restartsrv named

  • Log - /var/log/messages, /var/named/data/named.run (Debug information is written to this file)

  • Zone files - /var/named/

NSD (Alternate DNS option)

  • Conf - /etc/nsd/nsd.conf

  • Program - /usr/sbin/nsd

  • Init script - /etc/rc.d/init.d/nsd

  • Log - /var/log/messages

  • Zone files - /var/named

Dovecot

  • Conf - /etc/dovecot.conf

  • Program - /usr/sbin/dovecot

  • Init script: /etc/rc.d/init.d/dovecot

  • cPanel script to restart dovecot - /scripts/restartsrv dovecot

  • Log - /var/log/maillog

Courier

  • Conf - /usr/local/libexec/courier-imap

  • Program - /usr/lib/courier-imap/libexec/couriertcpd

  • Init script - /etc/rc.d/init.d/courier

  • cPanel script to restart Courier- /scripts/restartsrv courier

  • Log - /var/log/maillog

Tomcat

  • Tomcat 5.5 Conf - /usr/local/jakarta/tomcat/conf/server.xml

  • Tomcat 7 Conf - /usr/local/easy/share/easy-tomcat/conf/

  • Tomcat 5.5 Binary Distribution - /usr/local/jakarta/apache-tomcat-${VERSION} (/usr/local/jakarta/tomcat is a symlink to this directory)

  • Tomcat 7 Binary Distribution - /usr/local/easy/share/easy-tomcat7

  • Java Development Kit - /usr/local/jdk/ (Also known as $JAVA_HOME. This directory contains the Java Runtime Environment (JRE).)

  • Enabling Tomcat servlets for a site - /scripts/addservlets --domain=example.com

  • Removing Tomcat servlets from a site - /scripts/remservlets --domain=example.com

  • Apache module configuration for jk connector - /usr/local/apache/conf/jk.conf

  • Start - /usr/sbin/stoptomcat

  • Stop - /usr/sbin/starttomcat

  • Restart - /usr/sbin/restartsrv_tomcat

  • cPanel script to restart Tomcat - /scripts/restartsrv tomcat

  • Log Tomcat 5.5 - /usr/local/jakarta/tomcat/logs/catalina.out (Activity log) & catalina.err (Error log), /usr/local/apache/logs/mod_jk.log (for jk connector)

  • Log Tomcat 7 - /var/log/easy-tomcat7

cPanel installation directory structure

The below directories can be located under /usr/local/cpanel:

  • /3rdparty - Tools like fantastico, mailman files are located here

  • /addons - Advanced GuestBook, phpBB, etc.

  • /base - phpMyAdmin, Squirrelmail, Skins, webmail, etc.

  • /bin - cPanel binaries

  • /cgi-sys - CGI files like cgiemail, formmail.cgi, formmail.pl, etc.

  • /logs - cPanel access_log, error_log, license_log, stats_log

  • /whostmgr - WHM related files

  • /base/frontend - cPanel theme files

  • /perl - Internal Perl modules for compiled binaries

  • /etc/init - init files for cPanel services

Common cPanel scripts

Listed below are common cPanel scripts. These can be located under /scripts:

  • adddns - Add a DNS zone

  • addpop - Add a POP account

  • addservlets - Add JSP support to a domain (requires Tomcat)

  • adduser - Add an user to the system

  • apachelimits - Calculates memory limits for Apache processes then adds to httpd.conf

  • biglogcheck - Looks for logs nearing 2 Gigabytes in size

  • bsdcryptoinstall - Installs Crypto on FreeBSD

  • bsdldconfig - Configures the proper lib directories in FreeBSD

  • bsdpkgpingtest - Tests the connection speed for downloading FreeBSD packages

  • buildbsdexpect - Install expect on FreeBSD

  • buildeximconf - Rebuilds exim.conf

  • buildpostgrebsd-dev - Installs postgresql on FreeBSD

  • chpass - Change cPanel passwords (does not change all passwords)

  • cleandns - Removes domains from named.conf that do not have a Zone

  • courierup - Used to update/reinstall Courier

  • cpbackup - To backup accounts (if backups enabled) (--force)

  • dnscluster - Used to synchronize DNS zones with clustered servers (--help)

  • dumpstor - Displays contents of .datastore storable files

  • dumpgdbm - Displays contents of .gdbm locale files

  • easyapache - Recompile/Upgrade Apache and/or PHP

  • editquota - Used to manually set a users quota limit

  • ensure_vhost_includes - Ensures users includes are added in httpd.conf

  • fixcommonproblems - Fixes Mailbox permissions, Mailman, CGI scripts, ndc and quotas

  • fixmailman - Fixes common Mailman issues

  • fixndc - Fixes rndc errors with named

  • fixquotas - Fixes quota problems

  • fullhordereset - Resets Horde database to a fresh one. All previous user data is lost.

  • ftpup - Used to Update/Install FTP server (Pure-FTPD or ProFTPD) to latest version

  • initquotas - Initializes quotas

  • installzendopt - Installs Zend Optimizer (through phpextensionmgr)

  • killacct - Terminate an account

  • killdns - Removes a DNS Zone

  • mailperm - Fixes permission problems with mail directories

  • makecpphp - Rebuilds internal PHP from /var/cpanel/easy/apache/profile/makecpphp.profile.yaml

  • park - To park a domain (only adds DNS)

  • pkgacct - Used to create an account backup

  • phpup - Used to update PHP only

  • phpextensiomgr - Installs IonCube, Zend Optimizer, SuHosin & eAccelerator

  • realchpass - Similar to chpass, changes cPanel password only

  • rebuildcpusers - chowns /var/cpanel/users files

  • rebuildnamedconf - Rebuilds /etc/named.conf with zones from /var/named/*.db

  • restartsrv $servicename - Restart script for services

    Additional Information

    Restart Services through WHM

  • restorepkg - Restores an account from a backup/pkgacct file (must be in /home)

  • runlogsnow - Update logs of all users

  • runweblogs - Update stats for a particular user

  • securetmp - Secures /tmp partition with options nosuexec and nosuid

  • setupftpserver - Sets which FTP server to install (Pure-FTPD or ProFTPD)

  • setupmailserver - Sets which mail service to install (Courier or Dovecot)

  • setupnameserver - Sets which DNS service to install (Bind or NSD)

  • suspendacct - Suspends an account

  • unsuspendacct - Unsuspends a suspended account

  • upcp - Updates cPanel to the latest version (--force)

  • updatenow - Updates the cPanel scripts

  • updateuserdomains - Updates /etc/userdomains entries from /var/cpanel/users

  • wwwacct - To create new accounts

Important cPanel/WHM & Config files

Listed below are important cPanel/WHM & Config files:

  • /etc/vfilters/domainname - Email filters are set here

  • /etc/userdomains - All domains are listed here (addons, parked,subdomains along with their usernames)

  • /etc/cpbackup-userskip.conf - To exclude users from backups

  • /etc/resolv.conf - Resolvers configuration file (WHM -> Networking Setup -> Resolver Configuration)

  • /etc/nameserverips - Name Servers for DNS service (WHM -> DNS Functions -> Nameserver IPs)

  • /var/cpanel/resellers - Permissions for Resellers while using addpkg script

  • /etc/chkserv.d - All the services managed by Chkservd are stored here as files (WHM -> Service Configuration -> Service Manager)

  • /etc/ipaddrpool - Lists the free IP addresses on your server

  • /etc/domainips - Dedicated IP addresses assigned to domains

  • /etc/ips - Lists IP addresses on the server (WHM -> IP Functions -> Show IP Address Usage)

  • /etc/wwwacct.conf - Account creation defaults file in WHM (Basic cPanel/WHM Setup)

  • /etc/cpupdate.conf - Update configuration file for cPanel/WHM, Packages installed by cPanel/WHM & Operating System, SpamAssasin rules

  • /etc/cpbackup.conf - Backup configuration file

  • /var/run/chkservd - WHM -> Server Status -> Service Status

  • /var/log/dcpumon - Top log process

  • /root/cpanel3-skel - Skeleton directory

  • /var/spool/exim/msglog - Email message logs

  • /var/spool/cron - Cron jobs are stored here for all users

  • /var/cpanel/users - cPanel user file that defines account settings

  • /var/cpanel/users.cache - User cache files that are read by cPanel

  • /var/cpanel/cpanel.config - cPanel configuration file (WHM -> Server Configuration -> Tweak Settings)

  • /var/cpanel/userdata - Defines parked, addon, subdomains as well as VirtualHost

  • /var/cpanel/logs - Transfer logs

  • /var/cpanel/easy/apache - EasyApache build files/profile

  • /var/cpanel/userhomes - Session home for cPanel, Horde, Roundcube, phpmyadmin

  • /var/cpanel/serviceauth - chkservd service authentication data

  • /var/cpanel/updatelogs - upcp Daily logs

  • /var/cpanel/horde - Directory which stores Horde Version, Backups and Logs files

  • /var/cpanel/roundcube - Directory which stores RoundCube Version, Backups and Logs files

  • /var/cpanel/squirrelmail - Squirrelmail version file is stored here

  • /var/cpanel/cpanelsync - DNS Clustering files

  • /var/cpanel/bandwidth - This directory includes .rrd files of domains

  • /var/cpanel/<reseller_username>.accts - Reseller account file

  • /var/cpanel/packages - Hosting packages configuration files are stored here

  • /var/cpanel/root.accts - root owned domains are listed in this file

  • /var/cpanel/suspended - All suspended accounts are listed here

  • /var/cpanel/users - cPanel users file (user account configurations such as - theme, bwlimit, addon, parked, sub-domains, etc.)

  • /var/cpanel/zonetemplates - DNS Zone template files are stored here

Standard Security Best Practices

This article describes certain standard security best practices for any Linux server and offers minimal guidelines for securing your VPS. firstfoot Interactive Pvt Ltd. recommends these settings for protection against most common attacks.

Note

The security practices described here cannot eliminate the attacks completely. You may learn more about these in detail on the Web and enhance the security further as per your needs.

Security Practices for User Accounts

Listed below are certain security practices applicable for the user accounts.

  1. The root user has all the administrative privileges on the Server. However, if compromised or hacked, this user can pose a severe security threat. It is thus recommended to avoid its use wherever possible.

  2. The trusted users of your VPS should have their specific user accounts, and should not make use of the root user. This will also be helpful to trace the activity logs on your Server.

  3. With sudo (superuser do), you can delegate a limited set of administrative responsibilities to the desired users, who can only work with the commands you allow them to.

  4. Eliminate unnecessary user accounts and disable shell access for daemons.

    • Run the below command and identify unnecessary user accounts from the passwd file:

      cat /etc/passwd

    • Delete unnecessary users using the command:

      userdel <username>

    • Disable interactive logins for daemon accounts by specifying /bin/false for the user's shell.

Security Practices for SSH Access

To Change the Default SSH port for Your Server

You may change the default SSH port for your Server. This will reduce the chances of attack; however, it is not a foolproof measure.

  1. Open the SSHD configuration file for editing using the command:

    vi /etc/ssh/sshd_config

  2. Uncomment the line corresponding to the Port directive, as shown.

    Note

    Make sure you use a port below 1024 (preferred range is 1 - 1024). You may check the IANA website for unassigned port numbers, if you want to ensure no conflicts are encountered.

    Change the SSH Port

  3. Restart the SSH service using the command:

    /etc/init.d/sshd restart

Going forward, all the SSH connections to your Server will only work on the new port specified port.

To Change the Authentication Method

You may switch to key based authentication, instead of password authentication.

To Restrict SSH Access

You may disable SSH access for the root user and create a wheel user.

  1. Open the SSHD configuration file for editing using the command:

    vi /etc/ssh/sshd_config

  2. Uncomment the line corresponding to the PermitRootLogin directive and specify the value as no, as shown.

    Disable SSH access for root

  3. Create an user with the command:

    useradd -p <password> <user>

  4. To add an user to the wheel group, open /etc/group using the command:

    vi /etc/group

    Note
    • A wheel user is a special user who is able to execute the su command to gain root or superuser access. This user does not require you to login as root every time.

    • You may also add an existing user to the wheel group.

  5. Edit as shown below:

    Original: wheel:x:10:root

    After editing: wheel:x:10:root,testuser

  6. Restart the SSH service using the command:

    /etc/init.d/sshd restart

To use root user commands, you simply need to prefix the commands with keyword sudo.

Example: The file /etc/passwd is owned by root, but can be edited by this wheel user using sudo vi /etc/passwd.

You can even switch to a root user using the command sudo su -, and type exit to return to your normal user.

Installing ConfigServer Firewall (CSF)

ConfigServer Firewall (CSF) is an advanced firewall suite for Linux systems that enhances the security on your Server. It also has the Login Failure Daemon (LFD) process that regularly scans for failed login attempts on your Server and takes action against the offending IP Addresses.

Note

This documentation assumes that you are connected to the Server using an SSH client as a root user.

To Install CSF on a Server

  1. Change the present working directory to /usr/local/src using the command below. You may choose any other directory of your choice, where you want the installation script to be downloaded.

    cd /usr/local/src

  2. Run the below command to download the archive file to the present working directory:

    wget https://configserver.com/free/csf.tgz

  3. Extract the files using the command:

    tar xfz csf.tgz

  4. Go to the CSF directory using the command:

    cd csf

  5. To install CSF:

    • On a Server Without any Hosting Panel

      Run the general installation script ./install.generic.sh.

    • On a Server With cPanel or DirectAdmin

      • Run the installation script ./install.cpanel.sh to install CSF on a Server with cPanel.

      • Run the installation script ./install.directadmin.sh to install CSF on a Server with DirectAdmin.

    The CSF Firewall will be installed in the /etc/csf directory and the allowed inbound/outbound port configuration will be adjusted as per the current settings. You can make further adjustments through the configuration file /etc/csf/csf.conf.

  6. Restart the firewall for the changes to take effect using the command:

    /etc/init.d/csf restart

  7. You can disable the testing flag by changing the value for TESTING from 1 to 0 in the configuration file /etc/csf/csf.conf using an editor like vi.

    Note

    Ensure that all your custom firewall settings are working perfectly before you disable the testing mode.

    Disabling Testing Mode

  8. Restart the Firewall again.

To Manage CSF

CSF can be managed through the Command Line Interface. The command csf would present a list of commands and the information related to them.

CSF Commands

A few basic commands are:

  • Allowing an IP Address

    csf -a <ip_address>

  • Denying an IP Address

    csf -d <ip_address>

You can manage the CSF settings from your WHM Panel (Home >> Plugins).

Managing CSF through WHM

Regaining Server Access / Locked Out due to cPHulk

Brute force is an attack (hacking) method that involves using an automated system to guess the password to your web server or services. cPHulk is a WHM feature that helps protect your web server from malicious users who try to gain unauthorized access through brute force attacks.

The IP Address details in cPHulk are maintained in the form of a MySQL database. In case you are locked out of your server due to cPHulk, you need to follow the below process to regain server access.

To Regain Server Access / Locked Out due to cPHulk

  1. Login to your VPS through SSH.

  2. Stop the MySQL service using the command:

    service mysql stop

  3. Go to https://<Your_VPS_IP_Address>:2087 and try logging in.

  4. Now, go to Home -> Security Center -> cPHulk Brute Force Protection and delist/whitelist your local system's IP Address.

  5. Start the MySQL service using the command:

    service mysql start

Hosting your websites

This article will help you to setup the hosts, in case you want to run multiple websites on your VPS. This is similar to setting up a shared server that hosts multiple websites, using a single shared IP Address.

Note
  • This documentation assumes you've already installed the LAMP stack on your VPS. If you haven't done that yet, refer to the LAMP installation guide.

    Additional Information

    Getting your VPS LAMP ready

  • Ensure that you are connected to the server using an SSH client as a root user.

  • Website management becomes easier through cPanel or Plesk. If you have installed any of these panels, you need not follow this documentation.

Hosts Setup

The process to host a single website is different from hosting multiple sites.

To Host a Single Website

If you want to host only one domain name in the VPS, then all you need to do is point your domain name to the IP Address of the VPS. This can be done by simply adding an A record for the domain name from the DNS interface of the VPS.

By default, the document root of your server is /var/www/html. You can upload the contents of your site in this directory. The website can also be accessed using the IP Address of the VPS.

To Host Multiple Websites

If you want to host multiple domain names in the same VPS, then you would be required to create a virtual host entry in your Apache configuration file. Refer to the steps mentioned
below.

  1. Assume you want to host the websites for domain names domain1.com and domain2.com. You'll first have to create directories for each website under /var/www/html. You can create the directories from Plesk Power Panel's - File Manager or via SSH. The steps given below are using the Command Line Interface.

    Navigate to the directory /var/www/html.

    cd /var/www/html

    Create the directories for each website.

    mkdir domain1.com

    The directories will be created as below.

    Creating Directories

  2. Open the Apache configuration file by using the command:

    vi /etc/httpd/conf/httpd.conf

    Scroll down to the end of this file, uncomment the lines and add your domain names as shown below.

    Editing Apache Configuration File

    The various paramaters in Name based Virtual Hosting are:

    • NameVirtualHost: Designates an IP address for Name based Virtual Hosting

    • <VirtualHost>: Contains directives that apply only to a specific hostname or IP Address

    • ServerAdmin: Email address that the Server includes in error messages sent to the client

    • DocumentRoot: This directive sets the directory from which httpd will serve files for this host

    • ServerName: Used to uniquely identify the Virtual Host; FQDN (Fully Qualified Domain Name) format to be used

    • ServerAlias: This directive is used to set the alternate names for the host

    • ErrorLog: Location where the Server will log errors for this host

    Additional Information

    If you want to learn more about Virtual Hosts or customize them further, you may refer to the Apache Virtual Host documentation.

  3. For the configuration changes to take effect, you need to restart the Apache service using the command:

    service httpd restart

  4. To check how these sites will resolve or to test their functioning, you can add sample html files.

    Create the index.html files for domain1.com and domain2.com.

    vi /var/www/html/domain1.com/index.html

  5. In order to access the websites prior to setting up their DNS zones, you can edit your local computer's hosts file.

    Additional Information

    Modifying the hosts file

    For actual resolution over the Internet, create A records for each domain name pointing to the IP Address of the VPS, in their respective DNS zones.

Uploading Content through FTP

You can upload the content using any FTP client of your choice using the below details:

  • Host: <Your_VPS_IP_Address>

  • Username: root

  • Password: Password for the root user (same as your VPS password)

  • FTP Type: SFTP

  • Port: 22

This is a complete setup with minimal configuration. You can customize or secure your website further as per your needs.