-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Add agentless installer in the teleport discovery service #19648
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
12 commits
Select commit
Hold shift + click to select a range
a4989c5
Add agentless installer
bef1bb0
Resolve comments
a6e6e3a
Resolve comments
47e883b
Use GetCertAuthorities locally
ac469f3
Try to get IMDS hostname
44f260a
Try get imds hostname first
4b1303a
Use FIPS cipher suites
0ebee35
use the openssh ca, resolve comments
2eacb77
write keys to /etc/teleport/agentless by default
e22ad5e
Resolve comment
6e50fa4
lints
affd278
test fixes
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,61 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| set -o errexit | ||
| set -o pipefail | ||
| set -o nounset | ||
|
|
||
| ( | ||
| flock -n 9 || exit 1 | ||
| if grep -q "Section created by 'teleport join openssh'" "$SSHD_CONFIG"; then | ||
| exit 0 | ||
| fi | ||
|
|
||
| . /etc/os-release | ||
|
|
||
| if [ "$ID" = "debian" ] || [ "$ID" = "ubuntu" ]; then | ||
| # old versions of ubuntu require that keys get added by `apt-key add`, without | ||
| # adding the key apt shows a key signing error when installing teleport. | ||
| if [ "$VERSION_CODENAME" = "xenial" ] || [ "$VERSION_CODENAME" = "trusty" ]; then | ||
| curl -o /tmp/teleport-pubkey.asc https://deb.releases.teleport.dev/teleport-pubkey.asc | ||
| cat /tmp/teleport-pubkey.asc | sudo apt-key add - | ||
| echo "deb https://apt.releases.teleport.dev/ubuntu ${VERSION_CODENAME?} stable/{{ .MajorVersion }}" | sudo tee /etc/apt/sources.list.d/teleport.list | ||
| rm /tmp/teleport-pubkey.asc | ||
| else | ||
| curl https://deb.releases.teleport.dev/teleport-pubkey.asc | sudo tee /usr/share/keyrings/teleport-archive-keyring.asc | ||
| echo "deb [signed-by=/usr/share/keyrings/teleport-archive-keyring.asc] https://apt.releases.teleport.dev/${ID?} ${VERSION_CODENAME?} stable/{{ .MajorVersion }}" | sudo tee /etc/apt/sources.list.d/teleport.list >/dev/null | ||
| fi | ||
| sudo apt-get update | ||
| sudo apt-get install -y teleport | ||
| elif [ "$ID" = "amzn" ] || [ "$ID" = "rhel" ]; then | ||
| if [ "$ID" = "rhel" ]; then | ||
| VERSION_ID=$(echo "$VERSION_ID" | sed 's/\..*//') # convert version numbers like '7.2' to only include the major version | ||
| fi | ||
| sudo yum-config-manager --add-repo \ | ||
| "$(rpm --eval "https://yum.releases.teleport.dev/$ID/$VERSION_ID/Teleport/%{_arch}/stable/{{ .MajorVersion }}/teleport.repo")" | ||
| sudo yum install -y teleport | ||
| else | ||
| echo "Unsupported distro: $ID" | ||
| exit 1 | ||
| fi | ||
|
|
||
| IMDS_TOKEN=$(curl -m5 -sS -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 300") | ||
| LOCAL_IP=$(curl -m5 -sS -H "X-aws-ec2-metadata-token: ${IMDS_TOKEN}" http://169.254.169.254/latest/meta-data/local-ipv4) | ||
| PUBLIC_IP=$(curl -m5 -sS -H "X-aws-ec2-metadata-token: ${IMDS_TOKEN}" http://169.254.169.254/latest/meta-data/public-ipv4 || echo "") | ||
|
|
||
| PRINCIPALS="" | ||
| if [ ! "$LOCAL_IP" = "" ]; then | ||
| PRINCIPALS="$LOCAL_IP,$PRINCIPALS" | ||
| fi | ||
| if [ ! "$PUBLIC_IP" = "" ]; then | ||
| PRINCIPALS="$PUBLIC_IP,$PRINCIPALS" | ||
| fi | ||
|
|
||
| sudo /usr/bin/teleport join openssh \ | ||
| --openssh-config="${SSHD_CONFIG}" \ | ||
| --join-method=iam \ | ||
| --token="$1" \ | ||
| --proxy-server="{{ .PublicProxyAddr }}" \ | ||
| --additional-principals="$PRINCIPALS" \ | ||
| --restart-sshd | ||
|
|
||
| ) 9>/var/lock/teleport_install.lock | ||
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
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.