System and Network Administration (SNA) - Assignment: December 2017
System and Network Administration (SNA) - Assignment: December 2017
net/publication/331177953
CITATIONS READS
0 9,559
1 author:
SEE PROFILE
All content following this page was uploaded by Abdurraouf Fathi Sawehli on 18 February 2019.
INSTRUCTIONS TO CANDIDATES:
1
GROUP ASSIGNMENT
CT106-3.5-2-SNA
SYSTEM AND NETWORK ADMINISTRATION
NAME TP NUMBER
1. CHAN LEK KEAT
3. WU YICHEN TP042884
2
Project management:
Approach:
The approach that we followed to accomplish the assignment values is
that all of us should contribute in doing all the enhancements in a way that each
one of us will be involved in each step of the assignment. That helped us to
improve our technical skills and to expand our knowledge in system and network
administration.
Basically, in each enhancement was at least two group members
performing the value’s configuration and the other two assuring that the
configuration steps are done correctly and to carry out some researches if there
is any obstacle. Moreover, the other two are responsible for documenting the
configuration steps and the difficulties that we faced so we can include them in
the assignment documentation. By following that, we could mange to work in
effective manner and avoid wasting our time as possible as we could. In all the
way, all the configuration files were examined and tested in each step we pass to
make sure that our system is working probably.
We also created a shared google drive word file to save all the
configuration steps while we are implementing the values, further, snapshots
were taken to include them in the documentation as the last result or if there is
any obstacle, so we can refer to it in the next meeting and we do not get
confused.
We considered that in each time we complete a question or value, we start
its documentation directly to manage our time efficiently. Most of our meetings
were held in APU main campus and successfully most of the group mates
attended them. We also created a WhatsApp group to discuss any topic or
sharing useful resources that might help us in doing our assignment.
3
The division of tasks:
Many researches were carried out in all the assignment stages and each
one of us had to choose a task which needs to be the owner for. That does not
mean he will work on it individually as we all were involved in each step, but he is
as a leader for the selected value while we are implementing it. To add on that,
each one of us were required to try the question that we will implement in the
next meeting on our own virtual machines and then we implement it in our main
system whether he could accomplish it or not. The next table shows the question
name and its owner as well as the contribution’s percentage for each member.
N WU CHAN ABDURRA
NICHOLAS
O TASK WITH ITS OWNER: YICHE LEK OUF
CHIN
. N FATHI
4
Question 2 (ALL MEMBERS): 26% 24% 26%
5
using email via telnet.
5.3 [Bonus: 5] Reconfigure
one of the above to use
authentication via keys
and sshagent.
Question 6 (ALL MEMBERS): 26% 24% 26%
6
Question 10 (ALL 30% 24% 36%
MEMBERS):
7
Gantt Chart:
The next table shows how manged our time to complete our assignment and how we
consumed it for each enhancement.
8
Base project scenario: Sending mail using stunnel and MSA
MSA stands for Mail Submission Agent which allows us to correct minor errors in a
message’s format (such as syntax error, mistyped domain name. etc.) and instantly report
an error to the user so that it can be corrected before the process terminates / the mail is
sent to the recipients. Also, it has a dedicated port number 587, and it is always possible
for users to send new mails when connected to the domain. (Gellens & Klensin,
11/14/2013)
Stunnel encrypts the connection between gateway and mailhost. It listens on the port
specified in its configuration file and forwards the data to the original daemon listening
on its usual port. (PORTAL, 2016)
List the relevant configuration files, and for each one briefly describe what was done
9
Sending mail by using Telnet
10
Login screen for Squirrelmail
11
Any Outstanding/Unresolved Issues
Everything went smoothly. We did follow instructions which were given during lab
classes.
Value [5]
1. On your WebServer, set up two virtual servers (VirtualHost) in addition to the
webmail
2. Set up two normal users
3. Configure the system so users cannot serve web pages or run cgi scripts from their
home directories, and cannot access the virtual server document root, but can
upload files for web/cgi (hint-use a staging area, permissions like /tmp and
/home/vmail, and cron)
Task Owner:
This task required to set up two virtual servers (VirtualHost) and setting up two normal
users in the system. By doing so, the webmail will serve different files in different
locations. The users will also not be able to run cgi scripts from their home directories
and access the virtual server document root, but they can upload files for web/cgi.
12
List the relevant configuration files, and for each one briefly describe what was done
Setup two virtual servers
/usr/monkey/monkey.conf
- First, we need to configure the /usr/monkey/monkey.conf file in the WebServer
machine to set up virtual servers (VirtualHost).
3. We edit the file by adding the lines as shown below:
<Virtualhost>
VirtualServerName original.tinynet.edu
VirtualDocumentRoot /var/www/example/htdocs
VirtualScriptAlias /cgi-bin/ /var/www/example/scripts/
VirtuaForceGetDir off
</Virtualhost>
<Virtualhost>
VirtualServerName alice.tinynet.edu
VirtualDocumentRoot /var/monkey/htdocs/alice
VirtualScriptAlias /cgi-bin/ /var/monkey/htdocs/alice/scripts/
VirtuaForceGetDir off
</Virtualhost>
<Virtualhost>
VirtualServerName bob.tinynet.edu
VirtualDocumentRoot /var/monkey/htdocs.bob
VirtualScriptAlias /cgi-bin/ /var/monkey/htdocs/bob/scripts/
VirtuaForceGetDir off
</Virtualhost>
- When the file is edited, we now have 2 virtual servers available, they are called
“alice” and “bob”.
13
Configuring file path for VirtualDocumentRoot
/var/monkey/htdocs
- Now, we need to satisfy this line in the monkey configuration file:
VirtualDocumentRoot /var/monkey/htdocs/alice (VirtualHost for “alice”)
- To do this, we go to /var/monkey/htdocs/directory and create 2 new directories
inside it. They are called </alice> and </bob>.
- Change the permission of both directories with chmod, make it unreadable,
inexecutable and unsearchable by others
- Change the owner and group for the directory by using Ch0wn to change the
owner name and group name to nobody
By doing the steps as shown above, the users will not be able to access the virtual server
document root. Sticky bit is also required to prevent the users from deleting and
executing the document root.
By doing the steps as shown above, the users will not be able to run cgi scripts from their
home directories.
14
/home/username/
- In this task, the users in the machine cannot serve web pages or run cgi scripts
from their home directories. The best way to do this is to deny user access to their
home directories.
- To do this, we go to /home/username, we change the owner of both </alice> and
</bob> by using ch0wn command, we set the owner name and group name to
nobody.
By changing the owner of the home directories to nobody, the user cannot access their
home directories, thus cannot serve web pages or run cgi scripts from their home
directories.
By adding directories of the users in tmp, the users can upload files for web/cgi/
15
- Create a shell scripts in the directory: (the purpose of this shell script is to tell the
program to check for the availability of htdocs in var/monkey directory)
- We created a shell script named “sitepages” and coded it as follows:
#!/bin/sh
mv -f /opt/sitetemp/* /var/monkey/htdocs
- After the shell script has been created and moved to the /etc/cron.hourly/
directory, we need to tell the system to create a new cron job by executing the
code as follows:
crontab -e
59 * * * * /etc/cron.hourly/sitepages
The system will run hourly cron jobs at 59 minutes after the hour, basically executing the
sitepages scripts that we created every hour.
After all the steps above are done, the WebServer has two virtual servers (VirtualHost)
set up and running, the user can choose to login as “root” or login as normal users that we
created, “alice” and “bob”, and the normal users cannot cannot serve web pages or run
cgi scripts from their home directories, and cannot access the virtual server document
root, but can upload files for web/cgi.
16
Demonstration of using user “alice” to login with “alice1” as the password.
17
User “alice” cannot access home directory in /home/username/
User “alice” cannot access the /var/monkey/htdocs directory, which is the document root
The system lists out the active cron jobs by executing %crontab -u root -l command
18
The last line showing that the system will check for the availability of sitepages script
every hour.
Best References
www.my-tiny.net
http://www.cyberciti.biz/faq/how-do-i-add-jobs-to-cron-under-linux-or-unix-oses/
https://www.cyberciti.biz/tips/howto-run-cron-job-nth-week-day.html
19
Value [5]
Choose one server and
1. Allow no root access: force users to use sudo (like ubuntu)
2. Limit ssh access to only some users and no root logins
3. Have different color prompts for normal users and root
Task Owner:
SSH, also known as Secure Shell, is a protocol used to securely log onto remote system.
It allows a user to login to a system from other machines remotely. For security purposes,
it should be restricted to normal users and only certain users such as administrator can
use the SSH feature. In this task, the access to SSH for root logins has been disabled and
only two users will be able to access SSH. The system will also force users to use sudo
before the users execute any command. Different color prompts are also implemented for
users and root. In this case, the root will have red colour prompt and normal users will
have green colour prompt.
List the relevant configuration files, and for each one briefly describe what was done
Create normal users in the system (MailHost)
- In this task, multiple user accounts are required to set up in the system to carry
out the functions.
- We created three normal user accounts in the system. We created the user
accounts by execute %adduser command and enter the user details as follows:
#user account 1: kenneth; password: kenneth1
#user account 2: richard; password: richard1
#user account 3: raouf; password: raouf1
- After the %adduser command and all the required information has been entered,
the system will now have three user accounts set up and ready to use.
20
Make changes to sudoers
/etc/sudoers
- We need to force the users to use sudo features (like Ubuntu).
- To do this, we need to go to /etc/sudoers and edit the file as follows:
# User privilege specification
root ALL=(ALL) ALL
kenneth ALL=(ALL) ALL
richard ALL=(ALL) ALL
raouf ALL=(ALL) /usr/sbin/monkey -D
- We configured user “raouf” to have access to /usr/sbin/monkey -D only to make
the output to have significant difference with the other users.
By changing the /etc/sudoers file, the system will force the users to use sudo.
21
%/etc/rc.d/rc.sshd start
By doing the steps as above, only user “kenneth” and “richard” can access SSH service.
The root logins have also been disabled as well.
From the steps above, the command is basically telling the system to verify the type of
the user logged in. If the user ID is = 0 (root), the system will use red colour (01;31m) as
the colour prompts. If the user ID is not = 0 (not root, other users), the system will use
green colour (01;32m) as the colour prompts.
By doing all the steps above, the system (MailHost) will not allow any root access and
will force users to use sudo (like ubuntu). SSH service is also limited to permitted user
access only and no root logins. The system will also show red colour prompts when user
logged in as root account and green colour prompt if the user logged in as normal user
account.
22
Screenshots of tests, with explanations
Output of sudo
23
Output of user “raouf” trying to access midnight commander as root.
24
The colour prompt for other users are green.
25
User “raouf” trying to access SSH service by logging in as root.
Users that specified in the “AllowUsers” in SSH configuration file, “kenneth” in this
case, can use SSH service
Output of access granted when logging in as authorized user specified in sshd_config file.
26
Obstacles encountered, obstacles overcome
The colour prompts of the users will be red no matter what type of users logged in. There
were minor typing mistakes in the file. Overcame the problem by retyping the command.
Best References
https://www.digitalocean.com/community/tutorials/how-to-use-ssh-to-connect-to-a-
remote-server-in-ubuntu
https://linuxacademy.com/blog/linux/linux-commands-for-beginners-sudo/
http://www.my-tiny.net/M09-usrmgt.htm
http://www.my-tiny.net/M10-prompt.htm
27
Value [5]
1. Setup SASL plaintext authentication
2. Explain which authentication mechanisms may be more suitable for specific
configurations
Task Owner:
SASL, also known as Simple Authentication and Security Layer, is used for security
authentication and data security in internet protocols. In this task, SASL plaintext
authentication is responsible to collect credentials and verify authentication.
List the relevant configuration files, and for each one briefly describe what was done
Configure Postfix
/etc/postfix/main.cf
- We need to configure the file for postfix to make Postfix service uses SASL
plaintext authentication mechanism. In our case, we are using MailHost server to
demonstrate the application of SASL plaintext authentication.
- To do this, we go to Postfix configuration file, that is /etc/postfix/main.cf and edit
the file as follows:
#smtpd directives
smptd_sasl_auth_enable = yes
broken_sasl_auth_clients = yes
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_security_options = noanonymous
#smtpd_recipient_restrictions:
permit_mynetworks
28
permit-sasl_authenticated
reject_unauth_destination
Making changes to the main.cf file as above to setup SASL authentication service for
postfix. After the changes has been made, SASL authentication service is now able to run
on postfix properly. The broken_sasl_auth_clients configuration option lets Postfix
repeat the AUTH statement in a form that these broken clients understand (Postfix SASL
Howto), the output will be similar to this:
Configure Dovecot
/etc/dovecot.conf
- After Postfix have been configured, we need to configure Dovecot service to use
SASL plaintext authentication as well. This is because we had specified this line
in the Postfix configuration file:
smtpd_sasl_type = dovecot
29
user = root
socket listen {
client {
path = /var/spool/postfix/private/auth
mode = 0660
user = postfix
group = postfix
}
}
}
The path line indicates that the system will place the Dovecot SASL socket
in /var/spool/postfix/private/auth directory. Mode = 0660 limits read and write
permission, and only available for user and group postfix only. Mechanisms = plain login
provides plain and login as mechanisms for the Postfix SMTP server. Making changes to
the dovecot.conf file as above, SASL authentication service is available for dovecot
service by using “plain login” mechanisms.
After restarting the services required, SASL plaintext authentication should be working
on the system.
30
2. Types of authentication mechanisms
31
There are two choices of security services provided by IPSec: Authentication
Header (AH), which essentially allows authentication of the sender of data and
Encapsulating Security Payload, this supports both authentication of the sender and
encryption of data as well. The specific information associated with these services is
inserted into the packet in a header that follows the IP packet header. ISAKMP/ Oakley
protocol can be selected as separate key protocols.
Kerberos Service
Kerberos Service also known as Kerberos authentication protocol provides a
mechanism for authentication and for mutual authentication between a client and a server
or between one server and another server. Users, machines and services using Kerberos
need only trust the KDC, which runs as a single process and provide two services: an
authentication service and a ticket granting service.
KDC tickets provide mutual authentication, allowing nodes to prove their identity to one
another in a secure manner. Kerberos also uses conventional shared secret cryptography
to prevent packets travelling across the network from being read or changed and to
protect message from attacks. To start the Kerberos authentication process, the initiating
client sends a request to an authentication server for access to a service. The initial
request will be sent as plain text as no sensitive information in included in the request.
32
Screenshots of tests, with explanations
Creating user account “kenneth” with “kenneth1” as password
33
Generating the base64 encoded authentication information for user “kenneth”
Testing the authentication with telnet services and postfix by using information of user
“kenneth”
Testing out SASL plaintext authentication with squirrelmail and login as user “kenneth”
34
Output for successfully log into the squirrelmail with user “kenneth”
35
Log file for dovecot that shows the evidence of SASL plaintext authentication while
logging into squirrelmail. The location of the log file is in /var/log/dovecot.IMAP
We can see from the file that user “kenneth” logged in the Dovecot service and using
“method=PLAIN”. This indicates the SASL plaintext authentication took place in the
authentication phase.
36
Obstacles encountered, obstacles overcome
Best References
http://www.my-tiny.net/L14-ssl.htm
https://www.arschkrebs.de/slides/surviving_cyrus_sasl-handout.pdf
http://www.postfix.org/SASL_README.html
https://wiki.archlinux.org/index.php/Postfix_with_SASL
https://www.centos.org/docs/5/html/CDS/ag/8.0/Introduction_to_SASL-
Authentication_Mechanisms.html
37
Value [5]
1. Demonstrate xinetd port forwarding (outlined in RHL-RG 15.4.3.3)
2. For both telnet and tftp
3. Explain how telnet and tftp are useful for working with a cisco router or switch
Task Owner:
Xinetd stands for Extended Internet Daemon. Xinetd listens for incoming requests
over tinynet network and launches the appropriate service for that request. Requests are
made using port numbers as identifiers and xinetd usually launches another daemon to
handle the request.
Xinetd allows me to restrict connection to specific IP addresses and to specify TCP
ports and server IP address on which to listen. Xinetd configuration can be customized
according to our needs on the system.
List the relevant configuration files, and for each one briefly describes what was done
Using mc to open telnet file under /etc/xinetd.d working directory and then add bind
192.168.76.101 to locate the host. Choose a port number for host as we use the default
38
port 23. Add redirect 192.68.56.191 23 demonstrates that the redirected host will be
192.168.56.192 on port 23.
Using mc to open tftp file under /etc/xinetd.d working directory. Change disable =
yes to disable = no because we intend to set up tftp service. Bind the service with the IP
address of the gateway server, then specify the port number that we will be using (in this
case, we choose default port number 69).
root@if0m1nc is the host that requests for redirecting telnet service, while
192.168.76.101 is the IP of gateway server. Then make sure it is using port 23 as we have
configured. The system displays login option to if0m1na which is the host with IP
address of 192.168.56.191.
39
Enter tftp 192.168.76.101 69 to specify the destination and the port that the service
will be using. Next, the output shows that we are successfully connected to the host via
tftp service.
We cannot retrieve any files from redirected destination using tftp service.
How telnet and tftp are useful for working with a cisco router
Telnet allows network administrators to access the console on a router and issue
commands there. It simplifies the process of configuring the network. The TCP/IP
Telnet app allows system admins to remotely communicate with a device. Telnet with
IP network sends and receives the data remotely, rather than a specialized cable and
physical port on the device that is the case when directly connected computer with the
device in first configuration setup for not connected device. The Telnet application
calls a Telnet client and the device that listens for commands and replies to them a
Telnet server.
Tftp can help network administrators to move or update configuration files with
ease. Tftp helps regular backups of Cisco router configuration files and keep copies in
a safe place. If there is a serious failure that damages a router’s hardware or software,
the configuration will be destroyed. However, using tftp to backup the last working
configuration file, system administrators can usually get a router working again within
minutes of fixing any hardware problems
Best References
Task Owner:
List the relevant configuration files, and for each one briefly describe what was done
42
Obstacles encountered, obstacles overcome
Best References
43
Multitail Bonus [5]
1. Reconfigure one of the above to use authentication via keys and sshagent
Task Owner:
List the relevant configuration files, and for each one briefly describe what was done
Best References
44
Value [10]
1. Setup openvpn using static keys
2. Have two sets of config files, one for tun and one for tap
Task Owner:
Using the generated key to encrypt the connection between server and client in tiny
net. It implements virtual private network techniques for creating secure point to point
connection in bridged configurations.
List the relevant configuration files, and for each one briefly describe what was done
General Configuration
Change the current working directory to where the config CD is located and then run
the SetupMenu file.
45
Choose the install other packages sections and then press enter
46
Skip down to the openvpn section.
47
Fill up the blanks following the give instruction and then the certificate and key is
generated. Both server and client should run the same certificate authority keys and
certificate. These sets of files should be shared between both server and client so that
they can generate server and client keys and certificates for authentication.
48
Changing current working directory to /usr/doc/openvpn-2.0.9/easy-rsa and then
entering ./build-key-server server to generate a set of server keys and certificates. Type y
when signing the certificate is required(basically we don’t get a choice as we must key in
y to continue).
49
encrypts the communication between clients and server.
Complete the same steps for client , but change ./build-key-server server to ./build-
key-client client for generating a set of key and certificate for clients.
Copy the ca certificates and keys to clients as they have to match to set up the
communication.
Server Configuration Files
In server.conf, port 1194 defines the port that openvpn listens on. Uncommented
proto tcp defines which server we use and in this case, we use TCP (tun setup) because it
will create a routed IP tunnel for tun service. ca, cert, dh and key are files that we
generated in previous steps. Server configures server mode and supplies a VPN subnet
and the server will take 10.8.0.1 for itself as default. Keepalive causes ping-like message
to be sent back and forth over the link so that each side knows when the other side has
gone down. 10 20 defines that pinging every 10 seconds, assuming that remote peer is
down if no ping is received during a 120 seconds time period. Comp-lzo enables
compression on the VPN link. Persist options will intend to avoid accessing certain
resources on restart. Status outputs a short status file including current connections and
rewrite the file openvpn-status.log every minute.
Client Configuration Files
50
Client specifies the role of client for that particular machine. Remote defines the
internet protocol and port of the server. Nobind defines that the client do not need to be
binded to a specific local port number. The rest of the configurations are identical to the
server.conf.
Tun setups
51
make a directory called /dev/net and make a nod to /dev/net/tun
TAP Setups
Copy a set of tun configurations and rename them to tap-server.conf and tap-
client.conf as they have many similarities.
In tap-server.conf, we changed dev tun to dev tap0 as we use TAP interface. Change
proto tcp to proto udp as TAP interface sends udp packets but not tcp packets. We add
server-bridge to set the IP address 192.168.8.4 for the bridge interface that shares with
eth0 interace of openvpn server and then define the IP range from 128 to 254 as usable
52
IPs for clients.
In tap-client.conf, we changed dev tun to dev tap as we use TAP interface for clients.
Change proto tcp to proto udp as TAP interface sends udp packets but not tcp packets.
Tun Testing
53
Changing the current working directory to where we save the client.conf on the client
side and entering openvpn client.conf to start the openvpn service. Initialization sequence
completed means that the openvpn service is successfully deployed on the client side.
Once the client starts openvpn service, the server will display a few lines of output
showing a client is connected.
54
Now, pinging server from the client is working. IP packets can be sent over to the
server using openvpn service.
TAP Testing
Make /dev/net directory before starting configuration and make a nod on tun
interface so that openvpn recognizes the initialization of tun/tap interface. This process
should be done on both server and client.
55
server-side openvpn service is deployed.
56
Once the client side starts the openvpn, a list of outputs indicating a client with an IP
192.168.76.183 has established the connection.
Because of the success establishment, the client can ping the bridge interface of the
server by entering its IP address which is 192.168.8.4.
Error messages indicated that /dev/net files or directories do not exist on my system,
so I looked it up on the internet and then I found out that I must create device node and
57
tun/tap driver for openvpn service.
When aprogram opens /dev/net/tun, driver creates and registers corresponding net
device.
At last, I created the directory by entering mkdir /dev/net and created device node
by entering /dev/net/tun c 10 200.
Best References
Christoph, 2004. Re: [Openvpn-users] openVPN can't find /dev/net/tun. [Online]
Available at: https://openvpn.net/archive/openvpn-users/2004-04/msg00136.html
[Accessed 18 December 2017].
58
value [10]
1. Setup a VM using the TinyNet-gcc image
2. Install the asciiart package from the configuration CD
3. Compile the toilet source code
4. Demonstrate using shell scripts
Task Owner:
This task allows users to use asciiart package and creates ASCII art from plain text.
List the relevant configuration files, and for each one briefly describe what was done
Setup GCC virtual machine
- Setup a new virtual machine by using TinyNet-gcc.iso
- Make the virtual machine to have 320MB memory
- Make the virtual machine to have 500MB dynamically allocated hard drive
storage
- Install liloinst.sh as the base operating system for the virtual machine
59
The system print out “hello” using figlet art.
2. Fortune art
The system will print out random facts stored in the package.
- For example, when we are executing %echo -e "\e[01;32m"; fortune |boxes; echo
-e "\e[00m", the system will print out something like this:
The system will print out a random fact in green colour (01;32m)
3. Caesar art
The system will print out the user input word by using Caesar art.
- For example, when we are executing %echo abc|caesar 3, the system will print out the
next 3 word of the user input, in this case it is “def”.
- %echo abc|caesar (print "cde")
- %echo -e "\e[01;32m"; fortune |caesar 4 |boxes; echo -e "\e[00m" (print random fortune
stuffs with caesar format) like this:
60
Libcaca.
- We can find toilet-0.3.tar.gz, sl-5.02.tar.gz and Libcaca-0.99.beta19.tar.gz in the
/opt/ directory.
- As the files are compressed, we need to extract them. We open the content
inside the file and extract them in the same /opt/ directory.
- As the result, we will have 3 files available in the /opt/ directory. They are
/libcaca-0.99.beta19, /sl-5.02, /toilet-0.3
- Then, we need to let the system configure all 3 of the files by using %make
command
61
until the system finish configuring the file.
Testing toilet.build
/root/
- To test that whether we have properly configured the toilet source code, we can
tell the system to run a shell script by using the component stored in toilet source
code.
- We can do it by creating a new “toiletscript.sh” shell scripts by using “cat >”
command
- We configured the shell script to contain the following code
$ while true;
do echo "$(date '+%D %T' | toilet -f term -F border --gay)";
62
sleep 1;
done
- The code above is telling the system to display the system time and date every
second by using toilet component.
- We need to set the permission for the shell script to make the shell script
executable.
- After that, we can test out the shell script by executing the shell script with the
command %./toiletscript.sh
When the toiletscript.sh is executed, the system will display the time date every second,
as shown below:
63
Output for boxes with “cat” style.
64
Output for Caesar, fortune and boxes
65
Obstacles encountered, obstacles overcome
The system unable to run the toiletscript.sh shell script. Overcame by recreating a new
shell script file and set proper chmod permission.
Best References
http://www.my-tiny.net/L18-aart.htm
http://www.my-tiny.net/L20-make.htm
https://www.linux.com/learn/linux-tips-fun-figlet-and-toilet-commands
66
Value [10]
1. Setup the LDAP sever with two domains (o= and dc=)
2. Configure dovecot and squirrelmail to use LDAP
3. Get LDAP using stunnel
Task Owner:
Setting up the LDAP with multiple domains create a hierarchical structure for storing
information. In this task, the system creates organizational units, individuals and
resources in the network. By configuring dovecot, users can use LDAP to access
squirrelmail and the connection will be more secure with stunnel encryption.
List the relevant configuration files, and for each one briefly describe what was done
Enable LDAP service by making LDAP file executable
/etc/rc.d/rc.ldap
- We make the LDAP service available by chmod and apply the proper permissions
for the service. The command used is
chmod 755 /etc/rc.d/rc.ldap
- Restart rc.ldap service to apply the changes to the settings.
/etc/rc.d/rc.ldap stop
/etc/rc.d/rc.ldap start
67
by dn="cn=LDAPAdmin,o=tinynet.edu" write
by self write
by * read
68
objectClass: dcObject
objectClass: organization
o: MyTinyNet
dc: tinynet
description: LDAP Root
- The code snippets above is for the LDAP Root.
dn: cn=LDAPAdmin,dc=tinynet,dc=edu
objectClass: organizationalRole
objectClass: simpleSecurityObject
cn: LDAPAdmin
description: LDAP Administrator
userPassword: {PLAIN}slapmesilly
- The code snippets above is for the LDAP admin user.
dn: ou=UserNetA,dc=tinynet,dc=edu
ou: UserNetA
objectClass: top
objectClass: organizationalUnit
description: User on Net-A
- The code snippets above is for the user that is using LDAP service.
- We configured UserNet-B and UserNet-C section same as the UserNet-A.
69
cn: Barbara Jensen
- Then, we need to tell the program to create the Second DIT or domain that we
have configured in the LDAP file by executing the code as follows:
%ldapadd -x -D “cn=LDAPAdmin,dc=tinynet,dc=edu” -w slapmesilly -f
/etc/openldap/topclass.ldif
Configuring Dovecot
/etc/dovecot/dovecot.conf
- Now, we need to configure Dovecot service to use LDAP service. We can do it
by editing the /etc/dovecot/dovecot.conf file and uncomment this section of the
coding as shown below:
passdb ldap {
# Path for LDAP configuration file
args = /etc/dovecot/dovecot-ldap.conf
}
userdb ldap {
# Path for LDAP configuration file
args = /etc/dovecot/dovecot-ldap.conf
}
passdb passwd-file {
args = /home/vmail/mail-pwd
}
userdb static {
args = uid=vmail gid=vmail
}
- These lines of codes are telling the system where to look for the LDAP
configuration file and file used to store password in the system.
70
- We need to tell the program to access the LDAP server address so that the
Dovecot service can use LDAP service.
- We can do it by editing the /etc/dovecot/dovecot-ldap.conf file and change the
localhost address to the LDAP server as follows:
hosts = ldap.tinynet.edu
71
);
/config_plugins.php
- We need to tell squirrelmail to use the LDAP plugin.
- We can do it by editing the /config_plugins.php file in the squirrelmail directory
by uncommenting the following line:
# 3rd party –
# allows users to search the Directory Servers by name and
# lookup phone numbers, addresses, and other data
#$plugins[8] =’ldapquery’;
Configuring stunnel
/etc/rc.d/rc.stunnel
- Stunnel is required for LDAP in this task. By doing this, LDAP service can run
more securely with stunnel running.
- We can do it by making /etc/rc.d/rc.stunnel executable
chmod 755 /etc/rc.d/rc.stunnel
- Then, we need to get stunnel working by editing the /rc.stunnel file and make
changes as follows:
/usr/sbin/stunnel $LINE to /etc/stunnel $LINE
After all the steps above are done, the LDAP is now properly set up with two domains,
(o=) and (dc=). Dovecot service and squirrelmail are also able to use LDAP service when
running. Stunnel is also available for LDAP to use and makes the data transmission more
secure.
72
Screenshots of tests, with explanations
Creating the First DIT in topclass.ldif
73
Creating the Second DIT in topclass.ldif
74
The program adds the Second DIT
75
Change localhost address to LDAP server
76
Configuring config_plugins.php to enable LDAP plugin.
77
Configuring rc.stunnel file to make stunnel uses LDAP
None.
Best References
http://www.my-tiny.net/L11-slapd.htm
http://www.my-tiny.net/L12-ldif.htm
http://www.my-tiny.net/L13-ldap.htm
http://www.my-tiny.net/L14-ssl.htm
http://www.yolinux.com/TUTORIALS/LinuxTutorialLDAP-LDIF-example1.html
https://serverfault.com/questions/828490/setting-up-multiple-domain-in-ldap-server
78
Value [10]
1. Put the Dovecot mail directory and the webserver VirtualHost DocumentRoot
directories on a new VM NFS mount
2. Set up the webpage staging area and VirtualHost users on the NFS server, and
allow them ssh access to the staging area.
3. Run the staging area to document root cron jobs on the NFS server.
Task Owner:
Network File System, also known as NFS, is a client and server application that lets
computer user view, and provide the ability to store and update files on a remote
computer like they are using their own computer. Users can access the files and make
changes any time using any computer as long as the NFS service is available on all the
machines.
List the relevant configuration files, and for each one briefly describe what was done
Finding the required files
/home/vmail/ and /var/monkey/htdocs/
- First, we need to locate the directories for Dovecot mail and VirtualHost
DocumentRoot. The location of these files are as follows:
Dovecot mail directory: /home/vmail/ (MailHost)
VirtualHost DocumentRoot: /var/monkey/htdocs/ (WebServer)
79
- For WebServer (VirtualHost DocumentRoot)
We edit the files by typing in as follows:
/var/monkey/htdocs *(ro,sync,no_root_squash,no_subtree_check)
The * in the file indicates that all the files in that directory is visible to others and
can be mounted to the NFS server. “ro” permission indicates that the file can be
read and visible to all other users.
- For MailHost (Dovecot mail directory)
We edit the files by typing in as follows:
/home/vmail/ *(rw,sync,no_root_squash,no_subtree_check)
“rw” permission indicates that the file can be read and write.
chmod 755 indicates that the owner can read, write and execute, while the group
and others can read and execute only.
- When the commands are executed on all the machines, NFS service is now
running on all machines properly.
80
Mounting the files to NFS server
- When we need to mount files to the NFS server (gateway), we can do it by
executing the command as follows
mount 192.xx.xx.xx: /var/monkey/htdocs /home (example of mounting
DocumentRoot files to /home directory of NFS server (gateway)
The program will mount the DocumentRoot files, in this case,
/var/monkey/htdocs/ and its content to the /home directory on the NFS server
(gateway).
81
- We need to allow the user “raouf” to access the staging area /var/tmp/ by using
SSH service. To do this, we need to go to /etc/ssh/sshd_config and edit the file as
follows:
# Authentication:
AllowUsers raouf
- After that, we need to restart the SSH service to let the changes take place. We
restart the services by executing
%/etc/rc.d/rc.sshd stop
%/etc/rc.d/rc.sshd start
- User “raouf” is now able to access the staging area by using SSH service
After all the steps above are done, the system is now able to mount files with NFS server
(gateway) from the available directories mentioned. The system will also have a staging
area and VirtualHost users can access the staging area with SSH service. The cron job is
also running every hour.
82
Screenshots of tests, with explanations
/etc/exports file for stating VirtualHost DocumentRoot directory.
83
Output when starting /etc/rc.d/rc.nfsd and /etc/rc.d/rc.rpc services in MailHost
Showing list of available mount directories in gateway, VirtualHost Document Root for
WebServer (var/monkey/htdocs) and Dovecot mail directory in MailHost (/home/vmail).
84
User “raouf” able to access the staging area (/var/tmp) by using SSH.
Evidence of cron service running on the NFS server and will run the staging area to
document root every hour.
85
Obstacles encountered, obstacles overcome
The NFS server was unable to mount the files from another machine. The problem
overcame by changing the directories of the files that needs to be mounted and set the
permission of the folders properly.
Best References
https://www.slothparadise.com/how-to-connect-virtual-machines-and-setup-nfs-server-
part-1/
https://docs.vmware.com/en/VMware-
vSphere/6.5/com.vmware.vsphere.html.hostclient.doc/GUID-4A89D6DA-ACD4-4D53-
BE25-F7022C0B4A35.html
86
Value [20]
1. Setup ISC DHCP and Bind
2. Replace dnsmasq with dynamic updates in the ISC configuration
Task Owner:
DHCP stands for Dynamic Host Configuration Protocol is a network protocol that
enables a server to automatically assign an IP address to a computer from a defined range
of numbers (i.e., a scope) configured for a given network.
List the relevant configuration files, and for each one briefly describe what was done
Install the DHCP and BIND package by mount the config cd that is located in
/mnt/hdc/modules/isc working directory.
87
Go to working directory /var/named/caching-example and then copy and rename the
file localhost.zone to zone.example.con which is the file that we will use later in the
setup.
88
Two zones will be created according to the sample file.
Change the domain-name to our own. Change the routers to direct to out destination
subnet.
Enter /etc/rc.d/rc.bind to start the bind servicer and a short line of output will be
displayed to indicate the process status.
Enter dhcpd -q tho to start the DHCP service.
89
At last, a list of existing clients will be displayed with either their port number or IP
addresses.
It is quite difficult to find relative configurations for DHCP server as we are using
old verison slacksware which is not compatible to most Debian distributions out there
and sometimes the system does not recognize the file properly as I have to reinstall it
over and over in order to settle down the non-existing files issue.
Best References
Digital Ocean, 2014. How To Configure BIND as a Private Network DNS Server on
Ubuntu 14.04. [Online]
Available at: https://www.digitalocean.com/community/tutorials/how-to-configure-bind-
as-a-private-network-dns-server-on-ubuntu-14-04
[Accessed 01 December 2017].
90
Value [20]
1. Setup snort
2. Use multitail and hping2 to demonstrate recognised attacks
3. How is information about known attacks compiled?
Task Owner:
Snort is an intrusion detection system (IDS) which performs detection and analysis on
network traffic by performing real-time traffic analysis and packet logging. multitail and
hping2 is used to generate the traffic and demonstrate recognized attacks.
List the relevant configuration files, and for each one briefly describe what was done
Snort is a package that is included in the TinyNetConfig.iso which is used to install all
the enhancement packages in our system. To do so, we need to access to our
TinyNetConfig.iso by cd /mnt/hdc then ./SetupMenu and choose Snort to install it.
Next, we need to comment all the rules in the configuration file by accessing etc/snort
directory and selecte the snort.conf to edit that. That is done as the snort will not work if
there is any rule not existing in the system. We need also to include 4 new rules which
are:
include $RULE_PATH/gpl-back~r.rules
include $RULE_PATH/gpl-ddos.rules
include $RULE_PATH/http.rules
include $RULE_PATH/icmp.rules
include $RULE_PATH/other.rules
the rules file is under etc/snort/rules
91
Then, in /etc/snort, we need to confirm that the following paths point to the right
directories.
var RULE_PATH /rules
var PREPROC_RULE_PATH /preproc_rules
In the next figure, DDoS attack is being done using hping tool from the gateway (the
attacking machine) to the web server.
92
The command description is (-c = count/number of packets, -d = data size /size of packet,
-S sets the SYN flag, -w = window size (default is 64), -p = port number, --rand-source =
random source address mode)
93
Obstacles encountered, obstacles overcome
To overcome this issue, we need to copy the libmysqlclient file from its current place as
shown in the previous figure to /usr/lib directory
94
Then, we need to rename libmysqlclint.so.15.0.0 to libmysqlclint.so.15 without the
Zeros.
The second obstacle that we faced is an error that indicated that snort could not find the
dynamicengine and preprocessor libraries
To overcome this issue, we need to copy two folders of snort dynamicengine and process
to usr/local/lib from /usr/lib as following
95
Then, we need to change the libsf_engine.so.0.0.0 to with 000 to libsf_engine.so.
Another thing to be changed is to remove all zeros from the files inside dynamic
processes to look like the following. That can be done by accessing the /usr/local/lib/
snortdynamicpreprocessor and using the command mv for all the files.
96
By executing like these attack, the gathered information from these techniques might
be used to do and start other attacks like hping2 flood and DDOS attack and they are able
to mess up and flood the victim machine with many packets that it could be handled.
Best References
https://s3.amazonaws.com/snort-org-
site/production/document_files/files/000/000/129/original/snort_manual.pdf?AWSAcces
sKeyId=AKIAIXACIED2SPMSC7GA&Expires=1513809907&Signature=xAINS9yLgq
6d3GvZe%2BWbA7DF38E%3D
97
View publication stats
Conclusion:
The main objective for this assignment was to help us as IT students to
improve our technical skills and gain an extensive understanding of the basics of
the system and network administration. Different topics were taught and
discussed such as the fundamentals of TCP/IP and the machine’s configuration
and its files. Moreover, we got a good practice using different operating system
which Linux.
We worked as one team in all the assignment phases and without that vital
thing, we were not able to complete this assignment. Each one of use has shown
a great attitude toward the others. We could share our ideas and knowledge together
in a smooth way without any difficulties. The knowledge that we gained from this
assignment with the help of out lecture is extremely valuable and will help us a lot
in our studies and future job.
98