[CentOS] how to set a directory to system_u?

Sat Oct 2 11:49:47 UTC 2021
hw <hw at gc-24.de>

Hi,

I'm trying to a lable a directory for ejabberd to store files
that were uploaded with the http_upload module.  Apparently
I should set this to 'system_u:object_r:ejabberd_var_lib_t:s0'
since all the files in /var/lib/ejabberd are.  So:


ls -laZ /srv/data/
unconfined_u:object_r:ejabberd_var_lib_t:s0 320 Jul 29 23:55 ejabberd
semanage fcontext -a -t ejabberd_var_lib_t -s system_u '/srv/data/ejabberd(/.*)?'
restorecon -R /srv/data/ejabberd/
ls -laZ /srv/data/
unconfined_u:object_r:ejabberd_var_lib_t:s0 320 Jul 29 23:55 ejabberd


Why doesn't this work?  Why can't they finally write some decent tool to
use selinux that allows us to keep it enabled???

How can I set up the directory for ejabberd to store files in?