From b1d23be15103248e91b037bb3503820691b1f3b0 Mon Sep 17 00:00:00 2001 From: pvincent Date: Mon, 8 Apr 2024 12:12:41 +0400 Subject: [PATCH] fix harden sudo ln timezone --- lib/harden.sh | 2 +- lib/install.sh | 3 --- scripts/lxc-miaou-enable-ssh | 9 ++++++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/harden.sh b/lib/harden.sh index ee57ada..fc0f6e5 100755 --- a/lib/harden.sh +++ b/lib/harden.sh @@ -138,7 +138,7 @@ function set_timezone_if_defined { if ! grep -q "$timezone" /etc/timezone; then if [[ -f "/usr/share/zoneinfo/$timezone" ]]; then echo "set timezone to $timezone ..." - ln -fs "/usr/share/zoneinfo/$timezone" /etc/localtime + sudo ln -fs "/usr/share/zoneinfo/$timezone" /etc/localtime dpkg-reconfigure -f noninteractive tzdata echo OK else diff --git a/lib/install.sh b/lib/install.sh index e02d8f3..d16651f 100755 --- a/lib/install.sh +++ b/lib/install.sh @@ -427,9 +427,6 @@ function ask_for_email { local PREFIX="install:ask_for_email" valid_email=$(auto_detect_email) - #TODO: to delete... - # echo "valid_email=$valid_email" && exit 1 - while ! is_email_valid "$valid_email"; do echo -n "mandatory email: " read -rei "$valid_email" valid_email diff --git a/scripts/lxc-miaou-enable-ssh b/scripts/lxc-miaou-enable-ssh index 7ca102c..72941f5 100755 --- a/scripts/lxc-miaou-enable-ssh +++ b/scripts/lxc-miaou-enable-ssh @@ -63,9 +63,12 @@ EOF lxc exec "$CONTAINER" -- mkdir -p "/home/$SSH_USER/.ssh" lxc exec "$CONTAINER" -- chown "$SSH_USER:$SSH_USER" "/home/$SSH_USER/.ssh" lxc exec "$CONTAINER" -- chmod 760 "/home/$SSH_USER/.ssh" - lxc file push --uid 0 --gid 0 "/home/$miaou_user/.ssh/id_ed25519.pub" "$CONTAINER/home/$SSH_USER/.ssh/authorized_keys" &>/dev/null - lxc exec "$CONTAINER" -- chown "$SSH_USER:$SSH_USER" "/home/$SSH_USER/.ssh/authorized_keys" - lxc exec "$CONTAINER" -- chmod 600 "/home/$SSH_USER/.ssh/authorized_keys" + + if [[ -f "/home/$miaou_user/.ssh/authorized_keys" ]]; then + lxc file push --uid 0 --gid 0 "/home/$miaou_user/.ssh/authorized_keys" "$CONTAINER/home/$SSH_USER/.ssh/authorized_keys" &>/dev/null + lxc exec "$CONTAINER" -- chown "$SSH_USER:$SSH_USER" "/home/$SSH_USER/.ssh/authorized_keys" + lxc exec "$CONTAINER" -- chmod 600 "/home/$SSH_USER/.ssh/authorized_keys" + fi echo "create symbolic link for curl from TOOLBOX as required for Codium remote-ssh" lxc exec "$CONTAINER" -- ln -sf /TOOLBOX/curl /usr/bin/