Skip to content

Instantly share code, notes, and snippets.

@thalesfsp
Forked from vairisingh/install-teleport.sh
Created May 25, 2022 22:10
Show Gist options
  • Save thalesfsp/7f21d0487fa9bd151a816822da48b352 to your computer and use it in GitHub Desktop.
Save thalesfsp/7f21d0487fa9bd151a816822da48b352 to your computer and use it in GitHub Desktop.

Revisions

  1. @vairisingh vairisingh created this gist Jun 27, 2020.
    67 changes: 67 additions & 0 deletions install-teleport.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,67 @@
    #!/bin/bash

    export version=v4.2.8
    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: test.indivar.in
    auth_token: <<REDACTED>>
    auth_servers:
    - teleport.indivar.in: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

    #####################################