Thursday 7 June 2018

Roundcube (Webmail) on CentOS /RHEL 7

To install roundcube on CentOS 7 followings are the prerequisite that should be installed.
In My Case i have already installed Postfix with dovecot on CentOS 7 with
  • Domain name = hackthesec.co.in
  • Hostname = tec.hackthesec.co.in

Follow below Steps to install & configure latest versions of Roundcube :

Step:1 Install PHP , Database & Apache using below command :

[root@hackthesec ~]# yum install httpd php php-common php-json php-xml php-mbstring php-imap php-pear-DB php-mysql mysql mariadb-server
Once the above package list is installed , set the time zone value in PHP .
root@hackthesec ~]# vi /etc/php.ini
date.timezone = Asia/Delhi
Save & exit the file

Step:2 Create & Configure Roundcube Database

Let us first set the Initial settings & root password of Mariadb Server :
[root@hackthesec ~]# systemctl start mariadb
[root@hackthesec ~]# systemctl enable mariadb
ln -s '/usr/lib/systemd/system/mariadb.service' '/etc/systemd/system/multi-user.target.wants/mariadb.service'
[root@hackthesec ~]#
[root@hackthesec ~]# mysql_secure_installation
Above Command “mysql_secure_installation” will allow us to set root password , remove anonymous users , disable remote root login and will remove test database.
Now Create database for Roundube and grant all the permissions to the database

Step:3 Download tar file of Roundcube

Download latest version of Roundcube tar file either from their official site “https://roundcube.net/download/” or we can use below wget command.
[root@hackthesec ~]# wget http://nchc.dl.sourceforge.net/project/roundcubemail/roundcubemail/1.1.3/roundcubemail-1.1.3-complete.tar.gz
Untar the downloaded file in your web server document root.
[root@hackthesec ~]# tar -zxpvf roundcubemail-1.1.3-complete.tar.gz -C /var/www/html/
Rename the extracted file as Roundcube and set the required permissions
[root@hackthesec html]# mv roundcubemail-1.1.3 roundcube
[root@hackthesec html]# chown apache:apache roundcube
Start the Apache service
[root@hackthesec html]# systemctl start httpd
[root@hackthesec html]# systemctl enable httpd
ln -s '/usr/lib/systemd/system/httpd.service' '/etc/systemd/system/multi-user.target.wants/httpd.service'
[root@hackthesec html]#

Step:4 Start Roundcube installation using web browser installer.

To start the installation of Rouncube , access the below url in the web browser

click on Next…
Define the Database, Authentication Mechanism, SMTP & IMAP setting in this step. When We click on Create Config option it will ask us to Copy or download the configuration and save it as config.inc.php within the /var/www/html/roundcube/config/ directory of your Roundcube installation.
In my case i am using http based authentication mechanism , so i create one user on my Linux box and set its password using htpasswd command .
Linux box and set its password using htpasswd command .
[root@hackthesec ~]# htpasswd -c /home/hackthsec/.htpasswd hackthsec
New password:
Re-type new password:
Adding password for user hackthsec
[root@hackthesec ~]#


Remove the installer directory from your web server document root (/var/www/html/roundcube )
[root@hackthesec ~]# cd /var/www/html/roundcube/
[root@hackthesec roundcube]# rm -rf installer
[root@hackthesec roundcube]#

Step:5 Now access your account using Roundcube

Open the url in the browser “http://tec.hackthsec.co.in/roundcube/” , use the credentials that we set using htpasswd command.

Tuesday 29 May 2018

MANAGING DATABASE USERS

MANAGING DATABASE USERS

To access MySQL databases, you must first create at least one user. The following procedures describe how to manage MySQL database users using cPanel.
Creating a database user
To create a MySQL database user, follow these steps:
  1. In the Databases section of the cPanel home screen, click MySQL® Databases.
  2. Under Add New User, type the MySQL username in the Username text box.
  3. In the Password text box, type the user password.
  4. In the Password (Again) text box, retype the user password.
    You can click Password Generator and cPanel generates a random, strong password for you.
  5. Click Create User.
