Skip to content

Commit e949001

Browse files
oliverkurthGitHub Enterprise
authored andcommitted
Merge pull request #52 from vcf/topic/sshedi/crypt
Use mkpasswd to generate password hash
2 parents 659d146 + 5dc0d82 commit e949001

File tree

6 files changed

+13
-12
lines changed

6 files changed

+13
-12
lines changed

docker/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ RUN tdnf ${TDNF_OPTIONS} makecache && \
1818
git && \
1919
rm -rf /var/cache/tdnf
2020

21-
RUN cd / && git clone https://github.com/vmware/photon-os-installer.git
21+
RUN cd / && git clone --depth 1 https://github.com/vmware/photon-os-installer.git
2222

2323

2424
# this stage is a place holder that can be overidden with the
@@ -64,6 +64,7 @@ RUN tdnf ${TDNF_OPTIONS} makecache && \
6464
qemu-img \
6565
open-vmdk \
6666
stig-hardening \
67+
mkpasswd \
6768
$([ "${TARGETARCH}" == "amd64" ] && echo grub2-pc) && \
6869
rm -rf /var/cache/tdnf
6970

docker/build-rpms.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ fi
3232

3333
tdnf install -y ${TDNF_OPTIONS} "${BUILD_REQUIRES[@]}"
3434

35-
mkdir -p ${RPM_BUILD_DIR}
3635
mkdir -p ${RPM_BUILD_DIR}/{SOURCES,BUILD,RPMS,SRPMS}
3736
mv ${TARBALL} ${RPM_BUILD_DIR}/SOURCES/
3837

examples/iso/packages_installer_initrd.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@
3030
"grub2-efi-image",
3131
"grub2-theme",
3232
"gzip",
33-
"haveged",
3433
"libcap",
3534
"libffi",
3635
"libgcc",
3736
"libstdc++",
3837
"linux",
3938
"lua",
4039
"lvm2",
40+
"mkpasswd",
4141
"ncurses",
4242
"ncurses-terminfo",
4343
"nspr",
@@ -46,10 +46,8 @@
4646
"pcre",
4747
"popt",
4848
"python3",
49-
"python3",
5049
"python3-cracklib",
5150
"python3-curses",
52-
"python3-libs",
5351
"python3-requests",
5452
"readline",
5553
"rpm",
@@ -58,7 +56,6 @@
5856
"sqlite",
5957
"stig-hardening",
6058
"systemd",
61-
"systemd-libs",
6259
"systemd-pam",
6360
"systemd-udev",
6461
"tar",

photon-os-installer.spec

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,12 @@ Requires: grub2-pc
3333
Requires: gzip
3434
Requires: kpartx
3535
Requires: lvm2
36+
Requires: mkpasswd
3637
# needed for --rpmdefine option
3738
Requires: tdnf >= 3.5.6
3839
Requires: zlib
3940

41+
Requires: python3
4042
Requires: python3-pyOpenSSL
4143
Requires: python3-requests
4244
Requires: python3-cracklib

photon_installer/commandutils.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
#
66

77
import copy
8-
import crypt
98
import glob
109
import json
1110
import os
@@ -142,8 +141,13 @@ def is_vmware_virtualization():
142141

143142
@staticmethod
144143
def generate_password_hash(password):
145-
"""Generate hash for the password"""
146-
return crypt.crypt(password)
144+
result = subprocess.run(
145+
["mkpasswd", "-m", "sha-512", password],
146+
capture_output=True,
147+
text=True,
148+
check=True
149+
)
150+
return result.stdout.strip()
147151

148152
@staticmethod
149153
def _requests_get(url, verify):

photon_installer/packages_installer_initrd.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@
3030
"grub2-efi-image",
3131
"grub2-theme",
3232
"gzip",
33-
"haveged",
3433
"libcap",
3534
"libffi",
3635
"libgcc",
3736
"libstdc++",
3837
"linux",
3938
"lua",
4039
"lvm2",
40+
"mkpasswd",
4141
"ncurses",
4242
"ncurses-terminfo",
4343
"nspr",
@@ -49,7 +49,6 @@
4949
"python3",
5050
"python3-cracklib",
5151
"python3-curses",
52-
"python3-libs",
5352
"python3-requests",
5453
"readline",
5554
"rpm",
@@ -58,7 +57,6 @@
5857
"sqlite",
5958
"stig-hardening",
6059
"systemd",
61-
"systemd-libs",
6260
"systemd-pam",
6361
"systemd-udev",
6462
"tar",

0 commit comments

Comments
 (0)