From de94641c41635eeb18f782e68ce5a9d18af1736e Mon Sep 17 00:00:00 2001 From: Michael Shigorin Date: Tue, 6 Aug 2013 22:36:36 +0400 Subject: [PATCH] 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. --- conf.d/armh.mk | 4 ++-- conf.d/test.mk | 2 +- conf.d/vm.mk | 2 +- features.in/net-ssh/README | 3 +++ features.in/net-ssh/config.mk | 4 ++++ features.in/{vm-ssh => net-ssh}/generate.mk | 5 +++-- features.in/services/config.mk | 6 ------ features.in/vm-ssh/README | 6 ------ features.in/vm-ssh/config.mk | 3 --- features.in/vm-ssh/image-scripts.d/50-.ssh-perms | 5 ----- 10 files changed, 14 insertions(+), 26 deletions(-) create mode 100644 features.in/net-ssh/README create mode 100644 features.in/net-ssh/config.mk rename features.in/{vm-ssh => net-ssh}/generate.mk (66%) delete mode 100644 features.in/vm-ssh/README delete mode 100644 features.in/vm-ssh/config.mk delete mode 100755 features.in/vm-ssh/image-scripts.d/50-.ssh-perms diff --git a/conf.d/armh.mk b/conf.d/armh.mk index 8c887af5..1ea83f21 100644 --- a/conf.d/armh.mk +++ b/conf.d/armh.mk @@ -35,13 +35,13 @@ endif ifeq (vm,$(IMAGE_CLASS)) # 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,apt) @$(call add,BASE_PACKAGES,mkinitrd uboot-tools) @$(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 @$(call set,KFLAVOURS,cubox) @$(call set,BRANDING,altlinux-kdesktop) diff --git a/conf.d/test.mk b/conf.d/test.mk index a7c51fc4..d3926c64 100644 --- a/conf.d/test.mk +++ b/conf.d/test.mk @@ -72,7 +72,7 @@ endif # IMAGE_CLASS: ve 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_IPV4GW,10.0.2.2) diff --git a/conf.d/vm.mk b/conf.d/vm.mk index 0d3ee63b..0f40ff42 100644 --- a/conf.d/vm.mk +++ b/conf.d/vm.mk @@ -4,7 +4,7 @@ ifeq (vm,$(IMAGE_CLASS)) vm/bare: vm/.bare @$(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) # NB: use/x11 employs some installer-feature packages diff --git a/features.in/net-ssh/README b/features.in/net-ssh/README new file mode 100644 index 00000000..0ba1d526 --- /dev/null +++ b/features.in/net-ssh/README @@ -0,0 +1,3 @@ +Эта фича предназначена для добавления в образ поддержки SSH: +добавляется клиент и конфигурируется сервер (требуется задание +пути к существующему публичному ключу посредством переменной SSH_KEY). diff --git a/features.in/net-ssh/config.mk b/features.in/net-ssh/config.mk new file mode 100644 index 00000000..3bb4c377 --- /dev/null +++ b/features.in/net-ssh/config.mk @@ -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) diff --git a/features.in/vm-ssh/generate.mk b/features.in/net-ssh/generate.mk similarity index 66% rename from features.in/vm-ssh/generate.mk rename to features.in/net-ssh/generate.mk index 018eaf01..24df3caf 100644 --- a/features.in/vm-ssh/generate.mk +++ b/features.in/net-ssh/generate.mk @@ -2,11 +2,12 @@ ifdef BUILDDIR 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: @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 endif diff --git a/features.in/services/config.mk b/features.in/services/config.mk index 060f052e..617909ca 100644 --- a/features.in/services/config.mk +++ b/features.in/services/config.mk @@ -4,9 +4,3 @@ use/services: sub/rootfs @$(call xport,DEFAULT_SERVICES_DISABLE) @$(call xport,SERVICES_ENABLE) @$(call xport,SERVICES_DISABLE) - -# some presets - -use/services/ssh: use/services use/net - @$(call add,THE_LISTS,openssh) - @$(call add,DEFAULT_SERVICES_ENABLE,sshd) diff --git a/features.in/vm-ssh/README b/features.in/vm-ssh/README deleted file mode 100644 index f8eef361..00000000 --- a/features.in/vm-ssh/README +++ /dev/null @@ -1,6 +0,0 @@ -Эта фича предназначена для добавления в образ виртуальной машины -поддержки SSH: добавляется клиент и конфигурируется сервер -(требуется задание пути к существующему публичному ключу -посредством переменной SSH_KEY). - -Фактически требует один из вариантов use/vm-net для осмысленности. diff --git a/features.in/vm-ssh/config.mk b/features.in/vm-ssh/config.mk deleted file mode 100644 index c9f0f962..00000000 --- a/features.in/vm-ssh/config.mk +++ /dev/null @@ -1,3 +0,0 @@ -use/vm-ssh: - @$(call add_feature) - @$(call add,THE_LISTS,openssh) diff --git a/features.in/vm-ssh/image-scripts.d/50-.ssh-perms b/features.in/vm-ssh/image-scripts.d/50-.ssh-perms deleted file mode 100755 index 1aa7a02a..00000000 --- a/features.in/vm-ssh/image-scripts.d/50-.ssh-perms +++ /dev/null @@ -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