Skip to content

Instantly share code, notes, and snippets.

@dante11235
Forked from vairisingh/install-teleport.sh
Last active April 7, 2022 09:43
Show Gist options
  • Save dante11235/d43a3373eae6b28c25b7ccd730826739 to your computer and use it in GitHub Desktop.
Save dante11235/d43a3373eae6b28c25b7ccd730826739 to your computer and use it in GitHub Desktop.
Script to install Teleport on a system
#!/bin/bash
export version=v8.0.7
export os=linux
export arch=amd64
#####################################
curl -O https://get.gravitational.com/teleport-$version-$os-$arch-bin.tar.gz
tar -xzf teleport-$version-$os-$arch-bin.tar.gz
cd teleport
./install
#####################################
mkdir -p /var/lib/teleport
#####################################
cat > /etc/systemd/system/teleport.service <<- "EOF"
[Unit]
Description=Teleport SSH Service
After=network.target
[Service]
Type=simple
Restart=on-failure
EnvironmentFile=-/etc/default/teleport
ExecStart=/usr/local/bin/teleport start --config=/etc/teleport.yaml --pid-file=/var/run/teleport.pid
ExecReload=/bin/kill -HUP $MAINPID
PIDFile=/run/teleport.pid
[Install]
WantedBy=multi-user.target
EOF
#####################################
cat > /etc/teleport.yaml <<- "EOF"
teleport:
nodename: <<REDACTED>>
auth_token: <<REDACTED>>
auth_servers:
- tele.robto.it:3025
data_dir: /var/lib/teleport
proxy_service:
enabled: "no"
auth_service:
enabled: "no"
ssh_service:
enabled: "yes"
commands:
- name: arch
command: [/bin/uname, -p]
period: 1h0m0s
- name: hostname
command: [/bin/hostname]
period: 1m0s
EOF
#####################################
systemctl daemon-reload
systemctl enable teleport
systemctl start teleport
#####################################
@schneider82
Copy link

the <> parts how do we get the auth_token?

@dante11235
Copy link
Author

for example

tctl nodes add --ttl=5m --roles=node,proxy --token=secret-value 

you choose any name you want
and add the token generated from command obove

@dante11235
Copy link
Author

dante11235 commented Feb 9, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment