一、安装shellinabox
1、安装依赖工具
yum install git openssl-devel pam-devel zlib-devel autoconf automake libtool
2、克隆代码
git clone https://github.com/shellinabox/shellinabox.git && cd shellinabox
3、生成configure
autoreconf -i
4、编译安装
./configure --prefix=/opt/shellinabox
make install
echo $?
5、启动
cd bin/
./shellinabox -t
6、检查端口是否启动
netstat -ntplu
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:4200 0.0.0.0:* LISTEN 12131/./shellinabox
二、shellinabox web登陆截图
1、web登陆
2、堡垒机
3、192.168.16.51执行df和pwd命令
5、192.168.16.51执行top命令
三、嵌入到堡垒机项目
1、views
@login_required
def webssh(request):
return render(request,'web_ssh.html')
2、web_ssh.html
{% extends 'index.html' %} {% block page-title %}WEB SSH{% endblock %} {% block page-content %}
<div class="panel">
<div class="panel-heading">
<h3 class="panel-title">webssh</h3>
</div>
<div class="panel-body">
<ul>
<a class="btn-link" href="http://192.168.16.52:4200/">web ssh </a>
</ul>
</div>
</div>
{% endblock %}
四、测试截图
1、后台登陆
2、连接具webssh