Advanced linux talk: security

By the amount of linux spam on the forum of people that don't even take the time to read the threads that already are on the forum any more, it's clear that a lot of people are taking the step towards linux, but are "consuming" linux like there are "consuming" a youtube video or a casual video game, so it's time for the next step, a thread for advanced linux users to discuss in, so that n00b users may learn a few things about security, and why they should not use fast-food-distros like Mint and Ubuntu.

This about security.

I would like to see linux users here post which methods they use to harden their installs, which RBAC (DAC/MAC), which kernel patches, do you use PaX, do you use gradm, do you use clamav for those working in a mixed environment with windows liabilities, do you use virtualization, etc...

Let me start with writing what I use on my daily driver boxes: I use Fedora, which comes with SElinux and firewalld, and use kvm/qemu and lxc, and to complete SELinux I use PaX and grsecurity patches, with gradm for policy control, and a strict userspace profile.

Let me know what you guys are using, and then let's discuss linux hardening...

I just reinstalled Arch 4 days ago, as an educational experiment (will be doing it again to get a successful partionless btrfs install), so my security setup isn't very "advanced" right now, but I did build Grsecurity upon install, with the (I believe Linux default) DAC. gradm is a great tool, indeed, and works fantastically, but I don't exactly have a very strict policy, by, well, any standards. I have been meaning to work more on system security, and this thread will serve (hopefully) as a great motivator.

Yup, DAC is standard for linux, but many distros don't configure non-sudo user accounts by default, which defeats the purpose pretty much.

Very good that you compiled the grsecurity patches into the kernel and installed gradm, not that much users even do that. In fact, a lot of users can't even use it effectively, because they don't have systemd distros.

As I mentioned in another thread, most people I see (at least, in the Arch community) don't like systemd because they were set in their ways for an rc script system, but that really only benefits users who liked editing a single rc.conf for startup programs, etc., which isn't a huge deal on systemd, and isn't in itself a great example of systemd's power. It's something that can be handled so many ways that makes the fact that systemd offers that control shouldn't be a deal-breaker. 

Yeah, I agree completely, it's a bit of a thing in the linux world that people that adhere to the oldest distros tend to be very conservative, but often after 20 years, they've hit a bit of a burnout or an enthusiasm low, they did do all the hard work on the barricades of open source for all these years, it's to be expected that something like that happens.

I'm always excited for new stuff, I think it's great that Arch switched to systemd, I also think it's great that Arch switched to Python3. Part of the credibility of a bleeding edge distro is to implement new technologies very well early on, and that's exactly what fedora, gentoo and arch are always doing. The reality is that the bleeding edge distros not only perform better and have more features because they implement these new technologies, but also that whereas it takes six months - fedora to arch and gentoo - to implement these technologies stable, reliable, and fully functional, in the bleeding edge triumvirate, it takes medieval distros sometimes years to even implement them in a usable or stable fashion, even though they only start implementing them much later than the bleeding edge triumvirate. And not only new technologies, but also their own crap. I was so amused to see that portage, yum and yaourt had Cinnamon 2.0 before Mint did, whereas it's a fucking Mint contraption, and on top of all that, it was running on bleeding edge kernels, super fast and super stable, none of which was applicable to the Mint implementation, which was anything but smooth. The only way is forward, the problem is to keep motivating the people that are tired of gliding on the razor's edge, that are burned out a bit and disappointed by the fact that linux on PC has been boycotted so much for so long, and that people are so ignorant, whereas they've dedicated huge parts of their lives fighting for open source and educating people and investing a lot of their spare time after work to develop open source to the point where it is today.

Another problem is that people also need to stop thinking about servers when they think of linux. Yes, Debian is great for servers, but Debian sucks for modern desktops, because it's bloody medieval, and the Debian boys should quit the candy, because not implementing systemd but choosing Gnome Shell as the default distro, just at the point where nautilus is worse than ever before, where geo-location is unremovably integrated in Gnome, and where Gnome has broken more extensions than ever before, is just plain madness. Yes Ubuntu used to be great, but Ubuntu sucks across the board now, and has been sucking ever more for the last 3 years, to the point where it took them more than a fucking year to get 12.04 stable with 12.04.3... like wow, and it doesn't even have systemd, and it's still on x.org and gtk. Yes Mint is an improvement on Ubuntu, but what's the use in polishing a turd? Cinnamon looks less disturbing than Unity because it's not a chaotic Windows 8-like clickfest like Unity, but is it really good, it's about twice the RAM of Gnome Shell 3, it's 50% more RAM than KDE plasma, it's slow, and not finished, and it does nothing better than XFCE with Whisker or KDE with Lancelot. Etc... Modern PC's need features, they need speed, and they need the stability and ease of use of modern bleeding edge distros. Why did Manjaro grow from nothing to one of the most popular distros in only about a year's time, and they're still in beta (version 0.8.8 now)... because it's fucking bleeding edge and full-featured, it destroys Ubuntu in ease of use and performance, and people love it. Ubuntu is just a drag, it's a frustrating nightmare in comparison to modern user-friendly distros. People need to drop the marketing and the nostalgia, again, the only way is forward.

Not to detract from the focus of the thread, but part of the reason that your so-called "McDonalds" distros (love the term, by the way) are so ubiquitous in States is because of the conservative majority. Slow to change, slow to do, well, anything - Ubuntu was (and still is) a huge name in the Linux community, whether or not it is a good distro, or not. People know of it, and because they know of it, they assume it is good. Obstenance is taught, basically, from the ground up with thevery antiquated public education system hell-bent on standardization. Bleeding-edge is the only way to go, I agree, but, for example, taking the American education system and updating to the latest standards, actually removing the old non-functional systems, and replacing them, is near impossible due to the social view of the masses and the redundancy and aforementioned obstenance of the system itself. The same applies to Linux distros, especially in America. (American) Society will never be receptive to change, with the way things are currently going - and that is clearly evident in the adoption of distros. Sure, it's Linux, but it isn't in the *nix philosophy to not only use, but promote obsolescence, and that is exactly what Canonical is doing.

Forward, as you said,is the only way, but America likes just stop altogether.

Back to security, though.

But it has a lot to do with security. Debian, Ubuntu, etc... don't even have SELinux. You can RSBAC Debian, but it's REALLY hard to configure it perfectly for a desktop, it's really only a server thing on Debian.

People think that they're safe, but without PaX, they're not, especially on Debian or Ubuntu, because it takes .DEB distros so long to react to zero-day threats, so even with PaX, the time you gain against zero-day attacks, is not sufficient to implement a patch, because it'll be weeks or months before a patch comes through, unless you're lucky enough to be able to patch the system through the SuSE build service based on a patched RPM package.

I don't get it to be honest. As a beginner, I would be super happy to be able to use a practical, modern, fast and safe distro. If a vulnerability is found nowadays, chances are that if you check Arch, Gentoo and Fedora, a patch will already be in the repos as an update by the time you even read the notification mail. Sabayon and Manjaro are almost as quick on the trigger as Arch and Gentoo, but it may take Ubuntu months to provide a patch, and in the mean time, you don't even have a full controlled PaX to prevent zero-day exploits. Some things are patched by Google or another dev community, and in that case, the Ubuntu desktop users are lucky, whereas the Debian desktop users are not (the Debian server users patch themselves, servers are not the issue), or the Debian desktop users might be so lucky as to have a patch within days, but the Ubuntu users may not. And even IF they would go through the trouble of hardening an Ubuntu install, they would get so much breakage all the time and so much annoyance, they would give up.

I would like to know how many Ubuntu users have hardened their system, how many Ubuntu users run grsecurity (Pax + RSBAC).

Another thing is clamav. I would like to know how many dual booters use clamav, because I don't think many users realize that whereas linux might be impervious to viri, the linux install also offers a great vector to implant malware deeper into a Windows install, while at the same time, clamav does a much better job of cleaning the Windows install. Do people even use clamav, or do they continue to use useless Windows anti-malware software?

I have been using ubuntu recenlyt(to see what cannolical have been up to). I use clamAV and web surf in a VM but I might switch distros after reading this. Has opensuse tumbleweed got Pax yet? If not I will go sayaban or manjaro.  I am still a bit of a newb only 2 years of linux use, (my bash skills could use some work.)

You can get grsecurity on everything, it's just how easy it is to work with, and how much features and how new a kernel the distros have.

OpenSuSE is medium bleeding edge, Tumbleweed is actually quite recent and quite well implemented, but OpenSuSE is one of those distros that by default create a sudo user account and no separate root account, so you have to specify that during install, but luckily, there is a simple check-option to do that. I like the OpenSuSE installer, because it's the most full-featured GUI installer out there, I like the option to enter fstab parameters right during install (although it doesn't by default enable the SSD I/O scheduler for instance or doesn't detect SSD's automatically like Sabayon and Manjaro do).

