Skip to content

Commit 93af12a

Browse files
committed
Allow password auth and set default pass if $ALLOW_USER_PASSWD is set
1 parent c6d38cb commit 93af12a

2 files changed

Lines changed: 18 additions & 8 deletions

File tree

genesis/genesis.yaml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
# Build section. It specifies the build process of the project
22
build:
3-
3+
44
# Dependencies of the project
55
deps:
66
# Genesis project
77
- dst: /opt/genesis_core
88
# Local path
99
path:
1010
src: ../../genesis_core
11-
11+
1212
# Network configuration
1313
- dst: /etc/netplan/90-genesis-net-base-config.yaml
1414
# Local path
1515
path:
1616
src: ../../genesis_core/etc/90-genesis-net-base-config.yaml
17-
17+
1818
# Binary artifacts. Kernel, initrd, boot loaders.
1919
- dst: /opt/genesis_core/artifacts/undionly.kpxe
2020
# Local path
@@ -28,27 +28,30 @@ build:
2828
# Local path
2929
http:
3030
src: http://repository.genesis-core.tech:8081/seed_os/latest/vmlinuz
31-
31+
3232
# Take SDK from a local path for development purposes.
3333
- dst: /opt/gcl_sdk
3434
optional: true
3535
path:
3636
env: LOCAL_GENESIS_SDK_PATH
37-
37+
3838
# List of elements in the project
3939
elements:
4040
# List of images in the element
4141
- images:
4242
- name: genesis-core
4343
format: raw
44-
44+
4545
# OS profile for the image
4646
profile: genesis_base
4747

4848
# Provisioning script
4949
script: images/install.sh
50-
50+
5151
# Override image build parameters, for instance Packer parameters
5252
override:
5353
disk_size: "6G"
5454
# manifest: manifests/genesis-core.yaml
55+
56+
envs:
57+
- ALLOW_USER_PASSWD

genesis/images/install.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,14 @@ SDK_DEV_MODE=$([ -d "$DEV_SDK_PATH" ] && echo "true" || echo "false")
3838
# Install packages
3939
sudo apt update
4040
sudo apt install yq postgresql libev-dev libvirt-dev \
41-
tftpd-hpa isc-dhcp-server -y
41+
tftpd-hpa isc-dhcp-server yq -y
42+
43+
ALLOW_USER_PASSWD=${ALLOW_USER_PASSWD-}
44+
if [ -n "$ALLOW_USER_PASSWD" ]; then
45+
echo "ubuntu:ubuntu" | sudo chpasswd
46+
sudo rm /etc/ssh/sshd_config.d/60-cloudimg-settings.conf
47+
sudo yq -yi '.system_info.default_user.lock_passwd |= false' /etc/cloud/cloud.cfg
48+
fi
4249

4350
# Useful for all-in-one-vm tests
4451
# sudo apt install qemu-kvm libvirt-daemon-system zfsutils-linux \

0 commit comments

Comments
 (0)