![]() |
ubuntu.com - launchpad.net - ubuntu help
|
|
|||||||
Hello, Unregistered You are browsing a READ only archive of the main support categories pre 4/21/2008. You will not be able to post or reply any threads in this section.
|
|
Security Discussions Discuss security flaws/updates/notices in the various Ubuntu releases. |
|
|
Thread Tools | Display Modes |
|
|
#1 | |||||
|
Day Old Decaf
![]() |
Ubuntu Security
Written by: bodhi.zazen
![]() Ubuntu Security I am writing this guide as a concerned member of the Ubuntu Community. Security is a concern for us all and in welcoming new (and experienced) users to Ubuntu I would like to demystify the complexities of security that come with your new OS. Disclaimer : I am not an expert in security. This document is intended as a security overview for new users. This thread is not intended as an all inclusive how-to or discuss the merits of any particular security measure. I offer no guarantee that by running Ubuntu with any or all of these suggestions your security will be foolproof or that you will never be cracked. I would like to direct any general security discussions to the Security Discussions forum. I would like to thank the Ubuntu Staff, especially jdong and compiledkernel for their review and suggestions. Introduction : Security is an ongoing process and, like an onion, it has layers and stinks. The best defense you have is to read and learn how to secure your OS. Alas, there is not single action you can take to achieve absolute security (the only safe computer is one that is turned off, disconnected from the Internet, and in a locked vault) and security concerns and "ease of use" are sometimes competing concerns. Clarification of terms: The "Windows Mindset" is intended as exactly that. I assume most new users are coming from Windows and the issues under this section are both most familiar to them and areas of FAQ on the forums (how often do we see questions from the "Ubuntu Mindset" on ABT?). The "Ubuntu Mindset" is thus likely new information for most new users. Those divisions/titles are intended to divide security information into familiar/unfamiliar territory (assuming the reader comes from a windows background) or to lighten up an otherwise dry topic. Specifically it is my intention that the "windows mindset" will help users new to Linux (Ubuntu) feel more at home by starting with familiar themes. These titles or divisions are certainly not intended to convey more or less importance to any particular issue, those decisions I leave for "self determination". Summary: There is no such thing as "security in a box (tm)". Information security is an active job -- it is not installing some product on the system and sitting back and relaxing. The good news ~ Ubuntu (Linux) is fairly secure "out of the box". How to proceed: Prepare to read, read, read ... do not expect to get through this document in one session. Contents: Quote:
Basics This advice is fairly generic and applies to almost any OS. These simple steps offer a solid foundation that you should be able to implement almost immediately.
Psychocats ~ Security on Ubuntu Thanks to Johan! for the advice on 3rd party repos Note: Social Engineering. Click here for more information. Quote:
~ Quote from Wikipedia The Windows Mindset If you are coming from a windows background you are used to terms like antivirus, spyware, and firewalls. Linux is different and these are not as important. They are discussed first because these are FAQ on the forums. Unfortunately, it is sometimes difficult for new users to wade through some of the FUD (some of which is produced by anti-virus companies) ... Viruses The fact of the matter is: viruses/worms take advantage of flaws or holes in the code. At this time of this writing, there are no significant Linux viruses "in the wild". Linux boxes are no less targets than any other OS, many of the large (ie valuable) Internet sites run on *nix so there is no lack of motivation to crack into *nix. Do not believe the suggestion that the Linux community is complacent or "behind the times" in terms of viruses, or any other security issue. Linux developers have not "ignored" viruses, rather the OS is built to be highly resistant to them and since the code is "Open" there are literally thousands of eyes watching ... This is an example of what it would take to install malware on an Ubuntu box : Install evilmalware (Don't worry, that link will NOT install anything For the most part, Linux anti-virus programs scan for Windows viruses which do not run on Linux, even on wine (http://os.newsforge.com/article.pl?s...30222&from=rss). Anti-virus programs are "reactive" in that they can only protect you from known viruses. They can only protect you against the next Linux virus after it is developed, not before. Furthermore the "fix" will be to close any hole(s) in the code, these fixes will be available through security updates (which are more frequent in Linux then your previous OS if you are coming from Windows). My advice is to skip the anti-virus if you run Ubuntu. Why ?
Running antivirus can make some sense if you are intending to "protect" windows users, however, IMO, for a variety of reasons, it is best if Windows users learn to protect themselves. In fact the most common usecase for a Linux antivirus program is to run a Windows fileserver or serve mail to Windows clients. Note: There have been many documented cases in Windows and Linux that a buffer overflow in an antivirus product has been an attack vector! If you would like to run an antivirus program on Ubuntu you have several choices : Note: All of those links are to commercial software companies that wish to sell you something you may not need. They get you "in the door" with various free downloads. Take the "information" or "warnings" they give you about the need for antivirus scanning on Linux Platforms with a grain of salt Firewall Discussions about firewalls often are passionate (just search the Ubuntu forums). By default, Ubuntu includes a firewall, iptables, but by default nothing is engaged. This is reasonable as a default Ubuntu install opens zero ports to the outside world, so a firewall is redundant. However, installing "server software" will cause ports to open, so some people like to use a firewall as a catch-all layer to find mistakes in their configuration. Another use for firewalls is for the administrator to forcibly impose network policies on the user. For example, users may not talk to example.com, open up a listening port for remote connections, and so on. Also, a periodic audit of the system for open ports is a good practice. For example, running the "nmap" command from another machine, or using one of many online port scanners: http://nmap-online.com/ https://www.grc.com/x/ne.dll?bh0bkyd2 Remember, what you care about are open ports. Closed ports and stealth ports are equally secure, in that they are inaccessible to the public. Iptables references :
The "problem" is iptables is not so new user friendly. Fortunately, there are several more (new) user friendly interfaces available to allow you to manipulate your firewall (Firestarter and Guarddog are both GUI front ends for iptables) :
A source of confusion sometimes occurs when users feel the need to be running firestarter/Guarddog for their firewall to be active. This is untrue ! Keep in mind that these applications are not firewalls, but rather configuration tools for ip tables. These applications should be run only to configure your firewall. Once configured, IP tables (the actual firewall) is active (at boot) without having to run firestarter/guarddog. firestarter will monitor traffic, but it runs as root and there are better monitoring programs, so configure you firewall, shut down firestarter/grauddog, and let IP tables do the rest Wireless Security ~ WPA1, WPA2, LEAP, etc. Wireless connections are becoming ever more popular. Half the battle is to get your hardware working ![]() Next be sure to secure your wireless router as much as possible (IMO wireless will always be less secure ... ) wieman01 maintains a very complete page on wireless security Here Browser / Spyware : Java/Flash/Ad-ware/Trackers/Cookies This is where most users will have the most risk. We all want Java/Flash, but our Internet browser opens us to attacks. I advise :
Edit: Thank you Seisen for pointing out that No Script also blocks flash. See this link for additional information : How to Secure Firefox The Ubuntu Mindset Permissions and Encryption The first layer of defense is permissions. Permissions are used to set access and thus protect both system and user files. Basic permissions See also umask at the bottom of that link. The umask value can be set in ~/.bashrc. To set a "private home", as a user, Code:
chmod 700 $HOME Encryption is used as an additional layer of protection. One limit of encryption is that protection is only offered when mounting an encrypted partition (once the partition is mounted it is assessable/crackable just like any other file). https://help.ubuntu.com/community/EncryptedFilesystem https://help.ubuntu.com/community/En...ilesystemHowto http://www.howtoforge.com/truecrypt_data_encryption Root kits From http://en.wikipedia.org/wiki/Rootkit : Quote:
rkhunter http://wiki.linuxquestions.org/wiki/Rootkit_Hunterckrootkit http://www.howtoforge.com/howto_chkrootkit_portsentry Intrusion Detection Note: Adding an intrusion detection system like snort that analyzes network traffic for attack patterns, it can potentially introduce additional vulnerabilities. There have been documented examples of vulnerabilities in snort's preprocessor that granted hackers snort user, or even root user, access to the system! My initial suggestions are OSSEC HIDS and Snort. How to's:
Compiledkernel's Suggested Applications compiledkernel's suggested applications (Nagios, ntop, and darkstat are in the Ubuntu Repositories, check the home page to see if newer versions are available):
Running Server(s) Part of setting up a server is reading/learning how to secure it. Common servers include NFS, Samba, FTP, SSH, VNC, RDP, and HTTP. If the "how-to" you are following does not review security, you need to keep looking ..."Desktops" become "Servers" if server software is installed. Questions to ask yourself include:
Examples : SSH UDSF Secure SSH VNC Apache Hardened Kernels Hardened kernels are modifications to the Linux kernel that add additional security measures. This could include:
These techniques combined have been shown to be very effective in the real world in guarding against unknown attacks. For example, many administrators of hardened kernel servers either report or even prove that their hardened systems were invulnerable to newly discovered security holes, or that the severity of a breach was significantly reduced. The most common hardened kernel patch is called "grsecurity2" (http://grsecurity.org/), which does everything on this list. This requires, however, that you manually patch and recompile the kernel. SELinux and AppArmor do the "additional permissions systems" part. The basic theory is that by providing finer definitions of permissions than UNIX users and the "chmod" bits, even a successful attack against one service is virtually useless to attacking the rest of the system. Note: AppArmor is available in Feisty (7.04) and will be installed by default in Gutsy, Ubuntu 7.10. AppArmor Links AppArmor ~ Ubuntu Community Wiki AppArmor Geeks (OpenSUSE) All of these hardened systems, however, take effort on the administrators behalf to implement. They also take a lot of trial-and-error to find the correct balance of user functionality and security restrictions. Tightening the rules too much could cause various applications to stop working, and not tightening them enough could lead to a weaker security setup. If you run a large multiuser system where you must grant people shell access, or run services that have that unfortunate long history of attacks, then it is highly recommended that you look into setting up a hardened kernel. Reading the Logs Learn how to read your system logs and become familiar with "normal" activity. It should go without saying, your first introduction to system logs should *not* be when you suspect your system has been compromised. You should also be aware that if someone has root access they can alter system logs. This is when it is most helpful to be aware of "normal" activity. Ubuntu wiki ~ Linux Log Files There is a package called "logwatch" that e-mails to you the new portions of your log every night. This can help make log reading more enjoyable. How to perform a hardened installation This how to will walk you through a hardened install with an encrypted root partition and other goodies. This is a link to a how to for Debian : Towards a moderately paranoid Debian laptop setup You will need to use the "Alternate" install disk. How to Alternate Install Thank you to Uwe Hermann for posting a How-to for the moderately paranoid and hermanzone for the How-to with the alternate CD Screening your system There is a package, tiger, which will screen your system for potential security holes. While not complete it may be an excellent place to start (tiger does not check your firewall for example). For an overview of tiger see man tiger , scroll to the bottom and you will see a listing and brief description of the tests performed (modules). Install by any means, tiger john chkrootkit Code:
sudo apt-get install tiger john chkrootkit Code:
sudo tiger -H The command tigexp can be used to explain the results. Quote:
Forensics What to do when you think you have been cracked :
Intrusion References CERT® Coordination Center ~ Steps for Recovering from a UNIX or NT System Compromise CERT® Coordination Center ~ Intruder Detection Checklist Whew ... Further Reading: Ubuntu wiki ~ Security page Ubuntu wiki ~ Installing Security Tools The Big Ol' Ubuntu Security Resource Locking Down Ubuntu Ubuntu geek ~ Security category Security references Topics include Basics, firewall, Intrusion detection, Chroot, Forensics/Recovery, and Securing networked services. ~ Thank you to unSpawn at LinuxQuestions.org Peace be with you, bodhi.zazen Last edited by bodhi.zazen; April 27th, 2009 at 12:27 PM.. Reason: Removed Dead Link: 'UDSF Security Analysis Tools'/ Updated Link |
|||||
|
|
|
|
|
#2 |
|
Day Old Decaf
![]() |
Re: Ubuntu Security
When we all copied the stickies over, I did this one without thinking I would have to maintain it. If anyone in this community wants to maintain the sticky, copy this one into a new thread and make the changes to keep it up to date, let me know.
|
|
|
|
|
|
#3 |
|
I Want My $2!!
![]() Join Date: Mar 2007
Location: Denver, CO
Beans: 7,077
Ubuntu 8.10 Intrepid Ibex
|
Re: Ubuntu Security
Nice writeup -- must have missed it originally -- I can see you put a lot of time into it.
|
|
|
|
|
|
#4 |
|
Day Old Decaf
![]() Join Date: Jun 2006
Location: Switzerland
My beans are hidden!
Kubuntu Jaunty Jackalope (testing)
|
Re: Ubuntu Security
Why unsticky it? It's still very good
|
|
|
|
|
|
#5 |
|
First Cup of Ubuntu
![]() Join Date: Mar 2008
Beans: 1
|
Re: Ubuntu Security
thank too much! your thread helped me much.
|
|
|
|
|
|
#6 |
|
Way Too Much Ubuntu
![]() |
Re: Ubuntu Security
this is a good guide but is it necessary for every ubuntu user ? i do have a firewall running on ubuntu and i run the occasional virus scan too.
i have switched over to linux totally now so id like to know ?
__________________
When life tosses you lemons.... Throw them at stupid people !!!!
|
|
|
|
|
|
#7 |
|
Day Old Decaf
![]() Join Date: Jun 2006
Location: Switzerland
My beans are hidden!
Kubuntu Jaunty Jackalope (testing)
|
Re: Ubuntu Security
is what necessary?
|
|
|
|
|
|
#8 |
|
Way Too Much Ubuntu
![]() |
Re: Ubuntu Security
to have anything else installed in this guide other than a firewall and a on demand virus scanner.
__________________
When life tosses you lemons.... Throw them at stupid people !!!!
|
|
|
|
|
|
#9 |
|
Day Old Decaf
![]() Join Date: Jun 2006
Location: Switzerland
My beans are hidden!
Kubuntu Jaunty Jackalope (testing)
|
Re: Ubuntu Security
what do you need an antivirus for?
|
|
|
|
|
|
#10 |
|
Way Too Much Ubuntu
![]() |
Re: Ubuntu Security
i run xp in a virtual machine.
__________________
When life tosses you lemons.... Throw them at stupid people !!!!
|
|
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|