Presentation is loading. Please wait.

Presentation is loading. Please wait.

POS/420 Joshua Margolin – April 2, 2013 (Week 4) University of Phoenix Mililani Campus Introduction to Unix.

Similar presentations


Presentation on theme: "POS/420 Joshua Margolin – April 2, 2013 (Week 4) University of Phoenix Mililani Campus Introduction to Unix."— Presentation transcript:

1 POS/420 Joshua Margolin – April 2, 2013 (Week 4) University of Phoenix Mililani Campus Introduction to Unix

2 Agenda: Week 4 Installations Week 4 Virtual Private Server -Anonymous Proxy Server -Firewall -Open VPN (Time Permitting)

3 What is a Virtual Private Server? VPS is a virtual machine provide by an internet hosting service. VPS runs on software on the same physical computer as other customers virtual machines. Can have multiple servers on one physical machine. Advantage Cheap Space Easy to setup

4 Why is VPS important? Companies are moving towards Cloud Computing. Amazon uses Virtual Private Servers on the backend. Many of Amazons data centers rely on VPS technology. Get a job with Amazon and you could be configuring Linux on a VPS.

5 What is a Proxy? Proxy is a server that acts as an intermediary device between a client and server. (Middleman) Intercepts and inspects data before sending to recipient. Makes connection on behalf of the source. Machine that talks to the outside world ensuring no computer has direct access to internal computers. Common Uses Keep machines anonymous for security (Anonymous Proxy) Packet scanning (Firewall Proxy) Speed up access to resources via caching (Web Proxy)

6 What is a Proxy?

7 Proxy Installation This = root prompt cd.. Cd.. Command moves up one directory ls –a ls –a command displays folders and files horizontally. cd /etc/apt Changes to apt directory Simply type: apt-get update

8 Proxy Installation apt-get update Updates the software on VPS. This is necessary to make sure all software tools are installed on VPS. apt-get install wget wget is a built in program that retrieves content from web servers. wget This is a script that will install apache (webserver), and squid (proxy)

9 Proxy Installation chmod a+x proxy.sh By changing permissions chmod a+x will allow the file proxy.sh to become executable (a) = all users/groups/others (x) = executable Will execute the following contained in the script.

10 Proxy Installation Proxy.sh apt-get update apt-get install apache2 apt-get install squid3 touch /etc/squid3/squid_passwd chmod +r /etc/squid3/squid_passwd /etc/init.d/apache2 stop update-rc.d -f apache2 remove cd /etc/squid3 htpasswd /etc/squid3/squid_passwd account1 htpasswd /etc/squid3/squid_passwd account2 rm squid.conf wget /etc/init.d/squid3 restart

11 Proxy Installation Script will execute. Will see the following: Do you want to continue [Y/N]? (hit y and press enter) New Password: Re-type new Password: Passwords are for user accounts Repeat process for second user account VI file editor will open up squid.conf Squid.conf = config file for proxy server

12 Proxy Installation Scroll down to http_port 3128 Port 3128 is the port the proxy server will use. Acl user1 proxy_auth account1 Acl user2 proxy_auth account2 These are the two accounts passwords were created for. Tcp_outgoing_address user1 Tcp_outgoing_address user2 Change outgoing address to IP assigned to your server.

13 Proxy Installation Proxy Testing Settings Control Panel Internet Options Connections LAN settings Check mark use a Proxy Put in address and port 3128 Run browser put in account1 and password type in what is my IP addresswww.google.com

14 Proxy Completion Congratulations Linux Guru. You have successfully completed this training module

15 What is a Firewall? Either software or hardware based Keeps networks secure Works based on predetermined rules Port security Stateful packet inspection Records all connections and determines connection state Connections must be initiated by source/client and not receivers.

16 What is a Firewall?

17 Firewall Installation wget tar -xzf csf.tgz Tar –xzf is the command to uncompress an archived file x = extract z = filter the archive through gzip f=archive file name cd csf sh install.sh Sh install.sh is a script that configures csf firewall for the OS the VPS is running.

18 Firewall Installation OOPS! cant find perl module. Google the error! Google can't locate lwp/useragent.pm contains It appears other people have had the same issue! Advantage of Linux is since its open source someone is bound to have the same problem. Google has the answers.

