Skip to content

Commit 2bfd604

Browse files
authored
Merge pull request #20 from lima-vm/sshd-pam
Enable PAM support for sshd
2 parents 2ac2b01 + 958fd40 commit 2bfd604

File tree

4 files changed

+18
-2
lines changed

4 files changed

+18
-2
lines changed

build.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ docker run -it --rm \
1616
-v "${PWD}/lima-init-local.openrc:/home/build/lima-init-local.openrc:ro" \
1717
-v "${PWD}/lima-network.awk:/home/build/lima-network.awk:ro" \
1818
-v "${PWD}/nerdctl-${NERDCTL_VERSION}:/home/build/nerdctl.tar.gz:ro" \
19+
-v "${PWD}/sshd.pam:/home/build/sshd.pam:ro" \
1920
$(env | grep ^LIMA_ | xargs -n 1 printf -- '-e %s ') \
2021
-e "LIMA_REPO_VERSION=${REPO_VERSION}" \
2122
"mkimage:${ALPINE_VERSION}" \

genapkovl-lima.sh

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ EOF
4444
mkdir -p "$tmp"/etc/apk
4545
makefile root:root 0644 "$tmp"/etc/apk/world <<EOF
4646
alpine-base
47-
openssh
47+
openssh-server-pam
4848
EOF
4949

5050
rc_add devfs sysinit
@@ -73,6 +73,17 @@ rc_add networking default
7373

7474
rc_add sshd default
7575

76+
rc_add local default
77+
78+
mkdir -p "${tmp}/etc/local.d/"
79+
makefile root:root 0755 "$tmp/etc/local.d/lima.start" << EOF
80+
sed -i 's/#UsePAM no/UsePAM yes/g' /etc/ssh/sshd_config
81+
rc-service --ifstarted sshd reload
82+
EOF
83+
84+
mkdir -p "$tmp"/etc/pam.d
85+
cp /home/build/sshd.pam "${tmp}/etc/pam.d/sshd"
86+
7687
if [ "${LIMA_INSTALL_LIMA_INIT}" == "true" ]; then
7788
rc_add lima-init default
7889
rc_add lima-init-local default

mkimg.lima.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ profile_lima() {
1313
kernel_cmdline="console=tty0 console=ttyS0,115200"
1414
syslinux_serial="0 115200"
1515
apkovl="genapkovl-lima.sh"
16-
apks="$apks openssh"
16+
apks="$apks openssh-server-pam"
1717
if [ "${LIMA_INSTALL_CA_CERTIFICATES}" == "true" ]; then
1818
apks="$apks ca-certificates"
1919
fi

sshd.pam

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
auth include system-login
2+
account include system-login
3+
password include system-login
4+
session include system-login

0 commit comments

Comments
 (0)