Ubuntu security

Discussion in 'all things UNIX' started by ComputerSaysNo, Aug 14, 2012.

Thread Status:
Not open for further replies.
  1. NGRhodes

    NGRhodes Registered Member

    Joined:
    Jun 23, 2003
    Posts:
    2,381
    Location:
    West Yorkshire, UK
    So you admit in a properly hardened and correctly configured system a firewall is not needed (which is what I said )?
     
  2. mack_guy911

    mack_guy911 Registered Member

    Joined:
    Mar 21, 2007
    Posts:
    2,677
    @dicknixon

    i agree pfsense ...etc or if you had tried astaro security gateway/untangle they give you more power to your security then pfsense UTM

    this thread belong to Ubuntu security for more if you like to debate on UTM...etc please we can continue on below thread

    https://www.wilderssecurity.com/showthread.php?t=284339

    now as far port scanning

    you can try zen-map/nmap to check your system locally

    example: i check my system from zen-map/nmap local or on LAN side or wan side they may/maynot give me same/different results on all 3

    again it complex what you trying to achieve

    for wan side you can try grc.com if block it enough


    example 2 : now second case 90% what hacker do they try your system if they see normal firewall ....etc ......not to much bla bla to interest him/her/them they move forward but if your system security piss them off and hurt their ego what they do is put a bounty on your system on irc.....etc and calling all the F#%^^ to S#%^ your system and they keep doing it unless their ego satisfied.


    so what i mean to say here is hacking is complex

    sometimes great wall of firewalls breaks and sometimes average user never get hacked in this lifetime because he/she to boring and unchallenging.

    for me security is somewhere between not to hard and complex or not to easy for every one to come in.


    maybe you agree or disagree you have your right
     
  3. BrandiCandi

    BrandiCandi Guest

    That's the main reason for my constant and vigilant argument on the topic. I want everyone at least to be aware that security professionals recommend a firewall. Everyone is free to make their own decision, but it should be an informed decision. If Hungryman and Nick Rhodes decide they don't want a firewall then I have no problem whatsoever with it.

    Listen to the pros. Here are some links from pros for "home network security best practices."

    http://www.zdnet.com/blog/hardware/...as-home-network-security-best-practices/12589 (this article links to the NSA's recommendations in a pdf)
    http://www.ethicalhacker.net/component/option,com_smf/Itemid,54/topic,6254.msg34546/topicseen,1/
    http://www.sans.org/reading_room/whitepapers/hsoffice/free-tools-tips-secure-home-pc_1514 (pdf)
    http://www.sans.org/reading_room/whitepapers/hsoffice/defence-in-depth-home-front_1033 (pdf)
    http://www.sans.org/reading_room/whitepapers/hsoffice/layers-defense-small-office-home-network_610 (pdf)
    http://www.sans.org/reading_room/whitepapers/hsoffice/building-secure-home-network_611 (pdf)

    I guess I would ask those that advocate against recommending software firewalls to offer some professional sources that DON'T recommend a firewall (or specifically say one isn't needed). I couldn't find any.
     
  4. Hungry Man

    Hungry Man Registered Member

    Joined:
    May 11, 2011
    Posts:
    9,146
    If a Firewall provides nothing of use than it only provides attack surface. Look at the Windows exploit that allows for RCE by exploiting a counter in the Firewall.

    So the argument, as with all security software, is whether or not the benefits outweigh the potential for exploitation.

    I'm not a professional, but I advocate against adding any software that does more harm than good. Whether a firewall does more harm than good is what I want to know - I want to know what it's providing, other than exploitable code.

    I'll give those links a read in hope that they provide information.
     
  5. NGRhodes

    NGRhodes Registered Member

    Joined:
    Jun 23, 2003
    Posts:
    2,381
    Location:
    West Yorkshire, UK
    Just to be clear.
    I am not advocating against using firewalls in general, just trying to make it clear that they are not always needed and there are alternative ways of achieving the same level of security.
    I have not even said I do or don't run a firewall either.

    If you on a secured and controlled network there is no need for a firewall on your desktop, but if you are connecting to unknown network and with a OS which you have a config that is untested/unsure how secure it is a firewall is a good defense layer.

    As I have already said its very specific to your configuration and uses of your system if a firewall will be a help or not and thats assuming you know you can configure your firewall correctly AND check/test it is working correctly (and that applies to any security/hardening, you need to know what you are doing works !).
     
  6. tlu

    tlu Guest

    I admit that I haven't read all these articles in detail but I believe actually all of them are related to Windows. And yes - Windows has open ports by default, and that's why the Windows firewall is enabled by default since Windows XP SP 2 (if I remember correctly). But again - a default Ubuntu installation has no open ports, so the situation is different.

    EDIT: Every security professional recommends to also install an AV. But that also applies to Windows and is not needed in Linux (at least on a desktop system). Summary: Linux is not Windows.
     
  7. BrandiCandi

    BrandiCandi Guest

    Yes, several of the links assume home users are running Windows. But several of the links don't mention what type of operating system is in use. They contain OS-agnostic advice.

    Again, I will shut up forever about it if anyone can provide a link where professionals recommend the absence of a firewall on linux.
     
  8. moontan

    moontan Registered Member

    Joined:
    Sep 11, 2010
    Posts:
    3,931
    Location:
    Québec
    well,

    FWIW, i think it's good for any noob like meself to test your firewall at GRC to see if there are ports open.

    and to plug the holes if there are.
     
  9. tlu

    tlu Guest

    Well, I'm sure you'll find such statements via Google, like this one. And this is what the Ubuntu documentation says.

    The problem is that most people used to use Windows before, and a lot of Windows users - I'd say: particularly members of this forum - use so-called Personal Firewalls aka package filters in order to iron out Windows design flaws. I guess that leaves an indelible mark for the rest of their life, particularly if they enable outbound filtering ;) They often keep that attitude once they move to Linux.

    But, as already mentioned, a standard Ubuntu installation has no open ports. It's therefore not attackable by "intruders". This is also true for client applications like browsers or email programs: They are usually attacked through downloaded content - and a firewall wouldn't help here.

    However, that's not true if you install server services like samba, ssh or apache as they are usually used to allow access from "outside". If you don't want that, you have to close the ports opened by that server with a firewall.

    Having said that, I nevertheless agree that it might still be a good precautionary measure to execute

    sudo ufw enable
    sudo ufw default deny

    - just in case openssh or something like that is installed by accident ;)
     
  10. moontan

    moontan Registered Member

    Joined:
    Sep 11, 2010
    Posts:
    3,931
    Location:
    Québec
    well said tlu

    that's exactly my case, and the case of other people, like you mentioned. (though i don't use outbound filtering anymore)
    i feel safer knowing what's happening with my machine.
     
  11. tlu

    tlu Guest

    Some basic info regarding open ports here and here and regarding port scanning here.
     
  12. Not if there's a vulnerability in the TCP/IP stack itself. I don't believe any such vulnerabilities are known in Linux, but you never know when one might crop up.

    (OTOH iptables could also have vulnerabilities. Not sure which of those is more likely.)

    Umm. Can't connections to a client program be spoofed?
     
  13. tlu

    tlu Guest

    Exactly - there could be vulnerabilities in iptables, too. I'm not sure if that is an argument pro firewall.

    Spoofed in what way? Let's take some recent Firefox vulnerabilities : You'll notice that they're talking several times about "opening a specially crafted page" in order to execute code or whatever. How would a firewall be able to prevent that? The connection is already established.
     
  14. tlu

    tlu Guest

    I should have said:

    ... and openSSH has a vulnerability. If it doesn't, the open port shouldn't normally do any harm.
     
  15. BrandiCandi

    BrandiCandi Guest

    I don't know if I would qualify those links as "professional" advice, as much as I like Ubuntu Forums and psychocats.
    :thumb:
     
  16. wat0114

    wat0114 Registered Member

    Joined:
    Aug 5, 2012
    Posts:
    4,066
    Location:
    Canada
    A question regarding the following ufw rule:

    Code:
    sudo ufw allow out proto tcp from any to any port 80,443,554,1755,1935
    
    will this rule allow all applications outbound to only these ports?

    I first did

    sudo ufw enable
    sudo ufw default deny
     
  17. I would like to know too!

    What's the command to just allow 53,80 & 443 out?
     
  18. wat0114

    wat0114 Registered Member

    Joined:
    Aug 5, 2012
    Posts:
    4,066
    Location:
    Canada
    I think I may have figured it out. Besides the above rule, I then added:

    Code:
    sudo ufw reject out proto tcp to any
    Then checking status I get:

    Code:
    ~~~:~$ sudo ufw status numbered
    Status: active
    
         To                         Action      From
         --                         ------      ----
    [ 1] 80,443,554,1755,1935/tcp   ALLOW OUT   Anywhere (out)
    [ 2] Anywhere/tcp               REJECT OUT  Anywhere/tcp (out)
    [ 3] 80,443,554,1755,1935/tcp   ALLOW OUT   Anywhere (v6) (out)
    [ 4] Anywhere/tcp (v6)          REJECT OUT  Anywhere/tcp (v6) (out)
    I checked the "Reject" rule by deleting the "Allow" rule and I was not able to connect with Firefox - as I would expect. Because ufw processes rules from top - bottom, the Reject rule is observed only after the Allow rule is processed. I had tried a sudo ufw block out proto tcp to any rule but that always blocked the browser from connecting out even with the Allow rule first so a Reject worked.
     
  19. BrandiCandi

    BrandiCandi Guest

    You have to allow port 53 TCP and UDP, which is DNS. If you don't include that you can't resolve any web addresses to actual web servers. That's why your current ufw rule sets aren't working.

    You also should allow DHCP Access - Ports 67 and 68 UDP if you're using DHCP (which you probably are if you have a router).

    As far as the rule you posted, you don't need to include the "from any to any" part because it's a bit redundant. if you just say "allow out 80,443,554,1755,1935/tcp" what you're telling ufw is that you will only allow traffic out of your computer on those ports to any address. You asked "will this rule allow all applications outbound to only these ports? Kind of. It will only allow applications that are configured to use those ports to function. So if you have email on your computer, it won't work because you need to allow it to use ports 25, 110, and 143. Make sense?

    I would recommend that you delete what you've done and then use these rules:
    Code:
    sudo ufw default deny incoming && sudo ufw default deny outgoing
    Code:
    sudo ufw allow out 53,80,443,554,1755,1935/tcp
    Code:
    sudo ufw allow out 53,67,68/udp
     
  20. wat0114

    wat0114 Registered Member

    Joined:
    Aug 5, 2012
    Posts:
    4,066
    Location:
    Canada
    Hi Brandi,

    I didn't have to create a udp rule to or from port 53. The default config is deny inbound only, so if a connection is initiated from pc to outbound, inbound will be allowed anyway. I could probably create an allowed outbound udp to port 53, then a deny udp to any. I'll experiment. What I did have to do, however, was create email tcp out to ports 143 & 110 to get Thunderbird to work :)
     
  21. BrandiCandi

    BrandiCandi Guest

    If you're denying all incoming and allowing all outgoing, you should be fine. And if you do it that way then you wouldn't have to worry about DNS because it will be allowed automatically.

    You only have to explicity allow ports if you're denying outgoing. Your post above showed that you were rejecting all outgoing except the ports you listed.

    Glad you got it sorted out.
     
  22. chronomatic

    chronomatic Registered Member

    Joined:
    Apr 9, 2009
    Posts:
    1,343
    I use Ubuntu and have disabled UFW all together. I use a router flashed with Tomato and turned the firewall on (which is just iptables since Tomato is Linux). No ports are open outside of my home network. I think a router is the best way to go.

    I agree that a firewall is not really necessary on an Ubuntu box since there are no open ports and no services listening. Iptables is not an application firewall, so it wont block specific applications or warn when applications try to make an outgoing connection, thus I see no reason to enable it at all on a *desktop* box as long as you are aware of what services (if any) are listening.
     
  23. tlu

    tlu Guest

    You're absolutely right. On the other hand, ufw default deny doesn't hurt, and you'd be safe if you installed a service by accident as happened to moontan.
     
  24. wat0114

    wat0114 Registered Member

    Joined:
    Aug 5, 2012
    Posts:
    4,066
    Location:
    Canada
    I like Chronomatic's approach too. All I'm trying to do is control to which remote ports applications are allowed to connect to, just for fun and to get myself into using the Terminal a bit more often :)
     
  25. wat0114

    wat0114 Registered Member

    Joined:
    Aug 5, 2012
    Posts:
    4,066
    Location:
    Canada
    Final rule set which I'm happy with:

    Code:
                           To                         Action      From
         --                         ------      ----
    [ 1] 80,110,143,443,554,1755,1935/tcp ALLOW OUT   Anywhere (out)
    [ 2] 192.168.1.254 53/udp       ALLOW OUT   Anywhere (out)
    [ 3] 208.67.222.222 53/udp      ALLOW OUT   Anywhere (out)
    [ 4] Anywhere/tcp               DENY OUT    Anywhere/tcp (out)
    [ 5] Anywhere/udp               DENY OUT    Anywhere/udp (out)
    [ 6] 80,110,143,443,554,1755,1935/tcp ALLOW OUT   Anywhere (v6) (out)
    [ 7] Anywhere/tcp (v6)          DENY OUT    Anywhere/tcp (v6) (out)
    [ 8] Anywhere/udp (v6)          DENY OUT    Anywhere/udp (v6) (out)
    
    
    Funny thing is, "Deny" now works o_O Anyway, as Brandi alluded to, it's all sorted :)
     
    Last edited: Sep 7, 2012
Thread Status:
Not open for further replies.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.