运行系统更新
首先,确保系统软件包是最新的。
apt update
apt upgrade
在Debian 10上安装LAMP Stack
创建DVWA数据库和数据库用户
LAMP堆栈安装完成后,继续创建MariaDB DVWA数据库和数据库用户。
mysql -u root -p
创建DVWA数据库,相应地替换数据库名称。
create database dvwa;
创建DVWA数据库用户并授予所有权限,相应地替换数据库用户。
grant all on dvwa.* to dvwauser@localhost identified by '[email protected]';
重新加载权限表并退出数据库。
flush privileges;
quit
在Debian 10上安装DVWA
在apache web DVWA root目录中下载并安装/var/www/html
。
删除默认的apache index.html
文件。
rm -rf /var/www/html/index.html
将最新版本的DVWA克隆到Apache默认的Web根目录。
apt install git vim
git clone https://github.com/ethicalhack3r/DVWA /var/www/html/
检查/var/www/html/
的内容。
ls /var/www/html/
about.php config docs external hackable index.php login.php phpinfo.php README.md security.php vulnerabilities
CHANGELOG.md COPYING.txt dvwa favicon.ico ids_log.php instructions.php logout.php php.ini robots.txt setup.php
在Debian 10 Buster上配置DVWA
配置DVWA数据库连接详细信息。 首先重命名示例配置文件 /var/www/html/config/config.inc.php.dist
到 /var/www/html/config/config.inc.php
cp /var/www/html/config/config.inc.php.dist /var/www/html/config/config.inc.php
接下来,编辑配置文件,/var/www/html/config/config.inc.php
并设置数据库连接详细信息。
vim /var/www/html/config/config.inc.php
相应地替换数据库和数据库用户和密码。
... # Database variables # WARNING: The database specified under db_database WILL BE ENTIRELY DELETED during setup. # Please use a database dedicated to DVWA. # # If you are using MariaDB then you cannot use root, you must use create a dedicated DVWA user. # See README.md for more information on this. $_DVWA = array(); $_DVWA[ 'db_server' ] = '127.0.0.1'; $_DVWA[ 'db_database' ] = 'dvwa'; $_DVWA[ 'db_user' ] = 'dvwauser'; $_DVWA[ 'db_password' ] = '[email protected]'; ...
安装recaptcha密钥
生成后,只需将网站密钥和网站密钥复制并粘贴到,$_DVWA[ 'recaptcha_public_key' ]
和 $_DVWA[ 'recaptcha_private_key' ]
... # ReCAPTCHA settings # Used for the 'Insecure CAPTCHA' module # You'll need to generate your own keys at: https://www.google.com/recaptcha/admin $_DVWA[ 'recaptcha_public_key' ] = '6Lc4BsMUAAAAAKs72dKl4ZTVsA8giXiN7yqQcoVz'; $_DVWA[ 'recaptcha_private_key' ] = '6Lc4BsMUAAAAAI9v0sd_xvlh_PMXTcgtqRYJ6VEd'; ...
保存并退出配置文件,然后重新启动MariaDB,
systemctl restart mariadb
配置php
安装所需的php gd模块。
apt install php-gd
我们这里安装的PHP版本是7.3.
php -v
PHP 7.3.11-1~deb10u1 (cli) (built: Oct 26 2019 14:14:18) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.3.11, Copyright (c) 1998-2018 Zend Technologies with Zend OPcache v7.3.11-1~deb10u1, Copyright (c) 1999-2018, by Zend Technologies
继续编辑 /etc/php/7.3/apache2/php.ini
进行以下更改。
vim /etc/php/7.3/apache2/php.ini
) ) display_errors =off
(可选)隐藏php警告消息以减少冗长
保存并退出php配置文件
将DVWA Web根目录的所有权设置为Web服务器用户。
chown -R www-data:www-data /var/www/html
重启apache
systemctl restart apache2
通过浏览器完成DVWA设置
导航到web浏览器并使用地址DVWA访问http://server-IP/login.php
。