Enable SSH only if any keys exist

This commit is contained in:
Disassembler 2019-03-22 10:31:59 +01:00
parent db81cd38b8
commit 0c9c54f481
No known key found for this signature in database
GPG Key ID: 524BD33A0EE29499
2 changed files with 2 additions and 5 deletions

5
_vm.sh
View File

@ -89,14 +89,11 @@ wget https://dl.dasm.cz/_vm.tar -O - | tar xf - -C /mnt
chroot /mnt apk --no-cache add bridge ca-certificates curl e2fsprogs-extra gettext iptables kbd-misc libressl lxc postfix nginx openssh-server openssh-sftp-server util-linux wireguard-virt@et wireguard-tools-wg@et acme-sh@vm vmmgr@vm chroot /mnt apk --no-cache add bridge ca-certificates curl e2fsprogs-extra gettext iptables kbd-misc libressl lxc postfix nginx openssh-server openssh-sftp-server util-linux wireguard-virt@et wireguard-tools-wg@et acme-sh@vm vmmgr@vm
chroot /mnt newaliases chroot /mnt newaliases
mkdir -p /mnt/var/log/lxc mkdir -p /mnt/var/log/lxc
for SERVICE in cgroups consolefont crond iptables networking nginx ntpd postfix sshd swap urandom vmmgr; do for SERVICE in cgroups consolefont crond iptables networking nginx ntpd postfix swap urandom vmmgr; do
ln -s /etc/init.d/${SERVICE} /mnt/etc/runlevels/boot ln -s /etc/init.d/${SERVICE} /mnt/etc/runlevels/boot
done done
ADMINPWD=$(htpasswd -bnBC 10 "" "${ENCPWD}" | tr -d ':\n' | sed 's/$2y/$2b/') envsubst </mnt/etc/vmmgr/config.default.json >/mnt/etc/vmmgr/config.json ADMINPWD=$(htpasswd -bnBC 10 "" "${ENCPWD}" | tr -d ':\n' | sed 's/$2y/$2b/') envsubst </mnt/etc/vmmgr/config.default.json >/mnt/etc/vmmgr/config.json
# Disable root login using password
sed -i 's/root::/root:!:/' /mnt/etc/shadow
# Cleanup # Cleanup
rm -rf /mnt/root rm -rf /mnt/root
mkdir -p /mnt/root/.ssh mkdir -p /mnt/root/.ssh

2
vmmgr

@ -1 +1 @@
Subproject commit 81d9bb74ee63af02e20acda532f925fab2affa0d Subproject commit 2494c55493cb0d097e0e1d8a048785c88c29ab09