Regex

English! place to talk about development, programming and coding
Post Reply
manoj99
Znuny newbie
Posts: 41
Joined: 22 Jan 2020, 00:00
Znuny Version: 5.0.42
Real Name: mk99

Regex

Post by manoj99 »

Hello,

I'm trying to develop a simple if condition clause for my otrs.SetPermissions.pl file so that it would set permissions for /opt/otrs/ exlucding or ignoring few paths i.e
/opt/otrs/scripts
/opt/otrs/var/tmp/Article
/opt/otrs/var/tmp/Ticket
..
..

or may be passing a variable that matches to ignore multiple paths using qr ?

Can someone provide some inputs.

Thanks,
M.
zzz
Znuny superhero
Posts: 888
Joined: 15 Dec 2016, 15:13
Znuny Version: All
Real Name: Emin
Company: Efflux GmbH
Contact:

Re: Regex

Post by zzz »

Hey,

If you only want to ignore articles, you can go for the parameter --skip-article-dir

If you also want to add multiple paths, go for:
/opt/otrs/bin/otrs.SetPermissions.pl --skip-article-dir --skip-regex="^/scripts/" --skip-regex="^/NextFolder/EvenWithSubfolders/"

The starting point of your RegEx is always the home path of OTRS.

Best regards
Emin
Professional OTRS, Znuny & OTOBO services: efflux.de | efflux.de/en/

Free and premium add-ons: German | English
manoj99
Znuny newbie
Posts: 41
Joined: 22 Jan 2020, 00:00
Znuny Version: 5.0.42
Real Name: mk99

Re: Regex

Post by manoj99 »

Thanks for the reply Emin. thats actually a good solution but Im setting up SeLinx labels: For, Home dir (/opt/otrs) it needs sys_content(read only) excluding some folders under /opt/otrs/var that needs rw_content and .pl files that need exec permissions. So, if I use skip-regex that would intent to skill totally and I cannot have the permissions needed. So, If feel a simple regex function with if clause inside SetPermissions.pl would be great to have. so that it would be specific for certain folders that are in the list.

Hope you understood what Im trying to acheive.

Thanks,
M.
jojo
Znuny guru
Posts: 15019
Joined: 26 Jan 2007, 14:50
Znuny Version: Git Master
Contact:

Re: Regex

Post by jojo »

OTRS user and webserver need full access in whole OTRS home directory. Otherwise Package Manager and other tools will not work correctly
"Production": OTRS™ 8, OTRS™ 7, STORM powered by OTRS
"Testing": ((OTRS Community Edition)) and git Master

Never change Defaults.pm! :: Blog
Professional Services:: http://www.otrs.com :: enjoy@otrs.com
manoj99
Znuny newbie
Posts: 41
Joined: 22 Jan 2020, 00:00
Znuny Version: 5.0.42
Real Name: mk99

Re: Regex

Post by manoj99 »

Yes, under /opt/otrs , the directory permissions are 750 and files has 640 with otrs as an user and apache as a admin and webgroup. So, I think OTRS is happy with the permissions.

All I need is a solution for the use case mentioned above.
Post Reply