Re: selinux - help - directory policy syntax

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 2019-07-07 at 00:35 -0600, Robin Laing wrote:
> I want to modify a policy to allow a more localized directory for 
> creating thumbnails for videos and such.  Presently the policy 
> "thumb_exec_t" is set for "thumb_home_t"
> 
> I cannot find out in anything I have searched what the syntax 
> description for the two directories under this policy.
> 
> /home/[^]+/\.cache/thumbnail(/.*)?
> 
> /home/[^]+/\.thumbnail(/.*)?
> 
> So, does the  [^] mean the "user" home directory?
> 
> Does the + mean this directory? or something else?

That looks like regular expression, regex or regexp, to me.  A very
fancy, and hard to understand form of wildcarding.

See:  https://en.wikipedia.org/wiki/Regular_expression for a basic
explanation.

^ carat marks a starting point

[] square-brackets contain a bunch of characters that can be part of a
match

+ plus allows the previous characters to match one, or more, times
(e.g. if the wildcard specified matching ab, then abab and ababab would
also match).

. dot matches any character, or the dot itself when used inside
brackets.  Outside of brackets, you escape it with a backslash.

* asterisk matches the previous thing, one or more times (slightly
similar to how the plus operator works).

? question-mark matches the previous things zero or more times
(slightly similar to how the plus and asterisk operators).

I hate the mental gynmastics of understanding regex, but that
wildcarding looks like (to me) that it means:

Any file in any .cache/thumbnail or .thumbnail named sub-directories
within a user's homespace (as opposed to such-named directories
somewhere else in the directory tree).

The path must start with /home
and
Match anything after that
and
Has ".cache/thumbnail" in the path (one or more times)
then
Any files inside them.

If I've read it right, the match zero or more incidences means that
things like the following filepaths will all be matches for those
rules:

/home/tim/stuff/.thumbnail/diagram.jpeg
/home/tim/edits/.thumbnails/picture.jpg
/home/tim/.cache/thumbnail/image.png
/home/tim/.cache/thumbnails/graphic.tiff
/home/tim/.cache/thumbnail/.cache/thumbnails/example.gif

> There was a bug report about not being able to create thumbnails in
> the current directory where the thumbnail program is run.  Ideally
> that is what I would like or a related directory.  I want to create a
> large number of thumbnails which would be more than the /home/{user}
> directory.

If you mean to create thumbnail files in the same directory as the
original images, that's doable but with care.  I've nearly always done
things like the following for websites:

/home/tim/pictures/
/home/tim/thumbnails/

Using adjacent directories, so I don't have recursion explosions.

-- 
 
uname -rsvp
Linux 3.10.0-957.21.3.el7.x86_64 #1 SMP Tue Jun 18 16:35:19 UTC 2019 x86_64
 
Boilerplate:  All unexpected mail to my mailbox is automatically deleted.
I will only get to see the messages that are posted to the mailing list.
 
_______________________________________________
users mailing list -- users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/users@xxxxxxxxxxxxxxxxxxxxxxx



[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux