前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >企业实战(18)两步搞定轻量级开源堡垒机Teleport服务的数据备份与升级(3)

企业实战(18)两步搞定轻量级开源堡垒机Teleport服务的数据备份与升级(3)

作者头像
非著名运维
发布2022-06-22 14:50:17
3730
发布2022-06-22 14:50:17
举报
文章被收录于专栏:非著名运维

部署篇-->传送门: 企业实战(18)一文搞懂轻量级开源堡垒机Teleport的部署(1)

管理主机篇-->传送门:企业实战(18)超简单实现轻量级开源堡垒机Teleport管理Linux/Windows主机(2)

介绍:

Teleport是一款简单易用的开源堡垒机系统,具有小巧、易用的特点,支持 RDP/SSH/SFTP/Telnet 协议的远程连接和审计管理。

Teleport由两大部分构成:

  • 跳板核心服务
  • WEB操作界面

Teleport非常小巧且极易安装部署:仅需一分钟,就可以安装部署一套您自己的堡垒机系统!

因为Teleport内建了所需的脚本引擎、WEB服务等模块,因此不需要额外安装其他的库或者模块,整个系统的安装与部署非常方便。

特点:

- 极易部署

简洁设计,小巧灵活,无额外依赖,确保您可以在5分钟内完成安装部署,开始使用。

- 安全增强

配置远程主机为仅被您的teleport服务器连接,可有效降低嗅探、扫描、暴力破解等攻击风险。

- 单点登录

只需登录您的teleport服务器,即可一键连接您的任意远程主机,无需记忆每台远程主机的密码了。

- 按需授权

可以随时授权指定运维人员访问指定的远程主机,也可随时回收授权。仅仅需要几次点击!

- 运维审计

对远程主机的操作均有详细记录,支持操作记录录像、回放,审计工作无负担。

环境:

CentOS 7.5

Teleport 3.2.2

部署:

Teleport的安装部署非常简单,只需一分钟就可以完成。您需要先下载二进制安装包。

Teleport下载:https://tp4a.com/download

Teleport在线文档:https://docs.tp4a.com/

Teleport的安装部署非常简单,只需一分钟就可以完成。您需要先下载二进制安装包。

Teleport下载:https://tp4a.com/download

Teleport在线文档:https://docs.tp4a.com/

1.下载Teleport服务端安装包

代码语言:javascript
复制
[root@localhost ~]# mkdir teleport

[root@localhost ~]# cd teleport

[root@localhost teleport]# wget https://tp4a.com/static/download/teleport-server-linux-x64-3.2.2.tar.gz  //下载Teleport服务端安装包
--2020-08-25 20:26:43--  https://tp4a.com/static/download/teleport-server-linux-x64-3.2.2.tar.gz
正在解析主机 tp4a.com (tp4a.com)... 39.97.125.170
正在连接 tp4a.com (tp4a.com)|39.97.125.170|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:23137304 (22M) [application/octet-stream]
正在保存至: “teleport-server-linux-x64-3.2.2.tar.gz”

100%[============================================================>] 23,137,304  1.34MB/s 用时 19s

2020-08-25 20:27:03 (1.17 MB/s) - 已保存 “teleport-server-linux-x64-3.2.2.tar.gz” [23137304/23137304])


[root@localhost teleport]# ll
总用量 22596
-rw-r--r-- 1 root root 23137304 1月  23 2019 teleport-server-linux-x64-3.2.2.tar.gz

2.关闭防火墙

代码语言:javascript
复制
[root@localhost ~]# systemctl stop firewalld

[root@localhost ~]# sed -i 's/enforcing/disabled/' /etc/selinux/config

[root@localhost ~]# cat /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     disabled - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of disabled.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled         //永久关闭
# SELINUXTYPE= can take one of three two values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected.
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

[root@localhost ~]# iptables -F     //最好是把iptables规则也清空

3.解压Teleport服务端安装包

代码语言:javascript
复制
[root@localhost teleport]# tar -zvxf teleport-server-linux-x64-3.2.2.tar.gz
teleport-server-linux-x64-3.2.2/
teleport-server-linux-x64-3.2.2/data/
teleport-server-linux-x64-3.2.2/data/www/
teleport-server-linux-x64-3.2.2/data/www/teleport/
teleport-server-linux-x64-3.2.2/data/www/teleport/app_bootstrap.py
teleport-server-linux-x64-3.2.2/data/www/teleport/res/
teleport-server-linux-x64-3.2.2/data/www/teleport/res/fonts/
teleport-server-linux-x64-3.2.2/data/www/teleport/res/fonts/001.ttf
teleport-server-linux-x64-3.2.2/data/www/teleport/static/
teleport-server-linux-x64-3.2.2/data/www/teleport/static/css/
teleport-server-linux-x64-3.2.2/data/www/teleport/static/css/login.css
teleport-server-linux-x64-3.2.2/data/www/teleport/static/css/single.css
teleport-server-linux-x64-3.2.2/data/www/teleport/static/css/style.css
teleport-server-linux-x64-3.2.2/data/www/teleport/static/css/dashboard.css

4.查看并执行Teleport安装脚本

安装时需要指定安装路径,可以使用默认的安装路径/usr/local/teleport(直接回车即可),也可以指定别的路径。注意路径中不要含有中文字符或空格,以避免出现不可预知的错误。

默认的录像回放文件位于/usr/local/teleport/data/replay目录下,会占用/usr的空间,因此建议安装完成后配置录像回放文件的存储路径。

代码语言:javascript
复制
[root@localhost teleport]# ll
总用量 22596
drwxrwxr-x 5 1000 1000       62 1月  23 2019 teleport-server-linux-x64-3.2.2
-rw-r--r-- 1 root root 23137304 1月  23 2019 teleport-server-linux-x64-3.2.2.tar.gz