Changing a user's password
You can change a database user's password. You may want to do this for security reasons (changing passwords periodically is a good security practice), or you may need to do this if you forget the password.
To change a MySQL user's password, follow these steps:
  1. In the Databases section of the cPanel home screen, click MySQL® Databases.
  2. Under Current Users, locate the user for which you want to change the password, and then click Set Password.
  3. In the Password and Password (Again) text boxes, type the new password.
    You can click Password Generator and cPanel generates a random, strong password for you.
  4. Click Change Password. The new password takes effect immediately.
Renaming a user
To rename a MySQL user, follow these steps:
  1. In the Databases section of the cPanel home screen, click MySQL® Databases.
  2. Under Current Users, locate the user that you want to rename, and then click Rename.
  3. In the text box, type the new name, and then click Proceed.
Deleting a user
When you delete a user, the user and its database permissions are deleted.
To delete a MySQL user, follow these steps:
  1. In the Databases section of the cPanel home screen, click MySQL® Databases.
  2. Under Current Users, locate the user that you want to delete, and then click the red X icon.
  3. Click Delete User to confirm the deletion.

MANAGING DATABASES

After you create a database user, you are ready to create a database and associate the user with the new database.
Creating a database
To create a MySQL database, follow these steps:
  1. In the Databases section of the cPanel home screen, click MySQL® Databases.
  2. Under Create New Database, type the name of the database in the New Database text box.
  3. Click Create Database.
    When you create a database, your username is added to the database name. For example, if your username is username, and you create a database named database, the actual MySQL database name is username_database.
Adding a user to a database
To add a MySQL user to a database, follow these steps:
  1. In the Databases section of the cPanel home screen, click MySQL® Databases.
  2. Under Add User to Database, select the user that you want to add in the User list box.
  3. In the Database list box, select the database.
  4. Click Add.
  5. Click the check boxes to grant the user specific privileges, or click the ALL PRIVILEGES check box to grant the user all permissions to the database.
  6. Click Make Changes.
Checking and repairing a database
You can check MySQL databases for errors or possible corruption. If a database check reveals problems, you can repair the database as well.
To check and repair a database, follow these steps:
  1. In the Databases section of the cPanel home screen, click MySQL® Databases.
  2. To check a database:
    • Under Modify Databases, select the database in the Check DB list box.
    • Click Check DB.
  3. If a database check indicates problems with a database, you can repair it:
    • Under Modify Databases, select the database in the Repair DB list box.
    • Click Repair DB.
Removing a user from a database
When you remove a user from a database, the user can no longer access the database.
To remove a MySQL user from a database, follow these steps:
  1. In the Databases section of the cPanel home screen, click MySQL® Databases.
  2. Under Current Databases, locate the user that you want to remove, and then click the red X icon.
  3. Click Delete User from Database to confirm the deletion.
Deleting a database
Before you delete a database, make sure that you have a backup copy if you want to save any information that it contains.
When you delete a database, its associated users are not deleted. However, all permissions users have for that database are deleted.
To delete a MySQL database, follow these steps:
  1. In the Databases section of the cPanel home screen, click MySQL® Databases.
  2. Under Current Databases, locate the database that you want to delete, and then click Delete Database.
  3. Click Delete Database to confirm the deletion.

Managing a MySQL database in PHPMyAdmin

  1. This tutorial assumes you’ve already logged in to cPanel, and are starting on the home screen.
  2. Now let’s learn how to manage a database with phpMyAdmin.
  3. Click the "phpMyAdmin" icon.
    cpanel-pl-mysql-11-phpmyadmin-02
  4. This is the phpMyAdmin main page. It is from here that you can manage all MySQL databases that exist in your hosting account.
    cpanel-pl-mysql-11-phpmyadmin-03
  5. In the top left corner, you’ll see an entry with your account user name. Click the "plus sign" to its left.
    cpanel-pl-mysql-11-phpmyadmin-04
  6. You’ll now see a list of databases in your account. Click the one you want to manage.
    cpanel-pl-mysql-11-phpmyadmin-05
  7. You can now start managing your database. You can manage tables, add or delete entries, and perform queries among other things.
    cpanel-pl-mysql-11-phpmyadmin-06

Creating a database in cPanel using the MySQL Database Wizard

Creating a database in cPanel using the MySQL Database Wizard

  1. Log into your cPanel.
  2. Click the MySQL Database Wizard under the Databases heading.
  3. Next to New Database enter a name for your database and click Next Step.
  4. Next to Username enter a username.Enter a password next to Password, enter it again for Password (Again) and then click Create User.
  5. On the next page, you'll assign privileges for the user to the database. Check the box next to All Privilegesand then click Next Step.

Congratulations, now you know how to successfully create a database!

How to add a new subdomain and change its settings

How to add a new subdomain and change its settings


Subdomain
 
The subdomain is an extension of the primary domain that the user can create independently through his control panel (cPanel). The subdomain is used if you want to set up a new, independent web site on the same hosting, but you don’t need a different domain from the primary one. If the main domain is domain.mk, you will recognize the subdomains as a supplement to the main domain, for example: subdomain1. domain.mk, subdomain2.domain.mk, etc. You can access the subdomain through subdomain.domain.mk or domain.mk/sudomain. Additionally, for each created addon domain a new subdomain is automatically created.
 
Instructions for creating a subdomain
 
Step 1: Log in to your cPanel account (domain_name/cpanel) with the appropriate username and password.
Step 2: In the Domains section, click on Subdomains.

subdomail

Step 3:
In the newly opened window in the Subdomain section, enter the name of the subdomain you want to create.
- If you have more active domains on your hosting, from the Domain drop-down menu, select the domain you will use to create the subdomain.
- In the Document Root section, set the path where you want to create the folder on the subdomain, where your web site will be set up. The example given in the image, the folder on the subdomain proba.mkhost.com.mk is placed in the public_html folder. If you do not fill the Document root field, it will automatically be filled and the subdomain folder will be in the home directory (/).
- Click on the Create button

subdomain2
By doing this, the procedure for creating a subdomain is completed.
Have in mind that, after creating a specific subdomain, you should wait to refresh DNS zones (sometimes it may not be available immediately online). Our suggestion is to create the subdomain first (without first accessing it in a browser), wait 5 minutes after creation, and then access it.
Setting certain changes to a created subdomain 
Certain changes can be made to an existing subdomain. To change the path, first find the subdomain in the Subdomains -> Modify a Subdomain section, and in the Document Root section, click on the edit icon..
 
subdomain3

In the newly opened window, enter the new path. Then, click the Change button.


subdomain4

If you want to redirect the subdomain to another domain, click the Manage Redirection button and enter the link to which you want the subdomain to be redirected, then click on the Save button.

subdomain5

Creating FTP Accounts and linking

To create a new additional FTP account:

  1. Go to Home > FTP Accounts.
  2. On the FTP Accounts tab, click Create FTP Account.
  3. Specify the FTP account name in the appropriate field.
  4. Specify the Home directory by clicking  and select the directory required. Alternatively, you can specify the path in the input field.
  5. Type the new password into the New password and Confirm password boxes.
  6. Specify what FTP user can do with files and folders, and how much disk space on the server he or she can occupy:
    • To limit the amount of disk space, clear the Unlimited check box next to the Hard disk quota box, and type the amount of disk space in megabytes.
    • To allow the FTP user to view the contents of the home directory and download files from it, select the Read permission check box.
    • To allow the FTP user to create, view, rename and delete directories in the home directory, select the Write permission check box.
      If
      you do not grant any permissions, a connection to the FTP account will 
      be made, but the contents of the home directory will not be shown to the
      user.
  7. Click OK. A new FTP account will be added

Installing your cPanel SSL Certificate


How to manage SSL hosts and the shared certificate in WHM


  
1) Go to SSL/TLS in the menu.
2) Click Manage SSL Hosts.
3) If you have any Installed SSL Hosts or certificates, you can delete each one using its Delete button. Or, you can share an SSL host's certificate by selecting it in the menu, then pressing Share.
The SSL certificate we chose has now been set as the shared certificate. Now, any user on the server can access their account through that domain. For example, the user mysite3's account could be accessed through the shared SSL host as such:https://www.demo123.com/~mysite3/
4) Return to the previous page.
5) To disable the Shared Certificate, click Disable.
The SSL certificate is no longer shared.