dotfiles/ssh/makefile
James Patrick 0edd5d513a Adding public key system to update script.
There should be no issue with this. The SSH server will already
advertise the keys to all connecting instances.
2019-12-11 00:55:57 -05:00

36 lines
953 B
Makefile

SRC_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
CONFIG_SRC := $(SRC_DIR)/config
CONFIG_TRGT := ~/.ssh/config
JPATRICK_KEY := ~/.ssh/git.jpatrick.io
include ../lib/shared.mk
install: | init update
init:
$(info => Setting up ssh)
$(mk_link) $(CONFIG_SRC) $(CONFIG_TRGT)
$(mk_link) $(SRC_DIR)/public_keys ~/.ssh/public_keys
$(MAKE) -C $(SRC_DIR) init_jpatrick_key
update:
cd ~/.ssh \
&& mkdir -p public_keys/`hostname` \
&& for i in *.pub ; do ; \
cp $$i public_keys/`hostname`/$$i ; \
done
remove:
$(info => Remvoing ssh)
$(rm_link) $(TARGET)
$(report) warn "NOTE: All prior keys still remain."
init_jpatrick_key:
ifeq ($(shell [ ! -e $(JPATRIC_KEY) ] $(return_val_truthy) ), true)
$(report) info "Setting up key for jpatrick.io"
ssh-keygen -t ed25519 -C "`hostname`: `date`" -f $(JPATRICK_KEY) -N "" \
; report info "jpatrick.io key created"
else
$(report) warn "Key for jpatrick.io already created"
endif