From 0c67c3c36de4ba0321c7b518423a66693bbe7f2c Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Wed, 10 Jan 2024 02:14:36 +0300 Subject: [PATCH] tweaking... Signed-off-by: Alex A. Naanou --- gate-traefik/make.sh | 2 +- ssh/make.sh | 17 ++++++++++++----- wireguard/make.sh | 2 -- wireguard/templates/root/Makefile | 2 ++ 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/gate-traefik/make.sh b/gate-traefik/make.sh index ffad3b3..401cb24 100755 --- a/gate-traefik/make.sh +++ b/gate-traefik/make.sh @@ -90,7 +90,7 @@ echo "# Setup: iptables..." echo "# Setup: iptables update script..." @ lxc-attach $ID rc-update add local -@ lxc-attach $ID ln -s /root/routing.sh /etc/local.d/iptables-update.start +@ lxc-attach $ID -- ln -s /root/routing.sh /etc/local.d/iptables-update.start echo "# Post config..." pctSet $ID "${OPTS_STAGE_2}" $REBOOT diff --git a/ssh/make.sh b/ssh/make.sh index d189fde..5d9b92f 100755 --- a/ssh/make.sh +++ b/ssh/make.sh @@ -65,12 +65,19 @@ echo "# Creating CT..." pctCreateDebian $ID "${OPTS_STAGE_1}" "$PASS" echo "# Installing dependencies..." -@ lxc-attach $ID apt install vim htop iftop iotop tmux mc +@ lxc-attach $ID apt install vim htop iftop iotop tmux mc sudo -echo "# Setup: user..." -xread "user name for ssh: " SSH_USER -[ -z $SSH_USER ] \ - || @ lxc-attach $ID -- adduser $SSH_USER +echo "# Setup: users..." +while true ; do + xread "user name for ssh: " SSH_USER + [ -z $SSH_USER ] \ + || @ lxc-attach $ID -- adduser $SSH_USER + read -ep "Add another user? [y/N]: " MORE + if [[ $MORE == 'y' ]] ; then + continue + fi + break +done echo "# Post config..." pctSet $ID "${OPTS_STAGE_2}" $REBOOT diff --git a/wireguard/make.sh b/wireguard/make.sh index f12de0a..885c842 100755 --- a/wireguard/make.sh +++ b/wireguard/make.sh @@ -83,9 +83,7 @@ echo "# Copying assets..." echo "# Setup: wireguard default profile..." @ lxc-attach $ID -- bash -c "cd /root && \ ENDPOINT_PORT=51820 \ - ENDPOINT=${ENDPOINT} \ CLIENT_IP=10.42.0.1/32 \ - DNS=${NS_LAN_IP/\/*} \ ALLOWED_IPS=0.0.0.0/0 \ make default.client" @ lxc-attach $ID -- chmod 600 /etc/wireguard/wg0.conf diff --git a/wireguard/templates/root/Makefile b/wireguard/templates/root/Makefile index c334d5e..c19f56b 100644 --- a/wireguard/templates/root/Makefile +++ b/wireguard/templates/root/Makefile @@ -30,6 +30,8 @@ CLIENT_IP ?= 10.42.0.1/32 cat $< | wg pubkey > $@ +# NOTE: the first letter of each pattern is quoted to prevent it from +# being substituted when generating this Makefile from template. $(SERVER_CONF): $(SERVER_TPL) $(SERVER_KEY) cat $< \ | sed \