If you've already spent the time learning SELinux, but have to deploy Ubuntu as a server operating system, you can install SELinux and be on familiar ground. Jack Wallen shows you how.
Ubuntu Server has its own Mandatory Access Control system, called AppArmor, which is similar to SELinux, in that they both provide tools to isolate applications from one another, to protect the host system. But how each of these tools is used is quite different. In fact, just because you know one, doesn't mean you'll be able to immediately use the other. That's why you might want to consider installing SELinux on Ubuntu Server. You might be migrating from a Red Hat-based distribution and have invested considerable time learning how to use that particular system.
Good thing you can install SELinux on Ubuntu.
In fact, it's actually quite simple, and I'm going to show you how it's done. Once finished, you can start working with SELinux on Ubuntu Server in the same way you did when administering your Red Hat-based systems.
What you'll need
To make this work, you'll need a running instance of Ubuntu Server 20.04 and a user with sudo privileges. That's it. Let's get to work.
One warning: I highly recommend you first try this on a test system. And once you're certain it will work for you, I would recommend you install SELinux on a fresh install of Ubuntu Server and then build from there.
How to remove AppArmor
The first thing to do is remove AppArmor. Log into your Ubuntu Server and stop the service with the command:
sudo systemctl stop apparmorNow we can remove AppArmor with the command:
sudo apt-get remove apparmor -yOnce AppArmor has been removed, reboot your system with:
sudo rebootHow to install SELinux
Now we can install SELinux. Back at the terminal window, issue the command:
sudo apt-get install policycoreutils selinux-utils selinux-basics -yWhen the installation completes, activate SELinux with the command:
sudo selinux-activateSet SELinux to enforcing mode with:
sudo selinux-config-enforcingFinally, reboot your system once again with:
sudo rebootWhen the system comes back up, check to make sure SELinux is enabled with the command:
sestatusYou should see something like:
SELinux status: enabled SELinuxfs mount: /sys/fs/selinux SELinux root directory: /etc/selinux Loaded policy name: default Current mode: permissive Mode from config file: enforcing Policy MLS status: enabled Policy deny_unknown status: allowed Memory protection checking: requested (insecure) Max kernel policy version: 31And that's all there is to install SELinux on Ubuntu Server 20.04. If you're already familiar with this security system, you can jump in and start securing your server.
Cybersecurity Insider Newsletter
Strengthen your organization's IT security defenses by keeping abreast of the latest cybersecurity news, solutions, and best practices. Delivered Tuesdays and Thursdays
Sign up todayAlso see
- How to install Nextcloud 22 on Ubuntu Server 20.04 (TechRepublic)
- How to define DNS in Docker containers (TechRepublic)
- How to become a cybersecurity pro: A cheat sheet (TechRepublic)
- Security threats on the horizon: What IT pro's need to know (free PDF) (TechRepublic)
- Checklist: Securing digital information (TechRepublic Premium)
- Online security 101: Tips for protecting your privacy from hackers and spies (ZDNet)
- Cybersecurity and cyberwar: More must-read coverage (TechRepublic on Flipboard)