Chefだとこの辺。
- https://github.com/chef/chef/blob/491e99e796673b5a3762d5a47ed51fabf1b6f8f1/lib/chef/provider/file.rb#L436
- https://github.com/chef/chef/blob/8d32fdd4377476a9f7dc36a864ccdaa17c32b3a1/lib/chef/util/selinux.rb
cp
使って、あとからrestorecon
するやりかただと、.htaccess
やcrontab、それ以外でもリアルタイムで読むファイルが辛い。
あと、CentOS 7で何もしてないと
$ sudo restorecon /var/spool/cron/takahiromurayama
restorecon: Warning no default label for /var/spool/cron/takahiromurayama
で、ユーザー別crontabは、semanage
や/etc/selinux/targeted/contexts/files/file_contexts
でセキュリティコンテクストを設定していないとrestorecon
で戻らない。
参考: