mirror of
https://github.com/inspec/inspec
synced 2024-11-30 08:30:39 +00:00
577688a3a0
Many of the resources are named as a top-level class with a fairly generic class name, such as "OS". This causes an issue specifically with kitchen-google which depends on a gem which depends on the "os" gem which itself defines an OS class with a different superclass. This prevents users from using TK, Google Compute, and Inspec without this fix. Some mocked commands had their digest changed as well due to the new indentation, specifically in the User and RegistryKey classes. I strongly recommend viewing this diff with `git diff --ignore-space-change` to see the *real* changes. :)
83 lines
2 KiB
Ruby
83 lines
2 KiB
Ruby
# encoding: utf-8
|
|
# copyright: 2015, Vulcano Security GmbH
|
|
# author: Dominik Richter
|
|
# author: Christoph Hartmann
|
|
# license: All rights reserved
|
|
|
|
module Inspec::Resources
|
|
class Mysql < Inspec.resource(1)
|
|
name 'mysql'
|
|
|
|
attr_reader :package, :service, :conf_dir, :conf_path, :data_dir, :log_dir, :log_path, :log_group, :log_dir_group
|
|
def initialize
|
|
# set OS-dependent filenames and paths
|
|
case inspec.os[:family]
|
|
when 'ubuntu', 'debian'
|
|
init_ubuntu
|
|
when 'redhat', 'fedora'
|
|
init_redhat
|
|
when 'arch'
|
|
init_arch
|
|
else
|
|
# TODO: could not detect
|
|
init_default
|
|
end
|
|
end
|
|
|
|
def init_ubuntu
|
|
@package = 'mysql-server'
|
|
@service = 'mysql'
|
|
@conf_path = '/etc/mysql/my.cnf'
|
|
@conf_dir = '/etc/mysql/'
|
|
@data_dir = '/var/lib/mysql/'
|
|
@log_dir = '/var/log/'
|
|
@log_path = '/var/log/mysql.log'
|
|
@log_group = 'adm'
|
|
case os[:release]
|
|
when '14.04'
|
|
@log_dir_group = 'syslog'
|
|
else
|
|
@log_dir_group = 'root'
|
|
end
|
|
end
|
|
|
|
def init_redhat
|
|
@package = 'mysql-server'
|
|
@service = 'mysqld'
|
|
@conf_path = '/etc/my.cnf'
|
|
@conf_dir = '/etc/'
|
|
@data_dir = '/var/lib/mysql/'
|
|
@log_dir = '/var/log/'
|
|
@log_path = '/var/log/mysqld.log'
|
|
@log_group = 'mysql'
|
|
@log_dir_group = 'root'
|
|
end
|
|
|
|
def init_arch
|
|
@package = 'mariadb'
|
|
@service = 'mysql'
|
|
@conf_path = '/etc/mysql/my.cnf'
|
|
@conf_dir = '/etc/mysql/'
|
|
@data_dir = '/var/lib/mysql/'
|
|
@log_dir = '/var/log/'
|
|
@log_path = '/var/log/mysql.log'
|
|
@log_group = 'mysql'
|
|
@log_dir_group = 'root'
|
|
end
|
|
|
|
def init_default
|
|
@service = 'mysqld'
|
|
@conf_path = '/etc/my.cnf'
|
|
@conf_dir = '/etc/'
|
|
@data_dir = '/var/lib/mysql/'
|
|
@log_dir = '/var/log/'
|
|
@log_path = '/var/log/mysqld.log'
|
|
@log_group = 'mysql'
|
|
@log_dir_group = 'root'
|
|
end
|
|
|
|
def to_s
|
|
'MySQL'
|
|
end
|
|
end
|
|
end
|