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

Remove MD5 digest from everywhere and default to SHA256 #31162

Merged
merged 21 commits into from Mar 7, 2016

Conversation

isbm
Copy link
Contributor

@isbm isbm commented Feb 12, 2016

This removes obsolete MD5 digest that was by default everywhere. The new MD5 is SHA256. This is why.

@isbm isbm changed the title Remove MD5 digest from everywhere and default to SHA1 Remove MD5 digest from everywhere and default to SHA256 Feb 12, 2016
@@ -631,7 +631,7 @@ def deploy_war(war,

def passwd(passwd,
user='',
alg='md5',
alg='sha1',
Copy link
Member

Choose a reason for hiding this comment

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

wait, not sha256?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was not sure if this is OK for Tomcat, since this module replaces that there. SHA1 OK but others I didn't looked up if this is compatible.

@cachedout
Copy link
Contributor

@isbm We would like this to go into the develop branch instead of 2015.8.

@jfindlay We need to test to see what happens when the hashing algorithm is changed during an upgrade.

@thatch45
Copy link
Member

While I completely agree with this it should not go in a point release, this needs to be rebased on develop. Also, the primary use of md5 in salt is for file integrity and caches, and not for cryptographic means. The key fingerprints are just that, fingerprints.

This also begs the question, should we split out the hash usage for file integrity tasks to use crc and just bump the cryptographic hashes up to sha256?

Also, should we go ahead and build in support for alternative hashes like blake?

@thatch45
Copy link
Member

The main upgrade worry here is that all of the cache data for files, git backend etc will be invalidated, and we need to see if salt will just handle it, or if it will require a flush of the cache, and if it requires a cache flush we need to figure out how to make that automatic.

@thatch45
Copy link
Member

Keep in mind that it would need to be a controlled wipe

@cachedout
Copy link
Contributor

Personally, I would prefer not to switch this out from underneath people. There are people who use Salt's cache from external systems and forcing a full cache wipe on an upgrade (or even on a config change) strikes me as too aggressive.

My preference here would be to warn people that they should change the hash type in their config for at least a few releases before we even consider a hard-switch like this.

@isbm
Copy link
Contributor Author

isbm commented Feb 15, 2016

The main problem here is that the fingerprints for the key exchange is using MD5 and in our eyes this is a "no go" and we can't ship that. Hence I've changed this to be at all configurable, since the fingerprint function although had default to MD5, nothing was passing anything else from the hash_type options. Others, who stil wants MD5 can still configure it that way.

Also since we operate at 2015.8 at the moment, we would like to have this there (too), while @cachedout told me earlier that you, guys, doing "upward" rebase on your own, so it is enough to just commit to the lowest supported?

@cachedout maybe it would help to leave MD5 by default in the configs and hash_type, but write a big banner in the config that this is not a good idea any more? Or keep default SHA256 and write in the docs "From now on we use SHA256, so change it yourself back". I would suggest second, so the new installations won't use MD5 by an accident. But you to decide...

Does it makes sense?

@thatch45
Copy link
Member

@isbm, I completely agree and understand. and @cachedout and myself have discussed how to best handle this.
What we want to do is accept what you have done here apart from changing the default and then add a deprecation warning to the develop branch that we will be migrating to sha256 in the future and what the ramifications are, that way we can migrate cleanly and we can have plenty of time for upgrade testing etc.
This also means that you would be able to set the default config in your packages to sha256 without issue

@cachedout
Copy link
Contributor

@isbm Bump. How does what @thatch45 has outlined sound to you?

@cachedout
Copy link
Contributor

Hi @isbm

One more bump. Could you please take a look at the above comments and respond to the latest from @thatch45 ? We'd still like to see this problem solved, so hopefully we can all get on the same page. :]

Thanks.

@isbm
Copy link
Contributor Author

isbm commented Feb 23, 2016

@thatch45 @cachedout sorry being late here (we were busy on other PRs here). So what I understand is:

  • Make MD5 available by default as is.
  • Add deprecation warning
  • Rebase (or cherry-pick) that for develop branch.

Question: Where/how to add that deprecation warning other than just write some commented out block in the config files of /etc/salt/m*?

@thatch45
Copy link
Member

We want the deprecation warning to show up in the logs each time the master/minion starts. So we would add a check to see if the config value is set to anything lower than sha256 at the end of the config loading process in salt/config/init.py. Then use Salt's deprecation system to flag it.

@cachedout
Copy link
Contributor

Hi @isbm Just checking in to see how we're coming along with this one. Let me know if there's anything we can do. Thanks!

@isbm
Copy link
Contributor Author

isbm commented Feb 25, 2016

@thatch45 Yes, I will likely tackle it either tomorrow (Friday, CET) or Monday. One step at a time. 😉

@cachedout
Copy link
Contributor

No hurry. Just checking in. Thanks, @isbm

@isbm
Copy link
Contributor Author

isbm commented Feb 26, 2016

@cachedout @thatch45 Here is an attempt to speak the same things across the daemons for hashes, hence the mixin for all of them.

The develop branch is "a bit" diverged, so I will up-port this thing there in the separate PR.

@isbm
Copy link
Contributor Author

isbm commented Feb 26, 2016

Added a Unit test, that verifies if a nag-message is shown in the logs in case hash_type is MD5 or SHA1.

@thatch45
Copy link
Member

This looks great @isbm ! Thanks for the work, and for begin understanding as we try to ease into things and be careful on all fronts!

@rallytime
Copy link
Contributor

@isbm There's a small lint error. Would you mind cleaning that up? Thanks for your work here!

(The other test failure is not related.)

@isbm
Copy link
Contributor Author

isbm commented Feb 27, 2016

@rallytime Oops, overlooked. Done!

@isbm
Copy link
Contributor Author

isbm commented Feb 27, 2016

@thatch45 Thanks! I will "up-port" that to the develop branch and will test that prior.

@cachedout
Copy link
Contributor

@isbm Is this now ready for review from your perspective?

@isbm
Copy link
Contributor Author

isbm commented Mar 1, 2016

@cachedout sure. I am now working on develop part, which seems a bit different. Please review it ASAP so I can fix what is still missing, if anything, and take care of it for the development and 2016.4

@cachedout
Copy link
Contributor

@isbm This has merge conflicts. Could you please rebase it and then I'll take a look and see if we can get this in? Thanks.

@isbm
Copy link
Contributor Author

isbm commented Mar 3, 2016

@cachedout Done.

cachedout pushed a commit that referenced this pull request Mar 7, 2016
Remove MD5 digest from everywhere and default to SHA256
@cachedout cachedout merged commit 826fea6 into saltstack:2015.8 Mar 7, 2016
@isbm isbm deleted the isbm-md5-to-sha1 branch March 10, 2016 11:48
rallytime pushed a commit to rallytime/salt that referenced this pull request Mar 31, 2016
Updates hash_type default to sha256 instead of md5 for new
instances installed via salt-cloud.

Fixes saltstack#32246

Refs saltstack#31162
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.

None yet

4 participants