{"id":13732,"date":"2022-01-11T11:20:13","date_gmt":"2022-01-11T11:20:13","guid":{"rendered":"https:\/\/linuxways.net\/?p=13732"},"modified":"2022-01-11T11:20:18","modified_gmt":"2022-01-11T11:20:18","slug":"how-to-install-teleport-on-ubuntu-20-04","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/ubuntu\/how-to-install-teleport-on-ubuntu-20-04\/","title":{"rendered":"How to Install Teleport on Ubuntu 20.04"},"content":{"rendered":"<p>Teleport is an open-source, easy to install certificate Authority system. In case you have different servers that are accessible through SSH, different Kubernetes databases, and Web apps. So teleport is used to put them all in one platform as an access plane to all these infrastructures. It also has a feature of sharing and recording of interactive sessions across all environments.<\/p>\n<p>Teleport also runs as a systemd service and is very easy to install and deploy. In this article, we are going to discuss the installation process of teleport on Ubuntu 20.04 server.<\/p>\n<h2>Installation<\/h2>\n<p>As in case for Linux and Mac operating systems, teleport core service <strong>teleport <\/strong>and admin tool <strong>tctl<\/strong> are used as they are designed to work on such operating systems.Also the teleport user client <strong>tsh <\/strong>and <strong>UI<\/strong> are available for Linux, Mac and other operating systems.<\/p>\n<h2>Prerequisites<\/h2>\n<ul>\n<li>A Linux machine with a port 443 open<\/li>\n<li>A two-factor authenticator app such as Authy, Google Authenticator, or Microsoft Authenticator<\/li>\n<li>An SSH client like OpenSSH<\/li>\n<li>Access to a DNS service such as Amazon Route 53 or CoreDNS<\/li>\n<\/ul>\n<h2>Installation of teleport on Ubuntu 20.04 server<\/h2>\n<p>If you want 32-bit binaries or ARM binaries, check the latest release page at this link <a href=\"https:\/\/goteleport.com\/teleport\/download\/\">https:\/\/goteleport.com\/teleport\/download\/<\/a> . But to install the 64-bit version of teleport binaries, run the command as shown below.<\/p>\n<p>To install the public key of teleport, run the command as shown below.<\/p>\n<pre>$ curl https:\/\/deb.releases.teleport.dev\/teleport-pubkey.asc | sudo apt-key add -<\/pre>\n<p>To add repo to APT, run the command as shown below.<\/p>\n<pre>$ sudo add-apt-repository 'deb https:\/\/deb.releases.teleport.dev\/ stable main'<\/pre>\n<p>To update APT Cache, run the command as shown below.<\/p>\n<pre>$ sudo apt-get update<\/pre>\n<p>Finally to Install Teleport, run the command as shown below.<\/p>\n<pre>$ sudo apt install teleport<\/pre>\n<h2>Configuration of teleport<\/h2>\n<p>For the configuration of teleport, simply run the configuration and save it with yaml format. For further details, check the configuration as shown below with the use of your favorite editor.<\/p>\n<pre>$ sudo vim \/etc\/teleport.yaml<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"656\" height=\"611\" class=\"wp-image-13733\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-150.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-150.png 656w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-150-300x279.png 300w\" sizes=\"auto, (max-width: 656px) 100vw, 656px\" \/><\/p>\n<pre>teleport:\r\n\r\nnodename: linuxways\r\n\r\ndata_dir: \/var\/lib\/teleport\r\n\r\nlog:\r\n\r\noutput: stderr\r\n\r\nseverity: INFO\r\n\r\nformat:\r\n\r\noutput: text\r\n\r\nca_pin: []\r\n\r\ndiag_addr: \"\"\r\n\r\nauth_service:\r\n\r\nenabled: \u201cyes\u201d\r\n\r\ncluster_name: \"teleport\"\r\n\r\nlisten_addr: 0.0.0.0:3025\r\n\r\ntokens:\r\n\r\n- proxy,node,app:e6cebf660b1f3390f204130b9649\r\n\r\npublic_addr: 5.22.209.65:3025\r\n\r\nssh_service:\r\n\r\nenabled: \u201cyes\u201d\r\n\r\nlabels:\r\n\r\nenv: example\r\n\r\ncommands:\r\n\r\n- name: hostname\r\n\r\ncommand: [hostname]\r\n\r\nperiod: 1m0s\r\n\r\napp_service:\r\n\r\nenabled: \u201cyes\u201d\r\n\r\ndebug_app: true\r\n\r\nproxy_service:\r\n\r\nenabled: \u201cyes\u201d\r\n\r\nlisten_addr: 0.0.0.0:3023\r\n\r\nweb_listen_addr: 0.0.0.0:3080\r\n\r\ntunnel_listen_addr: 0.0.0.0:3024\r\n\r\npublic_addr: 5.22.209.65:3080<\/pre>\n<p>For the configuration to work properly, the directory \/<strong>var\/lib\/teleport<\/strong> must be provided with right permissions which enable teleport and tctl to read and write without issue. Run the command as shown below for that purpose.<\/p>\n<pre>$ sudo chmod 755 -R \/var\/lib\/teleport\/<\/pre>\n<h2>Configuration of Domain Name System<\/h2>\n<p>You have to provide the certificate for the secure https protocol. It is possible with the certificate that you already have or by creating a self sign certificate or add the DNS like tele.example.com pointing to your public ip and run commands with the use of ACME protocol that request TLS certificates to be automatically available from Let&#8217;s Encrypt. It accesses an HTTP endpoint on your Teleport host in order to complete authentication challenges.<\/p>\n<pre>$ sudo teleport configure --acme --acme-email=your-email@example.com --cluster-name=tele.example.com -o file<\/pre>\n<p>Or create a self sign certificate and<\/p>\n<pre>$ sudo openssl req -x509 -days 365 -nodes -newkey rsa:2048 -keyout \/etc\/pki\/tls\/private\/teleport.key -out \/etc\/pki\/tls\/certs\/teleport.crt<\/pre>\n<p>After the creation of the certificate, add those certificates on the configuration of the teleport as shown below.<\/p>\n<pre>$ sudo vim \/etc\/teleport.yaml<\/pre>\n<pre>teleport:\r\n\r\nnodename: linuxways\r\n\r\ndata_dir: \/var\/lib\/teleport\r\n\r\nlog:\r\n\r\noutput: stderr\r\n\r\nseverity: INFO\r\n\r\nformat:\r\n\r\noutput: text\r\n\r\nca_pin: []\r\n\r\ndiag_addr: \"\"\r\n\r\nauth_service:\r\n\r\nenabled: \u201cyes\u201d\r\n\r\ncluster_name: \"teleport\"\r\n\r\nlisten_addr: 0.0.0.0:3025\r\n\r\ntokens:\r\n\r\n- proxy,node,app:e6cebf660b1f3390f204130b9649\r\n\r\npublic_addr: 5.22.209.65:3025\r\n\r\nssh_service:\r\n\r\nenabled: \u201cyes\u201d\r\n\r\nlabels:\r\n\r\nenv: example\r\n\r\ncommands:\r\n\r\n- name: hostname\r\n\r\ncommand: [hostname]\r\n\r\nperiod: 1m0s\r\n\r\napp_service:\r\n\r\nenabled: \u201cyes\u201d\r\n\r\ndebug_app: true\r\n\r\nproxy_service:\r\n\r\nenabled: \u201cyes\u201d\r\n\r\nlisten_addr: 0.0.0.0:3023\r\n\r\nweb_listen_addr: 0.0.0.0:3080\r\n\r\ntunnel_listen_addr: 0.0.0.0:3024\r\n\r\npublic_addr: 5.22.209.65:3080<\/pre>\n<p><strong> https_keypairs:<\/strong><\/p>\n<pre><strong> - key_file: \/etc\/pki\/tls\/private\/teleport1.key<\/strong><\/pre>\n<pre><strong> cert_file: \/etc\/pki\/tls\/certs\/teleport1.crt<\/strong><\/pre>\n<h2>Configuration of Teleport service and start the service<\/h2>\n<p>Let&#8217;s create a systemd service for the teleport service with the commands as shown below.<\/p>\n<pre>$ sudo vim \/etc\/systemd\/system\/teleport.service<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"670\" height=\"278\" class=\"wp-image-13734\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-151.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-151.png 670w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-151-300x124.png 300w\" sizes=\"auto, (max-width: 670px) 100vw, 670px\" \/><\/p>\n<pre>[Unit]\r\n\r\nDescription=Teleport SSH Service\r\n\r\nAfter=network.target\r\n\r\n[Service]\r\n\r\nType=simple\r\n\r\nRestart=on-failure\r\n\r\nEnvironmentFile=-\/etc\/default\/teleport\r\n\r\nExecStart=\/usr\/local\/bin\/teleport start --pid-file=\/run\/teleport.pid\r\n\r\nExecReload=\/bin\/kill -HUP $MAINPID\r\n\r\nPIDFile=\/run\/teleport.pid\r\n\r\nLimitNOFILE=8192\r\n\r\n[Install]\r\n\r\nWantedBy=multi-user.target<\/pre>\n<p>Now, let&#8217;s run the command as shown below to reload the daemon, enable and start the service.<\/p>\n<pre>$ sudo systemctl daemon-reload<\/pre>\n<pre>$ sudo systemctl start teleport<\/pre>\n<pre>$ sudo systemctl enable teleport<\/pre>\n<p>To check the status of the teleport service, run the command as shown below.<\/p>\n<pre>$ sudo systemctl status teleport.service<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"829\" height=\"178\" class=\"wp-image-13735\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-152.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-152.png 829w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-152-300x64.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-152-768x165.png 768w\" sizes=\"auto, (max-width: 829px) 100vw, 829px\" \/><\/p>\n<h3>Creating the teleport user with the set up of two-factor authentication<\/h3>\n<p>To login, you must have a user with the right privilege. By default, teleport enforces the use of two factor authentication so we are creating a user with username admin-user using the two factor authentication with the use of google authenticator. You can use other ways of authentication available on the options too.<\/p>\n<p>Run the command as shown below to create the user.<\/p>\n<pre>$ sudo tctl users add admin-user --roles=editor,access --logins=root,ubuntu,linuxways<\/pre>\n<p>As you can see we are providing roles of editor and access to this user as admin privilege and users like root, ubuntu or linuxways can login to the servers in teleport cluster servers.<\/p>\n<p>After running the above command, you will see the output as shown on the screenshot below with the link to create a password for the user.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1215\" height=\"93\" class=\"wp-image-13736\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-153.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-153.png 1215w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-153-300x23.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-153-1024x78.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-153-768x59.png 768w\" sizes=\"auto, (max-width: 1215px) 100vw, 1215px\" \/><\/p>\n<p>Now, let&#8217;s browse the site and create a password for the user with the use of two-factor authentication as shown in the screenshot below.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"965\" height=\"669\" class=\"wp-image-13737\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-154.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-154.png 965w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-154-300x208.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-154-768x532.png 768w\" sizes=\"auto, (max-width: 965px) 100vw, 965px\" \/><\/p>\n<p>After you click on create account, the dashboard of the teleport Web UI will be shown. You will notice your newly created user with the list of nodes privileged to the user. For further details, check the screenshot as shown below.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1277\" height=\"558\" class=\"wp-image-13738\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-155.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-155.png 1277w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-155-300x131.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-155-1024x447.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-155-768x336.png 768w\" sizes=\"auto, (max-width: 1277px) 100vw, 1277px\" \/><\/p>\n<h2>Adding a node to the cluster<\/h2>\n<p>To add a new node to the teleport cluster, run the command as shown below.<\/p>\n<p>First login to the teleport<\/p>\n<pre>$ tsh login --proxy=tele.example.com --auth=local --user=admin-user<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"840\" height=\"223\" class=\"wp-image-13739\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-156.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-156.png 840w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-156-300x80.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-156-768x204.png 768w\" sizes=\"auto, (max-width: 840px) 100vw, 840px\" \/><\/p>\n<p>Generate a token with a specified time limit, here we are limiting time for 1hour.<\/p>\n<pre>$ tctl tokens add --type=node --ttl=1h<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"289\" class=\"wp-image-13740\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-157.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-157.png 800w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-157-300x108.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-157-768x277.png 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/p>\n<p>Now download the teleport package to your new node. In our case, our new node is running with Ubuntu operating system. For that, go through the installation process as shown below..<\/p>\n<pre>$ curl https:\/\/deb.releases.teleport.dev\/teleport-pubkey.asc | sudo apt-key add -<\/pre>\n<pre>$sudo add-apt-repository 'deb https:\/\/deb.releases.teleport.dev\/ stable main'<\/pre>\n<pre>$ sudo apt-get update<\/pre>\n<pre>$ sudo apt install teleport<\/pre>\n<p>Now run this command on the new node by using the token created with the above command. For further details, check the command as shown below.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"889\" height=\"180\" class=\"wp-image-13741\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-158.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-158.png 889w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-158-300x61.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-158-768x156.png 768w\" sizes=\"auto, (max-width: 889px) 100vw, 889px\" \/><\/p>\n<p>As in our case, the hostname is <strong>testserver<\/strong> so we can verify it by browsing the site of Teleport WEB-UI and check on servers section as shown in the picture below.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1277\" height=\"563\" class=\"wp-image-13742\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-159.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-159.png 1277w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-159-300x132.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-159-1024x451.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-159-768x339.png 768w\" sizes=\"auto, (max-width: 1277px) 100vw, 1277px\" \/><\/p>\n<h2>Accessing the added server<\/h2>\n<p>Now, the new node has been added successfully so it is easily accessible with the WEB UI or terminal by simply clicking on connect and accessing it with the preferred user option on the list. For further details, check the screenshot as shown below.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1269\" height=\"555\" class=\"wp-image-13743\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-160.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-160.png 1269w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-160-300x131.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-160-1024x448.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-160-768x336.png 768w\" sizes=\"auto, (max-width: 1269px) 100vw, 1269px\" \/><\/p>\n<p>In our case, we selected root as a user then the next tab will be open where the new node server can be accessed as shown on the screenshot below.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1087\" height=\"247\" class=\"wp-image-13744\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-161.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-161.png 1087w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-161-300x68.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-161-1024x233.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-161-768x175.png 768w\" sizes=\"auto, (max-width: 1087px) 100vw, 1087px\" \/><\/p>\n<p>As you can see, we are easily executing the commands on the new node \u201ctestserver\u201d with the WEB UI of teleport.<\/p>\n<h2>Conclusion<\/h2>\n<p>In this article, you have learnt how to install the teleport on Ubuntu 20.04 server and add the new node. Running the commands on the added server through the WEB UI of teleport is easy to do. Thank you!<\/p>","protected":false},"excerpt":{"rendered":"<p>Teleport is an open-source, easy to install certificate Authority system. In case you have different servers that are accessible through SSH, different Kubernetes databases, and Web apps. So&hellip;<\/p>","protected":false},"author":1,"featured_media":13829,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[830,100],"class_list":["post-13732","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ubuntu","tag-teleport","tag-ubuntu-20-04"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/13732","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=13732"}],"version-history":[{"count":0,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/13732\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/13829"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=13732"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=13732"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=13732"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}