Skip to content

Commit

Permalink
Merge pull request #21064 from Vogtinator/cifselinux
Browse files Browse the repository at this point in the history
network/cifs.pm: SELinux-aware directory creation
  • Loading branch information
grisu48 authored Jan 28, 2025
2 parents 55b8c60 + 5c4969c commit 132767f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tests/network/cifs.pm
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,13 @@ my @versions = qw(2.0 2.1 3 3.0 3.0.2 3.1.1);

sub setup_local_server() {
# Setup a local samba server with "currywurst" and "filedrop" shares
zypper_call('in samba');
my $pkgs = "samba";
$pkgs .= " policycoreutils-python-utils" if has_selinux;
zypper_call("in $pkgs");
assert_script_run("useradd geekotest");
assert_script_run("mkdir -p /srv/samba/{currywurst,filedrop}");
# The custom path needs to be explicitly allowed
assert_script_run('semanage fcontext -a -t samba_share_t "/srv/samba(/.*)"') if has_selinux;
assert_script_run("mkdir -Zp /srv/samba/{currywurst,filedrop}");
assert_script_run('echo -e \'[currywurst]\npath = /srv/samba/currywurst\nread only = yes\nbrowseable = yes\nguest ok = yes\n\n\' >> /etc/samba/smb.conf');
assert_script_run('echo -e \'[filedrop]\npath = /srv/samba/filedrop\nbrowseable = no\nwrite list = geekotest\ncreate mask = 0644\ndirectory mask = 0755\n\' >> /etc/samba/smb.conf');
assert_script_run('curl ' . data_url('samba/Currywurst.txt') . ' -o /srv/samba/currywurst/Recipe.txt');
Expand Down

0 comments on commit 132767f

Please sign in to comment.