Open main menu

CDOT Wiki β

Changes

OPS335 Lab 6

2,416 bytes added, 18:50, 16 March 2019
Controlling Access to Pages
# Create a new directory called '''private''' inside your '''DocumentRoot''' and move index.php inside it.
# Have your partner view both files again.<br><br>You will now modify the settings on the web-server to prevent machines outside our network from accessing the private directory.<br><br>
# Add the following directory statement to your apache configuration file. The default pathname for the apache configuration file is: '''/etc/httpd/conf/httpd.conf''' (NOTE: replace the X with your own network octet): {{Admon/important |Do not overwrite existing settings|There should already be two Directory statements in that file. One for '''/var/www''' and one for '''/var/www/html'''. Add your new Directory statement after them. Do not overwrite them.}} <source>
<Directory "/var/www/html/private">
AllowOverride None
</Directory>
</source>
 
{{Admon/important |Do not overwrite existing settings|There should already be two Directory statements in that file. One for '''/var/www''' and one for '''/var/www/html'''. Add your new Directory statement after them. Do not overwrite them.}}
This sets up separate rules and access permissions for that subdirectory. Your partner should no longer be able to access any pages in the private directory (or any sub-directories of it), but your other internal machines (including your host) should still have access.
# Re-start the web-server and try to access the page from another machine. Make sure that you can '''not''' do so before you continue.
# Install the '''php-mysql''' module so that the installation of php your web server is using can execute sql statements. You will have to restart the service after installing it.
#Modify the index.php page in your private directory to match the code below. This will test that your web server can connect to the database (replace the <user, > and <password, and database > with values appropriate for your machine):<br><source>
<?php
$mysqli = new mysqli("localhost", "<user>", "<password", "database>");
if ($mysqli->connect_errno) {
echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
== INVESTIGATION 3: INSTALL, CONFIGURE &amp; RUN WEBMAIL APPLICATION (Roundcube Mail) ==
 
*This investigation was under construction after it somehow did not get saved properly. Students in Fall 2017 are not required to complete this investigation.
{|cellpadding="15" width="40%" align="right"
</li>
::If your machine does not have the semage command, use yum to install the policycoreutils-python package.
<li>You will also need to tell selinux to allow the webserver to open connections to the MTAs with <source>setsebool -P httpd_can_network_connect 1</source></li><li>In the directory now named "webmail", there will be a file named '''INSTALL''' which will walk you through the rest of the Roundcube installation.<br /><br />Some installation tips to consider:
::* Be careful about copying &amp; pasting the MySQL setup part: take time and pay attention to detail: do not try to "rush it".
::* You will need to install additional Apache modules including: '''php-xml''' and '''php-mbstring'''.
::* Don't forget to set the password in the roundcube configuration.</li> <li>To make things easier, RoundCube has a well configured installation page available through your local web browser (You will see a note about it in the '''INSTALL''' file).</li>  ::* Go onto your host, open Firefox and on the address bar type "vm1.<yourSenecaID>.ops/webmail/installer", make sure your dns on host can resolve the web address. Alternatively, instead of "vm1.<yourSenecaID>.ops" you can input the ip address of your vm1, "192.168.X.2/webmail/installer", change X to your own IP octet. ::* Inside the web browser installer, ensure all required options are "'''ok'''", if "'''DOM: not ok'''" it means you need to install additional php packages (yum install php-xml php-mbstring). Once everything is ready (it will not let you continue otherwise) click next go to the next page. ::* On the next page, insert "vm3.<yourSenecaID>.ops" under the '''imap settings''' '''default_host''' field and "143" in '''default_port''' field. Insert "vm2.<yourSenecaID>.ops" under '''smtp settings''' '''smtp_server''' field, and "25" in '''smtp_port''' field. ::* Under '''Database setup''' '''db_dsnw''', enter "localhost" as your database server, "roundcubemail" for database name. Put "roundcube" as Database user, and the password you set for the roundcube user when you configured that in the previous steps for database password. Everything else can be left as default. ::* Click next to create the configuration file, then download it to your host. By default it will be saved under "~SenecaID/Downloads". Transfer the files to vm1 using scp and place it inside /var/www/html/webmail/config folder. ::* Go to test config page if you are not there already and "Check config file" should be ok. "Check DB config" should also be ok, if not check your mysql settings. ::* Finally test your configuration by sending email using your smtp server through test field provided by webmail installer, you should receive a test email sent by RoundCube. Test your IMAP settings by simply loging in with your SenecaID and vm3 password on the same webpage. ::* If everything works properly you can skip to step 10. *Remember you can edit the configuration file manually by editing "/var/www/html/webmail/config/config.inc.php".
</li>
<li>Note that both of your IMAP and SMTP servers are on different machines (i.e. not on vm1). Therefore, you will need to set should see custom values in the following options for parameters in the Roundcubeconfiguration file:
::* '''$config['smtp_server']'''
</li>
<li>You should be able to test the configuration in your Now that you have Roundcube installer after completing Step 3. One installed it is able time to contact both servers, test if the roundcube webmail application is working by logging onsending on, then sending and receiving e-mail messages.:
*Using a webbrowser, navigate to vm1.<yourdomain>.ops/webmail and login.
*Use the interface provided to send and receive email.</li><li>If mail sent through roundcube is sending from the wrong domain (i.e. user@vm3.yourdomain.ops instead of user@yourdomain.ops), each user can override it in the settings tab, or you can set:::* '''$config['mail_domain']''' </li></ol>
'''Record steps, commands, and your observations in INVESTIGATION 3 in your OPS335 lab log-book'''
572
edits