Manjaro and Arch are very close together. Manjaro is partly upstream to Arch, as is Arch very much upstream to Manjaro.The weak point in Manjaro is the GUI installer, their own installer that they use now is much better than the Mint installer they used before, but it's still not as good as their CLI (pseudo-GUI, or "assisted") installer. One of the problems with the Manjaro GUI installer is the same as with the Yast (OpenSuSE) installer: no separate root account, and a user sudo/wheel-account by default, difference here is that there is no simple check-option to make separate accounts, and that's not so good. The Manjaro CLI installer doesn't do that though, so from a security perspective, I would recommend using the CLI installer (and not only that, it also has more features, is faster, and less ambiguous). I'm glad they reduced the Mint bling in Manjaro, it was causing problems, the Mint bling period was their weakest period until now, they were stronger before and after. Sabayon uses the Fedora installer, Anaconda, and that's not the most full-featured installer out there, but it does have some really nice features (like partitioning assistance that actually works really well and interactively), and above all it's super stable and fast.

Fedora is the primus inter paris of the bleeding edge triumvirate, which is not surprising as the bloody thing is upstream to the most successful professional commercial linux distro in the world, and the bulk of the linux kernel contributors are either RedHat employees that are also in the Fedora community because it's their job, or Intel/IBM/AMD people that are in the Fedora community because they want to test against the latest and greatest. Whether Fedora always plays nice, and is the ideal distro, is another thing, because sometimes there is just a bit too much RedHat influence in Fedora for a community distro, for instance, Gnome has become a RedHat project, and there are some very strange things happening in Gnome, but on the other hand, there is a choice of other DE's in Fedora, and to be honest, the implementation of Wayland that I like most, is Hawaii from the maui project, but then not in the maui project, but on any of the bleeding edge triumvirate distros. Gnome is not super in terms of security though, not that there is a security problem with it, but just that the recent decision to implement geo-location in such a way that you can't uninstall it without breaking Gnome, is not a good sign as to the future privacy awareness of Fedora/RedHat, and that just bugs the hell out of me. But Fedora is very secure out of the box, it has libselinux, it has very good profiles, it has the best packaging system of any distro, it's all very secure in terms of open source, and they do respect the user's privacy in ABRT and libreport, all sharing of information is opt-in, not opt-out, and there are multiple layers of confirmation required, so that's good.

Sabayon has wildly improved recently, they are really on top of things for the moment. Not only is Gentoo arguably the best independent community distro together with Arch, it's also the fastest GNU/linux distro of all distros, without a doubt, and it's the basis of ChromeOS. ChromeOS is actually a pretty safe distro, it has all the security features talked about in this thread out of the box, without need for further configuration or customization, it's all there, Chromebooks run on Coreboot open-source BIOS, ChromeOS is very tight security-wise, except that there is one thing ChromeOS offers no security measures against: Google itself, they can data mine whatever they want and can push whatever they want to a ChromeOS system. And that's very unfortunate. But it does have a very important advantage: the Gentoo community can look into Google's code and configurations (because open source), and can use whatever is useful, profiles for instance. Sabayon comes with Google Chromium by default, and it's been rendered harmless, so it's safe to use. That means the extra advantage of the internal sandboxing, better flash support, and all the Google services in a secure environment. So Sabayon doesn't only offer the safest and best implementation of Steam Big Picture, but also of Chromium. And those are very important points nowadays. Gentoo/Sabayon, can very easily be hardened, and do offer more flexibility than Fedora in doing so. If RedHat should start dicking around with Fedora, I will first move to Sabayon, because although it has a few builds delay to the kernel, it's a source/binary distro, and source is always better in the long run for maximum performance. By default, it will be source-based.

People that replace ChromeOS, which is a hardened mini-Gentoo install, with mcdonalds-distros like Ubuntu, REALLY don't know what they are doing, because they're reducing the security of the system.

Most security features in linux come from kernel functionality, just by replacing ChromeOS with Ubuntu, you pretty much kill at least two years of linux evolution, even more when you take into account that Ubuntu doesn't support systemd, and that it has apparmor, but not enabled by default, and without many profiles or with old profiles, and apparmor is pretty easy to circumvent. Google knows why they base ChromeOS on Gentoo and not on Debian or Ubuntu, they could have based it on Debian, it would have been cheaper for them, but they took a more expensive route, because they want the Chromebooks to get a reputation as very safe to use devices.

I would also like to see how many people that got a successful malware infection or attack on a linux system, where not running Ubuntu or Mint, because the few cases that I know off whereby a linux system was compromised, was always on Ubuntu.

