Work with your team to deploy Question2Answer as a three-tiered web app, with a protected database back-end in your secure zone, users web browser clients in the outside zone, and the web server middleware in your dmz. Then clone your web server, so that you have two middleware servers, and deploy a load balancer in the dmz to leverage both web servers. The web server redundancy will improve your app’s availability, and with both web servers functioning properly, it should also scale your web app to be able to handle more simultaneous clients.
Phase I:
Phase II:
Upload an illustrated tutorial, in which you explain what your team did and how you accomplished it.
Examples:
(Phase I)
(Phase II)
Hints:
GRANT ALL PRIVILEGES ON QUE2ANS.* TO "Lieutenant"@"localhost" IDENTIFIED BY "u_will_Never_guess";
"localhost"
with the IP address of that host as a double-quoted string, such as "10.9.8.7"
.SHOW DATABASES;
and SELECT User,Host,Password FROM mysql.user;
might help you.apt search php-mysql
(for Debian/Ubuntu distros)
or dnf search php-mysql
(for RedHat-style distros).
470.php
(the name doesn’t matter, choose whatever filename you like
as long as it ends with a .php extension) in your web server’s DocumentRoot folder (usually /var/www/html
)
and put this one line of code in that file: <?php phpinfo(); ?>
Then restart your web server, and use a web browser to visit http://localhost/470.php
(or whatever
name you chose). If everything’s working, you should see a PHP status page, and somewhere on that
page it should show that it’s configured to use the MySQLi extension.apt search php-json
(Debian/Ubuntu)
or dnf search php-json
(RedHat), and if you find it, it might not hurt to go ahead and install that too.ls -Z
command,restorecon
command,httpd_can_network_connect
SELinux flags with the getsebool
command,semanage boolean
commands.Enforcing
to Permissive
or even Disabled
.
For a worthy security professional, that should only be a last resort.
Try to get your web app working within the SELinux control regime.
Permissive
mode to get the system up and running.
But after that, keep working on it, perhaps on a separate system, until you figure out how to make it work
properly in Enforcing
mode. Then show your success to your supervisor, and schedule a change request
to make the appropriate changes and put the web server’s SELinux mode back up to Enforcing
.haproxy.cfg
configuration file.
Instead, create your own frontend
and backend
configurations, with the load
balancer “frontend” bound to port 80/tcp, and each web server “backend” also relaying through port 80/tcp.$ModLoad imudp
and $UDPServerRun 514
directives in rsyslogd’s configuration file,
then configure haproxy.cfg
so that HAProxy sends its syslog messages to 127.0.0.1
. You should
see HAProxy log entries in /var/log/messages
or /var/log/syslog
. (You could also
configure a custom rsyslogd logging rule, which corresponds to whatever logging facility and priority
are configured in haproxy.cfg
. Then your logs would be sequestered to whatever file you specified
in your custom rule.) Generate some web traffic by accessing your Question2Answer web app
from a web browser, and look carefully at the logs HAProxy generates to see evidence that
successive web requests are proxied to different “backend” web servers.check.html
on both, but which on the first host contains the text “original”
and embeds a bright image, but on the clone contains the text “clone” and embeds a duller-hued image;
also, put different favicon.ico
icon files on each host.
Then use your web browser to repeatedly reload check.html
,
and notice that the content changes and/or the site icon changes color with each reload.To test your load balancer’s ability to keep serving Question2Answer through service outages,
use systemctl
to start and stop the web service on a web server.