Write directory title here
1. Introduction to Yearning
1.1 Introduction to Yearning
Yearning is an out-of-the-box MYSQL SQL audit tool, as a MYSQL web-side SQL audit platform.
1.2 Yearning features
- Simplicity is paramount: using compiled binary files, only one database is required without any other plug-ins, and deployment is easy.
- High performance: go+vue brings a smooth and beautiful user interface and powerful performance to Yearning.
- Compatibility: Yearning automatically reviews the syntax specifications of Mysql statements based on the analysis of the Mysql syntax tree and conducts functional audits according to the audit rules implemented by Yearning itself.
1.3 Yearning function
- SQL query: query work order, export, auto-completion, smart prompt, query statement audit, query result desensitization
- SQL audit: Process chemical order, SQL statement syntax detection, SQL statement compliance detection according to rules, automatic generation of DDL/DML rollback statements, historical audit records
- Push: E-mail work order push, DingTalk webhook robot work order push
- User permissions and management: role division, user-based fine-grained permissions, registration
- Others: todoList, LDAP login, dynamic audit rule configuration, custom audit level, OIDC SSO automatic registration and login, AutoTask self-execution
2. Introduction to the local environment
2.1 Local Environment Planning
This practice is a personal test environment, and the operating system version is centos7.6.
hostname | IP address | operating system version | kernel version |
---|---|---|---|
jeven | 192.168.3.166 | hundred 7.6 | 3.10.0-957.el7.x86_64 |
2.2 Introduction to this practice
1. The deployment environment for this practice is a personal test environment;
2. The Yearning SQL audit platform is deployed in the centos7.6 environment.
3. Check the local environment
3.1 Check the operating system version
Check OS version
[root@jeven ~]# cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)
3.2 Check the system kernel version
Check system kernel version
[root@jeven ~]# cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)
3.3 Check Docker version
Check Docker version
[root@jeven ~]# docker -v
Docker version 20.10.17, build 100c701
4. Deploy the mysql database
4.1 Create a data directory
Create data directory
mkdir -p /data/yearning/db
4.2 Create mysql database container
Create mysql database container
docker run -d --name my_mysql --privileged=true -v /data/yearning/db:/var/lib/mysql --restart always -e MYSQL_ROOT_PASSWORD=admin -e MYSQL_DATABASE=Yearning -p 3710:3306 mysql:5.7 --character-set-server=utf8mb4 --collation-server=utf8mb4_general_ci
4.3 View the status of the mysql container
View the status of the mysql container
[root@jeven yearning]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b2ed01e1d2db mysql:5.7 "docker-entrypoint.s…" 4 minutes ago Up 4 minutes 33060/tcp, 0.0.0.0:3710->3306/tcp, :::3710->3306/tcp my_mysql
5. Download the Yearning binary package
5.1 Download the Yearning binary package
Download the Yearning binary package
wget https://github.com/cookieY/Yearning/releases/download/v3.1.4/Yearning-v3.1.4-linux-amd64.zip
5.2 Unzip the package
Unzip the package
[root@jeven yearning]# unzip Yearning-v3.1.4-linux-amd64.zip
Archive: Yearning-v3.1.4-linux-amd64.zip
creating: Yearning/
creating: Yearning/docker/
inflating: Yearning/docker/Dockerfile
inflating: Yearning/docker/README.md
inflating: Yearning/docker/docker-compose.yml
inflating: Yearning/.DS_Store
inflating: Yearning/README.md
inflating: Yearning/conf.toml
inflating: Yearning/migrate
inflating: Yearning/Yearning
5.3 View Yearning file
View Yearning Documentation
[root@jeven yearning]# tree -L 2 ./Yearning
./Yearning
├── conf.toml
├── docker
│ ├── docker-compose.yml
│ ├── Dockerfile
│ └── README.md
├── migrate
├── README.md
└── Yearning
1 directory, 7 files
6. Deploy Yearning
6.1 Modify the conf.toml configuration file
Modify the content of conf.toml as follows
[Mysql]
Db = "Yearning"
Host = "192.168.3.166"
Port = "3710"
Password = "admin"
User = "root"
[General]
SecretKey = "dbcjqheupqjsuwsm"
Hours = 4
6.2 Initialization and installation
Initialization and installation
./Yearning install
6.3 Start the service
Start the Yearning service
./Yearning run
6.4 Check the Yearning listening port
Check that Yearning listens on port 8000
[root@jeven ~]# ss -tunlp |grep 8000
tcp LISTEN 0 128 :::8000 :::* users:(("Yearning",pid=79667,fd=8))
7. Visit Yearning
Open the browser http://192.168.3.166:8000, and replace the IP with the IP address of your own server
Default account/password: admin/Yearning_admin