teleport是一款簡單易用的堡壘機系統,運用在企業對windows.linux服務器的安全使用管理以及審計。
官網網址:http://teleport.eomsoft.net/ github地址:https://github.com/eomsoft/teleport
我接下來講解和安裝的是2.2.10版本,官網有3.0版本但是還是預覽版有些功能沒有完善。
teleport的windows遠程是基於rdp,linux是基於ssh.
teleport2.2.10版本的安裝很簡單:
目前只支持部署到Linux系統中去,支持以下版本:
- Ubuntu 14.04 64位 及以上版本
- CentOS 6.2 64位 及以上版本
- Debian 6.0 64位 及以上版本
- Redhat 6.2 64位 及以上版本
我的安裝環境是:centos7
下載安裝包:
cd /tmp wget http://teleport.eomsoft.net/static/download/opensource/teleport-server-linux-x64-2.2.10.1.tar.gz
解壓安裝包:
tar -zxvf teleport-server-linux-x64-2.2.10.1.tar.gz cd teleport-server-linux-x64-2.2.10.1/ sudo ./setup.sh
默認的安裝路徑是/usr/local/teleport.以上就安裝完成了,接下來我們需要開放一些端口以保證服務的正常運行。
firewall-cmd --add-port=7190/tcp --permanent (web訪問端口7190) firewall-cmd --add-port=52080/tcp --permanent(web后台RPC接口) firewall-cmd --add-port=52089/tcp --permanent(RDP跳轉服務) firewall-cmd --add-port=52189/tcp --permanent(ssh跳轉服務) firewall-cmd --reload
teleport默認使用的數據庫是sqlite,它也支持mysql,由於對sqlite不太熟悉,我這邊使用的mariadb(從centos7開始mariadb為默認的數據庫了)。
mariadb的安裝這邊我就不講了,我這邊以安裝好了講起。首先第一步我們需要創建teleport的數據庫
CREATE database teleport DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
第二我們需要創建一個用戶對teleport數據庫有權限讀寫。
grant all privileges on teleport.* to teleport@'localhost' identified by ‘123456';
用戶名是teleport,密碼是123456.接下來我們需要更改配置文件將mariadb數據庫的一些信息填入。
配置文件的默認路徑是/usr/local/teleport/data/etc,我們需要編輯文件web.ini.
cp /usr/local/teleport/data/etc/web.ini /usr/local/teleport/data/etc/web.ini.bak (先備份配置文件)
編輯配置文件web.ini
重啟teleport:
sudo /etc/init.d/teleport restart
有關teleport的命令
sudo /etc/init.d/teleport start(啟動) sudo /etc/init.d/teleport stop(暫停) sudo /etc/init.d/teleport restart(重啟) sudo /etc/init.d/teleport status(查看運行狀態)
啟動完后我們訪問http://您的堡壘機IP地址:7190,用戶名是admin密碼是admin.
然后點擊開始創建數據庫即可。
安裝就講到這里。
一個完整的teleport少不了tp助手,我們需要去官網下載tp助手進行安裝。每次打開teleport網站它會檢查我們的tp助手是否在運行。
接下來講講我在使用中遇到的問題以及解決辦法:
第一個問題就是通過TP助手連接我們的遠程windows發現只可以復制文件不可以用剪切板。
原因是tp助手集成的freerdp不帶有這個功能,如果我們使用需要剪切板的話需要自己手動升級下freerdp,具體步驟是:先去官網下載freerdp地址是:https://ci.freerdp.com/job/freerdp-nightly-windows/ 選擇你對應的系統位數進行下載。這里我提供一個64位的鏈接:https://ci.freerdp.com/job/freerdp-nightly-windows/arch=win64,label=vs2013/lastSuccessfulBuild/artifact/build/Release/wfreerdp.exe
然后去我們的tp助手的安裝目錄找到tools-->tprdp-->tprdp-client.exe 然后將我們剛才下載的復制進來進行替換(注意是替換tprdp-client.exe,替換后名稱要是tprdp-client哦。)注意親測win7替換后沒有用,win10替換后可以使用剪切板。
第二個問題就是核心服務崩潰
核心服務崩潰應該算是一個bug,如何解決?我們可以寫個腳本,定時檢查我們的teleport狀態,如果狀態是核心服務崩潰就重啟teleport.並記錄日志。
腳本為:
#!/bin/bash/ ####################################################### # $Name: teleport_check.sh # $Version: v1.0 # $Function: check teleport status # $Author: djx # $Create Date: 2017-11-8 # $Description: shell ###################################################### #注意此腳本未加文件鎖 Teleport_command=/etc/init.d/teleport #日志文件路徑 Teleport_log=/var/log/teleport/teleport_check.log Teleport_status=`${Teleport_command} status |awk '{print $5$6}' |grep 'notrunning.'` if [ "$?" -eq 0 ] then echo "$(date +%F_%T)" >> ${Teleport_log} echo "$(${Teleport_command} status)" >>${Teleport_log} $Teleport_command restart echo "$(${Teleport_command} status)" >>${Teleport_log} else echo "" fi
然后將此腳本添加到計划任務,按照實際情況設定間隔檢查的分鍾數。
第三個問題就是rdp客戶端連接win2008以上服務器失敗,日志提示“協議不支持”。
服務器端打開 計算機-屬性-遠程設置,將默認的“僅允許運行使用網絡級別身份驗證的遠程桌面的計算機連接”,更改為“允許運行任意版本遠程桌面的計算機連接” 即可正常連接