19 Firewall Installation apt-get install libwww-perl sh install.sh Next, test whether you have the required iptables modules: perl /etc/csf/csftest.pl RESULT: csf should function on this server cd.. cd.. cd etc vi csf.conf

20 Firewall Installation Csf.conf Edit conf file by reading instructions. Change from testing mode to live mode. Add 3128 proxy port to TCP IN/OUT. Save changes Restart csf csf –r lfd –r Lfd (login Failure Daemon) logging software that logs failed loggings and brute force attacks.

21 Firewall Installation Check mail to see if you have any hacker attacks! mail N 2 Sun Mar 17 02:01 23/926 lfd on yourdomain: Excessive resource usage: proxy (3204 (Parent PID:3201)) Oops! this MSG will fill up mailbox real quick. Message means that logging server is flagging what it thinks is suspicious activity due to VPS memory limitations. We will disable this alert. Go back and edit csf.conf Scroll down and set PT_USERPROC, PT_USERMEM, and PT_USERTIME = 0 Restart csf and lfd.

22 Firewall Installation No hacker attempts so lets create one. Have person next to you, SSH to your VPS but enter wrong password. Log into your VPS. Login to mail. Investigate the mail msg.

23 Firewall Completion Congratulations Linux Guru. You have successfully completed this training module.

24 What is a Virtual Private Network? A VPN is a virtual point to point connection between a client and receiver through the use of dedicated connections and encryption. Protects the confidentiality of information. Common uses Private and secure connection between your home computer and your online banking website. This is known as Secure Socket Layer (SSL) Government uses for the protection of classified information in transmit. Corporations use it to communicate between regional offices.

25 What is a Virtual Private Network?

26 VPN Installation What is OpenVPN? OpenVPN is an open source software application that implements a VPN. Uses a custom security protocol that uses SSL/TLS for key exchange. OpenVPN allows peers to authenticate to each other using pre- shared (secret key) and certificates. Secret key is called symmetric encryption. Asymmetric is used to encrypt (protect) the secret key during key exchange. Symmetric is used to encrypt and decrypt information once key exchange has been established.

27 VPN Installation What apt-get install openvpn Copy easy-rsa into the correct place cp -R /usr/share/doc/openvpn/examples/easy-rsa /etc/openvpn Easy-rsa is the folder that will hold the certifications and secret keys. Cp –R = command for copying directories recursively (will copy all files and directories)

28 VPN Installation Generate Keys cd /etc/openvpn/easy-rsa/2.0./vars (./=execute file in current directory) Permission denied chmod +x vars./clean-all source the vars script first (i.e. "source./vars") source./vars./clean-all./build-ca./build-key-server server./build-key client./build-dh (Use DIFFIE-HELLMAN encryption algorithm)

29 VPN Installation Apply iptables rules iptables are the tables provided by the Linux kernel firewall Linux comes with a built in kernel firewall called iptables. We use CSF as a wrapper which provides management of the iptables for us. However, in order for OpenVPN to work we must enter specific iptable commands. Forward the IP Vi /etc/sysctl.conf Configuration file for setting system variables #net.ipv4.ip_forward=1 Remove the #. This will enable packet forwarding for IPv4 for OpenVPN to work.

30 VPN Installation Run the forward Sysctl –p Should see the following result: Net.ipv4.ip_forward=1 Create iptables rules Iptables –t nat –A POSTROUTING –s /24 –o venet0 –j MASQUERADE -t specifies the packet matching table which command should use Nat – packet matching table that defines how packet should be routed. -A specifies one or more chain rules. POSTROUTING – altering a packet as it goes out -s source address and subnet mask -o out interface venet0– interface packet will use to go out. -j jump target Specifies target of the rule i.e., what to do if the packet matches it. MASQUERADE translates the private IP address to public.

31 VPN Installation ETHERNET to ISP provider | Linux #1 | ETHERNET1 | Anybox | | | | | < venet0 | IP Tables |venet NIC CARD | Virtual | | MASQ. | | Tun/TAP | X.X | | 10.8.X.X | Card | In the above drawing, a Linux box with IP_MASQUERADING is installed as Linux #1 and is connected to the Internet via Ethernet2 It has an assigned public IP address of X.X. It also has another network interface (venet0) connected to allow incoming network traffic be it from a ETHERNET1 connection.

