Skip to content

Verify controls in running configuration #44

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
Feb 22, 2022
Merged

Verify controls in running configuration #44

merged 17 commits into from
Feb 22, 2022

Conversation

FLiPp3r90
Copy link
Contributor

Instead of checking the server configuration file we check the lifetime parameters now. So we can be sure that the params are active.

@FLiPp3r90 FLiPp3r90 changed the title Some litte improvements Some little improvements Jul 16, 2021
@rndmh3ro rndmh3ro requested review from schurzi and chris-rock July 26, 2021 07:33
@rndmh3ro
Copy link
Member

LGTM! We do the same for the mysql-baseline, too.

Copy link
Member

@chris-rock chris-rock left a comment

Choose a reason for hiding this comment

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

Great work @FLiPp3r90

Copy link
Contributor

@schurzi schurzi left a comment

Choose a reason for hiding this comment

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

Nice PR. I really like the approach in checking the running config.

But now comes a big "but" from me:
I don't want to loose the checks of the static configuration. I think it would be best, if we keep the old config file checks an add the new running config checks. This way we can be sure, that the persistent configuration matches the running config.

oppinions? @rndmh3ro @chris-rock

@schurzi schurzi changed the title Some little improvements Add controls for running configuration Jul 26, 2021
@rndmh3ro
Copy link
Member

We'd essentially duplicate the code if we keep both. If there's a way to not duplicate this, it'd be great.

To counter your objections @schurzi: there are probably two ways to use the hardening and checks.

  1. we use the config-management and the cinc-profiles in an automated fashion. So we probably roll the config out, than check it. In this order, checking the running config should be enough.
  2. we reguarly check the configuration without hardening it. This way checking running state should be enough, too.

So while I agree that checking both config-files and the running state would be best, if we cannot do this without duplicating code, I'd only check running state.

@schurzi
Copy link
Contributor

schurzi commented Sep 1, 2021

yes, I'm also concerned about all this duplication. I thought maybe we can introduce a helper function, that generated two describe blocks for each single configuration, but I found no good way to do this.

One alternative, that may be acceptable is:

  [
          {name: "logging_collector", value: "on"},
          {name: "log_connections", value: "on"},
          {name: "log_disconnections", value: "on"},
          {name: "log_duration", value: "on"},
  ].each do |config|
        describe postgres_conf(POSTGRES_CONF_PATH) do
          its(config[:name]) { should eq config[:value] }
        end
        describe postgres_session(USER, PASSWORD).query('SHOW' + config[:name] +';') do
          its('output') { should eq config[:value] }
        end
  end

This would avoid many duplicated lines, and the intent can be seen with a little bit more effort. We can also structure the config hash a bit better and put it in an extra variable.

@FLiPp3r90 FLiPp3r90 requested a review from schurzi February 3, 2022 14:28
Filip Krahl added 17 commits February 3, 2022 15:33
Signed-off-by: Filip Krahl <filip.krahl@t-systems.com>
Signed-off-by: Filip Krahl <filip.krahl@t-systems.com>
Signed-off-by: Filip Krahl <filip.krahl@t-systems.com>
Signed-off-by: Filip Krahl <filip.krahl@t-systems.com>
Signed-off-by: Filip Krahl <filip.krahl@t-systems.com>
Signed-off-by: Filip Krahl <filip.krahl@t-systems.com>
Signed-off-by: Filip Krahl <filip.krahl@t-systems.com>
Signed-off-by: Filip Krahl <filip.krahl@t-systems.com>
Signed-off-by: Filip Krahl <filip.krahl@t-systems.com>
Signed-off-by: Filip Krahl <filip.krahl@t-systems.com>
Signed-off-by: Filip Krahl <filip.krahl@t-systems.com>
Signed-off-by: Filip Krahl <filip.krahl@t-systems.com>
Signed-off-by: Filip Krahl <filip.krahl@t-systems.com>
Signed-off-by: Filip Krahl <filip.krahl@t-systems.com>
Signed-off-by: Filip Krahl <filip.krahl@t-systems.com>
Signed-off-by: Filip Krahl <filip.krahl@t-systems.com>
Signed-off-by: Filip Krahl <filip.krahl@t-systems.com>
@schurzi schurzi changed the title Add controls for running configuration Verify controls in running configuration Feb 22, 2022
@schurzi schurzi added the minor label Feb 22, 2022
@schurzi schurzi added enhancement and removed minor labels Feb 22, 2022
@schurzi schurzi merged commit d5923d3 into dev-sec:master Feb 22, 2022
@schurzi schurzi added the minor label Feb 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants