Skip to content

Conversation

@ejaronne
Copy link

Adds overlay logic for SV-261937. Rather than psql --version, it uses SHOW server_version, querying directly into the server. The original STIG assumed a hosted instance, whereby the psql and server versions are stated, but the later won't state with an RDS instance - you'll only get the version of the psql binary on your InSpec runner.

ejaronne and others added 2 commits June 18, 2025 13:05
Adds overlay logic for SV-261937. Rather than psql --version, it uses SHOW server_version, querying directly into the server. The original STIG assumed a hosted instance, whereby the psql and server versions are stated, but the later won't state with an RDS instance - you'll only get the version of the psql binary on your InSpec runner.
Copy link
Contributor

@georgedias georgedias left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please review my updated comment and suggestion.

end
end

control 'SV-261937' do
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

after further reviewing the control, I believe we should change it to the following:

control 'SV-261937' do
  min_org_allowed_postgres_version = input('min_org_allowed_postgres_version')
  installed_postgres_version = command('psql --version').stdout.split[2]

  # If no organization specified postgres version was given, inform the user to manually review the control for proper major and minor release versions
  if (min_org_allowed_postgres_version.nil? || min_org_allowed_postgres_version.empty?)
    describe "Your installed Postgres version is: #{installed_postgres_version}. You must review this control manually or set / pass the 'min_org_allowed_postgres_version' to the profile. The latest supported releases can be found at http://www.postgresql.org/support/versioning/" do
      skip "Your installed Postgres version is: #{installed_postgres_version}. You must review this control manually or set / pass the 'min_org_allowed_postgres_version' to the profile. The latest supported releases can be found at http://www.postgresql.org/support/versioning/"
    end
  else
    sql = postgres_session(input('pg_dba'), input('pg_dba_password'), input('pg_host'), input('pg_port'))

    describe sql.query('SHOW server_version;', [input('pg_db')]) do
      its('output') { should cmp >= min_org_allowed_postgres_version }
    end
  end
end

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I approve!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, I think this one is ready to merge

@ejaronne ejaronne requested a review from georgedias June 19, 2025 16:18
end
end

control 'SV-261937' do
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, I think this one is ready to merge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants