Repository navigation
Migrate to M2crypto - #44962
Migrate to M2crypto#44962
Conversation
|
Tests and docs are coming. |
d5bb917 to
2c6821a
Compare
9f1c601 to
7e58f01
Compare
|
It's done as I see. @thatch45 @cachedout @cro could you please spent take some time to review this? |
|
At first glance this looks great, can you run a master on pycrypto and a minion on m2 and vis-versa? |
|
@thatch45 It's designed to can do this, but I haven't tested this case. I'll check. Thank you for the point. |
|
Thanks, we don't want to introduce a minion/master inconsistency in any direction |
f10f88c to
be69149
Compare
|
@thatch45 I've tested manually in different configurations, master-minion connection works fine. So new master + M2Crypto will work fine with old pyCrypto minions and vice versa. |
There was a problem hiding this comment.
Is this the cipher used by the pycrypto lib? Can't the encryption type be autodetected so that we could use AES here?
There was a problem hiding this comment.
Yes this is used by pycrypto by default. We could use autodetect here, I think. But I need to have a review to say exactly
There was a problem hiding this comment.
I am ok with this otherwise because this is not a default setting. If anything to just get this into the codebase.
But we should look at autodetect here in a future PR
There was a problem hiding this comment.
Salt requires pycrypto>=2.6.1, but pycrypto 2.6.1 doesn't support AES algorithm. So it looks to better to make this change later when user will have a way to choose what cryptographic backend to use to not be surprised.
There was a problem hiding this comment.
But yes, it's a very good catch, it should be changed to autodetect, or configurable in the future.
There was a problem hiding this comment.
Thanks fro the research, again, I am ok with where we are here do far and I think that we can move forward, the password protected key here is not default and we can make this configurable in the future
|
re-run py |
6dc1de6 to
4adf7b1
Compare
|
@cachedout and @cro Can you review this please? @DmitryKuzmenko There's a small conflict here on in the oxygen release notes, so this will need to be rebased before we can merge it in. |
4adf7b1 to
711923f
Compare
|
@rallytime done! |
711923f to
d9c426b
Compare
|
Conflicting again, I've rebased it once again. |
There was a problem hiding this comment.
sha1? This brings to mind the 2017 collision attacks on sha1.
cc: @thatch45
There was a problem hiding this comment.
Crypto in salt.crypt uses SHA hash package that does SHA1 signature.
Here is the same as we discussed above with Tom: if we'd like to use for instance SHA256 we have to either change this behavior in both M2Crypto and pyCrypto implementations or we'll break master-minion compatibility if they run in different configurations.
What I've done in this PR is cloned the current Crypto behavior replaced it with M2Crypto to keep the compatibility.
So I propose to keep this PR as is and do any feature improvements in different issues. And the first one we'd have to do is modularize the crypt package. This'd make it configurable and testable including writing compatibility tests.
d9c426b to
99a0e1f
Compare
|
The branch had conflicts, I've rebased it. |
This is due to the change in Salt for Oxygen: saltstack/salt#44962
What does this PR do?
Use M2Crypto by default if installed instead of Cryptodome or Crypto everywhere in Salt.
What issues does this PR fix or reference?
Implements #44923
Tests written?
Extended the existing test. Full coverage is coming after modularizing the crypto backend.
Commits signed with GPG?
Yes