Skip to content

Conversation

@aaronlippold
Copy link
Collaborator

@aaronlippold aaronlippold commented Jun 27, 2024

Signed-off-by: Aaron Lippold lippold@gmail.com
@DMedina6 is implementing and @aaronlippold is reviewing

Description

Updates to the testing requirements for various benchmarks require the ability to dynamically ask the sshd process which configuration file on the system is being used to configure the system.

This PR adds that ability to the ssh_config resource with a new resource sshd_active_config to active this and then inherit the rest of its interface from the existing sshd_config resource.

This is a blocker for profile updates to the latest revision of security profiles for the DoD STIGs.

PR Tasks

  • New resource sshd_active_config
  • Lazy loading file
  • Documentation
  • Unit Tests
  • bundle exec rake lint
  • bundle exec rake m ...tests...
  • Signed Off DCO

Related Issue

N/A

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New content (non-breaking change)
  • Breaking change (a content change which would break existing functionality or processes)

Checklist:

  • I have read the CONTRIBUTING document.

@aaronlippold aaronlippold requested a review from a team as a code owner June 27, 2024 14:44
@netlify
Copy link

netlify bot commented Jun 27, 2024

Deploy Preview for chef-inspec ready!

Name Link
🔨 Latest commit 18d80a2
🔍 Latest deploy log https://app.netlify.com/sites/chef-inspec/deploys/669ff9bb024dd500083849a2
😎 Deploy Preview https://deploy-preview-7070--chef-inspec.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@aaronlippold aaronlippold marked this pull request as draft June 27, 2024 14:45
@chef-expeditor
Copy link
Contributor

Hello aaronlippold! Thanks for the pull request!

Here is what will happen next:

  1. Your PR will be reviewed by the maintainers.
  2. Possible Outcomes
    a. If everything looks good, one of them will approve it, and your PR will be merged.
    b. The maintainer may request follow-on work (e.g. code fix, linting, etc). We would encourage you to address this work in 2-3 business days to keep the conversation going and to get your contribution in sooner.
    c. Cases exist where a PR is neither aligned to Chef InSpec's product roadmap, or something the team can own or maintain long-term. In these cases, the maintainer will provide justification and close out the PR.

Thank you for contributing!

@aaronlippold
Copy link
Collaborator Author

odd thing we are seeing is that git is not allowing us to add the docs ... seeing if I can resolve it. gitignore seems to be correct.

