Hướng dẫn trong này được tìm hiểu mà thực nghiệp trong mô hình lab để xem những lệnh đó có thực sự hiệu quả và thực hiện đúng chức năng trong hệ điều hành CentOS 7 không. Bạn hoàn toàn có thể tin chắc rằng những lệnh và trình tự được nêu trong này sẽ giúp bạn cấu hình DVWA chính xác trên hệ điều hành CentOS 7.
Trang 1#yum update
#yum install wget
#vi /etc/selinux/config SELINUX=disabled
#setenforce 0
#sestatus
Disable the Firewall
#service iptables stop
#chkconfig iptables off
1 Preliminary Note
rpm import /etc/pki/rpm-gpg/RPM-GPG-KEY*
yum -y install epel-release
2 Install mysql
#wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
#sudo rpm -ivh mysql-community-release-el7-5.noarch.rpm
#sudo yum install mysql-server
#sudo systemctl start mysqld
#mysql_secure_installation
Sau đó chúng ta tạo các liên kết khởi động hệ thống cho MySQL (để MySQL khởi động
tự động bất cứ khi nào hệ thống khởi động) và khởi động máy chủ MySQL:
systemctl start mysqld
To log in to MySQL as the root user:
#mysql -u root -p
3 Cài đặt Apache httpd Server
#yum -y install httpd
#systemctl start httpd.service
#service httpd start
#ps -eaf | grep httpd
#chkconfig level 2345 httpd on
To be able to access the web server from outside, we have to open the HTTP (80) and HTTPS (443) ports in the firewall The default firewall on CentOS is firewalld which can be configured with the firewalld-cmd command
Trang 2firewall-cmd permanent zone=public add-service=http
firewall-cmd permanent zone=public add-service=https
firewall-cmd –-reload
http://192.168.172.128
4 Cài đặt PHP
Thêm kho Remi CentOS.:
rpm -Uvh http://rpms.remirepo.net/enterprise/remi-release-7.rpm
Cài đặt yum-utils vì chúng ta cần có tiện ích yum-config-manager
yum -y install yum-utils
Để cài đặt PHP 5.4, chạy lệnh này:
yum -y install php
Cài đặt PHP 7.0
yum-config-manager enable remi-php70
yum -y install php php-opcache
Cài đặt PHP 7.1
yum-config-manager enable remi-php71
#yum -y install php php-opcache
#yum install php-mysql
#yum install php-pear php-pear-DB
5 Thử nghiệm PHP, chi tiết về cài đặt PHP
vi /var/www/html/info.php
<? php
phpinfo ();
?>
#http://192.168.172.128/info.php
6 Hỗ trợ Mysql trong PHP
Để có được hỗ trợ MySQL trong PHP, chúng ta có thể cài đặt gói php71w-mysql Đó là một ý tưởng tốt để cài đặt một số mô-đun PHP khác cũng như bạn
có thể cần chúng cho các ứng dụng của bạn Bạn có thể tìm kiếm các mô đun PHP5 có sẵn như sau:
#yum search php
Chọn những cái cần và cài đặt như sau:
Trang 3#yum -y install php-mysql
Trong bước tiếp theo, tôi sẽ cài đặt một số mô đun PHP phổ biến được yêu cầu bởi CMS Systems như Wordpress, Joomla và Drupal:
#yum -y install gd ldap odbc pear xml xmlrpc php-mbstring php-soap curl curl-devel
#systemctl restart httpd.service
Reload:
# http://192.168.172.128/info.php
7 PHPMyAdmin cài đặt:
#yum -y install phpMyAdmin
Bây giờ chúng ta cấu hình phpMyAdmin Chúng ta thay đổi cấu hình Apache
để phpMyAdmin cho phép kết nối không chỉ từ localhost (bằng cách bình luận trong <RequireAny> câu và thêm dòng 'Require all granted'):
#vi /etc/httpd/conf.d/phpMyAdmin.conf
Restart Apache
#systemctl restart httpd.service
http://192.168.1.100/phpmyadmin/
I Install DVWA
1 Cài đặt mã nguồn:
#cd /var/www/html
#wget
http://www.computersecuritystudent.com/SECURITY_TOOLS/DVWA/DVWAv1 07/lesson1/DVWA-1.0.7.zip
a Grab the DVWA-1.0.7 application
b Remember to down the zip file from computersecuritystudent and not googlecode
#ls -l | grep DVWA
Trang 4c Confirm DVWA-1.0.7.zip was downloaded
Unzip Package
Instructions:
#unzip DVWA-1.0.7.zip
Remove Zip File
Instructions:
1 #ls -lrta
2 #rm DVWA-1.0.7.zip
3 y
#cd /var/www/html/dvwa/config
#cp config.inc.php config.inc.php.BKP
#chmod 000 config.inc.php.BKP
#vi config.inc.php
Configure config.inc.php
Instructions:
1 Arrow down to the line that contains db_password
2 Arrow right and place your cursor on the second single quote
3 Press "i"
This puts the vi editor into INSERT mode
4 Type "dvwaPASSWORD"
5 Press <Esc>
This takes the vi editor out of INSERT mode
6 Type ":wq!"
This save the config.inc.php file
Trang 51 Restart Apache
o Instructions:
1 #service httpd restart
Restart Apache
2 #ps -eaf | grep -v grep | grep httpd
Make sure Apache is running
Trang 62 Start up a Web Browser
o Instructions:
1 Applications > Internet > Firefox
o Notes:
1 At this point, you can start up a web browser on any computer on your network (Windows, Mac, Whatever you want)
Trang 7 DVWA Database setup
o Instructions:
1 #http://192.168.1.116/dvwa/setup.php
Replace 192.168.1.116 with the IP Address obtained from Section 3, Step 3
2 Click the Create / Reset Database button
Trang 82 DVWA Creation Messages
o Instructions:
1 You should see the below database created, data inserted, and setup successful messages
2 Click on Logout
o
Trang 93 Login to DVWA
o Instructions:
1 Username: admin
2 Password: password
o
4 Welcome to DVWA
o Informational (FYI):
1. Click Here for subsequent lessons
Trang 10Section 9 Proof of Lab
1 Proof of Lab
o Instructions:
1 echo "select user,password from dvwa.users;" | mysql -uroot -pdvwaPASSWORD
2 date
3 echo "An Toàn Thông Tin"
Replace the string "Your Name" with your actual name
e.g., echo "EDU VN"
1 Do a PrtScn
2 Paste into a word document
3 Email to AnToanThongTin.Edu.VN@Gmail.Com
Trang 11o