-
Notifications
You must be signed in to change notification settings - Fork 188
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
os-02: Fix for SUSE environments #70
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mcgege thanks for this PR!
controls/os_spec.rb
Outdated
@@ -21,7 +21,7 @@ | |||
login_defs_passmaxdays = attribute('login_defs_passmaxdays', default: '60', description: 'Default password maxdays to set in login.defs') | |||
login_defs_passmindays = attribute('login_defs_passmindays', default: '7', description: 'Default password mindays to set in login.defs') | |||
login_defs_passwarnage = attribute('login_defs_passwarnage', default: '7', description: 'Default password warnage (days) to set in login.defs') | |||
if os.redhat? | |||
if os.redhat? || os.suse? | |||
shadow_group = 'root' | |||
elsif os.debian? | |||
shadow_group = 'shadow' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chris-rock @atomic111 we do not have here a sane default. It means in the situation prior to this change on a suse system shadow_group would be nil
. How should we handle this? Options from my POV:
- introduction of else and raise, something like:
shadow_group = if os.redhat?
'root'
elsif
'shadow'
else
raise 'Unsupported platform'
end
- defined sane default, like
shadow_group = 'root'
if os_debian?
shadow_group = 'shadow'
end
Ideas, opinions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The correct way is 1., but InSpec does not support exceptions yet. This is a high-prio ticket for one of the next InSpec releases. Should we go with 2. for now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chris-rock As I had to rework my patch I already implemented the second option ...
Had to rework my patch as the default group for /etc/shadow is "shadow" and group readable on a fresh SUSE system |
- for SUSE and Ubuntu environments: group should be "shadow" and file mode "0640" (for SUSE also corrected in Baseline, see dev-sec/linux-baseline#70)
controls/os_spec.rb
Outdated
@@ -103,7 +100,7 @@ | |||
describe file('/etc/shadow') do | |||
it { should_not be_readable.by('group') } | |||
end | |||
elsif os.debian? | |||
elsif os.debian? || os.suse? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mcgege can we do here the same/similar like above? Maybe via if os.debian? || os.suse? & else
construction
Signed-off-by: Michael Geiger <michael.geiger@telekom.de>
@artem-sidorenko done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mcgege thanks! looks good for me
@chris-rock any remarks?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect, thank you @mcgege
* refactor `attribute()` -> `input()` * fix regression/add supportfor evaluating gid on /etc/shadow and friends on - debian - suse - alpine Ref: - dev-sec#33 - dev-sec/linux-baseline#70 on-behalf-of: @Logicworks <dmiguel@logicworks.net> Signed-off-by: Deric Miguel <dmiguel@logicworks.net>
* refactor `attribute()` -> `input()` * fix regression/add supportfor evaluating gid on /etc/shadow and friends on - debian - suse - alpine Ref: - dev-sec#33 - dev-sec/linux-baseline#70 on-behalf-of: @Logicworks <dmiguel@logicworks.net> Signed-off-by: Deric Miguel <dmiguel@logicworks.net>
Missing shadow_group + test for SUSE