Skip to content

Conversation

carbonin
Copy link
Member

Exposes access to various SCAP settings through linux admin. A full list of items can be found on Trello (https://trello.com/c/Zh1TAxfm/50-8-7-1-phase-2-config-scap-stig-security)

carbonin added 19 commits July 27, 2015 16:38
…mits.conf file

This class will apply the fixes for two SCAP issues - no core dumps and
limiting the number of simultaneous non-root logins to 10.

https://bugzilla.redhat.com/show_bug.cgi?id=1219246
https://bugzilla.redhat.com/show_bug.cgi?id=1219247
The Securetty.remove_vcs method will remove all virtual
console entries from the /etc/securetty file.

https://bugzilla.redhat.com/show_bug.cgi?id=1219248
The key value syntax used with this method will be the same
for many files we are editing.
Currently the class will set the minimum password age
to one day.

https://bugzilla.redhat.com/show_bug.cgi?id=1219250
This file dictates that specific files or actions on the system
should be watched by auditd.

https://bugzilla.redhat.com/show_bug.cgi?id=1219256
@Fryguy
Copy link
Member

Fryguy commented Jul 30, 2015

Are these OS specific? That is, do the file paths only apply to a particular OS? If so, we might have to put this in a subclass and call it via Distros or something.

@carbonin
Copy link
Member Author

Most I would assume are not, I can check a sampling of distros though. What would be good coverage for that?

Copy link
Member

Choose a reason for hiding this comment

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

This pattern simplifies to just File.write(filename, new_text) If you need the extra new_line from the puts at the end you can append it to new_text manually above

@Fryguy
Copy link
Member

Fryguy commented Jul 30, 2015

What would be good coverage for that?

¯\_(ツ)_/¯

BTW, this is really nice...was this extracted from some other code or a script, or did you have to research this all yourself.

Copy link
Member

Choose a reason for hiding this comment

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

Should this method be named apply_scap_settings? Same question for AuditRules.

If they are all named the same, this could be written as:

[SshdConfig, Service, SysctlConf, LimitsConf, Securetty, LoginDefs, Useradd, AuditRules, AuditRules, Modprobe].each do |klass|
  klass.public_send(:apply_scap_settings)
end

or you can multiline the class array if you prefer.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I thought about that, but removing access to the vcs didn't seem really SCAP specific. I could make the method more generic then create an apply_scap_settings method or just have one that calls remove_vcs with the intention of creating other methods to edit this file in the future.

@carbonin
Copy link
Member Author

carbonin commented Aug 3, 2015

@Fryguy What should I do around the gem version for this PR?

@Fryguy
Copy link
Member

Fryguy commented Aug 3, 2015

Nothing. When we release we'll decide on the version number
On Aug 3, 2015 8:22 AM, "Nick Carboni" notifications@github.com wrote:

@Fryguy https://github.com/Fryguy What should I do around the gem
version for this PR?


Reply to this email directly or view it on GitHub
#120 (comment).

@carbonin carbonin changed the title [WIP] Add scap lockdown Add scap lockdown Aug 3, 2015
@carbonin
Copy link
Member Author

carbonin commented Aug 3, 2015

Looks like everything is where we expect it to be in RHEL 7.1

Copy link
Member

Choose a reason for hiding this comment

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

I feel like this logic belongs right inside service.restart. That way the caller just calls service.restart, and the Service class takes care of it all. What do you think? Doesn't have to be in this PR.

Copy link
Member Author

Choose a reason for hiding this comment

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

Just did a quick test and it looks like restart will succeed even if the service is stopped. So I can just take the method out and call to LinuxAdmin::Service directly.

Copy link
Member

Choose a reason for hiding this comment

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

Sorry, this seems strange to me. I'd prefer to see the [ ] syntax instead of the %w here.

Copy link
Member Author

Choose a reason for hiding this comment

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

I have no preference, I did it this was to appease RuboCop.

Copy link
Member

Choose a reason for hiding this comment

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

You can use FileUtils.rm or rm_f to avoid the existence check

@miq-bot
Copy link
Member

miq-bot commented Aug 3, 2015

Checked commits carbonin@36ea797 .. carbonin@4d5b5f2 with rubocop 0.32.1 and haml-lint 0.13.0
21 files checked, 0 offenses detected
Everything looks good. 🍪

@Fryguy
Copy link
Member

Fryguy commented Aug 3, 2015

@carbonin Let's investigate OpenSCAP and see if we should proceed with this PR.

@Fryguy Fryguy changed the title Add scap lockdown [WIP] Add scap lockdown Aug 4, 2015
@Fryguy
Copy link
Member

Fryguy commented Aug 11, 2015

Closing in favor of #121

@Fryguy Fryguy closed this Aug 11, 2015
@carbonin carbonin deleted the add_scap_lockdown branch February 12, 2016 18:12
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