vm-ssh: renamed to net-ssh and cleaned up

There was no need to split carrying over the pubkey
and tightening up permissions on the file and its parent
directory to be done in two separate scripts; this should
be more generic now as a bonus.

Users adjusted accordingly.
This commit is contained in:
Michael Shigorin 2013-08-06 22:36:36 +04:00
parent 62a37f373f
commit de94641c41
10 changed files with 14 additions and 26 deletions

View File

@ -35,13 +35,13 @@ endif
ifeq (vm,$(IMAGE_CLASS)) ifeq (vm,$(IMAGE_CLASS))
# NB: early dependency on use/kernel is on intent # NB: early dependency on use/kernel is on intent
vm/.arm-base: profile/bare use/kernel use/net-eth/dhcp use/vm-ssh; @: vm/.arm-base: profile/bare use/kernel use/net-eth/dhcp use/net-ssh; @:
@$(call add,BASE_PACKAGES,interactivesystem e2fsprogs) @$(call add,BASE_PACKAGES,interactivesystem e2fsprogs)
@$(call add,BASE_PACKAGES,apt) @$(call add,BASE_PACKAGES,apt)
@$(call add,BASE_PACKAGES,mkinitrd uboot-tools) @$(call add,BASE_PACKAGES,mkinitrd uboot-tools)
@$(call set,BRANDING,altlinux-kdesktop) @$(call set,BRANDING,altlinux-kdesktop)
vm/.cubox-bare: vm/.arm-base use/armh use/armh-cubox use/services/ssh +systemd \ vm/.cubox-bare: vm/.arm-base use/armh use/armh-cubox use/net-ssh +systemd \
use/repo use/branding use/xdg-user-dirs/deep +pulse use/repo use/branding use/xdg-user-dirs/deep +pulse
@$(call set,KFLAVOURS,cubox) @$(call set,KFLAVOURS,cubox)
@$(call set,BRANDING,altlinux-kdesktop) @$(call set,BRANDING,altlinux-kdesktop)

View File

@ -72,7 +72,7 @@ endif # IMAGE_CLASS: ve
ifeq (vm,$(IMAGE_CLASS)) ifeq (vm,$(IMAGE_CLASS))
vm/net-static: vm/bare use/vm-net/static use/vm-ssh vm/net-static: vm/bare use/vm-net/static use/net-ssh
@$(call set,VM_NET_IPV4ADDR,10.0.2.16/24) @$(call set,VM_NET_IPV4ADDR,10.0.2.16/24)
@$(call set,VM_NET_IPV4GW,10.0.2.2) @$(call set,VM_NET_IPV4GW,10.0.2.2)

View File

@ -4,7 +4,7 @@ ifeq (vm,$(IMAGE_CLASS))
vm/bare: vm/.bare vm/bare: vm/.bare
@$(call add,BASE_PACKAGES,apt) @$(call add,BASE_PACKAGES,apt)
vm/net: vm/bare use/vm-net/dhcp use/vm-ssh vm/net: vm/bare use/vm-net/dhcp use/net-ssh
@$(call add,BASE_PACKAGES,su) @$(call add,BASE_PACKAGES,su)
# NB: use/x11 employs some installer-feature packages # NB: use/x11 employs some installer-feature packages

View File

@ -0,0 +1,3 @@
Эта фича предназначена для добавления в образ поддержки SSH:
добавляется клиент и конфигурируется сервер (требуется задание
пути к существующему публичному ключу посредством переменной SSH_KEY).

View File

@ -0,0 +1,4 @@
use/net-ssh: use/net use/services
@$(call add_feature)
@$(call add,THE_LISTS,openssh)
@$(call add,DEFAULT_SERVICES_ENABLE,sshd)

View File

@ -2,11 +2,12 @@ ifdef BUILDDIR
include $(BUILDDIR)/distcfg.mk include $(BUILDDIR)/distcfg.mk
# prepare the provided public SSH key to be carried over into the VM image # prepare the provided public SSH key to be carried over into the image
all: SSH_DIR = $(BUILDDIR)/files/root/.ssh all: SSH_DIR = $(BUILDDIR)/files/root/.ssh
all: all:
@if [ -s "$(SSH_KEY)" ]; then \ @if [ -s "$(SSH_KEY)" ]; then \
install -pD "$(SSH_KEY)" "$(SSH_DIR)/authorized_keys"; \ mkdir -pm0700 "$(SSH_DIR)"; \
install -pm0600 "$(SSH_KEY)" "$(SSH_DIR)/authorized_keys"; \
fi fi
endif endif

View File

@ -4,9 +4,3 @@ use/services: sub/rootfs
@$(call xport,DEFAULT_SERVICES_DISABLE) @$(call xport,DEFAULT_SERVICES_DISABLE)
@$(call xport,SERVICES_ENABLE) @$(call xport,SERVICES_ENABLE)
@$(call xport,SERVICES_DISABLE) @$(call xport,SERVICES_DISABLE)
# some presets
use/services/ssh: use/services use/net
@$(call add,THE_LISTS,openssh)
@$(call add,DEFAULT_SERVICES_ENABLE,sshd)

View File

@ -1,6 +0,0 @@
Эта фича предназначена для добавления в образ виртуальной машины
поддержки SSH: добавляется клиент и конфигурируется сервер
(требуется задание пути к существующему публичному ключу
посредством переменной SSH_KEY).
Фактически требует один из вариантов use/vm-net для осмысленности.

View File

@ -1,3 +0,0 @@
use/vm-ssh:
@$(call add_feature)
@$(call add,THE_LISTS,openssh)

View File

@ -1,5 +0,0 @@
#!/bin/sh
# tighten up permissions just in case
[ ! -d /root/.ssh ] || chmod 700 /root/.ssh
[ ! -f /root/.ssh/authorized_keys ] || chmod 600 /root/.ssh/authorized_keys