CodeNewbie Community 🌱

Sharon428931
Sharon428931

Posted on

SafeLine WAF Lab Setup: DVWA + Ubuntu Prerequisites

Before you dive into deploying SafeLine WAF, there are a few essential prerequisites to ensure your setup goes smoothly. This guide walks you through preparing a homelab environment using Ubuntu Server and Kali Linux, along with the Damn Vulnerable Web Application (DVWA) for testing.


Step 2: Prerequisites

2.1 Clone DVWA from Git

cd /var/www/html
sudo git clone https://github.com/digininja/DVWA.git
Enter fullscreen mode Exit fullscreen mode

If git is not installed:

sudo apt-get install -y git
Enter fullscreen mode Exit fullscreen mode

2.2 Set File Permissions

sudo chown -R www-data:www-data DVWA
sudo chmod -R 755 DVWA
Enter fullscreen mode Exit fullscreen mode

2.3 DNS Resolution Setup

Edit /etc/hosts on both Kali and Ubuntu:

sudo nano /etc/hosts
Enter fullscreen mode Exit fullscreen mode

Add the following line:

10.0.0.147 dvwa.local
Enter fullscreen mode Exit fullscreen mode

This allows access to DVWA at:

http://dvwa.local:8080/DVWA/
Enter fullscreen mode Exit fullscreen mode


2.4 Ubuntu Configurations

Install OpenSSL

sudo apt-get install -y openssl
Enter fullscreen mode Exit fullscreen mode

Install and Configure LAMP Stack

sudo apt-get install -y apache2 php php-mysql mysql-server
sudo mysql_secure_installation
# Set MySQL root password: ubuntu (testing purposes)
Enter fullscreen mode Exit fullscreen mode

Update DVWA Config File

Edit DVWA/config/config.inc.php:

$DBMS = 'MySQL';
$db   = 'dvwa';
$user = 'dvwa_user';
$pass = 'p@ssw0rd';
$host = 'localhost';
Enter fullscreen mode Exit fullscreen mode

Create DVWA Database and User

sudo mysql -u root -p
Enter fullscreen mode Exit fullscreen mode

Inside MySQL shell:

CREATE DATABASE dvwa;
CREATE USER 'dvwa_user'@'localhost' IDENTIFIED BY 'p@ssw0rd';
GRANT ALL ON dvwa.* TO 'dvwa_user'@'localhost';
FLUSH PRIVILEGES;
exit;
Enter fullscreen mode Exit fullscreen mode

Initialize DVWA

Visit:

http://dvwa.local/setup.php
Enter fullscreen mode Exit fullscreen mode

Click Create/Reset Database.


2.5 Change DVWA Listening Port to 8080

sudo nano /etc/apache2/ports.conf
Enter fullscreen mode Exit fullscreen mode

Change:

Listen 80
Enter fullscreen mode Exit fullscreen mode

to:

Listen 8080
Enter fullscreen mode Exit fullscreen mode

2.6 Change Apache Virtual Host Port

sudo nano /etc/apache2/sites-available/000-default.conf
Enter fullscreen mode Exit fullscreen mode

Update:

<VirtualHost *:8080>
    ...
</VirtualHost>
Enter fullscreen mode Exit fullscreen mode

Restart Apache:

sudo systemctl restart apache2
Enter fullscreen mode Exit fullscreen mode

✅ Next Step: With your environment ready, we can move on to installing and configuring SafeLine WAF to protect DVWA.


Join the SafeLine Community

If you continue to experience issues, feel free to contact SafeLine support for further assistance.

Top comments (0)