mirror of
https://github.com/inspec/inspec
synced 2024-11-27 07:00:39 +00:00
0c5a28431d
Signed-off-by: Dominik Richter <dominik@vulcanosec.com>
35 lines
No EOL
940 B
Ruby
35 lines
No EOL
940 B
Ruby
# encoding: utf-8
|
|
# copyright: 2015, Vulcano Security GmbH
|
|
# license: All rights reserved
|
|
|
|
class Postgres
|
|
attr_reader :service, :data_dir, :conf_dir, :conf_path
|
|
def initialize
|
|
case os[:family]
|
|
when 'ubuntu', 'debian'
|
|
@service = 'postgresql'
|
|
@data_dir = '/var/lib/postgresql'
|
|
@version = command('ls /etc/postgresql/').stdout.chomp
|
|
@conf_dir = "/etc/postgresql/#{@version}/main"
|
|
@conf_path = File.join @conf_dir, 'postgresql.conf'
|
|
|
|
when 'arch'
|
|
@service = 'postgresql'
|
|
@data_dir = '/var/lib/postgres/data'
|
|
@conf_dir = '/var/lib/postgres/data'
|
|
@conf_path = File.join @conf_dir, 'postgresql.conf'
|
|
|
|
else
|
|
@service = 'postgresql'
|
|
@data_dir = '/var/lib/postgresql'
|
|
@conf_dir = '/var/lib/pgsql/data'
|
|
@conf_path = File.join @conf_dir, 'postgresql.conf'
|
|
end
|
|
end
|
|
end
|
|
|
|
module Serverspec::Type
|
|
def postgres
|
|
@postgres ||= Postgres.new()
|
|
end
|
|
end |