#949 Fixed serious SELinux issue.
Closed a year ago by pboy. Opened a year ago by pboy.
pboy/fedora-kickstarts main  into  main

Fixed serious SELinux issue.
Peter Boy • a year ago  
file modified
+7 -5
@@ -174,6 +174,11 @@ 

  ##### begin custom post script (after base) #########################

  %post

  

+ # When we build the image /var/log gets populated.

+ # Let's clean it up.

+ echo "Cleanup leftover in /var/log"

+ cd /var/log  && find . -name \* -type f -delete 

+ 

  echo "Zeroing out empty space."

  # Create zeros file with nodatacow and no compression

  touch /var/tmp/zeros
@@ -191,11 +196,8 @@ 

  rm -f /etc/systemd/system/default.target

  ln -s /lib/systemd/system/multi-user.target /etc/systemd/system/default.target

  echo .

- 

- # When we build the image /var/log gets populated.

- # Let's clean it up.

- echo "Cleanup leftover in /var/log"

- rm -rf /var/log/*

+ rm -f /var/log/anaconda/*

+ touch /.autorelabel

  

  %end

  ##### end custom post script ########################################

Enable VM to create journals again.

Is there a bug filed about this to selinux-policy? This seems like the wrong place to fix it.

This isn't the right way to fix whatever you are seeing. File a bug with selinux-policy and/or anaconda which has some extra relabeling steps it takes.

Sorry, my comment may have been a bit short. There is no bug in SELinux, but it was a wrong resp. missing action added to the kickstart in order to empty a subdir. That results in a SELinux issue. And there is nothing wrong with Anaconda either. If, then something would be to improve with OZ and/or Imagefactory. And who wanted to deal with that? Both are in such a state that fixing a flaw is not the answer. That would be at least a one-year effort.
Unfortunately, without my fix, it makes the VM unusable, so it's important to fix it for release.

I'm a bit lost here... can you describe the actual issue? Is there a bug/description somewhere?

I might speculate that it's systemd-journald being mad that /var/log/journal doesn''t exist and it can't create it? But not sure...

I'm a bit lost here... can you describe the actual issue?

There is no bug anywhere but I originally just used a wrong resp. inappropriate procedure.

With the original command I just deleted the complete content of /var/log. As that step is outside a running VM, by manipulating the vm diskfile, the SELinux labels are not updated (and simply can not get updated). And with the first boot, systemd-journald can not re-create the journal subdirectory and sends all the output to the terminal. (You got it right, exactly. Why not those ...). I fixed it by just deleting the files but retain the subdirectories inside /var/log, and added a relabeling to first boot, following an information I found in virt-builder documentation.

So that is really not an issue of SELinux or Anaconda. Both are no longer active at all by the time this happens in ImageFactory. If anything, it is a shortcoming of ImageFactory. But the same problem arises with virt-builder and with guestfish. Those expert will know that much better than me.

And when I think of the effort it took both of us to include the VM Kickstart, I feel a bid screwed and hindered as much as possible by some people to improve something on Fedora Server.

ok, thats fine. I just wanted to know what the issue was. ;)

I don't think the line 23/24 changes are needed.

anaconda files would have been deleted by the previous find command right?
and I don't think we want to force a relabel on boot, or everyone who boots the image will be annoyed that it has to do a relabel when first booting.

The find not deleting /var/log makes perfect sense.

Pull-Request has been closed by pboy

a year ago
Metadata