主机管理+堡垒机系统开发:审计回顾

一、创建用户并授权

1、创建用户、设置密码

[root@localhost CrazyEye]useradd  audit
[root@localhost CrazyEye]# passwd audit
Changing password for user audit.
New password: 
BAD PASSWORD: The password is shorter than 8 characters
Retype new password: 
passwd: all authentication tokens updated successfully.

2、sudoers授权

$cat /etc/sudoers
%crazy_audit    ALL=NOPASSWD:ALL #/usr/bin/strace,/usr/bin/python3

3、给文件夹授权

chown -R audit.audit /opt/CrazyEye/

二、安装必要工具

1、安装sshpass

curl -O -L http://downloads.sourceforge.net/project/sshpass/sshpass/1.06/sshpass-1.06.tar.gz 
tar xvzf sshpass-1.06.tar.gz 
cd sshpass-1.06
./configure
make && sudo make install

2、安装django

[root@localhost CrazyEye]# su audit
[audit@localhost CrazyEye]$ pwd
/usr/local/Python-3.5.3/bin
./pip3  install --upgrade pip
./pip3 install django -i http://pypi.douban.com/simple --trusted-host pypi.douban.com

3、后台授权机器

三、实战测试

1、启动程序

[audit@localhost CrazyEye]$ pwd
/opt/CrazyEye
[audit@localhost CrazyEye]$ python manage.py runserver 0.0.0.0:9000

2、登陆截图

1、登陆堡垒机

2、连接到目标主机

扫描二维码关注公众号,回复: 2838721 查看本文章

3、目标主机操作命令

3、部分日志展示

猜你喜欢

转载自www.cnblogs.com/luoahong/p/9497678.html