Showing posts with label Bandwidth Throttling. Show all posts
Showing posts with label Bandwidth Throttling. Show all posts

Monday, December 16, 2013

How to Setup and Configure WebHTB in Debian Squeeze

First of All we will ready our server as an Web Server with Database & SSL Support:

    # apt-get install mysql-server mysql-client apache2
    # apt-get install openssl ssl-cert
    # mkdir /etc/apache2/ssl
    # make-ssl-cert /usr/share/ssl-cert/ssleay.cnf /etc/apache2/ssl/apache.pem
    # a2enmod ssl
    # /etc/init.d/apache2 force-reload
    # cp /etc/apache2/sites-available/default /etc/apache2/sites-available/ssl


Change the SSL port 80 to 443:


# vim /etc/apache2/sites-available/ssl

=>> change <VirtualHost *:80> to

       <VirtualHost *:443>


=>> Add the following two lines between <virtualHost> container


</VirtualHost>
SSLEngine On
SSLCertificateFile /etc/apache2/ssl/apache.pem

</VirtualHost>


ReEnable SSL and forcefully restart the services:

# /etc/init.d/apache2 force-reload
# a2ensite ssl
# /etc/init.d/apache2 restart


Download and Install the required Packages:

# apt-get install libphp-adodb php5-cli php5-gd php-pear php5-snmp php5-adodb phpmyadmin curl libnet-netmask-perl

Downlad and configure WebHTB package and upzip package:

# apt-get install bzip2
# cd /var
# wget http://www.webhtb.ro/downloads/WebHTB_V2.9.bz2
# tar -jxvf WebHTB_V2.9.bz2
# chown -R www-data.www-data /var/webhtb



Now add the following lines in ssl file:

# vim /etc/apache2/sites-available/ssl


Alias /webhtb /var/webhtb
<Directory "/var/webhtb">
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
SSLEngine On


The ssl file should look like this Finally (In my case)
=======================================
<VirtualHost *:443>
        ServerAdmin webmaster@localhost
        Alias /webhtb /var/webhtb
        <Directory "/var/webhtb">
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        allow from all
        </Directory>
        SSLEngine On

        DocumentRoot /var/www
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </Directory>

        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn
SSLEngine On
SSLCertificateFile /etc/apache2/ssl/apache.pem

        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
================================================

Restart the apache2 service:

# a2ensite ssl
# /etc/init.d/apache2 restart


Go to your favorite web browser and navigate the following Link:
https://Server-Ip-Address/webhtb/setup/


Now the Graphical Mode config will start......

    >> Give the mysql root password in the asking password text boxes...
    >> Chose the appropriate interface.. {Remember it should be your LAN facing interface not WAN }
    >> After pressing Apply it will redirect you https://Server_Ip_Address/webhtb/index.php#


=======================================================================
$$$$$ Here you Don't Need to add any new Interface bcoz you have already assigned a NIC in Setup Phase.
=======================================================================

Add Class from the (Classes+) Menu:

    >> Go to Classes+  >> Add Classes >> Add a New Class page will arrive..{add here as you need}

Now you have to Add Client:

    >> Go to Add client Menu
                >> CLINT can be any name but PCName (Client PC)can be a good one.
                >> BANDWIDTH IS IN kbps (kilo bit not byte)
                >> LIMIT (Limit at a certain bandwidth as you want...)
                >> MAC (You can apply policy through specific MAC)
                >> BURST & PRIORITY should be default (If you are not an Advanced User)
                >> UPLOAD (You can specify upload throttle speed)

            Optional:
                >> SRC IPS should be your gate way ip   
                >> DST IPS should be your Client PC IP