-
Notifications
You must be signed in to change notification settings - Fork 620
Expand file tree
/
Copy pathinstall_mnemosyne.sh
More file actions
executable file
·104 lines (81 loc) · 2.3 KB
/
Copy pathinstall_mnemosyne.sh
File metadata and controls
executable file
·104 lines (81 loc) · 2.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#!/bin/bash
set -e
set -x
SCRIPTS=`dirname "$(readlink -f "$0")"`
MHN_HOME=$SCRIPTS/..
if [ -f /etc/debian_version ]; then
OS=Debian # XXX or Ubuntu??
apt-get update
apt-get install -y git python-pip python-dev supervisor
pip install virtualenv
INSTALLER='apt-get'
REPOPACKAGES=''
PYTHON=`which python`
PIP=`which pip`
$PIP install virtualenv
VIRTUALENV=`which virtualenv`
elif [ -f /etc/redhat-release ]; then
OS=RHEL
export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:$PATH
if [ ! -f /usr/local/bin/python2.7 ]; then
$SCRIPTDIR/install_python2.7.sh
fi
#use python2.7
PYTHON=/usr/local/bin/python2.7
PIP=/usr/local/bin/pip2.7
VIRTUALENV=/usr/local/bin/virtualenv
else
echo -e "ERROR: Unknown OS\nExiting!"
exit -1
fi
if ! [ $REMOTE_MONGO == "true" ]; then
bash $SCRIPTS/install_mongo.sh
fi
mkdir -p /opt
cd /opt/
rm -rf /opt/mnemosyne
git clone https://github.com/threatstream/mnemosyne.git
cd mnemosyne
$VIRTUALENV -p $PYTHON env
. env/bin/activate
pip install -r requirements.txt
chmod 755 -R .
IDENT=mnemosyne
SECRET=`python -c 'import uuid;print str(uuid.uuid4()).replace("-","")'`
CHANNELS='amun.events,conpot.events,thug.events,beeswarm.hive,dionaea.capture,dionaea.connections,thug.files,beeswarn.feeder,cuckoo.analysis,kippo.sessions,cowrie.sessions,glastopf.events,glastopf.files,mwbinary.dionaea.sensorunique,snort.alerts,wordpot.events,p0f.events,suricata.events,shockpot.events,elastichoney.events'
cat > /opt/mnemosyne/mnemosyne.cfg <<EOF
[webapi]
host = 0.0.0.0
port = 8181
[mongodb]
database = mnemosyne
[hpfriends]
host = localhost
port = 10000
ident = $IDENT
secret = $SECRET
channels = $CHANNELS
[file_log]
enabled = True
file = /var/log/mhn/mnemosyne.log
[loggly_log]
enabled = False
token =
[normalizer]
ignore_rfc1918 = False
EOF
deactivate
. /opt/hpfeeds/env/bin/activate
python /opt/hpfeeds/broker/add_user.py "$IDENT" "$SECRET" "" "$CHANNELS"
mkdir -p /var/log/mhn/
cat >> /etc/supervisor/conf.d/mnemosyne.conf <<EOF
[program:mnemosyne]
command=/opt/mnemosyne/env/bin/python runner.py --config mnemosyne.cfg
directory=/opt/mnemosyne
stdout_logfile=/var/log/mhn/mnemosyne.out
stderr_logfile=/var/log/mhn/mnemosyne.err
autostart=true
autorestart=true
startsecs=10
EOF
supervisorctl update