SySeVR环境配置和可能的问题
SySeVR环境配置
文章目录
- SySeVR环境配置
- 0. docker
- 1. apt及一些依赖包
- 2. python/pip
- 3. 相关源码拉取, 项目组织
- 4. joern/neo4j
- 5. pip
- 6. 验证
- 7. 启动ssh(可选)
顺着输就行了
注意ubuntu22.04及以上不再支持python2, 可以装ubuntu20.04
uname -m
x86-64对应amd64
0. docker
docker run --name wh_kvmodel_slice -it -p 1022:22 -p 1888:8888 -p 1474:7474 -p 1687:7687 -v wh_kvmodel:/home --gpus all --workdir /home -d --ipc=host ubuntu:20.04 tail -f /dev/null
docker exec -it wh_kvmodel_slice bash
配置详情
- host-port–1888: jupyter
- host-port–1474: neo4j-console
- host-port–1687: neo4j
- host-port–1022: ssh
- work_dir: /home -> /home/nfs/docker/volumes/wh_kvmodel/_data
1. apt及一些依赖包
apt update
apt install openssh-server git vim graphviz libgraphviz-dev graphviz-dev pkg-config unzip p7zip-full #openjdk-8-jdk
apt update报错说明源有问题看下apt源怎么配, 没配好不要进入下面的步骤
2. python/pip
apt install python-dev python-setuptools
apt install python2
wget https://bootstrap.pypa.io/pip/2.7/get-pip.py
python2 get-pip.py
apt install python3 python3-pip
python2 -m pip install pip --upgrade
python3 -m pip install pip --upgrade
3. 相关源码拉取, 项目组织
cd /home
git clone https://github.com/SySeVR/SySeVR.git
git clone https://github.com/ZigZagframework/zigzag_framework.git
git clone https://github.com/speeDy167/SySeVRs_NT521.O11.ANTN.git
cp -r SySeVRs_NT521.O11.ANTN/Tools SySeVR/Tools
rm -r SySeVR/Tools/joern-0.3.1
cp -r zigzag_framework/ZigZag/SySeVR/joern-0.3.1 SySeVR/Tools/joern-0.3.1
cp -r /home/SySeVR/SySeVR_docker/docker_build/home/SySeVR/softdir/jdk1.8.0_161 SySeVR/Tools/jdk1.8.0_161
4. joern/neo4j
vim ~/.bashrc
=========把这些输到~/.bashrc里===============
alias vb="vim ~/.bashrc"
alias s="source ~/.bashrc"
export SHOME=/home/SySeVR
export SDEP=/home/SySeVR/Tools
export JHOME=$SDEP/joern-0.3.1
export NHOME=$SDEP/neo4j
export AHOME=$SDEP/apache-ant-1.9.14
export JAVA_HOME=$SDEP/jdk1.8.0_161
export JAVAB=$JAVA_HOME/bin
export JB=$JHOME/bin
export NB=$NHOME/bin
export AB=$AHOME/bin
export PATH=$PATH:$AB:$JB:$NB:$JAVAB
alias joern='java -jar $JB/joern.jar'
chmod 777 $JB/*
chmod 777 $AB/*
chmod 777 $NB/*
chmod 777 $JAVAB/*
==========================================
source ~/.bashrc
cd $JHOME && ant
5. pip
python2 $SDEP/py2neo-py2neo-2.0/setup.py install
python2 $SDEP/python-joern-0.3.1/setup.py install
python2 -m pip install python-igraph==0.8.3
python3 -m pip install xlrd gensim==3.8.3 imbalanced-learn==0.4.0 scikit-learn==1.3.2 tensorflow==2.8.0 keras==2.8.0
所有在pip install过程中编译相关的问题基本上是和pip版本有关, 可以尝试更新pippython2 -m pip install pip --upgrade && python3 -m pip install pip --upgrade
, 或者报错中提示的依赖(不推荐)
6. 验证
joern
java -version
neo4j
7. 启动ssh(可选)
mkdir ~/.ssh && vim ~/.ssh/authorized_keys # 把公钥输进去
vim /etc/ssh/sshd_config
========================================
# Package generated configuration file
# See the sshd_config(5) manpage for details
# What ports, IPs and protocols we listen for
Port 22
# Use these options to restrict which interfaces/protocols sshd will bind to
#ListenAddress ::
#ListenAddress 0.0.0.0
Protocol 2
# HostKeys for protocol version 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
HostKey /etc/ssh/ssh_host_ed25519_key
#Privilege Separation is turned on for security
UsePrivilegeSeparation yes
# Lifetime and size of ephemeral version 1 server key
KeyRegenerationInterval 3600
ServerKeyBits 1024
# Logging
SyslogFacility AUTH
LogLevel INFO
# Authentication:
LoginGraceTime 120
PermitRootLogin prohibit-password
StrictModes yes
RSAAuthentication yes
PubkeyAuthentication yes
#AuthorizedKeysFile %h/.ssh/authorized_keys
# Don't read the user's ~/.rhosts and ~/.shosts files
IgnoreRhosts yes
# For this to work you will also need host keys in /etc/ssh_known_hosts
RhostsRSAAuthentication no
# similar for protocol version 2
HostbasedAuthentication no
# Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication
#IgnoreUserKnownHosts yes
# To enable empty passwords, change to yes (NOT RECOMMENDED)
PermitEmptyPasswords no
# Change to yes to enable challenge-response passwords (beware issues with
# some PAM modules and threads)
ChallengeResponseAuthentication no
# Change to no to disable tunnelled clear text passwords
#PasswordAuthentication yes
# Kerberos options
#KerberosAuthentication no
#KerberosGetAFSToken no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes
X11Forwarding yes
X11DisplayOffset 10
PrintMotd no
PrintLastLog yes
TCPKeepAlive yes
#UseLogin no
#MaxStartups 10:30:60
#Banner /etc/issue.net
# Allow client to pass locale environment variables
AcceptEnv LANG LC_*
Subsystem sftp /usr/lib/openssh/sftp-server
# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication. Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
UsePAM yes
=============================================
passwd
service ssh start
ps -e | grep ssh