CentOS 7.X部署Yearning
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CentOS 7.X部署Yearning相关的知识,希望对你有一定的参考价值。
1、介绍
Yearning SQL 审计平台 基于Vue.js与Django的整套mysql-sql审核平台解决方案。提供基于Inception的SQL检测及执行。
GitHub:https://github.com/cookieY/Yearning
文档:https://cookiey.github.io/Yearning-document/
2、安装基础组件
# 安装nginx
yum -y install nginx
# 安装mysql
rpm -ivh mysql57-community-release-el6-11.noarch.rpm
yum -y install mysql-community-server
# 安装python3.x
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
# 安装Inception
git clone https://github.com/mysql-inception/inception.git
cd inception
sh inception_build.sh debug
vi /etc/inc.cnf
[inception]
general_log=1
general_log_file=inception.log
port=6669
socket=/tmp/inc.socket
character-set-client-handshake=0
character-set-server=utf8
inception_remote_system_password=root
inception_remote_system_user=wzf1
inception_remote_backup_port=3306
inception_remote_backup_host=127.0.0.1
inception_support_charset=utf8mb4
inception_enable_nullable=0
inception_check_primary_key=1
inception_check_column_comment=1
inception_check_table_comment=1
inception_osc_min_table_size=1
inception_osc_bin_dir=/data/temp
inception_osc_chunk_time=0.1
inception_enable_blob_type=1
inception_check_column_default_value=1
nohup /root/inception/debug/mysql/bin/Inception --defaults-file=/etc/inc.cnf --port=6669 &
# 测试
mysql -uroot -h127.0.0.1 -P6669 # 输出了所有变量,表示启动成功
3、安装Yearning
git clone https://github.com/cookieY/Yearning.git
cd Yearning/src
pip install -r requirements.txt
# 创建数据库
create database Yearning DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
# 配置数据库连接(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
4、访问http://localhost
text [Centos] centos7相关#linux #centos
以上是关于CentOS 7.X部署Yearning的主要内容,如果未能解决你的问题,请参考以下文章
Yearning SQl审查统计+inception sql检测安装