{"action":"created","issue":{"url":"https://api.github.com/repos/BackSlasher/chef-selinuxpolicy/issues/56","repository_url":"https://api.github.com/repos/BackSlasher/chef-selinuxpolicy","labels_url":"https://api.github.com/repos/BackSlasher/chef-selinuxpolicy/issues/56/labels{/name}","comments_url":"https://api.github.com/repos/BackSlasher/chef-selinuxpolicy/issues/56/comments","events_url":"https://api.github.com/repos/BackSlasher/chef-selinuxpolicy/issues/56/events","html_url":"https://github.com/BackSlasher/chef-selinuxpolicy/issues/56","id":188873266,"number":56,"title":"Better check for which folder to relabel possible?","user":{"login":"daften","id":1221024,"avatar_url":"https://avatars.githubusercontent.com/u/1221024?v=3","gravatar_id":"","url":"https://api.github.com/users/daften","html_url":"https://github.com/daften","followers_url":"https://api.github.com/users/daften/followers","following_url":"https://api.github.com/users/daften/following{/other_user}","gists_url":"https://api.github.com/users/daften/gists{/gist_id}","starred_url":"https://api.github.com/users/daften/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/daften/subscriptions","organizations_url":"https://api.github.com/users/daften/orgs","repos_url":"https://api.github.com/users/daften/repos","events_url":"https://api.github.com/users/daften/events{/privacy}","received_events_url":"https://api.github.com/users/daften/received_events","type":"User","site_admin":false},"labels":[{"id":154187650,"url":"https://api.github.com/repos/BackSlasher/chef-selinuxpolicy/labels/Accepting%20PRs","name":"Accepting PRs","color":"159818","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":11,"created_at":"2016-11-11T23:30:31Z","updated_at":"2016-11-14T00:47:51Z","closed_at":null,"body":"This is more a question than an issue, because nothing is truly broken.\r\nI have a fcontext for /var/lib/mysql-default(/.*)?\r\nThe relabel for this is a restorecon on /var/lib\r\n\r\nCould the code that checks the path be rewritten so the restorecon would be done on /var/lib/mysql-default? Is there a list of special regex characters that could be trimmed from the end that should never be in folder names?\r\n\r\nThe question comes because a restorecon on /var/lib takes reaaaaally long\r\n\r\nThe fact that the condition uses the same command while not changing anything, doesn't help either. As far as I can see ATM this only means a run almost twice as long (in my case)."},"comment":{"url":"https://api.github.com/repos/BackSlasher/chef-selinuxpolicy/issues/comments/260226012","html_url":"https://github.com/BackSlasher/chef-selinuxpolicy/issues/56#issuecomment-260226012","issue_url":"https://api.github.com/repos/BackSlasher/chef-selinuxpolicy/issues/56","id":260226012,"user":{"login":"atward","id":5027130,"avatar_url":"https://avatars.githubusercontent.com/u/5027130?v=3","gravatar_id":"","url":"https://api.github.com/users/atward","html_url":"https://github.com/atward","followers_url":"https://api.github.com/users/atward/followers","following_url":"https://api.github.com/users/atward/following{/other_user}","gists_url":"https://api.github.com/users/atward/gists{/gist_id}","starred_url":"https://api.github.com/users/atward/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/atward/subscriptions","organizations_url":"https://api.github.com/users/atward/orgs","repos_url":"https://api.github.com/users/atward/repos","events_url":"https://api.github.com/users/atward/events{/privacy}","received_events_url":"https://api.github.com/users/atward/received_events","type":"User","site_admin":false},"created_at":"2016-11-14T00:47:51Z","updated_at":"2016-11-14T00:47:51Z","body":"@daften, the problem is that the cookbook has no way of knowing what is the highest possible path given a regex. Take for example the following:\r\n\r\n```\r\nselinux_policy_fcontext \"/var/lib/mysql-(default|dist)(/.*)?\" do\r\n  secontext \"mysqld_db_t\"\r\nend\r\n```\r\n\r\nThe best the code can do is check for the existence of files/directories that match the regex, and then apply to that (which it is doing by `File.directory?`).\r\n\r\nIf you use the lazy change from #57, and put a `directory  '/var/lib/mysql-default'` prior to your `selinux_policy_fcontext` it should only run `restorecon -iR /var/lib/mysql-default`. I suspect you current code is installing mysql after the selinux changes."}}
{"actor":{"display_login":"atward"}}