From 1516b0aeb5003fc1bf31097363e5be631470a829 Mon Sep 17 00:00:00 2001 From: Martin Schurz Date: Sun, 19 Nov 2023 15:00:56 +0100 Subject: [PATCH] ensure compatibility with new inspec version Signed-off-by: Martin Schurz --- controls/postgres_spec.rb | 48 ++++++--------------------------------- inspec.yml | 15 ++++++++++++ 2 files changed, 22 insertions(+), 41 deletions(-) diff --git a/controls/postgres_spec.rb b/controls/postgres_spec.rb index 3f194e7..f628d50 100644 --- a/controls/postgres_spec.rb +++ b/controls/postgres_spec.rb @@ -22,47 +22,13 @@ title 'PostgreSQL Server Configuration' # inputs -USER = input( - 'user', - description: 'define the postgresql user to access the database', - value: 'postgres' -) - -PASSWORD = input( - 'password', - description: 'define the postgresql password to access the database', - value: 'iloverandompasswordsbutthiswilldo' -) - -POSTGRES_DATA = input( - 'postgres_data', - description: 'define the postgresql data directory', - value: postgres.data_dir -) - -POSTGRES_CONF_DIR = input( - 'postgres_conf_dir', - description: 'define the postgresql configuration directory', - value: postgres.conf_dir -) - -POSTGRES_CONF_PATH = input( - 'postgres_conf_path', - description: 'define path for the postgresql configuration file', - value: File.join(POSTGRES_CONF_DIR.to_s, 'postgresql.conf') -) - -POSTGRES_HBA_CONF_FILE = input( - 'postgres_hba_conf_file', - description: 'define path for the postgresql configuration file', - value: File.join(POSTGRES_CONF_DIR.to_s, 'pg_hba.conf') -) - -POSTGRES_LOG_DIR = input( - 'postgres_log_dir', - description: 'define path for the postgresql log file', - value: '/var/log/postgresql' -) +USER = input('user', value: 'postgres') +PASSWORD = input('password', value: 'iloverandompasswordsbutthiswilldo') +POSTGRES_DATA = input('postgres_data', value: postgres.data_dir) +POSTGRES_CONF_DIR = input('postgres_conf_dir', value: postgres.conf_dir) +POSTGRES_CONF_PATH = input('postgres_conf_path', value: File.join(POSTGRES_CONF_DIR.to_s, 'postgresql.conf')) +POSTGRES_HBA_CONF_FILE = input('postgres_hba_conf_file', value: File.join(POSTGRES_CONF_DIR.to_s, 'pg_hba.conf')) +POSTGRES_LOG_DIR = input('postgres_log_dir', value: '/var/log/postgresql') only_if do command('psql').exist? diff --git a/inspec.yml b/inspec.yml index 7707da8..7306f8e 100644 --- a/inspec.yml +++ b/inspec.yml @@ -10,3 +10,18 @@ inspec_version: '>= 4.6.3' version: 3.1.1 supports: - os-family: unix +inputs: + - name: user + description: define the postgresql user to access the database + - name: password + description: define the postgresql password to access the database + - name: postgres_data + description: define the postgresql data directory + - name: postgres_conf_dir + description: define the postgresql configuration directory + - name: postgres_conf_path + description: define path for the postgresql configuration file + - name: postgres_hba_conf_file + description: define path for the postgresql configuration file + - name: postgres_log_dir + description: define path for the postgresql log file