Sna Documentation
Sna Documentation
Table of Contents
Acknowledgement ........................................................................................................................................ 2
Introduction .................................................................................................................................................. 3
Work breakdown Structure .......................................................................................................................... 4
Base System: Group Component .................................................................................................................. 5
Secure Webmail: Sending mail using stunnel, mail submission port, and https:// .................................. 5
Migrate to Net-R ..................................................................................................................................... 13
Protocol Analysis ..................................................................................................................................... 18
Iptables.................................................................................................................................................... 21
NFS .......................................................................................................................................................... 28
Replace DNSMASQ .................................................................................................................................. 31
Basic VPN ................................................................................................................................................ 36
Individual..................................................................................................................................................... 47
IDS ........................................................................................................................................................... 47
Sudo ........................................................................................................................................................ 53
LDAP ........................................................................................................................................................ 60
Conclusion ................................................................................................................................................... 66
1|Page
CT106-3-2-SNA
Acknowledgement
This assignment could not be completed without the help and participation of so many people.
Therefore, the team really appreciates all the contributions and assistance that has been provided
and also in debt to all helping hands. As for starters, the team would like to thank Dr. Thomas
Patrick O’daniel for teaching the team various methods and techniques with different approach
associated with the project in order to complete the assignment completely. His constructive
advices and notes that he prepared for us has been the backbone to successfully complete this
assignment. Furthermore, the team is thankful to their parents and friends for the constant
motivational support and encouragements which has pushed us to provide a fruitful
accomplishment of this project. Finally, our honorable gratitude to the head of the module for
providing us the opportunity to learn about the fundamentals of network services and prepare a
detailed documentation.
2|Page
CT106-3-2-SNA
Introduction
Network and System Administration also known as SNA is the learning course to setup servers
using Oracle Virtual Machines. This is possible by utilizing the resource notes from TinyNet.my.
Four types of servers are being setup as the base system which are Gateway, Webserver, MailHost
and LDAPHost and these are being installed with Linux 2.6 Operating System configuration.
These base systems allowed the team to develop the required enhancements such as Cross System
Multi-tail, SUDO, NFS, Ip tables, LDAP and etc.
3|Page
CT106-3-2-SNA
4|Page
CT106-3-2-SNA
Objective
Setting up Stunnel
1) In order to configure Stunnel, base configurations have to be done in Gateway, Webserver and
Mailhost server. The very first step to configure Stunnel is to configure the library file of
“/etc/rc.d/rc.stunnel” file. The file should be an executable file, therefore, the permissions for the file
must be modified by entering the command listed below.
Figure 1: rc.stunnel
2) After modifying the permission, the symbol ‘*’ is shown at the beginning of the file name which indicates
its accessibility.
3) After setting up “rc.stunnel” as an executable file, there are several steps which have to be considered to
make it work. As shown in the image below, the directory must be changed to /usr/sbin/stunnel in rc.stunnel
file.
5|Page
CT106-3-2-SNA
Figure 2: rc.stunnel
Figure 3:client.conf
6|Page
CT106-3-2-SNA
2. this link is used to download the TinyNetCA certificate to zip the file
7|Page
CT106-3-2-SNA
Once configured, the library files which are needed, Stunnel appear in the Netstat interface. The “netstat -
tulp” command is used to check the network connections and listening ports.
8|Page
CT106-3-2-SNA
After performing required configurations, the stunnel connection can be established by entering
‘/etc/rc.d/rc.stunnel command in the terminal.
9|Page
CT106-3-2-SNA
The very first step in configuring mail submission port is to set up the Postfix and SquirrelMail and make both
the files work together.
1) Setting up Postfix
ii) Comment “#” the first line of relayhost and uncomment the second line as shown below.
Figure 7: “/etc/postfix/main.cf”
2) Setting up SquirrelMail
i) In Webserver, open the Midnight Commander(MC) and open the directory file of
“/var/www/squirrelmail/config/config_svr_adrs.php”.
ii) Enable the “$smtpPort = 587;” and disable the “$smtpPort = 25;” as shown in the image below:
10 | P a g e
CT106-3-2-SNA
Figure 8: “/var/www/squirrelmail/config/config_svr_adrs.php”.
11 | P a g e
CT106-3-2-SNA
None
References
12 | P a g e
CT106-3-2-SNA
Migrate to Net-R
Objective:
a) Clone and reconfigure your TinyNet servers as Net-R servers
b) Reconfigure DNSMASQ to hand out static addresses to servers rather than dynamic ones
c) Describe the Net-R automatic traffic generation system
Configuration:
Migrate to Net-R servers
1) Install net-r configuration iso
2) Clone ToClone to domserver and change the virtual optical disk to net-r iso.
3) Clone ToClone to netR1 and change the virtual optical disk to net-r iso.
4) Type mc once login to root from the domserver and locate to mnt/hdc/SetupMenu
5) Configure as Net-r domain server (Figure 9)
13 | P a g e
CT106-3-2-SNA
6) Repeat step 5 but in netR1 and configure as Net-r Host. (Figure 10)
14 | P a g e
CT106-3-2-SNA
1) Open mc from domain server, and locate to etc/dnsmasq.conf. Press F4 to edit. (Figure12)
2) Comment line 33 with # at the starting of the line and Uncomment line 37 and 39 with # at the
starting of the line. (Figure 13)
15 | P a g e
CT106-3-2-SNA
Figure 15
16 | P a g e
CT106-3-2-SNA
Referencing
Net-R::Migrate. 2018. Net-R::Migrate. [ONLINE] Available at: http://www.my-tiny.net/net-
r/NR02-move.htm. [Accessed 12 December 2018].
17 | P a g e
CT106-3-2-SNA
Protocol Analysis
Objective:
Use tcpflow to capture the dialog between the browser and the webserver when
a) you access the default monkey webpage. How can you recover the images?
b) you access a mailbox in squirrelmail. How many requests are made? How many
servers are involved?
Configuration:
1) Use the command ‘tcpflow -p -c -I eth0 port 80 | grep -oE `(GET|POST|HEAD) .* HTTP/.
[01]|HOST| *` ’ view request and responds from the server. (Figure 16)
Figure 16
18 | P a g e
CT106-3-2-SNA
2) Once the command is executed, the following will be shown in Figure2. It shows the host’s IP
and the result it produces.
Figure 17
How many requests are made to load the inbox page in squirrelmail? How many servers are
involved?
5 requests have been made to load the inbox page in the squirrel mail. There is only one server
involved which is the host server, 192.168.56.215.
Outstanding/Unresolved Issues
19 | P a g e
CT106-3-2-SNA
Referencing
John Collins. 2018. Running a network trace on the command line using tcpflow. [ONLINE]
Available at: http://www.alphadevx.com/a/370-Running-a-network-trace-on-the-command-line-
using-tcpflow. [Accessed 12 December 2018].
Owl River Company - tcpflow tutorial - 46.101.8.169. 2018. Owl River Company - tcpflow tutorial
- 46.101.8.169. [ONLINE] Available at: http://www.owlriver.com/tips/tcpflow-tutorial/index.php.
[Accessed 13 December 2018].
20 | P a g e
CT106-3-2-SNA
Iptables
Owner: Magentira Kumar (TP041192)
Objectives
1) Adding all six “Rules for things that no proper TCP stack should be processing” from
the IPTables Quick Reference section-p –protocol TCP but use a LOG target.
2) Using hping2 and Multitail to show the rules are working as it should.
a. iptables -A INPUT -p tcp --tcp-flags ALL NONE -j LOG --log-level alert - -log-prefix "iptables ALL
NONE "
b. iptables -A INPUT -p tcp --tcp-flags FIN,SYN FIN,SYN -j LOG --log-level alert --log-prefix
"iptables FIN,SYN FIN,SYN "
c. iptables -A INPUT -p tcp --tcp-flags SYN,RST SYN,RST -j LOG --log-level alert --log-prefix
"iptables SYN,RST SYN,RST "
d. iptables -A INPUT -p tcp --tcp-flags FIN,RST FIN,RST -j LOG --log-level alert --log-prefix
"iptables FIN,RST FIN,RST "
e. iptables -A INPUT -p tcp --tcp-flags FIN,ACK FIN -j LOG --log-level alert --log-prefix "iptables
FIN,ACK FIN "
f. iptables -A INPUT -p tcp --tcp-flags ACK,URG URG -j LOG --log-level alert --log-prefix "iptables
ACK,URG URG "
21 | P a g e
CT106-3-2-SNA
2) The console was cleared by using “clear” command and then “iptables –L” command was used to see
all current iptables rules.
Testing
22 | P a g e
CT106-3-2-SNA
23 | P a g e
CT106-3-2-SNA
3) Third rule is tested with SYN and RST flag sets by inputting:
24 | P a g e
CT106-3-2-SNA
4) Fourth rule is tested with FIN and RST flag sets by inputting:
25 | P a g e
CT106-3-2-SNA
All six rules used in the gateway server will be lost once the gateway server has been
rebooted.
All six rules used in the gateway server will be lost once the gateway server has been
rebooted.
26 | P a g e
CT106-3-2-SNA
References
27 | P a g e
CT106-3-2-SNA
NFS
Owner: Magentira Kumar (TP041192)
Objective
1) To set up the VirtualHost users on the NFS server and allow them ssh access to their
staging area.
1. Create a new machine by naming it as NFS with base memory size of 96MB and virtual hard disk
size of 200MB. Then run the machine and login as root.
3. Select New > Primary > Size: 1080 > Beginning > Bootable. Then, press the down key and select
New > Primary > Size: (just press Enter key) > Type: 82 (press Enter key twice).
5. Configure the machine the same way as all the other machines were configured.
6. Load the TinyNetConfig.iso into the machine from the menu bar (Devices > Optical Drive >
TinyNetConfig.iso) after rebooting the machine.
28 | P a g e
CT106-3-2-SNA
1. Start rc.rpe and rc.nfsd on both Mailhost and NFS by inputting /etc/rc.d/rc.rpc start and then input
/etc/rc.d/rc.nfsd start.
4. In Mailhost, input mkdir /media/nfs_share and in NFS, input mkdir /mnt/hda1/exported to make
directory.
6. In mailhost, input showmount -e (ip address of the NFS server) to see shares available on a host.
7. In mailhost, input mount -t nfs (ip address of the NFS server):/mnt/hda1/exported /media/nfs_share
29 | P a g e
CT106-3-2-SNA
Test NFS
None
None
References
NFS - Quick and Dirty Setup, 2015. HOWTO. [Online] Available at:
https://docs.slackware.com/howtos:network_services:nfsquick_and_dirty_setup
[Accessed 10 December 2018].
30 | P a g e
CT106-3-2-SNA
Replace DNSMASQ
Owner: Teo Jun Fu TP041243
Objective
31 | P a g e
CT106-3-2-SNA
Edit the file named.conf in /etc. Add new zone in named.conf and it can be found in
/var/named/caching-example.
Before:
After:
32 | P a g e
CT106-3-2-SNA
33 | P a g e
CT106-3-2-SNA
6. Configure DHCP server. Remove or rename old dhcpd.conf file in /etc. Then, copy new
dhcpd.conf file from /usr/doc/dhcp-4.1-ESV-R7/examples to /etc. Then, open and edit
dhcpd.conf file as shown in figure below:
Obstacles
34 | P a g e
CT106-3-2-SNA
References
My-Tiny.Net, n.d. Lab Exercise 3: Configuring our Virtual Machines. [Online]
Available at: http://www.my-tiny.net/Lab03_Roles.htm
[Accessed 03 December 2018].individual
35 | P a g e
CT106-3-2-SNA
Basic VPN
Owner: Teo Jun Fu TP041243
Objectives
1. To set up OpenVPN in Gateway and in MailHost
2. To have two sets of configuration files; TUN and TAP
Configuration
Set up OpenVPN:
1. Setup OpenVPN in Gateway and Mailhost. Server = Gateway, Client = Mailhost.
2. Open mc mnt/hdc/SetupMenu Choose install other packages Choose
OpenVPN.
3. In Gateway:
a) Copy server.conf from /usr/doc/openvpn-2.0.9/sample-config-files to
/etc/openvpn. Then, configure the file.
b) Edit “server.conf” file and save it.
c) Type “cd /usr/doc/openvpn-2.0.9/easy-rsa”
d) Type “source vars”
e) Type “./clean-all” to clean files.
f) Type “./build-ca” to create certificate.
g) Enter server for it as shown in figure below:
36 | P a g e
CT106-3-2-SNA
37 | P a g e
CT106-3-2-SNA
3. Copy all the generated files to key directory in /etc/openvpn by using the command
“cp keys/* /etc/openvpn/keys”
4. In Mailhost
i) Make a copy of “client.conf” file from /usr/doc/openvpn-2.0.9/sample-config-
files to /etc/openvpn
ii) Edit “client.conf” as show below:
38 | P a g e
CT106-3-2-SNA
39 | P a g e
CT106-3-2-SNA
40 | P a g e
CT106-3-2-SNA
41 | P a g e
CT106-3-2-SNA
Tap configuration:
1. In Gateway:
a) Go to /etc/openvpn and copy server.conf in the same directory. Rename it as tap-
server.conf.
b) In tap-server.conf, comment out line 53, dev tun and add a new line dev tap0. Then,
make the following changes:
42 | P a g e
CT106-3-2-SNA
43 | P a g e
CT106-3-2-SNA
44 | P a g e
CT106-3-2-SNA
Obstacle
CA private key was unable to load due to unknown reason. Failed to run TUN on client side and
command “./build-ca can only be entered once due to only one master CA is required for others.
45 | P a g e
CT106-3-2-SNA
References
My-Tiny.net, n.d. Lab Exercise 6: Configuring Services to use LDAP. [Online]
Available at: http://www.my-tiny.net/Lab06b_WebLDAP.htm
[Accessed 10 December 2018].
46 | P a g e
CT106-3-2-SNA
Individual
IDS
Owner: Magentira Kumar (TP041192)
Objective
1) To setup snort
3) To understand how the information about known attacks compiled into rules
1) A virtual machine must be created and configured with ‘snort’. The configuration must be done
in the virtual machine by mounting ‘TinyConfig.iso’ image file and inputting the following
commands which will prompt the user with server role setup.
- mount
- cd /mnt/hdc
- ls -1
-./SetupMenu
2) Locate and open snort.conf which was placed under /etc/snort directory.
3) At line 810, place a hashtag (“#”) in front of all the existing rules to make them inexecutable.
4) Append five new rules which have been listed below in snort.conf.
- include /etc/snort/rules/gpl-backdoor.rules
- include /etc/snort/rules/gpl-ddos.rules
- include /etc/snort/rules/http.rules
- include /etc/snort/rules/icmp.rules
- include /etc/snort/rules/other.rule
47 | P a g e
CT106-3-2-SNA
5) At line 110, modify the rule path to /etc/snort/rules in order to enable the system to execute the right
path.
5) As shown in the image below, locate files which end with ‘.new’ keyword from /etc/snort directory.
Rename the respective files by removing ‘.new’ keyword. For example, modify the file name from
unicode.map.new to unicode.map.
6) Next, locate rc.syslog file which is under /etc/rc.d directory and press F4 to edit. Input the following
command under Local Facilities to specify the location of snort.log.
7) Enter /etc/rc.d/rc.syslog restart to restart the file and allows the system to display alert messages in
snort.log.
8) Edit the symlink of certain files under the directories of /usr/lib/mysql and /usr/lib so that all the
respective files point to the correct destination. For that, remove /opt/lzmtar/mysql-c from the path
names. The symbol ‘!’ will be changed to @; indicating that they have valid paths.
11) After performing all the configurations, enter command snort -c /etc/snort/snort.conf -l
/var/log/snort to initialise snort in the virtual machine. The output will be displayed as below.
48 | P a g e
CT106-3-2-SNA
Figure 63
1) Based on the image shown below, hping2 is used to create 5 packets via 192.168.56.243 through
the open port 80. This can be achieved by entering hping2 -S 192.168.56.243 -p 80 -c 5. The user
has the privilege to change the number of packets by modifying the command.
49 | P a g e
CT106-3-2-SNA
Figure 64
2) Besides that, hping2 command is also used to create and flood a network with innumerable number
of packets. In this case, we have used 80000 packets and flooded webserver with unnecessary
traffic . Due to the intense number of packets, the system will crash; prompting the user to enter
CTRL+C in order to abort it. This can be achieved by entering the command as shown in the
image below.
Figure 65
50 | P a g e
CT106-3-2-SNA
The snort log file and alert log file can be found in /var/log/snort.
Alerts are generated based on the rules defined in configuration file as shown in the table
below.
It is important to large-scale intrusions that the rules of network traffic could be collected
and analysed well and also the current network status can be reported correctly. Moreover,
the ongoing function of the networks apart from the constant changes in traffic. The
network traffic model shows a type of network pattern and the network traffic rule into a
group of rules compiled by a methodology with soft computing methods.
51 | P a g e
CT106-3-2-SNA
References
NFS - Quick and Dirty Setup, 2015. HOWTO. [Online] Available at:
https://docs.slackware.com/howtos:network_services:nfsquick_and_dirty_setup
[Accessed 11 December 2018].
52 | P a g e
CT106-3-2-SNA
Sudo
Owner: (Chiranjeev TP053346 )
Objective:
Choose one server and
a) Change the start-up display to show a random fortune in colour each time a user logs
in rather than the command summary and root login
b) Allow no root access: force users to use sudo
c) Have different colour prompts for normal users and root
Configuration:
Add User
1) One virtual machine will be configured in order to achieve this enhancement. For this, I
have chosen the gateway.
2) Add new user to the gateway by inputting ‘adduser’ command .For this step, the required
input is for the username and password where else other information is not really required.
(Figure 66)
53 | P a g e
CT106-3-2-SNA
54 | P a g e
CT106-3-2-SNA
"double quote" and the `backtick` (on the far left of the keyboard)
PS1='\u@\h:\w\$ '
'single quote' (under the " on the keyboard)
55 | P a g e
CT106-3-2-SNA
4) Login back to root and the new user to see the colour difference which has been modified.
(Figure 70 & Figure 71)
56 | P a g e
CT106-3-2-SNA
Change the start-up display to show a random fortune in colour each time a user logs in rather than
the command summary and root login
4) Reboot
5) Login root. Open mc and locate to etc/profile. Input the following command
echo -e "\e[01;33m"; fortune |boxes -d columns -a hcvc; echo -e "\e[00m" (Figure 9)
6) F2 save and F10 to exit. Locate to etc/issue and press F4 to edit issue file.
7) Delete the command summary and root log in so that the random fortune will only appear,F2
save and F10 to exit
8) Reboot
9) Login root and the random fortune with colour will appear. (Figure 10)
58 | P a g e
CT106-3-2-SNA
Referencing
MyTinyNet::Prompt. 2018. MyTinyNet::Prompt. [ONLINE] Available at: http://my-
tiny.net/M10-prompt.htm. [Accessed 10 December 2018].
59 | P a g e
CT106-3-2-SNA
LDAP
Owner: Teo Jun Fu TP041243
Objectives
1. Setup LDAP server with two domains ( o= and dc=)
2. Configure dovecot and squirrelmail to use the LDAPhost
Configuration
Setup LDAP server
1. Run the LDAPhost server and login as root.
2. At the command prompt, type these commands:
cd/mnt/hdc
ls -1 /mnthdc
./SetupMenu
3. At the SetupMenu, choose “Configure as TinyNet LDAPhost” to configure as the
LDAPhost. After done this command and type “reboot” to restart the LDAPhost.
4. Type these commands to start the LDAP:
/etc/rc.d/rc.ldap start
chmod 755 /etc/rc.d/rc.ldap
60 | P a g e
CT106-3-2-SNA
2. F2 to save file.
61 | P a g e
CT106-3-2-SNA
7. After use the ldapadd to add user, the data in userdata.ldif will be edited.
Configure dovecot
8. Go to the mailhost and configure /etc/dovecot/dovecot.conf file.
62 | P a g e
CT106-3-2-SNA
63 | P a g e
CT106-3-2-SNA
Configure squirrelmail
Obstacles
Stunnel is not running in the LDAPhost with the use of command “/etc/rc.d/rc.stunnel start” in
htop. No display of stunnel process in the list.
64 | P a g e
CT106-3-2-SNA
65 | P a g e
CT106-3-2-SNA
Conclusion
In this assessment, the team has successfully gained some deeper insights about configuring virtual
machines and implementing other enhancements. The project team has done several researches to
comprehend the project requirements and execute them. It cannot be denied that the assignment
has been done successfully within the deadline with the strong cooperation of all team members.
The project has unexceptionally enhanced the team’s networking skills, cyber security skills and
significantly help them to boost their self-esteem.
66 | P a g e