[root@localhost teleport]# cd teleport-server-linux-x64-3.2.2

[root@localhost teleport-server-linux-x64-3.2.2]# ll
总用量 4
drwxrwxr-x 2 1000 1000  80 9月  17 2018 daemon
drwxrwxr-x 5 1000 1000  39 1月  23 2019 data
drwxrwxr-x 3 1000 1000  33 1月  10 2019 script
-rwxrwxr-x 1 1000 1000 320 1月  23 2019 setup.sh

[root@localhost teleport-server-linux-x64-3.2.2]# ./setup.sh    //执行安装脚本
[]===========================================================================[]
 | Teleport Server Installation                                              |
 |===========================================================================|
 |    ver: 3.2.2                                                             |
 | author: apex.liu@qq.com                                                   |
[]===========================================================================[]

Welcome to install Teleport Server!

NOTICE: There are a few steps need you enter information or make choice,
        if you want to use the DEFAULT choice, just press `Enter` key.
        Otherwise you need enter the highlight character to make choice.


Prepare installation...
 - check local installation ... [not exists]


Set installation path [/usr/local/teleport]:                   //默认的安装路径(回车)
 - copy [/root/teleport/teleport-server-linux-x64-3.2.2/data/bin]
     -> [/usr/local/teleport/bin]
 - copy [/root/teleport/teleport-server-linux-x64-3.2.2/data/www]
     -> [/usr/local/teleport/www]
 - copy [/root/teleport/teleport-server-linux-x64-3.2.2/data/tmp/etc]
     -> [/usr/local/teleport/data/etc]
process [daemon.in] to [/etc/init.d/teleport]
process [start.sh.in] to [/usr/local/teleport/start.sh]
process [stop.sh.in] to [/usr/local/teleport/stop.sh]
process [status.sh.in] to [/usr/local/teleport/status.sh]

start services...
starting teleport web ... [done]
starting teleport core server ... [done]

check services status...
teleport web server is running.
teleport core server is running.

--==[ ALL DONE ]==--

5.访问进行初始化配置

初次安装完成后,可以访问 http://你的teleport服务器IP:7190/进行初始化设置。

代码语言:javascript
复制
[root@localhost ~]# ss -antulp | grep :7190
tcp    LISTEN     0      128       *:7190                  *:*                   users:(("tp_web",pid=2917,fd=5))

初始化设置时,需要确定使用的数据库类型。Teleport默认使用内建的sqlite3数据库,因此无需额外安装数据库服务即可开始使用堡垒机的各项功能。如果您希望使用MySQL数据库,请在初始化之前进行MySQL数据库配置。

需要在这里设置系统管理员的账号和密码,此账号具有系统的最高权限,请牢记密码。设置完成后,点击“开始配置”按钮即可完成初始配置工作了:

初始化配置完成后,刷新页面即可进入teleport的登录界面。

服务控制:

Teleport 有两个服务:核心服务 core 和网页服务 web。两个服务可以同时启动、停止、重启,也可单独操作其中的一个。

操作完整的 teleport 服务:

  • 启动:/etc/init.d/teleport start
  • 停止:/etc/init.d/teleport stop
  • 重启:/etc/init.d/teleport restart
  • 查看运行状态:/etc/init.d/teleport status

仅操作核心服务 core:

  • 启动:/etc/init.d/teleport start core
  • 停止:/etc/init.d/teleport stop core
  • 重启:/etc/init.d/teleport restart core

仅操作网页服务 web:

  • 启动:/etc/init.d/teleport start web
  • 停止:/etc/init.d/teleport stop web
  • 重启:/etc/init.d/teleport restart web

升级:

注意:升级之前,请确保备份了您的数据!!升级过程中也会再次提示您备份数据!

1 备份数据

默认情况下,teleport的配置文件、数据文件等均放在 /usr/local/teleport/data 目录下,因此,可以将此目录进行备份即可。需要注意的是,默认的录像回放文件也在此目录下,因此有可能数据量会比较大。

2 下载并升级

Teleport安装包下载:https://tp4a.com/download

备份完成后,就可以进行升级了。升级过程也很简单,与安装过程基本一致。需要下载最新的安装包,解压,然后以 root 身份运行压缩包中的 setup.sh 脚本,像这样:

wget https://www.tp4a.com/static/download/teleport-server-linux-x64-3.2.2.tar.gz (下载要新版本的服务端安装包)

tar -zxvf teleport-server-linux-x64-3.2.2.tar.gz

cd teleport-server-linux-x64-3.2.2

./setup.sh

安装脚本会自动检测当前已经安装的版本和路径,并询问要执行的操作。这里我们要升级,按提示,输入 g 并回车,然后会确认升级以及确认已经对数据进行了备份,这里我们输入 y 并回车进行确认,之后,安装脚本会停止teleport的服务,复制新版本的文件,然后重新启动服务,就像这样:

本文参与 腾讯云自媒体同步曝光计划,分享自微信公众号。
原始发表:2020-09-01,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 非著名运维 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 部署篇-->传送门: 企业实战(18)一文搞懂轻量级开源堡垒机Teleport的部署(1)
  • 管理主机篇-->传送门:企业实战(18)超简单实现轻量级开源堡垒机Teleport管理Linux/Windows主机(2)
  • 介绍:
  • 特点:
  • 环境:
  • 部署:
  • 服务控制:
  • 升级:
相关产品与服务
数据库
云数据库为企业提供了完善的关系型数据库、非关系型数据库、分析型数据库和数据库生态工具。您可以通过产品选择和组合搭建,轻松实现高可靠、高可用性、高性能等数据库需求。云数据库服务也可大幅减少您的运维工作量,更专注于业务发展,让企业一站式享受数据上云及分布式架构的技术红利!
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档