Skip to content
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

Fix os detection #120

Merged
merged 2 commits into from
Jan 13, 2019
Merged

Fix os detection #120

merged 2 commits into from
Jan 13, 2019

Conversation

IceBear2k
Copy link
Contributor

This pull request includes #119 plus additional fixes for all other OS version detection.

Sebastian Gumprich and others added 2 commits January 2, 2019 21:07
Before this commit the regex searched for the pattern
anywhere in the string. This resulted in the following on Centos 7.6:

(The `string centos release:` was added as a debug output)
```
basti$ bundle exec inspec exec ../ssh-baseline/ -t docker://79335b76fbaf --controls=ssh-08
"centos release: 7.6.1810"
"centos release: 7.6.1810"

Profile: DevSec SSH Baseline (ssh-baseline)
Version: 2.3.2
Target:  docker://79335b76fbaf7cf6877bd4b86f220cde2dba595baeb96ec6feb5ede279c17bc1

  ×  ssh-08: Client: Check for secure ssh ciphers
     ×  SSH Configuration Ciphers should eq "aes256-ctr,aes192-ctr,aes128-ctr"

     expected: "aes256-ctr,aes192-ctr,aes128-ctr"
          got: "chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr"

     (compared using ==)

Profile Summary: 0 successful controls, 1 control failure, 0 controls skipped
Test Summary: 0 successful, 1 failure, 0 skipped
```
For the version string `7.6.1810` the case-statement in the library found `6\.`
and since this is the first case statement, ciphers will get set to ciphers53.

This commit changes the behaviour to look for the pattern at the beginning of the line.

Open question:
Are all version-strings just the number without anything before or after it? I could not check for MacOS,
so I changed the regex only for the OS I knew.

Signed-off-by: Sebastian Gumprich <github@gumpri.ch>
…r all OS

Signed-off-by: IceBear2k <ib-github@myrl.net>
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.

This is a great improvement @IceBear2k Thank you @rndmh3ro for identifying the root cause.

@chris-rock chris-rock merged commit 3a0383b into dev-sec:master Jan 13, 2019
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.

2 participants