aaronlippold and others added 7 commits July 9, 2024 12:09
… with a non-constant value (inspec#7079)

* fix: update io reads to fix codescanning vuln

Signed-off-by: Sonu Saha <sonu.saha@progress.com>

* fix: remove kernel#open fallback and update open method to handle local files

Signed-off-by: Sonu Saha <sonu.saha@progress.com>

* fix: replace io.readlines to file.readlines

Signed-off-by: Sonu Saha <sonu.saha@progress.com>

* chore: fix lint offense, unnecessary space

Signed-off-by: Sonu Saha <sonu.saha@progress.com>

* fix: raise exception for standard errors as FetcherFailure

Signed-off-by: Sonu Saha <sonu.saha@progress.com>

* chore: update exception message

Signed-off-by: Sonu Saha <sonu.saha@progress.com>

---------

Signed-off-by: Sonu Saha <sonu.saha@progress.com>
Signed-off-by: Sonu Saha <sonu.saha@progress.com>
Obvious fix; these changes are the result of automation not creative thinking.
Signed-off-by: Ian Maddaus <ian.maddaus@progress.com>
Obvious fix; these changes are the result of automation not creative thinking.
Signed-off-by: Aaron Lippold <lippold@gmail.com>
@github-actions github-actions bot added the Documentation ZH multi-repo label for the docs-team label Jul 10, 2024
@aaronlippold
Copy link
Collaborator Author

Thank you @IanMadd for the assist. @DMedina6 will update the two doc files and then look to see if we need to add a unit test or not for this enhancement.

@aaronlippold aaronlippold marked this pull request as ready for review July 13, 2024 23:22
@aaronlippold aaronlippold requested a review from a team as a code owner July 13, 2024 23:22
identifier = "inspec/resources/os/sshd_active_config.md sshd_active_config resource"
parent = "inspec/resources/os"
+++
Use the `sshd_active_config` Chef InSpec audit resource to test configuration data for the OpenSSH daemon located at `/etc/ssh/sshd_active_config` on Linux and Unix platforms. sshd---the OpenSSH daemon---listens on dedicated ports, starts a daemon for each incoming connection, and then handles encryption, authentication, key exchanges, command execution, and data exchanges.
Copy link
Collaborator Author

@aaronlippold aaronlippold Jul 13, 2024

Choose a reason for hiding this comment

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

I don't think /etc/ssh/sshd_active_config is what should be here correct?

The sshd active config finds the path of the sshd_config file by interrogating the active sshd process for the config file it is loaded with. Then we can say, all other functions and properties of the ssh and sshd resource are the same with the addition of the active_path variable available to the sshd_active_config resource which will be the path of the config file the sshd service reported as loaded.

Copy link
Contributor

Choose a reason for hiding this comment

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

My mistake. This has been corrected.

Copy link
Contributor

@clintoncwolfe clintoncwolfe left a comment

Choose a reason for hiding this comment

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

This looks very good from where I sit. There is a linting concern - I opened a PR against your branch to resolve, mitre#1 .

I've also asked Product for clearance to include this in the next release of InSpec 6.


### Version

This resource first became available in v1.0.0 of InSpec.
Copy link
Contributor

Choose a reason for hiding this comment

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

This has been approved by Product and is expected to be in v6.8.0 - you may update the docs.

Copy link
Contributor

Choose a reason for hiding this comment

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

Fixed.

Copy link
Contributor

@clintoncwolfe clintoncwolfe left a comment

Choose a reason for hiding this comment

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

Thanks!

@Vasu1105 Vasu1105 merged commit 0ab3568 into inspec:main Jul 24, 2024
Nik08 pushed a commit that referenced this pull request Sep 13, 2024
…ig file in use. (#7070)

* modify resource

* windows compatibility

* end line

* removing comments to clean things up

Signed-off-by: Aaron Lippold <lippold@gmail.com>

* CHEF-12175: Remove use of `Kernel.open` or `IO.read` or similar sinks with a non-constant value (#7079)

* fix: update io reads to fix codescanning vuln

Signed-off-by: Sonu Saha <sonu.saha@progress.com>

* fix: remove kernel#open fallback and update open method to handle local files

Signed-off-by: Sonu Saha <sonu.saha@progress.com>

* fix: replace io.readlines to file.readlines

Signed-off-by: Sonu Saha <sonu.saha@progress.com>

* chore: fix lint offense, unnecessary space

Signed-off-by: Sonu Saha <sonu.saha@progress.com>

* fix: raise exception for standard errors as FetcherFailure

Signed-off-by: Sonu Saha <sonu.saha@progress.com>

* chore: update exception message

Signed-off-by: Sonu Saha <sonu.saha@progress.com>

---------

Signed-off-by: Sonu Saha <sonu.saha@progress.com>

* fix: Missing regular expression anchor (#7077)

Signed-off-by: Sonu Saha <sonu.saha@progress.com>

* Bump version to 6.6.27 by Chef Expeditor

Obvious fix; these changes are the result of automation not creative thinking.

* Fix gitignore file in docs dir (#7082)

Signed-off-by: Ian Maddaus <ian.maddaus@progress.com>

* Bump version to 6.6.28 by Chef Expeditor

Obvious fix; these changes are the result of automation not creative thinking.

* adding docs now that the gitignore is fixed.

Signed-off-by: Aaron Lippold <lippold@gmail.com>

* add docs for sshd_active_config resource

* fix docs

* unit tests

* rubocop on ssh_config.rb, sshd_con_test.rb, and sshd_active_config.md

* rename active path in method

* doc fix

* Linting Corrections for Active SSHD Config (#1)

Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>

* Update sshd_active_config.md

updated version

* doc version update

---------

Signed-off-by: Aaron Lippold <lippold@gmail.com>
Signed-off-by: Sonu Saha <sonu.saha@progress.com>
Signed-off-by: Ian Maddaus <ian.maddaus@progress.com>
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
Co-authored-by: Daniel Medina <dmedina@mitre.org>
Co-authored-by: Sonu Saha <98935583+ahasunos@users.noreply.github.com>
Co-authored-by: Chef Expeditor <chef-ci@chef.io>
Co-authored-by: Ian Maddaus <IanMadd@users.noreply.github.com>
Co-authored-by: Clinton Wolfe <clintoncwolfe@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants