SELinux Archive on
 help / color / Atom feed
From: Gionatan Danti <>
To: Dominick Grift <>
Cc: "Christian Göttsche" <>,
Subject: Re: lnk_file read permission
Date: Fri, 31 Jul 2020 21:37:30 +0200
Message-ID: <> (raw)
In-Reply-To: <>

Il 2020-07-31 19:09 Gionatan Danti ha scritto:
> I did not know that systemd would, with specific settings, create a
> private mysql data dir.
> I would try the var_lib_t approach more widely.
> Thanks.

Mmm, it seems labeling the link as var_lib_t is not always sufficient.
Doing a mongodb test relocation from /var/lib/mongodb to /zzz/mongodb 
the service does not start, even if I can see the link having var_lib_t 

# ls -alZ /var/lib/
lrwxrwxrwx. root    root    unconfined_u:object_r:var_lib_t:s0 mongodb 
-> /zzz/mongodb

Indeed, I can see the following in /var/log/audit:

type=AVC msg=audit(1596222151.576:253): avc:  denied  { read } for  
pid=4313 comm="mongod" name="mongodb" dev="dm-0" ino=33673444 
tcontext=unconfined_u:object_r:var_lib_t:s0 tclass=lnk_file permissive=0

Relabeling the synlink with its "native" label via restorecon -RF 
produce the following:

# ls -alZ /var/lib/
lrwxrwxrwx. root    root    system_u:object_r:mongod_var_lib_t:s0 
mongodb -> /zzz/mongodb

But the service again does not start, with the followin logs:

type=AVC msg=audit(1596222240.363:257): avc:  denied  { read } for  
pid=4344 comm="mongod" name="mongodb" dev="dm-0" ino=33673444 
tcontext=system_u:object_r:mongod_var_lib_t:s0 tclass=lnk_file 

What would be the best approach in this case? I know that one approach 
would be to use a bind mount, but I would like to avoid it because:
a) it has bad filesystem discoverably (you had to search for bind mount 
explicitly, while a symlink is visible even with a simple ls)
b) I need to setup a fcontext <<None>> for the actual dir which is 
bind-mounted (otherwise, a "restorecon -RF /zzz/" will cause issues, by 
relabeling any files with default_t)

I am open to suggestions...

Danti Gionatan
Supporto Tecnico
Assyoma S.r.l. -
email: -
GPG public key ID: FF5F32A8

  reply index

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-31  9:57 Gionatan Danti
2020-07-31 13:12 ` Stephen Smalley
2020-07-31 16:56   ` Gionatan Danti
2020-07-31 16:25 ` Christian Göttsche
2020-07-31 16:53   ` Dominick Grift
2020-07-31 17:09     ` Gionatan Danti
2020-07-31 19:37       ` Gionatan Danti [this message]
2020-07-31 19:44         ` Dominick Grift
2020-07-31 19:49           ` Gionatan Danti
2020-07-31 17:00   ` Gionatan Danti
2020-07-31 17:45   ` Dominick Grift

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

SELinux Archive on

Archives are clonable:
	git clone --mirror selinux/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 selinux selinux/ \
	public-inbox-index selinux

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone