diff options
author | Eljo George <eljog@github.com> | 2023-03-10 23:27:28 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-10 23:27:28 +0300 |
commit | 1449f416a0d5c65fbd7e7bfac041eb43f1ecd98d (patch) | |
tree | f7b289200f7f5527e50998f3df3a10993d4b36a2 | |
parent | adf7240a7cfbaecfb84597359843212a870f6682 (diff) |
Remove duplicate env var sourcing for codespaces (#481)feature_sshd_1.0.9
* Remove duplicate env var sourcing for codespaces
-rw-r--r-- | src/sshd/devcontainer-feature.json | 2 | ||||
-rwxr-xr-x | src/sshd/install.sh | 39 |
2 files changed, 1 insertions, 40 deletions
diff --git a/src/sshd/devcontainer-feature.json b/src/sshd/devcontainer-feature.json index da1f8a9..a5d464f 100644 --- a/src/sshd/devcontainer-feature.json +++ b/src/sshd/devcontainer-feature.json @@ -1,6 +1,6 @@ { "id": "sshd", - "version": "1.0.8", + "version": "1.0.9", "name": "SSH server", "documentationURL": "https://github.com/devcontainers/features/tree/main/src/sshd", "description": "Adds a SSH server into a container so that you can use an external terminal, sftp, or SSHFS to interact with it.", diff --git a/src/sshd/install.sh b/src/sshd/install.sh index 634f163..1460408 100755 --- a/src/sshd/install.sh +++ b/src/sshd/install.sh @@ -13,7 +13,6 @@ SSHD_PORT="${SSHD_PORT:-"2222"}" USERNAME="${USERNAME:-"${_REMOTE_USER:-"automatic"}"}" START_SSHD="${START_SSHD:-"false"}" NEW_PASSWORD="${NEW_PASSWORD:-"skip"}" -FIX_ENVIRONMENT="${FIX_ENVIRONMENT:-"true"}" set -e @@ -93,35 +92,6 @@ sed -i -E "s/#*\s*Port\s+.+/Port ${SSHD_PORT}/g" /etc/ssh/sshd_config # Need to UsePAM so /etc/environment is processed sed -i -E "s/#?\s*UsePAM\s+.+/UsePAM yes/g" /etc/ssh/sshd_config -# Script to store variables that exist at the time the ENTRYPOINT is fired -store_env_script="$(cat << 'EOF' -# Wire in codespaces secret processing to zsh if present (since may have been added to image after script was run) -if [ -f /etc/zsh/zlogin ] && ! grep '/etc/profile.d/00-restore-secrets.sh' /etc/zsh/zlogin > /dev/null 2>&1; then - echo -e "if [ -f /etc/profile.d/00-restore-secrets.sh ]; then . /etc/profile.d/00-restore-secrets.sh; fi\n$(cat /etc/zsh/zlogin 2>/dev/null || echo '')" | sudoIf tee /etc/zsh/zlogin > /dev/null -fi -EOF -)" - -# Script to ensure login shells get the latest Codespaces secrets -restore_secrets_script="$(cat << 'EOF' -#!/bin/sh -if [ "${CODESPACES}" != "true" ] || [ "${VSCDC_FIXED_SECRETS}" = "true" ] || [ ! -z "${GITHUB_CODESPACES_TOKEN}" ]; then - # Not codespaces, already run, or secrets already in environment, so return - return -fi -if [ -f /workspaces/.codespaces/shared/.env-secrets ]; then - while read line - do - key=$(echo $line | sed "s/=.*//") - value=$(echo $line | sed "s/$key=//1") - decodedValue=$(echo $value | base64 -d) - export $key="$decodedValue" - done < /workspaces/.codespaces/shared/.env-secrets -fi -export VSCDC_FIXED_SECRETS=true -EOF -)" - # Write out a scripts that can be referenced as an ENTRYPOINT to auto-start sshd and fix login environments tee /usr/local/share/ssh-init.sh > /dev/null \ << 'EOF' @@ -141,15 +111,6 @@ sudoIf() } EOF -if [ "${FIX_ENVIRONMENT}" = "true" ]; then - echo "${store_env_script}" >> /usr/local/share/ssh-init.sh - echo "${restore_secrets_script}" > /etc/profile.d/00-restore-secrets.sh - chmod +x /etc/profile.d/00-restore-secrets.sh - # Wire in zsh if present - if type zsh > /dev/null 2>&1; then - echo -e "if [ -f /etc/profile.d/00-restore-secrets.sh ]; then . /etc/profile.d/00-restore-secrets.sh; fi\n$(cat /etc/zsh/zlogin 2>/dev/null || echo '')" > /etc/zsh/zlogin - fi -fi tee -a /usr/local/share/ssh-init.sh > /dev/null \ << 'EOF' |