PaX is a tool that buys you time when your system is being targeted by a security vulnerability exploit. Such vulnerabilities come with bad code. Bad code is ALWAYS present in closed source software, whether that be Adobe flash player (and that is a total disaster on linux, so it's most certainly vulnerable), or some proprietary graphics driver by nVidia or AMD, or a commercial application like Steam or Skype. Sometimes there are also vulnerabilities in open source code, but those are rare in release versions, even though they are not so rare anymore in comparison to a few years ago, but it's getting better again because of the extensive use of coding tools that can automatically check for vulnerabilities. Pax can prevent exploits to execute code vulnerabilities, even if the vulnerability is not known. For instance, a process starts to use a buffer overflow. That is suspicious, and PaX will detect that and immediately block that. Now part of why Intel and AMD are so motivated to make the open source graphics drivers the primary drivers, is because if they are open source, they eliminate security vulnerabilities, and the drivers don't cause problems with security functions like PaX. For instance, a user has an nVidia graphics card, and can't use nouveau due to the lack of performance, so has to use the proprietary nVidia GeForce driver. This driver is a closed source Windows driver that runs in a compatibility layer. It also talks to proprietary closed source kernel modules that have been compiled into the kernel by the installer or the akmod/kmod/dkms packages. There are vulnerabilities in that proprietary driver, and possibly also in those proprietary kernel modules. There just are, just by the size, it's more than clear that that closed source software is not ideally optimized at all, and that it contains a lot of crap. If you run PaX, PaX will detect a buffer overflow or similar vulnerability as it pops up in the system, and will insulate that part of code, so that IF there would be an exploit, it would not be able to execute. Now the problem is, that this security measure, can block the nVidia driver, in which case, the graphics card can't work with the proprietary graphics driver any more, and there is nothing the user can do except disable the security features in his distro, so basically, turn it into a open unprotected malware target like Windows. Well, not like Windows, because it will still be exponentially safer than windows, but it will not be as safe as other distros that don't have the proprietary driver, and that have PaX without breakage.

Thank you for the detailed and patient reply.

That open opened my eyes to getting rid of a sudo based account setup. So tonight I will be replacing Ubuntu with Sayabon.  I have a Nvidia GPU so no Pax but I will have appamour and systemd.If more of the Linux community was like you I would participate more often.

 

 

 

 

 

 

 

Sabayon is bleeding edge, you can use PaX, you won't get breakage. The only thing to be aware of is to not use the nVidia installer (from the nVidia website) for installing the proprietary drivers. Use the nVidia drivers that are in the repos of Sabayon, they will have patched kernel modules for kernel 3.12, which is the kernel Sabayon runs on now, and it will be stable and run without artefacts.

You'll really enjoy Sabayon after Ubuntu, I'm sure.

Coming from Ubuntu + Unity, the biggest hurdle is that you'll be using another DE. Those come out of the box with a rather "default" configuration, because they're not "one size fits all" like Unity, they are made for customization, so take your time building up your ideal graphical computing experience, it really pays off.

I was triple booting Sayabon, Ubuntu and Windows 7.I am interested in what Unity will be like they make the switch to QT.  I will just keep Ubuntu in a VM. Which DE would you suggest I like E 11 but it can be a little buggy.

 

If you would like to see how bad x.org can be search x security on YouTube its from c/3.

I do agree even though Linux is a lot more secure oob from windows, and if you use arch gentoo or fedora you are even better protected which leads me to think, why is tails deb based? Strange to be set around security but uses a old database...

Also gtk has its problems not as many as x.org but still, just wait for the days of java and flash to die (Firefox get your asses in gear) we are a hell of a lot more secure from start.

Also I use clamav on my fedora distro, I don't have a windows partition but my dads laptop is windows so more for that, also live disks...

Still to configure stuff like this was going to use apparmor but Novell, MS ERM no ta may go grsecurity.

Tails is a distro focused on privacy, not on security. There is a difference. Tails uses Tor by default and stuff like that, and that may be useful for some people, like whistle blowers or journalists, but they are useless for normal users.

X.org had to solve so much problems in the past, that it became a hugely complex monster. That is historical. It's not that unsafe, the standard is very high in open source, and probably the biggest challenge right now is to keep it that way.

But this is exactly the kind of small problems where PaX is a really useful safety net. It makes it a whole lot harder to exploit small bugs or inconsistencies, and to be honest, a complex piece of software like an X server, will never be completely safe, because of the complexity and the constant evolution.

SElinux has other advantages over AppArmor, in that it has much better diagnostics and notifcation for instance. It used to be very annoying to run SELinux, but since a couple of years, it has become really easy to use and to be honest, since Fedora 18, I haven't had any SELinux problems anymore, and that's a year ago.

I like Fedora a lot, but I'm also conscious of the fact that all the bills at Fedora are paid by RedHat, just like the bills at OpenSuSE are paid by Microsoft, Novell and AMD. And although they are still community distros, they really aren't that independent, and that sets them apart from independent community distros like Arch and Gentoo. Arch and Gentoo have a great way of moving forward, despite being an independent community distro, which sets them apart from other independent community distros like Debian or Slackware, etc... there is always a set of characteristics to every distro out there, and that benefits users: if Fedora or OpenSuSE go to far in the commercial direction, people start using Arch or Gentoo, and if Arch and Gentoo rush forward too fast and become instable, people switch to Debian or Slackware, and they keep each other in balance.

Yeah, but Enlightenment is at E17 now, and that's not that buggy any more, but it's all about from scratch configuration, and that's great for users who have the patience to do that, and also very rewarding in the end.

A lot of users that like tiling, still focus on AwesomeWM or the likes, whereas in most cases, for desktop users with only a few virtual machines running, that don't require constant monitoring beyond the capabilities of the bog standard hypervisors, something like E17 would actually bring a lot of advantages.

Unity doesn't interest me at all to be honest. The Ubuntu users typically use a lot of gtk applications, so I predict even heavier systems in the near future with Qt-based Unity on top of Mir. I don't know, I don't see where Canonical is going, I think they have great ideas, but an acute lack of vision.

True but with privacy you should expect security, yeah it connects tor by default but you would have though set it on fedora so your bleeding edge and secure, have stuff like pax clam av etc etc and it could be a rather hard distro, I understand its all live but doesn't stop hackers as well due to base I would have thought

Also can you run selinux and pax together without breakage on a fedora system? Just install?

Also if you had to choose would you go fedora or sabayon from a security standpoint I understand that rolling has its advantages security wise, always been up to date on base over waiting 6 months for base update on fedora

Again all comes down to learning and posts exactly like this with friendly discussions always help :)

