{"id":11857,"date":"2022-03-18T23:35:35","date_gmt":"2022-03-18T20:35:35","guid":{"rendered":"https:\/\/kifarunix.com\/?p=11857"},"modified":"2024-03-09T11:08:08","modified_gmt":"2024-03-09T08:08:08","slug":"install-and-setup-teleport-access-plane-on-linux","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/install-and-setup-teleport-access-plane-on-linux\/","title":{"rendered":"Install and Setup Teleport Access Plane on Linux"},"content":{"rendered":"\n
In this tutorial, you will learn how to install and setup Teleport access plane on Linux. According to the documentation page<\/a>, Teleport is a Certificate Authority and an Access Plane for your infrastructure. With Teleport you can:<\/p>\n\n\n\n Some of the notable features for Teleport include;<\/p>\n\n\n\n Teleport is available in two editions: community and enterprise edition.<\/p>\n\n\n\n We will be using the community edition in this example setup.<\/p>\n\n\n\n In this example tutorial, we are using an Ubuntu 20.04 system. Hence, to install Teleport on Ubuntu 20.04 Linux server;<\/p>\n\n\n\n Install Teleport repository GPG signing key;<\/p>\n\n\n\n Install Teleport repository on Ubuntu 20.04;<\/p>\n\n\n\n Update package cache;<\/p>\n\n\n\n Install Teleport on Ubuntu 20.04 Linux;<\/p>\n\n\n\n Next, you need to configure Teleport for secure SSH access.<\/p>\n\n\n\n Set the hostname of the Teleport server and update the DNS records accordingly.<\/p>\n\n\n\n If you don’t have a DNS server, set the name resolution on hosts file;<\/p>\n\n\n\n Update your domain names accordingly.<\/p>\n\n\n\n For a secured access to Teleport web interface, you need to generate SSL\/TLS certificates. This can be the commercially signed certificates (if your Teleport is public facing) or self-signed (if your instance is local).<\/p>\n\n\n\n In this setup, we will use self-signed SSL certs and thus, the command below can be ran to generate them.<\/p>\n\n\n\n NOTE: The certificate must have a subject that corresponds to the domain of your Teleport host, e.g., Once you have setup the domain name and generates the SSL certs, run the command below to generate Teleport configuration file.<\/p>\n\n\n\n This is the sample configuration file;<\/p>\n\n\n\n You can create your config file and you can test its validity using the Next, start and enable Teleport service to run on system boot;<\/p>\n\n\n\n Check the status;<\/p>\n\n\n\n Run the command below to generate Teleport admin user. The Teleport users can be created using the tctl command in the format;<\/p>\n\n\n\n Thus;<\/p>\n\n\n\n To get the permissions of the role;<\/p>\n\n\n\n For example;<\/p>\n\n\n\n tctl will generate a signup token and give you a URL to share with a user. A user will have to complete account creation by visiting the URL.<\/p>\n\n\n\n Sample command output;<\/p>\n\n\n\n You can now access the link provided, which is valid for one hour (by default, can be adjusted using the If the firewall is running on the server, ensure you open port 443\/tcp to allow external access.<\/p>\n\n\n\n You can access the URL on browser.<\/p>\n\n\n\n Click Get Started<\/strong> to create an account.<\/p>\n\n\n\n Set the password for your account and generate 2FA code by scanning the QR code using any authenticator app. I used Duo Mobile in this example.<\/p>\n\n\n\n Enter the 2FA code and proceed to create Teleport admin account.<\/p>\n\n\n\n And there you go.<\/p>\n\n\n\n You can now proceed to add servers for secure access to the Teleport access plane.<\/p>\n\n\n\n Read more on Teleport Admin Guide<\/a><\/p>\n\n\n\n Mount Remote Filesystem Over SSH using SSHFS<\/a><\/p>\n\n\n\n\n
\n
Install and Setup Teleport Access Plane on Linux<\/h2>\n\n\n\n
Install Teleport on Linux<\/h3>\n\n\n\n
wget -qO- https:\/\/deb.releases.teleport.dev\/teleport-pubkey.asc \\\n| gpg --dearmor > \/etc\/apt\/trusted.gpg.d\/teleport.gpg<\/code><\/pre>\n\n\n\n
echo \"deb https:\/\/deb.releases.teleport.dev\/ stable main\" > \/etc\/apt\/sources.list.d\/teleport.list<\/code><\/pre>\n\n\n\n
apt update<\/code><\/pre>\n\n\n\n
apt install teleport<\/code><\/pre>\n\n\n\n
Configure Teleport on Linux<\/h3>\n\n\n\n
\n
hostnamectl set-hostname teleport.kifarunix-demo.com<\/code><\/pre>\n\n\n\n
echo \"192.168.59.23 teleport.kifarunix-demo.com teleport\" >> \/etc\/hosts<\/code><\/pre>\n\n\n\n
\n
*.kifarunix-demo.com<\/code>. Replace the domain names accordingly.<\/p>\n\n\n\n
openssl req -x509 -nodes -newkey rsa:4096 \\\n-keyout \/var\/lib\/teleport\/teleport.key \\\n-out \/var\/lib\/teleport\/teleport.pem -sha256 -days 3650 \\\n-subj \"\/C=US\/ST=Oregon\/L=Portland\/O=Company Name\/OU=Org\/CN=*.kifarunix-demo.com\"<\/code><\/pre>\n\n\n\n
\n
teleport configure -o \/etc\/teleport.yaml \\\n --cluster-name=kifarunix-demo.com \\\n --public-addr=teleport.kifarunix-demo.com:443 \\\n --cert-file=\/var\/lib\/teleport\/teleport.pem \\\n --key-file=\/var\/lib\/teleport\/teleport.key<\/code><\/pre>\n\n\n\n
cat \/etc\/teleport.yaml<\/code><\/pre>\n\n\n\n
version: v2\nteleport:\n nodename: ubuntu20\n data_dir: \/var\/lib\/teleport\n log:\n output: stderr\n severity: INFO\n format:\n output: text\n ca_pin: []\n diag_addr: \"\"\nauth_service:\n enabled: \"yes\"\n listen_addr: 0.0.0.0:3025\n cluster_name: kifarunix-demo.com\n proxy_listener_mode: multiplex\nssh_service:\n enabled: \"yes\"\n labels:\n env: example\n commands:\n - name: hostname\n command: [hostname]\n period: 1m0s\nproxy_service:\n enabled: \"yes\"\n web_listen_addr: 0.0.0.0:443\n public_addr: teleport.kifarunix-demo.com:443\n https_keypairs:\n - key_file: \/var\/lib\/teleport\/teleport.key\n cert_file: \/var\/lib\/teleport\/teleport.pem\n acme: {}\n<\/code><\/pre>\n\n\n\n
--test<\/code><\/strong> option.<\/p>\n\n\n\n
teleport configure --test \/etc\/teleport.yaml<\/code><\/pre>\n\n\n\n
\n
systemctl enable --now teleport<\/code><\/pre>\n\n\n\n
systemctl status teleport<\/code><\/pre>\n\n\n\n
\n\u25cf teleport.service - Teleport SSH Service\n Loaded: loaded (\/lib\/systemd\/system\/teleport.service; enabled; vendor preset: enabled)\n Active: active (running) since Sat 2022-03-18 15:02:19 UTC; 24s ago\n Main PID: 2144 (teleport)\n Tasks: 8 (limit: 2274)\n Memory: 36.2M\n CGroup: \/system.slice\/teleport.service\n \u2514\u25002144 \/usr\/local\/bin\/teleport start --pid-file=\/run\/teleport.pid\n\nMar 18 15:02:21 teleport.kifarunix-demo.com teleport[2144]: 2022-03-18T15:02:21Z [DB:SERVIC] INFO Starting Postgres proxy server on 0.0.0.0:443. service\/service.go:3158\nMar 18 15:02:21 teleport.kifarunix-demo.com teleport[2144]: 2022-03-18T15:02:21Z [DB:SERVIC] INFO Starting Database TLS proxy server on 0.0.0.0:443. service\/service.go:3176\nMar 18 15:02:21 teleport.kifarunix-demo.com teleport[2144]: 2022-03-18T15:02:21Z [PROXY:SER] INFO Starting proxy gRPC server on [::]:443. service\/service.go:3210\nMar 18 15:02:21 teleport.kifarunix-demo.com teleport[2144]: 2022-03-18T15:02:21Z [PROXY:SER] INFO Starting TLS ALPN SNI proxy server on [::]:443. service\/service.go:3239\nMar 18 15:02:21 teleport.kifarunix-demo.com teleport[2144]: 2022-03-18T15:02:21Z INFO [NODE:1:CA] Cache \"node\" first init succeeded. cache\/cache.go:742\nMar 18 15:02:21 teleport.kifarunix-demo.com teleport[2144]: 2022-03-18T15:02:21Z [PROC:1] INFO Service node is creating new listener on 0.0.0.0:3022. service\/signals.go>\nMar 18 15:02:21 teleport.kifarunix-demo.com teleport[2144]: 2022-03-18T15:02:21Z [NODE:1] INFO Service 9.0.1:v9.0.1-0-g7bbe6f15c is starting on 0.0.0.0:3022 sqlite cach>\nMar 18 15:02:21 teleport.kifarunix-demo.com teleport[2144]: 2022-03-18T15:02:21Z [NODE:1] INFO Service 9.0.1:v9.0.1-0-g7bbe6f15c is starting on 0.0.0.0:3022. utils\/cli.>\nMar 18 15:02:21 teleport.kifarunix-demo.com teleport[2144]: [NODE] Service 9.0.1:v9.0.1-0-g7bbe6f15c is starting on 0.0.0.0:3022.\nMar 18 15:02:21 teleport.kifarunix-demo.com teleport[2144]: 2022-03-18T15:02:21Z [PROC:1] INFO The new service has started successfully. Starting syncing rotation\n<\/code><\/pre>\n\n\n\n
\n
tctl users add --roles=ROLES [<flags>] <account><\/code><\/pre>\n\n\n\n
tctl users add --roles=editor,access kifarunix-admin<\/code><\/pre>\n\n\n\n
tctl get role\/role<\/code><\/pre>\n\n\n\n
tctl get role\/editor<\/code><\/pre>\n\n\n\n
User \"kifarunix-admin\" has been created but requires a password. Share this URL with the user to complete user setup, link is valid for 1h:\nhttps:\/\/teleport.kifarunix-demo.com:443\/web\/invite\/1c2fd60cad32df99a65b75081f78bbda\n\nNOTE: Make sure teleport.kifarunix-demo.com:443 points at a Teleport proxy which users can access.\n<\/code><\/pre>\n\n\n\n
\n
--ttl<\/code>).<\/p>\n\n\n\n
https://teleport.kifarunix-demo.com:443\/web\/invite\/1c2fd60cad32df99a65b75081f78bbda<\/code><\/pre>\n\n\n\n
<\/figure><\/a><\/div>\n\n\n\n
<\/figure><\/a><\/div>\n\n\n\n
Other Tutorials<\/h3>\n\n\n\n