1

Just getting started with Selinux on a Fedora 27 droplet from Digital Ocean. Apparently the semanage command is not installed by default. Every tutorial I've read refers to this command. I need to set the selinux context for a directory that contains a systemd-nspawn container. Normally we would run something like this:

$ semanage fcontext -a -t svirt_sandbox_file_t "/path/to/mycontainer(/.*)?"
$ restorecon -R /path/to/mycontainer/

Very surprised to find Fedora 27's documentation is not up-to-date on selinux. Just a hodge-podge of old docs and articles that refer primarily to yum packages, stating that the selinux tools are installed by default. All of them refer to the semanage command.

I mean, if I sudo dnf search selinux, a million packages show up, including the policycoreutils packages, which seem to be the ones that most of the tutorials refer to. But I'm more concerned with the lack of information. I thought selinux shipped complete on Fedora.

What am I missing here? Is there another way of setting selinux context? Should semanage work out of the box on Fedora?

  • $ rpm -qf --qf '%{name}\n' $(which semanage) policycoreutils-python-utils – Ignacio Vazquez-Abrams Dec 11 '17 at 4:43
  • You may want to use sestatus to see if SELinux is actually available though. – Ignacio Vazquez-Abrams Dec 11 '17 at 4:44
  • Sestatus shows selinux is enabled. The above command outputs error: no such file or directory. – tilikoom Dec 11 '17 at 13:19
  • I can easily dnf install the policycoreutils packages but as mentioned, I thought selinux was ready to go on Fedora so I assumed that I was missing something. Take care. – tilikoom Dec 11 '17 at 14:12
  • Yes, you're missing the package I indicated... – Ignacio Vazquez-Abrams Dec 11 '17 at 14:53
1

On my installation vm (Not on DO) I simply did the following:

1 - [sudo] yum provides semanage
policycoreutils-python-utils-2.7-4.fc27.x86_64 : SELinux policy core python utilities
Repo        : @System
Matched from:
Filename    : /usr/sbin/semanage

2 - [sudo] yum install policycoreutils-python-utils-2.7-4.fc27.x86_64

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.