Merge "Switch to using oslo.utils secretutils"

This commit is contained in:
Zuul 2025-02-28 01:42:53 +00:00 committed by Gerrit Code Review
commit ef1585f9d7
2 changed files with 8 additions and 4 deletions

View File

@ -23,7 +23,6 @@ Includes injection of SSH PGP keys into authorized_keys file.
"""
import crypt
import os
import random
import tempfile
@ -31,6 +30,7 @@ import tempfile
from oslo_concurrency import processutils
from oslo_log import log as logging
from oslo_serialization import jsonutils
from oslo_utils import secretutils
import nova.conf
from nova import exception
@ -631,9 +631,13 @@ def _set_passwd(username, admin_passwd, passwd_data, shadow_data):
# md5 is the default because it's widely supported. Although the
# local crypt() might support stronger SHA, the target instance
# might not.
encrypted_passwd = crypt.crypt(admin_passwd, algos['MD5'] + salt)
encrypted_passwd = secretutils.crypt_password(
admin_passwd, algos['MD5'] + salt
)
if len(encrypted_passwd) == 13:
encrypted_passwd = crypt.crypt(admin_passwd, algos['DES'] + salt)
encrypted_passwd = secretutils.crypt_password(
admin_passwd, algos['DES'] + salt
)
p_file = passwd_data.split("\n")
s_file = shadow_data.split("\n")

View File

@ -37,7 +37,7 @@ oslo.limit>=1.5.0 # Apache-2.0
oslo.reports>=1.18.0 # Apache-2.0
oslo.serialization>=4.2.0 # Apache-2.0
oslo.upgradecheck>=1.3.0
oslo.utils>=7.4.0 # Apache-2.0
oslo.utils>=8.0.0 # Apache-2.0
oslo.db>=10.0.0 # Apache-2.0
oslo.rootwrap>=5.15.0 # Apache-2.0
oslo.messaging>=14.1.0 # Apache-2.0