arenadata / adcm

Arenadata Cluster Manager that is software that manage clusters and created by Arenadata
https://docs.arenadata.io/adcm/
Apache License 2.0
28 stars 15 forks source link

Fix secret key location and ensure existence #2149

Closed giggsoff closed 9 months ago

giggsoff commented 1 year ago

Two fixes spitted into separate commits:

  1. generate_secret_key stores the key into the current location, so we should use it from there.
  2. It is nice to have the secret file in place in order to not invalidate sessions (for example download logs of jobs) after restart of container (as we will generate new key on fly if no file stored), so let's check for the key existence to generate it.
sonarcloud[bot] commented 1 year ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

a-alferov commented 1 year ago

@giggsoff Thanks for participating. We fixed this in the latest release. https://github.com/arenadata/adcm/blob/2022.12.26.18/os/etc/sv/init/run#L47 In the future, we will completely get rid of this file.

giggsoff commented 1 year ago

@giggsoff Thanks for participating. We fixed this in the latest release. https://github.com/arenadata/adcm/blob/2022.12.26.18/os/etc/sv/init/run#L47 In the future, we will completely get rid of this file.

The problem in the file location. You point me onto the code with mv "${adcmroot}/python/secretkey.txt" "${adcmsecretfile}", but it should be mv "secretkey.txt" "${adcmsecretfile}" (see my comment in the PR).

a-alferov commented 1 year ago

@giggsoff Yes you are right. Now it still works thanks to this code: https://github.com/arenadata/adcm/blob/master/python/adcm/settings.py#L52 But in the next release, we will completely get rid of storing the secret key on the file system https://github.com/arenadata/adcm/commit/d57ab68e11ead55f5295e6f2b87473c8a8768dff