32 VPN Installation ETHERNET to ISP provider | Linux #1 | ETHERNET1 | Anybox | | | | | < venet0 | IP Tables |venet NIC CARD | Virtual | | MASQ. | | Tun/TAP | X.X | | 10.8.X.X | Card | The second system (which does not need to be Linux) connects into the Linux #1 box and starts its network traffic to the Internet. This second machine does NOT have a publicly assigned IP address from the Internet, so it uses say 10.8.X.X

33 VPN Installation ETHERNET to ISP provider | Linux #1 | ETHERNET1 | Anybox | | | | | < venet0 | IP Tables |venet NIC CARD | Virtual | | MASQ. | | Tun/TAP | X.X | | 10.8.X.X | Card | With IP Masquerade and the routing configured properly, this second machine "Anybox" can interact with the Internet as if it was directly connected to the Internet with a few small exceptions [noted later].

34 VPN Installation ETHERNET to ISP provider | Linux #1 | ETHERNET1 | Anybox | | | | | < venet0 | IP Tables |venet NIC CARD | Virtual | | MASQ. | | Tun/TAP | X.X | | 10.8.X.X | Card | I tell machine ANYBOX that Linux box is its gateway. When a packet comes into the Linux box from ANYBOX, it will assign the packet to a new TCP/IP source port number and insert its own IP address inside the packet header, saving the originals. The MASQ server will then send the modified packet over the ETHERNET interface onto the Internet.

35 VPN Installation ETHERNET to ISP provider | Linux #1 | ETHERNET1 | Anybox | | | | | < venet0 | IP Tables |venet NIC CARD | Virtual | | MASQ. | | Tun/TAP | X.X | | 10.8.X.X | Card | When a packet returns from the Internet into the Linux box, Linux examines if the port number is one of those ports that was assigned above. If so, the MASQ server will then take the original port and IP address, put them back in the returned packet header, and send the packet to ANYBOX. The host that sent the packet will never know the difference.

36 VPN Installation Create the VPS OpenVPN configuration file wget vi /etc/openvpn/server.conf port 1194 proto tcp dev tun ca /etc/openvpn/easy-rsa/2.0/keys/ca.crt cert /etc/openvpn/easy-rsa/2.0/keys/server.crt key /etc/openvpn/easy-rsa/2.0/keys/server.key dh /etc/openvpn/easy-rsa/2.0/keys/dh1024.pem server ifconfig-pool-persist ipp.txt push "redirect-gateway def1" push "dhcp-option DNS " client-to-client duplicate-cn keepalive comp-lzo user nobody group nogroup persist-key persist-tun status openvpn-status.log log /var/log/openvpn.log verb 3

37 VPN Installation Start OpenVPN openvpn server.conf starts openvpn using server.conf file Create the PC OpenVPN Configuration file cd /etc/openvpn/easy-rsa/2.0/keys/ wget conf conf

38 VPN Installation Config.conf client dev tun proto tcp remote XX.XXX 1194 resolv-retry infinite nobind persist-key persist-tun ca ca.crt cert client.crt key client.key comp-lzo verb 3 redirect-gateway script-security 2

39 VPN Installation Reboot vi /etc/rc.local Write the following contents above exit o iptables -t nat -A POSTROUTING -s /24 -o venet0 -j MASQUERADE

40 VPN Installation Download Certs and Keys Caution! Use secure means! Keys and certs are not encrypted. SFTP or SSH. client.conf ca.crt client.crt client.key Reboot VPS Install Wireshark Install OpenVPN client on desktop Move Certs and Keys into OpenVPN config folder

41 VPN Installation Configure the client.ovpn file

42 VPN Completion Congratulations Linux Guru. You have successfully completed this training module.


Download ppt "POS/420 Joshua Margolin – April 2, 2013 (Week 4) University of Phoenix Mililani Campus Introduction to Unix."

Similar presentations


Ads by Google