Yearning 介绍(SQL审核平台)
介绍
Yearning SQL 审计平台 基于Vue.js与Django的整套mysql-sql审核平台解决方案。提供基于Inception的SQL检测及执行。
GitHub:https://github.com/cookieY/Yearning
文档:https://cookiey.github.io/Yearning-document/
安装部署(centos6.8)
1、Nginx安装
yum install nginx -y
2、MySQL Server安装
https://dev.mysql.com/downloads/repo/yum/ 下载yum库mysql57-community-release-el6-11.noarch.rpm
rpm -ivh mysql57-community-release-el6-11.noarch.rpm
- 查看
yum list|grep mysql57
- 安装
yum install mysql-community-server -y
3、Python 3.6安装
- 解压
tar -xvf Python-3.6.4.tar.xz
- 创建目录
mkdir -p /usr/local/python/3.6.4/lib
- 编译
cd Python-3.6.4 ./configure --enable-shared --prefix=/usr/local/python/3.6.4 LDFLAGS="-Wl,-rpath /usr/local/python/3.6.4/lib" make make install
- 软连接
cp /usr/bin/python /usr/bin/python2.6.6 ln -fs /usr/local/python/3.6.4/bin/python3.6 /usr/bin/python ln -fs /usr/local/python/3.6.4/bin/pip3 /usr/bin/pip
- yum修改
vi /usr/bin/yum 将头部 #!/usr/bin/python 修改为 #!/usr/bin/python2.6.6
4、Inception安装
参考:http://www.cnblogs.com/shhnwangjian/p/8464172.html
5、Yearning安装
- git下载
git clone https://github.com/cookieY/Yearning.git
- 创建库
create database Yearning DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
- 安装相应python依赖库
cd Yearning/src pip install -r requirements.txt
- 配置,编辑Yearning/src/deploy.conf文件
[mysql] db = 所创建的库名 address = 数据库地址 port = 数据库端口 password = 数据库密码 username = 数据库用户 [host] ipaddress = 服务器ip地址:端口 (涉及跨域十分重要!!设置不正确将无法登陆!!) 如 本机地址为192.168.137.13 nginx设置端口为80 则应填写为 192.168.137.13:80 之后通过该地址访问平台。 [Inception] ip = Inception地址 port = Inception端口 user = Inception用户名 password = Inception密码 backupdb = 备份数据库地址 backupport = 备份数据库端口 backupuser = 备份数据库用户名 backuppassword = 备份数据库密码 [LDAP] LDAP相关设置 LDAP_SERVER = LDAP服务地址 LDAP_SCBASE = LDAP dc 设置 如 dc=xxx,dc=com LDAP_DOMAIN = LDAP域名 如 xxx.com [email] 邮箱推送相关设置 username = 邮箱发件账号 如 xxxx@163.com password = 邮箱发件账号密码 smtp_server = 邮箱stmp地址, 具体地址请咨询对应邮箱提供者
- 初始化数据库
python manage.py makemigrations python manage.py migrate
- 添加初始化用户
echo "from core.models import Account;Account.objects.create_user(username='admin', password='admin123456', group='admin',is_staff=1)" | python manage.py shell
- 复制编译好的静态文件到nginx html目录下
cd Yearning/webpage/dist cp -rf * /usr/share/nginx/html/ service nginx restart
- 启动django
cd Yearning/src python manage.py runserver 0.0.0.0:8000
- 访问首页http://192.168.137.13