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

TO Postinstall: Check if hashlib.scrypt() exists before calling it #6286

Merged
merged 1 commit into from
Oct 20, 2021

Conversation

zrhoffman
Copy link
Member

Fixes #6285 by, rather than assuming that Python 3 includes hashlib.scrypt(), checking whether it exists, and if not, using our pure Python implementation of Scrypt.


Which Traffic Control components are affected by this PR?

  • Traffic Ops - Postinstall

What is the best way to verify this PR?

Verify that _postinstall.hash_pass() works in Python 3 on CentOS 7.

<<'DOCKER_COMMANDS' docker run --rm -iv$(pwd):/opt -w/opt centos:7 bash
yum -y install python3 &&
<<'PYTHON_COMMANDS' PYTHONPATH=traffic_ops/install/bin python3
import _postinstall
print(_postinstall.hash_pass('mysecretpassword'))
PYTHON_COMMANDS
DOCKER_COMMANDS

Expected output:

SCRYPT:16384:8:1:/clKimOLhQKGKtLV1rH1UNyykUQ0VRVdRZj+/I8YQ940vqkHYh5OiAaGMVDUfl8PXfkHnyoq3XRrWxmLOtLCLw==:IL/i6VQqT5rWyOf2eKE1/7GY5fia1AyOLSJNL8HkVhArzU7R0S2joJ4ls+bIQdkCx23PknEmMIm4+41q99GmZw==

If this is a bugfix, which Traffic Control versions contained the bug?

  • 6.0.0
  • master

PR submission checklist

@zrhoffman zrhoffman added bug something isn't working as intended Traffic Ops related to Traffic Ops install related to the installation process labels Oct 14, 2021
Copy link
Contributor

@ocket8888 ocket8888 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 good to me, CiaB and postinstall tests still passing, just needs a conflict fix

@ocket8888 ocket8888 self-assigned this Oct 20, 2021
@zrhoffman
Copy link
Member Author

Rebased to fix the merge conflict in CHANGELOG.md

@ocket8888 ocket8888 merged commit a30bbcb into apache:master Oct 20, 2021
@zrhoffman zrhoffman added this to the 6.0.1 milestone Oct 20, 2021
@zrhoffman zrhoffman deleted the hasattr-scrypt branch October 20, 2021 18:44
zrhoffman added a commit that referenced this pull request Nov 5, 2021
zrhoffman added a commit to zrhoffman/trafficcontrol that referenced this pull request Nov 9, 2021
rawlinp pushed a commit that referenced this pull request Nov 11, 2021
@zrhoffman zrhoffman added the authentication Relating to login, registration, passwords, tokens, etc. label Jan 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
authentication Relating to login, registration, passwords, tokens, etc. bug something isn't working as intended install related to the installation process Traffic Ops related to Traffic Ops
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TO Postinstall: AttributeError: module 'hashlib' has no attribute 'scrypt'
2 participants