Yup, no breakage is to be expected with running pax + libselinux. You just cherry pick the grsecurity parts you want, and leave their RSBAC out of it, but use SELinux instead.

Fedora is periodical release, but it's not really. Mostly a release ships with the last kernel of the previous release, so that Fedup works without issues, and there is a zero-day kernel upgrade through the repos. That's just a wise decision. Fedup works great, I've never seen breakage, and it works really fast for a full system update (about 10 minutes on a newer system). A full system update has the benefit of starting out with a clean system. I actually prefer the Fedora system over a rolling release, but then Fedora is the only distro with a fully functional update tool that actually works.

Now the difference between Fedora and Sabayon/Gentoo, is not so enormous. Thing to know is that Fedora has all the RedHat, Intel, AMD, IBM, and linux foundation guys in it, that is a benefit no other distro has. Fedora was introduced 10 years ago, so came pretty late to the show, but in those 10 years, because of very strict packaging rules and a tight set of rules, they have created a new, higher, quality standard for linux distributions, and that has brought them to the forefront of linux development. Fedora is the only distro that has no upstream, and yet, it's also one of the most stable and easy-to-manage distros, with an incredible set of modern tools. Gentoo is the same, but they are not pushed forward by a commercial back-end, but just by the hacker motto "because we can". The same goes for Arch by the way. Fedora, Arch and Gentoo are the bleeding edge triumvirate, the source of all things GNU/Linux, they have a different focus, but they are very similar. Like for instance, the standard application manager in Fedora and Gentoo can both do package and source based installations, but Fedora mainly does packages (RPM-based), and Gentoo does mainly source (but can also do packages, and is also RPM based). Arch has it's own packages, and has the AUR, which makes source almost superfluous for most users.

In terms of security, both Fedora and Gentoo enable the selinux kernel headers by default, arch doesn't, but that's an easy enough fix, and in good Arch tradition, there is very good documentation on how to do it.

Okay so what would you recommend on sudo files, the fact a basic user can run sudo and become root, is this a wise idea or should you deselect the option to be admin in anaconda? Seeing as in windows it is recommended that you have 2 accounts, one admin and one standard so you can self elevate the system for that one command?

I do plan to do a reset of Fedora with security beefed up learning that PaX is around (Didnt know before today :P) so adding a little bit of extra security would be ideal via logins.