SQL審核平台-Yearning安裝部署實踐


相關文檔:

https://guide.yearning.io/ yearning簡介

http://python.yearning.io/install/  yearning安裝

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

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

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

搭建環境

MySQL版本:5.7.24

linux系統:CentOS7

Python版本:3.6 

Yearning安裝

Yearning_python

下載yearning1.4.7版本

git地址:https://github.com/cookieY/Yearning/tree/v1.4.7

 直接點擊下載壓縮包即可

 

創建yearning數據庫

在自己的數據庫實例中創建yearning所需的數據庫

create database Yearning DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;

安裝python依賴包

cd Yearning/src
pip install -r requirements.txt 

配置Yearning配置文件

編輯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地址, 具體地址請咨詢對應郵箱提供者

  

初始化數據庫

python3  manage.py makemigrations
python3  manage.py migrate 

這一步可能會報錯

1.沒有使用python3,

SyntaxError: Non-ASCII character '\xe6' in file /data/mysql/opdir/Yearning-1.4.7/src/settingConf/settings.py on line 154, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details

2.使用python3啟動

ModuleNotFoundError: No module named 'Crypto'  

 沒有Crypto模塊,需要安裝該模塊

[root@XXX ~]# pip install crypto   安裝該模塊

  

添加初始化用戶

 echo "from core.models import Account;Account.objects.create_user(username='admin', password='admin123456', group='admin',is_staff=1)" | python3 manage.py shell

 

復制編譯好的靜態文件到nginx html目錄下

cd /data/mysql/opdir/Yearning-1.4.7/webpage
npm install

 

npm install phantomjs-prebuilt@2.1.16 --ignore-scripts(上面如果有問題,執行這條就ok)

  

 

如果沒有npm,需要先安裝前段相關的軟件

npm
yum install npm

node
npm install node

前端相關安裝
npm install --global vue-cli
npm install -g webpack
npm install webpack webpack-cli -g
npm install --global vue-cli
webpack -v #查看下是否安裝成功
vue -V #查看下是否安裝成功

nginx 自己裝(前端代理用)
yum install nginx

  

Yearning_go

python支持的yearning已經不再維護,建議使用go-yearning

安裝2.1.6版本yearning

安裝文檔:https://guide.yearning.io/install.html

 

如果登陸界面現實密碼錯誤,就吧yearning庫刪除掉,重新執行初始化命令

 以下信息表示yearning初始化成功

 

 Yearning下載

下載2.1.6版本(目前最新)

 https://github.com/cookieY/Yearning/releases

 

 

解壓后的目錄結構

 

 修改配置文件

cat conf.toml
[Mysql]
Db = "Yearning"
Host = "127.0.0.1"
Port = "3306"
Password = "xxxx"
User = "root"

[General]   #數據庫加解密key,只可更改一次。
SecretKey = "dbcjqheupqjsuwsm"

 

關於SecretKey

SecretKey是token/數據庫密碼加密/解密的salt。

建議所有用戶在初次安裝Yearning之前將SecretKey更改(不更改將存在安全風險)

格式: 大小寫字母均可, 長度必須為16位

特別注意:

此key僅可在初次安裝時更改!之后不可再次更改!如再次更改會導致之前已存放的數據源密碼無法解密,最終導致無法獲取相關數據源信息

 

使用幫助

 

./Yearning -h 

 

初始化數據結構

./Yearning -m

  

啟動服務

默認啟動
./Yearning -s
參數啟動
./Yearning -s -b "172.27.80.35" -p "8000"

  

配置nginx

server{
        listen 80;
        client_max_body_size 75M;
        server_name xxx.com;
        location / {
            proxy_redirect off;
            proxy_pass http://127.0.0.1:8090;
        }
    }

 

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM