Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
devcontainer-features
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
eazydevelop-devcontainer-temp
devcontainer-features
Commits
1449f416
Unverified
Commit
1449f416
authored
Mar 10, 2023
by
Eljo George
Committed by
GitHub
Mar 10, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove duplicate env var sourcing for codespaces (#481)
* Remove duplicate env var sourcing for codespaces
parent
adf7240a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1 addition
and
40 deletions
+1
-40
devcontainer-feature.json
src/sshd/devcontainer-feature.json
+1
-1
install.sh
src/sshd/install.sh
+0
-39
No files found.
src/sshd/devcontainer-feature.json
View file @
1449f416
{
"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."
,
...
...
src/sshd/install.sh
View file @
1449f416
...
...
@@ -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
'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment