How to realize docker Yearning+Inception SQL auditing platform
This article introduces the relevant knowledge of "how to implement the docker Yearning+Inception SQL audit platform". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
[1] installation
[1.1] system environment
System environment: CentOS Linux release 7.6.1708 (Core)
System memory: 4G
System kernel: 1
Python:3.6.4
Close iptables and selinux
This installation uses external MySQL 5.7,
[1.2] close iptables
[root@localhost ~] # systemctl stop firewalld.service// turn off iptables
[root@localhost ~] # systemctl disable firewalld.service// boot forbids starting iptables
[1.3] disable selinux and install Python
[root@localhost ~] # vim / etc/sysconfig/selinux
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing-SELinux security policy is enforced.
# permissive-SELinux prints warnings instead of enforcing.
# disabled-No SELinux policy is loaded.
Change SELINUX=disabled// to disabled
# SELINUXTYPE= can take one of three two values:
# targeted-Targeted processes are protected
# minimum-Modification of targeted policy. Only selected processes are protected.
# mls-Multi Level Security protection.
SELINUXTYPE=targeted
[1.3.1] Python installation
[root@localhost ~] # cd / root/software
[root@localhost software] # yum-y install zlib-*
[root@localhost software] # wget https://www.python.org/ftp/python/3.6.4/Python-3.6.4.tgz
[root@localhost software] # tar-zxvf Python-3.6.4.tgz
[root@localhost software] # mkdir-p / usr/local/python3
[root@localhost software] # cd Python-3.6.4/
[root@localhost Python-3.6.4] #. / configure-prefix=/usr/local/python3
[root@localhost Python-3.6.4] # make
[root@localhost Python-3.6.4] # make install
[root@localhost Python-3.6.4] # mv / usr/bin/python / usr/bin/python_bak// modifies the old version
[root@localhost Python-3.6.4] # ln-s / usr/local/python3/bin/python3 / usr/bin/python// create a new soft connection
[root@localhost Python-3.6.4] # python-Vamp / check the version of python
Python 3.6.4
[root@localhost Python-3.6.4] # vim ~ / .bash_profile// is configured successfully, pip3 is not available. Further configuration is needed to add / usr/local/python3/bin to PATH.
# .bash _ profile
# Get the aliases and functions
If [- f ~ / .bashrc]; then
. ~ / .bashrc
Fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin:/usr/local/python3/bin
Export PATH
[root@localhost Python-3.6.4] # source ~ / .bash_profile// let the environment variable take effect
[1.3.2] configure the yum source or yum is not available
[root@localhost Python-3.6.4] # yum-y update// obviously the above except is written in python2, and of course it cannot be executed using the default Python3. So replace #! / usr/bin/python in line 1 of this file with #! / usr/bin/python2.7
File "/ usr/bin/yum", line 30
Except KeyboardInterrupt, e: ^
SyntaxError: invalid syntax
[root@localhost Python-3.6.4] # vim / usr/bin/yum
So replace #! / usr/bin/python in line 1 of this file with #! / usr/bin/python2.7
[1.4] install MySQL
[root@localhost ~] # cd / etc/yum.repos.d/
[root@localhost yum.repos.d] # vim mysql.repos
[mysql5.7-community]
Name=MySQL 5.7 Community Server
Baseurl= http://repo.mysql.com/yum/mysql-5.7-community/el/7/$basearch/
Enabled=1
Gpgcheck=0
[root@localhost yum.repos.d] # yum-y install mysql-*// waits for installation to complete
[1.5] start MySQL service and set boot up
[root@localhost yum.repos.d] # systemctl start mysqld
[root@localhost yum.repos.d] # systemctl enable mysqld
[root@localhost yum.repos.d] # systemctl daemon-reload
[1.6] View the initial password of mysql
[root@localhost yum.repos.d] # grep 'temporary password' / var/log/mysqld.log
2019-06-25T03:27:20.334210Z 1 [Note] A temporary password is generated for root@localhost: GIutnKkR%7fe
[1.7] Log into the mysql environment to configure and modify parameters
[root@localhost yum.repos.d] # mysql-uroot-pGIutnKkR%7fe / / enter to the database
Mysql > set global validate_password_policy=0
Mysql > set global validate_password_length=1
Mysql > set global validate_password_mixed_case_count=2
Mysql > show variables like 'validate_password%'
+-+ +
| | Variable_name | Value |
+-+ +
| | validate_password_check_user_name | OFF |
| | validate_password_dictionary_file |
| | validate_password_length | 6 | |
| | validate_password_mixed_case_count | 2 | |
| | validate_password_number_count | 1 | |
| | validate_password_policy | LOW |
| | validate_password_special_char_count | 1 | |
+-+ +
7 rows in set (0.02 sec)
Mysql > alter user 'root'@'localhost' identified by' 123456'
Mysql > flush privileges
Mysql > quit
Create a Yearning database with users and passwords and authorize
[root@localhost yum.repos.d] # mysql-uroot-p123456
Mysql > create database Yearning charset utf8;// create Yearning library
Mysql > create user 'Yearning'@'%' identified by' Yearning';// to create Yearning users
Mysql > grant all on *. * to 'Yearning'@'%' identified by' Yearning'; / / authorize Yearning user rights
Mysql > flush privileges
Mysql > quit
[1.9] install docker
[root@localhost ~] # yum install-y yum-utils device-mapper-persistent-data lvm2// installs docker's dependency package
[1.9.1] set yum source
[root@localhost ~] # yum-config-manager-- add-repo https://download.docker.com/linux/centos/docker-ce.repo
[1.9.2] you can view all docker versions in all repositories and select a specific version to install
[root@localhost ~] # yum list docker-ce-- showduplicates | sort-r
Loaded plug-ins: fastestmirror, langpacks
Installed software packages
Installable software package
* updates: ap.stykers.moe
Loading mirror speeds from cached hostfile
* extras: ftp.sjtu.edu.cn
Docker-ce.x86_64 3Rank 18.09.6-3.el7 docker-ce-stable
Docker-ce.x86_64 3rig 18.09.6-3.el7 @ docker-ce-stable
Docker-ce.x86_64 3Rank 18.09.5-3.el7 docker-ce-stable
Docker-ce.x86_64 3Rank 18.09.4-3.el7 docker-ce-stable
Docker-ce.x86_64 3Rank 18.09.3-3.el7 docker-ce-stable
Docker-ce.x86_64 3Rank 18.09.2-3.el7 docker-ce-stable
Docker-ce.x86_64 3Rank 18.09.1-3.el7 docker-ce-stable
Docker-ce.x86_64 3Rank 18.09.0-3.el7 docker-ce-stable
Docker-ce.x86_64 18.06.3.ce-3.el7 docker-ce-stable
Docker-ce.x86_64 18.06.2.ce-3.el7 docker-ce-stable
Docker-ce.x86_64 18.06.1.ce-3.el7 docker-ce-stable
Docker-ce.x86_64 18.06.0.ce-3.el7 docker-ce-stable
Docker-ce.x86_64 18.03.1.ce-1.el7.centos docker-ce-stable
Docker-ce.x86_64 18.03.0.ce-1.el7.centos docker-ce-stable
Docker-ce.x86_64 17.12.1.ce-1.el7.centos docker-ce-stable
Docker-ce.x86_64 17.12.0.ce-1.el7.centos docker-ce-stable
Docker-ce.x86_64 17.09.1.ce-1.el7.centos docker-ce-stable
Docker-ce.x86_64 17.09.0.ce-1.el7.centos docker-ce-stable
Docker-ce.x86_64 17.06.2.ce-1.el7.centos docker-ce-stable
Docker-ce.x86_64 17.06.1.ce-1.el7.centos docker-ce-stable
Docker-ce.x86_64 17.06.0.ce-1.el7.centos docker-ce-stable
Docker-ce.x86_64 17.03.3.ce-1.el7 docker-ce-stable
Docker-ce.x86_64 17.03.2.ce-1.el7.centos docker-ce-stable
Docker-ce.x86_64 17.03.1.ce-1.el7.centos docker-ce-stable
Docker-ce.x86_64 17.03.0.ce-1.el7.centos docker-ce-stable
* base: ap.stykers.moe
[1.9.3] install docker and select the corresponding version
[root@localhost ~] # yum install docker-ce # since only stable repository is enabled by default in repo, the latest stable version of 18.03.1.ce is installed here.
[root@localhost ~] # yum install # for example: yum install docker-ce-18.03.1.ce
[root@localhost ~] # yum install-y docker-ce-18.03.1.ce// waits for installation to complete
[1.9.4] start and join boot boot
[root@localhost ~] # systemctl start docker
[root@localhost ~] # systemctl enable docker
[1.9.5] verify whether the installation is successful (both client and service indicate that the docker installation starts successfully)
[root@localhost ~] # docker version
Client:
Version: 18.09.6
API version: 1.39
Go version: go1.10.8
Git commit: 481bc77156
Built: Sat May 4 02:34:58 2019
OS/Arch: linux/amd64
Experimental: false
Server: Docker Engine-Community
Engine:
Version: 18.09.6
API version: 1.39 (minimum version 1.12)
Go version: go1.10.8
Git commit: 481bc77
Built: Sat May 4 02:02:43 2019
OS/Arch: linux/amd64
Experimental: false
[II] installation of Inception and Yearning
Download Yearning source code
[root@localhost] # mkdir-p / root/software
[root@localhost ~] # cd / root/software
[root@localhost software] # git clone https://github.com/cookieY/Yearning.git// get git Yearning source code
[root@localhost software] # cd Yearning/install/yearning-docker-compose/init-sql// go under the environment variable
[root@localhost init-sql] # mysql-uYearning-pYearning Yearning < install.sql// import environment variables into the database
[root@localhost ~] # cd / root/software/Yearning/install/// cd to the environment directory to extract the inception.tar package
[root@localhost install] # tar-xvf inception.tar
[root@localhost install] # cd inception/bin/
[root@localhost bin] # mkdir-p / var/log/inception/// create inception log directory
[root@localhost bin] # mkdir-p / var/run/inception/// create an inception.socket directory
[root@localhost bin] # vim inc.cnf// modify inception configuration file
[inception]
General_log=1
General_log_file=/var/log/inception/inception.log// inception log directory
Port=6669
Socket=/var/run/inception/inc.socket// inception.socket storage directory
Character-set-client-handshake=0
Character-set-server=utf8
Inception_support_charset=utf8mb4
Inception_enable_nullable=0
Inception_check_primary_key=1
Inception_check_column_comment=1
Inception_check_table_comment=1
Inception_enable_blob_type=1
Inception_check_column_default_value=1
Inception_support_charset=utf8
Inception_osc_on=OFF
Inception_check_column_default_value=OFF
Inception_check_column_comment=OFF
Inception_check_table_comment=OFF
Inception_enable_identifer_keyword=ON
Inception_remote_backup_host = 192.168.1.150max / IP of the backup database
Inception_remote_backup_port = 3306 / database default port
Inception_remote_system_user = the authorized user of the root// database _ can be defined according to yourself
Inception_remote_system_password = 123456 / database user password
[2.2] start the inception service
[root@localhost bin] # pwd
/ root/software/Yearning/install/inception/bin
[root@localhost bin] # nohup bin/Inception-- defaults-file=inc.cnf & / / background scheduling enabled
Run Yearning [Note: the parameters after HOST= native IP and MYSQL_ADDR= native IP do not need to be selected as long as you follow this document. By default, just follow mine.]
[root@localhost bin] # docker run-d-e HOST=192.168.1.150-e MYSQL_ADDR=192.168.1.150-e MYSQL_USER=Yearning-e MYSQL_PASSWORD=Yearning-p8080 MYSQL_USER=Yearning 80-p8000 MYSQL_ADDR=192.168.1.150 8000 registry.cn-hangzhou.aliyuncs.com/cookie/yearning:v1.3.0
[3] related configuration
[3.1] visit Yearning
Visit Yearning (access address is the IP address where you started docker)
Default value for login administrator: admin / Yearning_admin
This is the end of the content of "how to implement the docker Yearning+Inception SQL Audit platform". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!