Skip to content

Commit

Permalink
TO Postinstall: Check if hashlib.scrypt() exists before calling it (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
zrhoffman authored Oct 20, 2021
1 parent e9586bf commit a30bbcb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- [#6255](https://github.com/apache/trafficcontrol/issues/6255) - Unreadable Prod Mode CDN Notifications in Traffic Portal
- [#6259](https://github.com/apache/trafficcontrol/issues/6259) - Traffic Portal No Longer Allows Spaces in Server Object "Router Port Name"
- [#6175](https://github.com/apache/trafficcontrol/issues/6175) - POST request to /api/4.0/phys_locations accepts mismatch values for regionName.
- [#6283](https://github.com/apache/trafficcontrol/issues/6283) - The Traffic Ops Postinstall script will work in CentOS 7, even if Python 3 is installed

### Changed
- Updated `t3c` to request less unnecessary deliveryservice-server assignment and invalidation jobs data via new query params supported by Traffic Ops
Expand Down
2 changes: 1 addition & 1 deletion traffic_ops/install/bin/_postinstall.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ def hash_pass(passwd): # type: (str) -> str
p_val = 1
dklen = 64
salt = os.urandom(dklen)
if sys.version_info.major >= 3:
if sys.version_info.major >= 3 and hasattr(hashlib, 'scrypt'): # Python 2.7 and CentOS 7's Python 3.6 do not include hashlib.scrypt()
hashed = hashlib.scrypt(passwd.encode(), salt=salt, n=n, r=r_val, p=p_val, dklen=dklen)
else:
hashed = Scrypt(password=passwd.encode(), salt=salt, cost_factor=n, block_size_factor=r_val, parallelization_factor=p_val, key_length=dklen).derive()
Expand Down

0 comments on commit a30bbcb

Please sign in to comment.