Skip to content

Commit 938f54b

Browse files
committed
(PUP-110603) Mark ZFS as an SELinux-Capable Filesystem
Since OpenZFS 0.6.3, ZFS can handle SELinux labels. We should therefore allow Puppet to set labels for files on ZFS filesystems. Adding the test here is probably excessive, and whilst I did consider adding a check to make sure the version of ZFS in use was recent enough, I couldn't see a way to do so without linking this package to `zfs_core`. Additionally, Puppet 7 only supports back to CentOS 6, which has OpenZFS 0.8.5 builds in the official repos.
1 parent 13188f1 commit 938f54b

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

lib/puppet/util/selinux.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ def selinux_category_to_label(category)
204204
def selinux_label_support?(file)
205205
fstype = find_fs(file)
206206
return false if fstype.nil?
207-
filesystems = ['ext2', 'ext3', 'ext4', 'gfs', 'gfs2', 'xfs', 'jfs', 'btrfs', 'tmpfs']
207+
filesystems = ['ext2', 'ext3', 'ext4', 'gfs', 'gfs2', 'xfs', 'jfs', 'btrfs', 'tmpfs', 'zfs']
208208
filesystems.include?(fstype)
209209
end
210210

spec/unit/util/selinux_spec.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
'/' => 'ext3',
6666
'/sys' => 'sysfs',
6767
'/mnt/nfs' => 'nfs',
68+
'/mnt/zfs' => 'zfs',
6869
'/proc' => 'proc',
6970
'/dev' => 'tmpfs' })
7071
end
@@ -85,6 +86,10 @@
8586
expect(selinux_label_support?('/dev/shm/testfile')).to be_truthy
8687
end
8788

89+
it "should return true if zfs" do
90+
expect(selinux_label_support?('/mnt/zfs/testfile')).to be_truthy
91+
end
92+
8893
it "should return false for a noncapable filesystem" do
8994
expect(selinux_label_support?('/mnt/nfs/testfile')).to be_falsey
9095
end

0 commit comments

Comments
 (0)