Yearning 介紹(SQL審覈平臺)

介紹

Yearning SQL 審計平臺 基於Vue.js與Django的整套mysql-sql審覈平臺解決方案。提供基於Inception的SQL檢測及執行。html

GitHub:https://github.com/cookieY/Yearningpython

文檔:https://cookiey.github.io/Yearning-document/mysql

 

安裝部署(centos6.8)

一、Nginx安裝nginx

yum install nginx -y

二、MySQL Server安裝git

https://dev.mysql.com/downloads/repo/yum/ 下載yum庫mysql57-community-release-el6-11.noarch.rpmgithub

rpm -ivh mysql57-community-release-el6-11.noarch.rpm
  • 查看
yum list|grep mysql57
  • 安裝
yum install mysql-community-server -y

三、Python 3.6安裝web

  • 解壓
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安裝sql

參考:http://www.cnblogs.com/shhnwangjian/p/8464172.htmlshell

五、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

相關文章
相關標籤/搜索