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

replace pycrypto with pycryptodomex [2017.7] #54119

Closed
wants to merge 2 commits into from

Conversation

JanZerebecki
Copy link
Contributor

pycrypto is unmaintained and has open security issues.

Fixes: #54115

What does this PR do?

replace pycrypto with pycryptodomex, like it already is on many platforms

What issues does this PR fix or reference?

#54115

Previous Behavior

require pycrpto

New Behavior

require pycryptodomex

Tests written?

No, drop in replacement of functionality.

Commits signed with GPG?

Yes

pycrypto is unmaintained and has open security issues.

Fixes: saltstack#54115
@JanZerebecki JanZerebecki requested a review from a team as a code owner August 5, 2019 18:37
@ghost ghost requested a review from dwoz August 5, 2019 18:37
@Akm0d Akm0d self-requested a review August 5, 2019 18:58
@dmurphy18 dmurphy18 self-requested a review August 5, 2019 18:59
@dmurphy18
Copy link
Contributor

@JanZerebecki There is a plan to make Salt cryptography a plug-able entity. Currently pycryptodomex is not available on all platforms that Salt provides for.

Currently there is a hierarchy as follows, in preferred order:
M2Crypto
pycryptodomex
pycrypto

Hence, if pycryptodomex is already installed, it will be preferred over pycrypto.
This also answers #54115

Lastly this only addresses Suse spec file, and pip requirements, actual packaging occurs with https://github.com/saltstack/salt-pack and https://github.com/saltstack/salt-pack-py3

@JanZerebecki
Copy link
Contributor Author

The main goal of this PR was fixing this for pip requirements, the changes under pkg were just easy to add while I was at it.

pycrypto should not be installed on a platform that has one of your stated alternatives. Do you agree with that?

@dmurphy18 I couldn't read from your comment if you think something about this PR needs to be changed or if it is acceptable as is. If it needs to be changed, please point out how.

@dmurphy18
Copy link
Contributor

dmurphy18 commented Aug 5, 2019

@JanZerebecki re: pycrypto should not be installed on a platform that has one of your stated alternatives. Do you agree with that?

I personally prefer that a customer use a better alternative than pycrypto when it is available, however cannot dictate customer circumstances, hence the alternative of providing a preference for now with Python 2. As for the PR I cannot see it passing all tests since as previously stated, pycryptodomex is not available on all platforms that SaltStack supports.

Also note that the 2017.7 branch is only supported for CVE's and this would be better placed in a later branch if it was to be considered.

@JanZerebecki
Copy link
Contributor Author

I'm not saying that salt should stop working with pycrypto. But it should only stop preferring it over the others when being installed using pip. Currently with pip it installs pycrypto even when pycryptodomex is already installed.

On which platforms is pycryptodomex not available via pip, where pycrypto is?

It is hard to read the CI log, but the only failure seems unrelated https://jenkinsci.saltstack.com/job/pr-kitchen-ubuntu1604-py3/job/PR-54119/1/consoleText (same one on py2/centos7 and py2/ubuntu1604):

test_issue_2731_masterless (integration.shell.test_call.CallTest) ... FAIL

Any idea regarding the failure?

@dmurphy18
Copy link
Contributor

@JanZerebecki The package does not build on Debian/Ubuntu is the most probable cause.

Understand your point with pip preferences but you need to ensure works on Debian 8/9, Ubuntu 16.04/18.04, Redhat 6/7

@JanZerebecki
Copy link
Contributor Author

Earlier in the log for all the platforms CI runs on one can see that installing pycryptodomex worked just fine on each of them. So that is not the cause for the CI failure.

@dmurphy18
Copy link
Contributor

@JanZerebecki Need to review if M2Crypto is the preferred crypto library, have to discuss this within the core team, next week, and shall get back to you

This might help understand what is happening when
test_issue_2731_masterless fails and stdout of the test process is
empty.
@dmurphy18
Copy link
Contributor

@JanZerebecki pycryptodomex shall be the pip install preferred library, will take a deeper look into this PR and see why tests failing. Can you re-submit these changes against the 2018.3 branch since that is the branch which is currently supported. The 2017.7 branch is only for CVE fixes at this point.

Thanks

@JanZerebecki JanZerebecki changed the title replace pycrypto with pycryptodomex replace pycrypto with pycryptodomex [2017.7] Aug 16, 2019
@JanZerebecki
Copy link
Contributor Author

The main commit cherry picked on 2018.3: #54241

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.

3 participants