No commit activity in last 3 years
No release in over 3 years
Itamae resource plugin to handle with SELinux security context.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.10
~> 10.0
~> 4.0

Runtime

>= 0
 Project Readme

itamae-plugin-resource-security_context

Description

Itamae resource plugin to handle with SELinux security context.

Features

  • Restoring security context

Currently, only the feature above is supported.

Examples

At first, load this plugin.

require 'itamae/plugin/resource/security_context'

Restoring security context every time Itamae runs

security_context '/etc/nginx/nginx.conf' do
  action :restore
end

Note that default action of security_context is :nothing, so you need to write action directly when you want to restore security context.

You can also restore context recursively:

security_context '/etc/httpd/conf.d' do
  action    :restore
  recursive true
end

Restoring security context when file is modified

security_context '/etc/nginx/nginx.conf' do
  action :nothing
end

template '/etc/nginx/nginx.conf' do
  source :auto
  owner  'root'
  group  'root'
  mode   '644'
  notifies :restore, 'security_context[/etc/nginx/nginx.conf]'
end

As noted earlier, the default action of security_context is :nothing, so you can ommit block:

security_context '/etc/nginx/nginx.conf'

template '/etc/nginx/nginx.conf' do
  source :auto
  owner  'root'
  group  'root'
  mode   '644'
  notifies :restore, 'security_context[/etc/nginx/nginx.conf]'
end

Requirements

Install

$ gem install itamae-plugin-resource-security_context

Copyright

Copyright (c) 2016 KITAITI Makoto

See COPYING.txt for details.