mirror of
https://github.com/inspec/inspec
synced 2024-11-22 20:53:11 +00:00
use single quotes
This commit is contained in:
parent
5c137a7ab1
commit
1773d20178
20 changed files with 51 additions and 51 deletions
|
@ -16,7 +16,7 @@ class AuditDaemonConf < Vulcano.resource(1)
|
||||||
end
|
end
|
||||||
|
|
||||||
def to_s
|
def to_s
|
||||||
"audit daemon configuration file"
|
'audit daemon configuration file'
|
||||||
end
|
end
|
||||||
|
|
||||||
def method_missing(name)
|
def method_missing(name)
|
||||||
|
|
|
@ -6,7 +6,7 @@ class AuditDaemonRules < Vulcano.resource(1)
|
||||||
name 'audit_daemon_rules'
|
name 'audit_daemon_rules'
|
||||||
|
|
||||||
def initialize
|
def initialize
|
||||||
@content = vulcano.run_command("/sbin/auditctl -l").stdout.chomp
|
@content = vulcano.run_command('/sbin/auditctl -l').stdout.chomp
|
||||||
|
|
||||||
@opts = {
|
@opts = {
|
||||||
assignment_re: /^\s*([^:]*?)\s*:\s*(.*?)\s*$/,
|
assignment_re: /^\s*([^:]*?)\s*:\s*(.*?)\s*$/,
|
||||||
|
@ -27,7 +27,7 @@ class AuditDaemonRules < Vulcano.resource(1)
|
||||||
assignment_re: /^\s*([^:]*?)\s*:\s*(.*?)\s*$/,
|
assignment_re: /^\s*([^:]*?)\s*:\s*(.*?)\s*$/,
|
||||||
multiple_values: false
|
multiple_values: false
|
||||||
}
|
}
|
||||||
@status_content ||= vulcano.run_command("/sbin/auditctl -s").stdout.chomp
|
@status_content ||= vulcano.run_command('/sbin/auditctl -s').stdout.chomp
|
||||||
@status_params = SimpleConfig.new(@status_content, @status_opts).params
|
@status_params = SimpleConfig.new(@status_content, @status_opts).params
|
||||||
status = @status_params['AUDIT_STATUS']
|
status = @status_params['AUDIT_STATUS']
|
||||||
if (status == nil) then return nil end
|
if (status == nil) then return nil end
|
||||||
|
|
|
@ -16,7 +16,7 @@ class InetdConf < Vulcano.resource(1)
|
||||||
end
|
end
|
||||||
|
|
||||||
def to_s
|
def to_s
|
||||||
"inetd_conf"
|
'inetd_conf'
|
||||||
end
|
end
|
||||||
|
|
||||||
def method_missing(name)
|
def method_missing(name)
|
||||||
|
|
|
@ -16,7 +16,7 @@ class LimitsConf < Vulcano.resource(1)
|
||||||
end
|
end
|
||||||
|
|
||||||
def to_s
|
def to_s
|
||||||
"limits_conf"
|
'limits_conf'
|
||||||
end
|
end
|
||||||
|
|
||||||
def method_missing(name)
|
def method_missing(name)
|
||||||
|
|
|
@ -16,7 +16,7 @@ class LoginDef < Vulcano.resource(1)
|
||||||
end
|
end
|
||||||
|
|
||||||
def to_s
|
def to_s
|
||||||
"login_def"
|
'login_def'
|
||||||
end
|
end
|
||||||
|
|
||||||
def method_missing(name)
|
def method_missing(name)
|
||||||
|
|
|
@ -56,7 +56,7 @@ class MysqlConf < Vulcano.resource(1)
|
||||||
end
|
end
|
||||||
|
|
||||||
def read_content
|
def read_content
|
||||||
@content = ""
|
@content = ''
|
||||||
@params = {}
|
@params = {}
|
||||||
|
|
||||||
# skip if the main configuration file doesn't exist
|
# skip if the main configuration file doesn't exist
|
||||||
|
|
|
@ -16,7 +16,7 @@ class NtpConf < Vulcano.resource(1)
|
||||||
end
|
end
|
||||||
|
|
||||||
def to_s
|
def to_s
|
||||||
"ntp_conf"
|
'ntp_conf'
|
||||||
end
|
end
|
||||||
|
|
||||||
def method_missing(name)
|
def method_missing(name)
|
||||||
|
|
|
@ -71,13 +71,13 @@ class Passwd < Vulcano.resource(1)
|
||||||
def users
|
def users
|
||||||
@parsed.map {|x|
|
@parsed.map {|x|
|
||||||
{
|
{
|
||||||
"name" => x.at(0),
|
'name' => x.at(0),
|
||||||
"password" => x.at(1),
|
'password' => x.at(1),
|
||||||
"uid" => x.at(2),
|
'uid' => x.at(2),
|
||||||
"gid" => x.at(3),
|
'gid' => x.at(3),
|
||||||
"desc" => x.at(4),
|
'desc' => x.at(4),
|
||||||
"home" => x.at(5),
|
'home' => x.at(5),
|
||||||
"shell" => x.at(6)
|
'shell' => x.at(6)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
|
@ -32,7 +32,7 @@ class PostgresConf < Vulcano.resource(1)
|
||||||
end
|
end
|
||||||
|
|
||||||
def read_content
|
def read_content
|
||||||
@content = ""
|
@content = ''
|
||||||
@params = {}
|
@params = {}
|
||||||
|
|
||||||
# skip if the main configuration file doesn't exist
|
# skip if the main configuration file doesn't exist
|
||||||
|
|
|
@ -39,7 +39,7 @@ class PostgresSession
|
||||||
out.downcase =~ /^error/
|
out.downcase =~ /^error/
|
||||||
# skip this test if the server can't run the query
|
# skip this test if the server can't run the query
|
||||||
RSpec.describe( cmd ) do
|
RSpec.describe( cmd ) do
|
||||||
it "is skipped", skip: out do
|
it 'is skipped', skip: out do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
|
|
@ -45,7 +45,7 @@ class SecurityPolicy < Vulcano.resource(1)
|
||||||
|
|
||||||
# find line with key
|
# find line with key
|
||||||
key = method.to_s
|
key = method.to_s
|
||||||
target = ""
|
target = ''
|
||||||
@@policy.each_line {|s|
|
@@policy.each_line {|s|
|
||||||
target = s.strip if s.match(/\b#{key}\s*=\s*(.*)\b/)
|
target = s.strip if s.match(/\b#{key}\s*=\s*(.*)\b/)
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,8 +14,8 @@ module DummyTestTypes
|
||||||
|
|
||||||
def command(sth)
|
def command(sth)
|
||||||
res = OpenStruct.new
|
res = OpenStruct.new
|
||||||
res.stdout = ""
|
res.stdout = ''
|
||||||
res.stderr = ""
|
res.stderr = ''
|
||||||
res
|
res
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -40,12 +40,12 @@ module Vulcano
|
||||||
is_valid = true
|
is_valid = true
|
||||||
err = lambda{|msg| @log.error msg; is_valid = false }
|
err = lambda{|msg| @log.error msg; is_valid = false }
|
||||||
warn = lambda{|msg| @log.warn msg; is_valid = false }
|
warn = lambda{|msg| @log.warn msg; is_valid = false }
|
||||||
err.("Missing profile name in vmetadata.rb") if @dict['name'].nil?
|
err.('Missing profile name in vmetadata.rb') if @dict['name'].nil?
|
||||||
err.("Missing profile title in vmetadata.rb") if @dict['title'].nil?
|
err.('Missing profile title in vmetadata.rb') if @dict['title'].nil?
|
||||||
err.("Missing profile version in vmetadata.rb") if @dict['version'].nil?
|
err.('Missing profile version in vmetadata.rb') if @dict['version'].nil?
|
||||||
err.("Missing summary in vmetadata.rb") if @dict['summary'].nil?
|
err.('Missing summary in vmetadata.rb') if @dict['summary'].nil?
|
||||||
warn.("Missing maintainer in vmetadata.rb") if @dict['maintainer'].nil?
|
warn.('Missing maintainer in vmetadata.rb') if @dict['maintainer'].nil?
|
||||||
warn.("Missing copyright in vmetadata.rb") if @dict['copyright'].nil?
|
warn.('Missing copyright in vmetadata.rb') if @dict['copyright'].nil?
|
||||||
is_valid
|
is_valid
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -29,11 +29,11 @@ module Vulcano
|
||||||
if !File.directory? path
|
if !File.directory? path
|
||||||
return @log.error "This is not a folder: #{path}"
|
return @log.error "This is not a folder: #{path}"
|
||||||
else
|
else
|
||||||
@log.ok "Valid directory"
|
@log.ok 'Valid directory'
|
||||||
end
|
end
|
||||||
|
|
||||||
metadata = Metadata.for_path(path, @profile_id)
|
metadata = Metadata.for_path(path, @profile_id)
|
||||||
@log.ok "vmetadata.rb" unless metadata.nil? or !metadata.valid?
|
@log.ok 'vmetadata.rb' unless metadata.nil? or !metadata.valid?
|
||||||
|
|
||||||
specs = Dir["#{path}/spec/*_spec.rb"]
|
specs = Dir["#{path}/spec/*_spec.rb"]
|
||||||
if specs.empty?
|
if specs.empty?
|
||||||
|
|
|
@ -95,9 +95,9 @@ module Vulcano
|
||||||
def metadata
|
def metadata
|
||||||
header = @raw.sub(/^[^#].*\Z/m,'')
|
header = @raw.sub(/^[^#].*\Z/m,'')
|
||||||
{
|
{
|
||||||
"title" => mOr(header.match(/^# title: (.*)$/), @filename),
|
'title' => mOr(header.match(/^# title: (.*)$/), @filename),
|
||||||
"copyright" => mOr(header.match(/^# copyright: (.*)$/), 'All rights reserved'),
|
'copyright' => mOr(header.match(/^# copyright: (.*)$/), 'All rights reserved'),
|
||||||
"rules" => rules2dict(@rules)
|
'rules' => rules2dict(@rules)
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -115,10 +115,10 @@ module Vulcano
|
||||||
d = nil
|
d = nil
|
||||||
d = rule.desc.gsub(/\s*\n\s*/, ' ').strip unless rule.desc.nil?
|
d = rule.desc.gsub(/\s*\n\s*/, ' ').strip unless rule.desc.nil?
|
||||||
{
|
{
|
||||||
"impact" => rule.impact,
|
'impact' => rule.impact,
|
||||||
"title" => rule.title,
|
'title' => rule.title,
|
||||||
"desc" => d,
|
'desc' => d,
|
||||||
"code" => rule.instance_variable_get(:@__code)
|
'code' => rule.instance_variable_get(:@__code)
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ module Vulcano
|
||||||
|
|
||||||
def self.backend(version = 1)
|
def self.backend(version = 1)
|
||||||
if version != 1
|
if version != 1
|
||||||
raise "Only backend version 1 is supported!"
|
fail 'Only backend version 1 is supported!'
|
||||||
end
|
end
|
||||||
Vulcano::Plugins::Backend
|
Vulcano::Plugins::Backend
|
||||||
end
|
end
|
||||||
|
|
|
@ -109,7 +109,7 @@ module Vulcano::Backends
|
||||||
ssh_opts[:auth_methods].push('password')
|
ssh_opts[:auth_methods].push('password')
|
||||||
end
|
end
|
||||||
if ssh_opts[:keys].empty? and ssh_opts[:password].nil?
|
if ssh_opts[:keys].empty? and ssh_opts[:password].nil?
|
||||||
raise "You must configure at least one authentication method" +
|
fail "You must configure at least one authentication method" +
|
||||||
": Password or key."
|
": Password or key."
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ class VulcanoBaseRule
|
||||||
def initialize(id, opts, &block)
|
def initialize(id, opts, &block)
|
||||||
@id = id
|
@id = id
|
||||||
@impact = nil
|
@impact = nil
|
||||||
@__code = ""
|
@__code = ''
|
||||||
@__block = block
|
@__block = block
|
||||||
@title = nil
|
@title = nil
|
||||||
@desc = nil
|
@desc = nil
|
||||||
|
|
|
@ -8,8 +8,8 @@ module Vulcano
|
||||||
attr_reader :rules, :only_ifs
|
attr_reader :rules, :only_ifs
|
||||||
def initialize(profile_id, backend, profile_registry: {}, only_ifs: [])
|
def initialize(profile_id, backend, profile_registry: {}, only_ifs: [])
|
||||||
if backend.nil?
|
if backend.nil?
|
||||||
raise "ProfileContext is initiated with a backend == nil. " +
|
fail 'ProfileContext is initiated with a backend == nil. ' +
|
||||||
"This is a backend error which must be fixed upstream."
|
'This is a backend error which must be fixed upstream.'
|
||||||
end
|
end
|
||||||
|
|
||||||
@profile_id = profile_id
|
@profile_id = profile_id
|
||||||
|
|
|
@ -4,25 +4,25 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
||||||
require 'vulcano/version'
|
require 'vulcano/version'
|
||||||
|
|
||||||
Gem::Specification.new do |spec|
|
Gem::Specification.new do |spec|
|
||||||
spec.name = "vulcano"
|
spec.name = 'vulcano'
|
||||||
spec.version = Vulcano::VERSION
|
spec.version = Vulcano::VERSION
|
||||||
spec.authors = ["Dominik Richter"]
|
spec.authors = ['Dominik Richter']
|
||||||
spec.email = ["dominik@vulcanosec.com"]
|
spec.email = ['dominik@vulcanosec.com']
|
||||||
spec.summary = %q{Validate Vulcano compliance checks.}
|
spec.summary = %q{Validate Vulcano compliance checks.}
|
||||||
spec.description = %q{Validate Vulcano compliance checks.}
|
spec.description = %q{Validate Vulcano compliance checks.}
|
||||||
spec.homepage = "https://github.com/..."
|
spec.homepage = 'https://github.com/...'
|
||||||
spec.license = "Proprietary"
|
spec.license = 'Proprietary'
|
||||||
|
|
||||||
spec.files = `git ls-files -z`.split("\x0")
|
spec.files = `git ls-files -z`.split("\x0")
|
||||||
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
||||||
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
||||||
spec.require_paths = ["lib"]
|
spec.require_paths = ['lib']
|
||||||
|
|
||||||
spec.add_development_dependency "bundler", "~> 1.5"
|
spec.add_development_dependency 'bundler', '~> 1.5'
|
||||||
spec.add_development_dependency "minitest", "~> 5.5"
|
spec.add_development_dependency 'minitest', '~> 5.5'
|
||||||
spec.add_development_dependency "rspec", "~> 3.3"
|
spec.add_development_dependency 'rspec', '~> 3.3'
|
||||||
spec.add_development_dependency "rake", "~> 10"
|
spec.add_development_dependency 'rake', '~> 10'
|
||||||
spec.add_development_dependency "pry", "~> 0.10"
|
spec.add_development_dependency 'pry', '~> 0.10'
|
||||||
spec.add_development_dependency 'rubocop', '~> 0.33.0'
|
spec.add_development_dependency 'rubocop', '~> 0.33.0'
|
||||||
|
|
||||||
spec.add_dependency 'thor', '~> 0.19'
|
spec.add_dependency 'thor', '~> 0.19'
|
||||||
|
|
Loading…
Reference in a new issue