This article assumes that you know how to install programs on either Ubuntu or Kubuntu. It also assumes that you have some knowledge of basic computer networking principles. If you do not know how to install programs on Ubuntu, go tohttps://help.ubuntu.com/community/InstallingSoftware. If you do not know much about networking, go to http://www.faqs.org/docs/linux_network/x-087-2-intro.html. This article also assumes that you are using Ubuntu or Kubuntu 6.06(Dapper Drake), but the Firewall section can be adapted for any recent Linux distribution.
Downloading Security Updates
A program is only secure if it has no vulnerabilities. Even the most popular software can have a hidden one. When someone fixes the vulnerability,a new version of the program is usually released. Both Ubuntu and Kubuntu have software repositories dedicated to security updates.When a vulnerability is fixed, a package of the program is released so that you can download it. Ubuntu and Kubuntu usually enable some of their security update repositories by default, but it is always a good idea to check to see if all of them are enabled. You may also want to specify how often you want your computer to look for security updates--and even install them--while you're at it (for Ubuntu 6.06only).
If you are using Ubuntu, click on System -- Administration --Software Properties and click on the Installation Mediatab. Now scroll down until you see a repository with the wordSecurity in it. Make sure that it is checked. If it is not,click on the check box to enable it.
On Kubuntu, click on Kmenu -- System -- Adept (PackageManager). Enter your password and then click on Adept and then on Manage Repositories. Find a line that contains the words deb http://security.ubuntu.com/ubuntu. Those are security repositories. If it is grayed out, right click on the entry,select Enable, and click Apply. It is important to enable every grayed-out security repository that you can find.
Now you can configure how often you want your computer to check for new updates. With Ubuntu, click on System -- Administration --Software Properties and click on the Internet Updates tab.Check the box that is marked Check for updates automaticallyand from the drop down menu select how often you want your computer to look for updates. You can even configure Ubuntu to automatically download updates and install security updates. When there are new updates available, Ubuntu will alert you by starting Update-Manager.The Update-Manager's notification icon will appear in the system tray. Click on it to install new updates.
Kubuntu uses a program called adept_updater which appears in your system tray when new updates are available. You can click on the iconto install new updates. As of this writing, you can not configureadept_updater to install security updates automatically.
Securing the /home directories
There may be times when you want to protect your data from malicious users, but you don't want the hassle of encrypting that data. As long as no one else on your computer can log in as root, (the super administrator account) your data will be hidden from other users' eyes. To make your data safer, go to Applications -- Accessories --Terminal (on Ubuntu) or Kmenu -- System -- Konsole (onKubuntu) and type: chmod 0700 /home/your-user-name (where your-user-name is the name you use to login to your computer). You can also use this command for individual files and folders if you want to keep other users fromviewing any of your files. (For more information on securing your home directory, go to https://wiki.ubuntu.com/SecureHome).
The best way to protect yourself from attackers on the Internet is to disconnect yourself from the Internet. The next best way is to install a firewall, which is like a lock on a door to a room inside of a building. It allows only authorized programs and protocols to open the door between your computer and the Internet. It also locks the door from the outside, keeping people and programs from opening the "door", walking in, and harming your computer. A firewall uses filters that either allow or prevent programs from sending or receiving data. If there is protocol with a security hole in your computer, you can configure the firewall to block all incoming connections to that protocol until the hole is fixed.
Although both Ubuntu and Kubuntu are fairly secure--they do not leave any ports open by default--it is always a good idea to install a firewall. Since firewalls are important to making a computer more secure, two firewalls are evaluated in this article: Firestarter and Guarddog. Each has strengths and weaknesses, both in the GUIs(Graphical User Interface) and the way they run, so it is a matter of personal preference. Both of them work on any official Ubuntu distribution or other popular Linux distributions (such as SUSE or Fedora Core). The following instructions will show you how to set up Firestarter for Ubuntu and Guard dog for Kubuntu, but they work just fine vice versa. Even though the firewalls are different, there are some firewall security principles that apply to any firewall and operating system. All firewalls either white-list or blacklist IP addresses (Internet Protocol address) and protocols. A white-list isan explicit list of protocols and IP addresses that the firewall lets pass through. A blacklist is the exact opposite of a white-list: it is an explicit list of protocols and IP addresses that the firewall will block.
There are some common protocols that you will either want to white-list not want to blacklist. They are:
Http/Https(Common web site protocol)
Ftp, (A file transfer protocol. Many web sites use this to upload and download files)
Smpt(An email sending protocol)
Pop3(An email receiving protocol)
(A list of more ports can be found at:http://www.chebucto.ns.ca/~rakerman/port-table.html)
Allow the firewall to permit only the few protocols and/or IP addresses that you will be using. If you don't recognize a protocol, block it. You can unblock any protocol later when you have a need for it.
Firestarter(based on the GTK GUI toolkit) focuses on simplicity. Firestarter allows the white-listing of good connections; it blocks all connections from the start, both incoming and outgoing. After you have installed Firestarter, go to Applications -- System Tools-- Firestarter to start it. You should see a blue icon appearing your system tray. The first time you run Firestarter, a wizard is automatically launched. If you need to return to the wizard later,you can access it from the Firewall menu. All of the choices that you make in the wizard can be changed by going to Edit --Preferences.
Click on the Policy tab to get started. You will see a drop down menu next to the word Editing. Click on it and select the Outbound traffic policy. Now make sure the radio button that saysRestrictive by default, causing the firewall to block all traffic that is not white-listed. This will make your computer very secure by only allowing a few programs to open the "door".
The next step is to tell Firestarter what protocols you don't want to lock down. Right click on the Allow Service Portand For tables. Click on Add Rule, select a name from the drop down menu, or enter your own protocol name and port. You have the option to allow any computer on the Internet or network, the firewall host (your computer), or IP address (a specific computer Internet Protocol address on the Internet or your network).Select the appropriate source and click Add. Do this for any protocol you want to use (such as email, web, etc). You can use this same process to allow incoming connections (click on Incoming traffic policy next to the word Editing instead ofOutgoing traffic policy).
(Insert firestarter.jpg here)
When Firestarter blocks a connection, the icon in the system tray turns red. If you are having trouble with either connecting to another computer or browsing the web, click on the red icon and then click onthe Events tab. This will show you what protocol(s)Firestarter has blocked and you can now white-list the protocol if you need to use it.
If you notice that Firestarter blocks a particular computer's IP and you recognize it (as it may be a family member or colleague's computer),add the IP to the Allow connections from host table under the appropriate outgoing or incoming policies.
Guarddog(which uses Qt for it GUI toolkit) differs from Firestarter because it lets you configure a firewall for numerous networks such as the Internet, your local computer, and your Local Area Network. The advantage of using Guarddog is that you can configure a firewall for as many different networks as you want. To configure Guarddog, go to Kmenu -- System -- Guarddog.Enter your password to continue. After you enter your password, click on the Protocol tab and select on the the "zone"(what Guarddog calls the configurations for different networks) that you would like to configure. On the right you will notice the Zone Properties tree. Click on the tree category that you would like to configure (such as Chat)and it will expand, revealing several common protocols. Guarddog automatically blocks every protocol by default so you will have to white-list the protocols you'd like the firewall to accept, and blacklist the protocols you'd like the firewall to outright reject.You should click on the Network tree and enable DNS andICMP Redirect if you can not browse the web.
To to add a protocol that is not in any of the trees, click on the Advancedtab and add a new protocol under User Defined Protocols to be able to enable or disable it in the Protocol tab. To block a certain IP address or domain, create a new zone and leave all the check boxes blank (to block all protocols).
If you use a router to connect to the Internet and/or are behind a NAT you should create a new zone for the Local Area Network that you belong to. You should d enable the Internet and Localzones so that you will be able to connect to the Internet and the Local zones. Now click on the Protocol tab and check to see if the new zone you have created is selected under Protocols Served from Zone. Configure the firewall to allow the protocols you need to pass through it for the Local and Internet column. By selecting the check boxes in both columns you allow your computer to use the checked protocols on your local area network (which goes to your router which is connected to the Internet).
Now move over to the Protocol tab and make sure that Protocols Served from Zone is set to your newly created zone. Check the protocols you need to enable. By turning these on for the LocalorInternetzones, you allow your computer to use the checked protocols in the new zone you created.
(Insert guarddog.png here)
When you are finished with configuring your changes, click Apply to change the settings. If your firewall keeps you from browsing theweb, or starting certain system services you can temporarily disable it until you find out what it's blocking; click on the Advancedtab, check Disable Firewall and click Apply.
Testing your firewall
To see if your firewall is doing what you want it to do you can test it athttp://www.grc.com at the Gibson Research Center. Go toShields Up or Leak Test to try out your firewall.
Summing it up
You now have a fairly secure system. It will be hard for a cracker to break into your computer, or for some other user on your computer to read sensitive data (you may want to encrypt that data to be even safer).Always remember that your computer will remain secure if you are careful and do not accidentally enable a protocol that you don't use,or copy sensitive data to a folder that anyone can read.