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

Add node attributes to override KEX, MAC and cipher values #141

Merged

Conversation

bazbremner
Copy link
Contributor

Comments and feedback on this approach, as well as around the default Kex, MAC and cipher choices are welcome - I note that there's a refactor of Kex and Cipher selections going on, plus there may be further discussions to be had on the default lists, so this is a quick hack to allow a complete override of several values.

Original commit message follows:

There's advice available on preferred choices of key exchange, message
authentication and ciphers from a number of sources [1][2][3], all of
which don't entirely agree with each other, and then there's the
hardcoded selection of Kex, MAC and ciphers encoded in this cookbook.

At the time of committing, there is a refactor going on to simplify kex
and cipher handling:
#134

Even in that refactor, hmac-ripemd160 MACs, which have been removed in
OpenSSH 6.7 (and hence flagged by ssh-audit[1] and are absent from
Mozilla's recommendations[2] for modern sshd, yet are still recommended
by secure secure shell[3]) are included in the default MAC list.

Likewise hmac-sha2-256 and hmac-sha2-512 are flagged by ssh-audit[1] as
they are encrypt-and-MAC, which has a number of issues, discussed in
secure secure shell[3].

There is likely to be more complexity and balancing of features/security
to consider plus the future changes of refactors in this cookbook, so
initially, I'd just like a way of overriding the generated defaults.

[1] https://github.com/arthepsy/ssh-audit
[2] https://wiki.mozilla.org/Security/Guidelines/OpenSSH
[3] https://stribika.github.io/2015/01/04/secure-secure-shell.html

@bazbremner bazbremner changed the title Add node attributes to override KEX, MAC and cipher values WIP: Add node attributes to override KEX, MAC and cipher values Dec 13, 2016
@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 9948c24 on bazbremner:override_kex_mac_and_ciphers into 10953dc on dev-sec:master.

@chris-rock
Copy link
Member

@bazbremner Awesome! Thank you for bringing up the discussion. We are very close to merge #134 We should build this PR into two iterations: enable customization as you showed in this PR and updating the ciphers for newer versions. For that, lets also double-check https://bettercrypto.org, since we follow their recommendation

@bazbremner
Copy link
Contributor Author

@chris-rock thanks for the comment. Yes, I agree that updating the generated ciphers should be a separate PR, but I thought the additional complexity and discussion that entails is useful background and justification for allowing a blanket override, as provided by my changes.

Assuming the basic premise is OK, what other changes would you like me to make to bring this PR into a mergable state?

@artem-sidorenko
Copy link
Member

@bazbremner I like this approach

Regarding cipher update, I see it like @chris-rock: it should be done in a separate PR

Regarding this PR, the #134 is merged, can you please rebase?

There's advice available on preferred choices of key exchange, message
authentication and ciphers from a number of sources [1][2][3], all of
which don't _entirely_ agree with each other, and then there's the
hardcoded selection of Kex, MAC and ciphers encoded in this cookbook.

After initial discussions around this change with @chris-rock and
@artem-sideorenko, there may be follow-on changes to the hardcoded
selections this cookbook generates, however that's a topic for future
discussion and PRs.

There is likely to be more complexity and balancing of features/security
to consider plus the future changes of refactors in this cookbook, so
initially, I'd just like a way of overriding the generated defaults.

Note that `node['ssh'][{'client', 'server'}][{'weak_hmac', 'weak_kex',
'cbc_required'}}` are all ignored if these overrides are used, as the
user is supplying their preferred choices, rather than relying on the
cookbook's generated strings.

[1] https://github.com/arthepsy/ssh-audit
[2] https://wiki.mozilla.org/Security/Guidelines/OpenSSH
[3] https://stribika.github.io/2015/01/04/secure-secure-shell.html
@bazbremner
Copy link
Contributor Author

@chris-rock @artem-sidorenko rebased following the merge of #134. I've also reworded the commit message following our discussions. 👍

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 35c2be2 on bazbremner:override_kex_mac_and_ciphers into 0fa0082 on dev-sec:master.

@artem-sidorenko
Copy link
Member

@bazbremner please also remove the WIP from PR title (as gets pulled by changelog generator)

LGTM,
@chris-rock ?

@bazbremner bazbremner changed the title WIP: Add node attributes to override KEX, MAC and cipher values Add node attributes to override KEX, MAC and cipher values Dec 14, 2016
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 looks great to me. Thank you @bazbremner @artem-sidorenko

@artem-sidorenko artem-sidorenko merged commit d1f1bf1 into dev-sec:master Dec 14, 2016
@artem-sidorenko
Copy link
Member

@bazbremner thank you!

@bazbremner
Copy link
Contributor Author

No problems, thanks for the speedy turnaround and feedback.

@bazbremner bazbremner deleted the override_kex_mac_and_ciphers branch December 14, 2016 12:54
artem-sidorenko added a commit to artem-forks/chef-ssh-hardening that referenced this pull request Dec 22, 2016
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.

None yet

4 participants