# Eat_bees_shit一个没有写前端页面的堡垒机 Eat_bees_shit==================Eat_bees_shit是基于Python开发的一款简单易用的IT审计堡垒机,通过对原生ssh代码进行了部分修改,从而实现用户在登录堡垒机后,他所有的命令操作都将被实时抓取并写入审计日志,以供后期审计,目前CrazyEye主要实现了以下功能: - 用户行为审计 - 底层使用原生ssh,不牺牲ssh使用体验,对用户操作无任何影响 - 支持对主机进行分组管理 - 可为运维人员分配指定服务器、指定账号的操作权限,即一个用户可以登录多少生产服务器,以及登录后有什么权限,都可以自如的控制 - 用户登录堡垒后的所有操作均可被记录下来以供日后审计. 注意:: 目前暂时不支持对Windows系统的操作审计和批量任务 快速安装`(for Ubuntu)`========###环境依赖 python3.5+ Django==2.1.7 sshpass openssh ####3.安装sshpass* 进入文件目录,执行`tar xvzff Eat_bees_shit.gz`* `cd sshpass-1.06/`* `./configure`* `make && make install` ###3.安装改过源码的openssh * `cd src/openssh-7.3p1/`* `./configure --prefix=/usr/local/openssh7/ ` 注意有可能会报错误configure: error: OpenSSL version header not found.这是因为openssh需要openssl,此时需要安装一下openssl的开发模块` 在ubuntu上安装openssl dev组件 sudo apt-get install zlib1g sudo apt-get install zlib1g-dev sudo apt-get install libssl-dev 再重新执行configure就应该没问题了 * `make && make install` ###4.配置审计用户 * 创建一个审计用户,`adduser Eat_bees_shit`* 修改audit_user的.bashrc, `vim /home/crazy_audit/.bashrc`,在文件末尾加下以下2行并保存 python3 /usr/local/Eat_bees_shit/Eat_bees_shit.py run logout * 修改sudo配置文件,使crazy_audit用户可以在sudo时不用输入密码 $ sudo vim /etc/sudoers %Eat_bees_shit ALL=NOPASSWD:ALL #/usr/bin/strace,/usr/bin/python3 ###5.Eat_bees_shit sudo python3 manage.py runserver 0.0.0.0:9000 *注意启动此程序的用户不应是crazye_audit用户 ###6.登录* 管理用户登录通过浏览器打开`http://your_ip_addr:9000/` 用户名:django创建时的账户 密码: 密码 * 普通只需要通过命令行登录即可 [email protected]:~$ su eat_bee_dung <Settings "Eat_bee_dung.settings">Username:[email protected]Passwrod:Welcome login ...0, web[1]1, Java[1]2, yun[1]3 未分组主机【4】Choose group:00 python IP:192.168.146.137 POrt:22,IDC:Web主机Choose host:0login host python(192.168.146.137)@python:123456sshpass -p 123456 /usr/local/openssh7/bin/ssh [email protected] -o "StrictHostKeyChecking no" -Z 2fe9b171f7fb7e50f20c1e6c0efaea15ssh tag: 2fe9b171f7fb7e50f20c1e6c0efaea15Welcome to Ubuntu 18.10 (GNU/Linux 4.18.0-25-generic x86_64) * Documentation: https://help.ubuntu.com * Management: https://landscape.canonical.com * Support: https://ubuntu.com/advantage 0 packages can be updated.0 updates are security updates. Your Ubuntu release is not supported anymore.For upgrade information, please visit:http://www.ubuntu.com/releaseendoflife New release ‘19.04‘ available.Run ‘do-release-upgrade‘ to upgrade to it. Last login: Sat Sep 28 22:22:18 2019 from 192.168.146.134[email protected]:~$ pwd/home/python[email protected]:~$ lscmd.log demo.log Documents Eat_bee_dung examples.desktop paramiko-master paramiko-master.zip.0 Public pycrypto-2.6.1.tar.gz sshpass-1.06 Templates venvcmd.txt Desktop Downloads Eat_bee_dung.zip Music paramiko-master.zip Pictures PycharmProjects ssh_cmd.py sshpass-1.06.tar.gz test.py Videos[email protected]:~$ ifconfigens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.146.137 netmask 255.255.255.0 broadcast 192.168.146.255 inet6 fe80::4b70:fb40:7a4:c087 prefixlen 64 scopeid 0x20<link> ether 00:0c:29:a9:86:20 txqueuelen 1000 (以太网) RX packets 477 bytes 338486 (338.4 KB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 321 bytes 45678 (45.6 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10<host> loop txqueuelen 1000 (本地环回) RX packets 177 bytes 14776 (14.7 KB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 177 bytes 14776 (14.7 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 [email protected]:~$ 作者介绍============= 我也不想这么菜 虽然有诸多不完美但是基本功能还是实现了 感谢很多大佬对我的帮助 大家想看完整课程的话 就到B站搜索老男孩,里面有详细的制作过程
原文地址:https://www.cnblogs.com/langjitanya/p/11607637.html
时间: 2024-10-14 04:28:38