-
Notifications
You must be signed in to change notification settings - Fork 56
feat: implement RFC 16 to allow emergency node access #3557
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
57 commits
Select commit
Hold shift + click to select a range
1af5518
image: add `openssh-server` and `openssh` package
miampf 3477a23
image: `sshd` config + `create-host-ssh-key` service
miampf 1297392
terraform: setup ssh access for azure
miampf 52a6e07
image: setup for ssh connections
miampf 13225b5
chore: formatting
miampf 8db68c8
terraform: add `emergency_ssh` variable to AWS,GCP,openstack
miampf 1f32349
terraform: adjust `emergency_ssh` variable description
miampf 9c81aaa
terraform: allow connection to ssh hosts outside of `10.*` range
miampf 96a1ac7
image: use `/run/ssh` directory for ssh files
miampf 5a717db
docs: emergency ssh troubleshooting section
miampf 3455829
chore: tidy, check, generate
miampf 3e3ab95
terraform: use certificate in config
miampf bc39585
image: remove `AuthorizedKeysFile` setting
miampf 00411b2
chore: fix rebase
miampf 534492f
fix: use correct path to cert in CLI
miampf 70bee6c
fix: correct certificate formatting in CLI
miampf 3755da4
docs: wrote ssh config info
miampf cdb9ed2
cli,terraform: adjust code according to docs
miampf 8b920e2
fix: vale errors
miampf 077e00f
chore: bazel run //:generate
miampf 6ebcb8d
terraform: add `loadbalancer_address` output for azure
miampf abc8733
e2e: initialize structure
miampf b44b6ae
e2e: add emergency ssh action
miampf 56b415f
e2e: propagate create workspace
miampf 1d87616
e2e: add emergency ssh workflow
miampf 25a8226
e2e: add emergency ssh test option to workflow
miampf a310785
e2e: added forgotten machine type for runner
miampf 0af238b
e2e: actually treat steps as steps
miampf adc4859
e2e: add `emergency ssh to e2e test action
miampf dcbf824
e2e: fix some problems in action
miampf abda8f6
terraform: add `loadbalancer_address` output to GCP and AWS
miampf 924df54
e2e: install terraform for test
miampf 5a3d20f
e2e: fix variable names
miampf c012b4b
e2e: switch to terraform directory correctly
miampf 1634744
e2e: don't check host keys
miampf 74ff522
chore: fix rebase
miampf 7f9c313
fix: typo in CLI
miampf f83f0ee
terraform: add `loadbalancer_address` output to STACKIT
miampf 4a5882d
terraform: `loadbalancer_address` outputs in correct section
miampf 1381e94
e2e: correct permissions
miampf aaaa4d5
e2e: bump k8s version in workflow
miampf fb7d945
chore: update branch
miampf d5def19
e2e: improve test ergonomics & reliability
miampf c72c0ef
chore: fix rebase
miampf 4aa1982
e2e: finish test
miampf 4f5a9a6
chore: remove unwanted changes
miampf e60c1b3
chore: repair image hashsums
miampf c7d1e96
chore: implement style suggestions
miampf 949f7fd
e2e: remove push trigger, add to weekly instead
miampf 3f7a2b7
e2e: revert unwanted formatting changes
miampf 69accbd
cli: ssh -> SSH in strings
miampf 56b572a
docs: spelling changes
miampf 30d79f9
docs: fix autoformatting
miampf 74ebd46
e2e: remove `e2e-ssh.yml`
miampf eeeac9a
chore: bazel run //:generate
miampf 3e418b7
docs: implement suggestions
miampf c24d3b1
chore: fix hashsums from rebase
miampf File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
name: Emergency ssh | ||
description: "Verify that an emergency ssh connection can be established." | ||
|
||
inputs: | ||
kubeconfig: | ||
description: "The kubeconfig file for the cluster." | ||
required: true | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Test emergency ssh | ||
shell: bash | ||
env: | ||
KUBECONFIG: ${{ inputs.kubeconfig }} | ||
run: | | ||
set -euo pipefail | ||
|
||
# Activate emergency ssh access to the cluster | ||
pushd ./constellation-terraform | ||
echo "emergency_ssh = true" >> terraform.tfvars | ||
terraform apply -auto-approve | ||
lb="$(terraform output -raw loadbalancer_address)" | ||
popd | ||
|
||
# write ssh config | ||
cat > ssh_config <<EOF | ||
Host $lb | ||
ProxyJump none | ||
|
||
Host * | ||
StrictHostKeyChecking no | ||
UserKnownHostsFile=/dev/null | ||
IdentityFile ./access-key | ||
PreferredAuthentications publickey | ||
CertificateFile=constellation_cert.pub | ||
User root | ||
ProxyJump $lb | ||
EOF | ||
|
||
for i in {1..26}; do | ||
if [[ "$i" -eq 26 ]]; then | ||
echo "Port 22 never became reachable" | ||
exit 1 | ||
fi | ||
echo "Waiting until port 22 is reachable: $i/25" | ||
if nc -z -w 25 "$lb" 22; then | ||
break | ||
fi | ||
done | ||
|
||
# generate and try keypair | ||
ssh-keygen -t ecdsa -q -N "" -f ./access-key | ||
constellation ssh --debug --key ./access-key.pub | ||
internalIPs="$(kubectl get nodes -o=jsonpath='{.items[*].status.addresses}' | jq -r '.[] | select(.type == "InternalIP") | .address')" | ||
for ip in $internalIPs; do | ||
for i in {1..26}; do | ||
if [[ "$i" -eq 26 ]]; then | ||
echo "Failed to connect to $ip over $lb" | ||
exit 1 | ||
fi | ||
echo "Trying connection to $ip over $lb: $i/25" | ||
if ssh -F ssh_config -o BatchMode=yes $ip true; then | ||
echo "Connected to $ip successfully" | ||
break | ||
fi | ||
done | ||
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.