Skip to content

Commit c6bd724

Browse files
authored
Merge pull request #633 from yeti-platform/1.6
1.6
2 parents 62e3fa3 + 02a0142 commit c6bd724

23 files changed

+422
-621
lines changed

.gitignore

+8
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,11 @@ node_modules
6262
# Vagrant
6363
.vagrant/
6464
vagrant
65+
66+
#IDE
67+
.idea
68+
69+
#Patch
70+
*.patch
71+
#venv
72+
venv

Pipfile.lock

+298-277
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/web/api/templates/observable_api.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<td class="icon-cell"><a href="{{ url_for('frontend.InvestigationView:graph_node', id=observable['id'], klass='observable')}}"><i class="flaticon-network38"></i></a></td>
2020
<td><a href="{{ url_for('frontend.ObservableView:get', id=observable['id'])}}">{{observable['value']}}</a></td>
2121
<td>{{macros.display_tags(observable['tags'])}}</td>
22-
<td>{{ observable['context']|join(', ', attribute='source')}}</td>
22+
<td>{{ observable['context']|unique(attribute='source')|join(', ', attribute='source')}}</td>
2323
<td>{{macros.display_datetime(observable['created'])}}</td>
2424
<td>{{ observable['sources']|join(', ')}}</td>
2525
</tr>

core/web/frontend/templates/macros/malware.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<td>{{link.description}}</td>
1111
<td>{{ node.family.name }}</td>
1212
<td>{{ macros.display_tags(node.aliases)}}</td>
13-
<td>{{node.context|join(', ', attribute='source')}}</td>
13+
<td>{{node.context|unique(attribute='source')|join(', ', attribute='source')}}</td>
1414
</tr>
1515
{% endfor %}
1616
{%endfor%}

core/web/frontend/templates/observable/search_results.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ <h1 class="panel-title">Observables present in database</h1>
3232
<table class="table table-condensed">
3333
<tr><th>Value</th><th>Tags</th><th>Context</th><th>Creation date</th></tr>
3434
{% for obs in data['known']%}
35-
<tr><td><a href="{{url_for("frontend.ObservableView:get", id=obs["id"])}}">{{obs['value']}}</a></td><td>{{macros.display_tags(obs['tags'])}}</td><td>{{obs['context']|join(', ', attribute='source')}}</td><td>{{macros.display_datetime(obs['created'])}}</td></tr>
35+
<tr><td><a href="{{url_for("frontend.ObservableView:get", id=obs["id"])}}">{{obs['value']}}</a></td><td>{{macros.display_tags(obs['tags'])}}</td><td>{{obs['context']|unique(attribute='source')|join(', ', attribute='source')}}</td><td>{{macros.display_datetime(obs['created'])}}</td></tr>
3636
{% endfor %}
3737
</table>
3838
{% endif %}
@@ -41,7 +41,7 @@ <h5>Interesting neighbors</h5>
4141
<table class="table table-condensed">
4242
<tr><th>Value</th><th>Tags</th><th>Context</th><th>Creation date</th></tr>
4343
{% for link, obs in data["neighbors"]%}
44-
<tr><td><a href="{{url_for("frontend.ObservableView:get", id=obs["id"])}}">{{obs["value"]}}</a> <span class="small">({% if obs["value"] == link["dst"]%}{{link["src"]}}{%else%}{{link["dst"]}}{%endif%}{%if link["description"]%} - {{link["description"]}}{%endif%})</span></td><td>{{macros.display_tags(obs["tags"])}}</td><td>{{obs["context"]|join(", ", attribute="source")}}</td><td>{{macros.display_datetime(obs["created"])}}</td></tr>
44+
<tr><td><a href="{{url_for("frontend.ObservableView:get", id=obs["id"])}}">{{obs["value"]}}</a> <span class="small">({% if obs["value"] == link["dst"]%}{{link["src"]}}{%else%}{{link["dst"]}}{%endif%}{%if link["description"]%} - {{link["description"]}}{%endif%})</span></td><td>{{macros.display_tags(obs["tags"])}}</td><td>{{obs["context"]|unique(attribute="source")|join(", ", attribute="source")}}</td><td>{{macros.display_datetime(obs["created"])}}</td></tr>
4545
{% endfor %}
4646
</table>
4747
{% endif %}

core/web/frontend/templates/observable/single.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ <h3 class="panel-title" id="yeti-node-name" data-id="{{observable.id}}" data-cla
7979
<td><a href="{{ url_for("frontend.ObservableView:get", id=node.id) }}">{{node.value}}</a></td>
8080
<td>{{link.description}}</td>
8181
<td>{{ macros.display_tags(node.tags)}}</td>
82-
<td>{{node.context|join(', ', attribute='source')}}</td>
82+
<td>{{node.context|unique(attribute='source')|join(', ', attribute='source')}}</td>
8383
</tr>
8484
{% endfor %}
8585
{%endfor%}

doc/installation.rst

+65-14
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,49 @@ Installation
55

66
Installing Yeti is pretty straightforward. This procedure was tested on Ubuntu 18.04, but YMMV.
77

8-
Install dependencies::
8+
Install the dependencies needed to add new repositories::
99

10-
$ sudo apt-get install build-essential git python-dev mongodb redis-server libxml2-dev libxslt-dev zlib1g-dev python-virtualenv wkhtmltopdf
10+
$ sudo apt update && sudo apt install dirmngr gnupg wget curl apt-transport-https
1111

1212
Install Yarn::
1313

1414
$ curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
1515
$ echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
16-
$ sudo apt-get update && sudo apt-get install yarn
16+
$ sudo apt update && sudo apt install yarn
17+
18+
Install mongodb-org::
19+
20+
$ wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add -
21+
$ echo "deb https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list
22+
$ sudo apt update
1723

18-
Download Yeti:
24+
Install dependencies::
1925

26+
$ sudo apt install build-essential git python-dev mongodb-org mongodb-org-shell mongodb-org-server mongodb-org-mongos redis-server libcurl4 libxml2-dev libxslt-dev zlib1g-dev python-virtualenv wkhtmltopdf python-pip python3-pip
27+
28+
Return at home and download Yeti:
29+
30+
$ cd
2031
$ git clone https://github.com/yeti-platform/yeti.git
2132

2233
Activate virtualenv if you want to, then install requirements::
2334

2435
$ cd yeti
25-
$ [sudo] pip install -r requirements.txt
36+
$ sudo -H pip3 install -r requirements.txt
2637
$ yarn install
2738

28-
Create the logging directory::
39+
Create user and the logging directory::
40+
41+
$ sudo useradd -r -M -d /opt/yeti -s /usr/sbin/nologin yeti
42+
$ sudo mkdir /var/log/yeti
43+
$ sudo chown yeti /var/log/yeti
44+
45+
Copy yeti on /opt filesystem, and configure::
2946

30-
$ [sudo] mkdir /var/log/yeti
31-
$ [sudo] chown <user> /var/log/yeti
47+
$ cd
48+
$ sudo mv yeti /opt
49+
$ sudo chown -R yeti:yeti /opt/yeti
50+
$ sudo chmod +x /opt/yeti/yeti.py
3251

3352
Quick & dirty
3453
-------------
@@ -45,7 +64,7 @@ This will only enable the web interface - if you want to use Feeds and Analytics
4564
$ celery -A core.config.celeryctl.celery_app worker --loglevel=ERROR -Q oneshot -n oneshot -c 2 --purge
4665
$ celery -A core.config.celeryctl beat -S core.scheduling.Scheduler --loglevel=ERROR
4766

48-
Or, to bootstrap a production use instance of Yeti on Ubuntu 16.04 (without the Redis tweaks), everyone's favorite command::
67+
Or, to bootstrap a production use instance of Yeti on Ubuntu 18.04 (without the Redis tweaks), everyone's favorite command::
4968

5069
$ curl https://raw.githubusercontent.com/yeti-platform/yeti/master/extras/ubuntu_bootstrap.sh | sudo /bin/bash
5170

@@ -61,7 +80,7 @@ For production use, it may be better to daemonize Yeti and tweak redis for perfo
6180

6281
Install ``nginx`` and ``uwsgi``::
6382

64-
$ sudo apt-get install nginx uwsgi
83+
$ sudo apt install nginx uwsgi uwsgi-plugin-python3
6584

6685
Optimize redis
6786
^^^^^^^^^^^^^^
@@ -84,7 +103,7 @@ Add the following lines in ``/etc/rc.local``::
84103
Install systemd services
85104
^^^^^^^^^^^^^^^^^^^^^^^^
86105

87-
Copy all files in ``extras/systemd/*`` to ``/lib/systemd/system/``. If you'd
106+
Copy all files in ``extras/systemd/*`` to ``/etc/systemd/system/``. If you'd
88107
rather have the web content served through nginx (recommended for production),
89108
copy ``yeti_uwsgi.service``, otherwise you'll be fine with ``yeti_web.service``.
90109

@@ -98,20 +117,52 @@ And start with::
98117

99118
systemd protips::
100119

101-
$ sudo service yeti_web start|stop|restart
120+
$ sudo service yeti_uwsgi start|stop|restart
102121
or
103122
$ sudo systemctl start|status|stop yeti_web
104123

105124
To enable the systemd scripts once you've installed them::
106125

107-
sudo systemctl enable yeti_web
126+
sudo systemctl enable yeti_uwsgi
127+
128+
For install yeti with development webserver::
129+
$ sudo systemctl enable mongod.service
130+
$ sudo systemctl enable yeti_web.service
131+
$ sudo systemctl enable yeti_oneshot.service
132+
$ sudo systemctl enable yeti_feeds.service
133+
$ sudo systemctl enable yeti_exports.service
134+
$ sudo systemctl enable yeti_analytics.service
135+
$ sudo systemctl enable yeti_beat.service
136+
$ sudo systemctl start mongod.service
137+
$ sudo systemctl start yeti_web.service
138+
$ sudo systemctl start yeti_oneshot.service
139+
$ sudo systemctl start yeti_feeds.service
140+
$ sudo systemctl start yeti_exports.service
141+
$ sudo systemctl start yeti_analytics.service
142+
$ sudo systemctl start yeti_beat.service
143+
144+
For install yeti with nginx reverse proxy::
145+
$ sudo systemctl enable mongod.service
146+
$ sudo systemctl enable yeti_uwsgi.service
147+
$ sudo systemctl enable yeti_oneshot.service
148+
$ sudo systemctl enable yeti_feeds.service
149+
$ sudo systemctl enable yeti_exports.service
150+
$ sudo systemctl enable yeti_analytics.service
151+
$ sudo systemctl enable yeti_beat.service
152+
$ sudo systemctl start mongod.service
153+
$ sudo systemctl start yeti_uwsgi.service
154+
$ sudo systemctl start yeti_oneshot.service
155+
$ sudo systemctl start yeti_feeds.service
156+
$ sudo systemctl start yeti_exports.service
157+
$ sudo systemctl start yeti_analytics.service
158+
$ sudo systemctl start yeti_beat.service
108159

109160
If you're running nginx, add the following configuration to one of the nginx
110161
server directives::
111162

112163
server {
113164
listen 80;
114-
server_name yeti;
165+
server_name yeti.domain.lan;
115166

116167
location / {
117168
include uwsgi_params;

extras/docker/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,6 @@ This will start a Yeti service running on <http://localhost:5000/>
4343

4444
To start a more performant container for web requests, run:
4545

46-
docker-compose -p yeti -f extras/docker/dev/docker-compose.yml run -p 8080:8080 yeti /docker-entrypoint.sh uwsgi-http
46+
docker-compose -p yeti -f extras/docker/dev/docker-compose.yaml run -p 8080:8080 yeti /docker-entrypoint.sh uwsgi-http
4747

4848
Then point your browser to <http://localhost:8080.>

extras/systemd/yeti_uwsgi.service

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ After=mongodb.service redis.service
66
Type=simple
77
User=yeti
88
WorkingDirectory=/opt/yeti
9-
ExecStart=/usr/local/bin/uwsgi --socket 127.0.0.1:8000 -w yeti --callable webapp --processes 4 --threads 2 --stats 127.0.0.1:9191
9+
ExecStart=/usr/bin/uwsgi --plugin python3 --socket 127.0.0.1:8000 -w yeti --callable webapp --processes 4 --threads 2 --stats 127.0.0.1:9191
1010
Restart=always
1111
KillSignal=SIGQUIT
1212
Type=notify

extras/ubuntu_bootstrap.sh

+19-24
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
1-
# Install dependencies
2-
export LC_ALL="en_US.UTF-8"
1+
#!/bin/bash
2+
3+
set -e
4+
5+
#Check execution with root
6+
7+
if [[ "$EUID" -ne "0" ]]; then
8+
echo "Run this script as root"
9+
fi
310

411
if [ -f "/usr/bin/apt" ]; then
512
APT="/usr/bin/apt"
@@ -8,43 +15,33 @@ else
815
fi
916

1017
$APT update -y
11-
$APT install dirmngr
18+
$APT install -y dirmngr gnupg apt-transport-https curl wget
1219

1320
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
1421
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
1522

16-
# https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/
17-
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 9DA31620334BD75D9DCB49F368818C72E52529D4
18-
19-
# https://wiki.ubuntu.com/Releases
20-
OS_CODENAME=`lsb_release -c --short`
21-
22-
if [ $OS_CODENAME == "bionic" ] || [ $OS_CODENAME == "artful" ] || [ $OS_CODENAME == "zesty" ] || [ $OS_CODENAME == "yakkety" ] || [ $OS_CODENAME == "xenial" ]; then
23-
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.0 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-4.0.list
24-
elif [ $OS_CODENAME == "wily" ] || [ $OS_CODENAME == "vivid" ] || [ $OS_CODENAME == "utopic" ] || [ $OS_CODENAME == "trusty" ]; then
25-
echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/4.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.0.list
26-
else
27-
echo "[!] Installing on an unsupported or outdated version of Ubuntu, trying Trusty package for Mongo"
28-
echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/4.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.0.list
29-
fi
23+
wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | apt-key add -
24+
echo "deb https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.4 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-4.4.list
3025

3126
$APT update -y
32-
$APT install build-essential git python-dev mongodb-org redis-server libcurl3 libxml2-dev libxslt-dev zlib1g-dev python-virtualenv python-pip nginx yarn -y
27+
$APT install -y build-essential git python-dev mongodb-org mongodb-org-server mongodb-org-mongos mongodb-org-shell redis-server libcurl4 libxml2-dev libxslt-dev zlib1g-dev python-virtualenv python-pip python3-pip nginx yarn uwsgi-plugin-python3
3328

3429
# Clone project
3530
cd /opt
3631
git clone https://github.com/yeti-platform/yeti.git
3732

3833
# Install requirements
3934
cd /opt/yeti
40-
pip install -r requirements.txt
41-
pip install uwsgi
35+
pip3 install -r requirements.txt
36+
pip3 install uwsgi
4237
yarn install
4338

4439
# Configure services
45-
useradd yeti
40+
useradd -r -M -d /opt/yeti -s /usr/sbin/nologin yeti
4641
sudo mkdir /var/log/yeti
4742
sudo chown yeti /var/log/yeti
43+
chown -R yeti:yeti /opt/yeti
44+
chmod +x /opt/yeti/yeti.py
4845
cp extras/systemd/*.service /etc/systemd/system/
4946
systemctl enable mongod.service
5047
systemctl enable yeti_uwsgi.service
@@ -54,14 +51,12 @@ systemctl enable yeti_exports.service
5451
systemctl enable yeti_analytics.service
5552
systemctl enable yeti_beat.service
5653
systemctl daemon-reload
57-
chown -R yeti:yeti /opt/yeti
58-
chmod +x /opt/yeti/yeti.py
5954

6055
# Configure nginx
6156
rm /etc/nginx/sites-enabled/default
6257
cp extras/nginx/yeti /etc/nginx/sites-available/
6358
ln -s /etc/nginx/sites-available/yeti /etc/nginx/sites-enabled/yeti
64-
service nginx restart
59+
systemctl reload nginx
6560

6661
# Start services
6762
echo "[+] Starting services..."

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"bootstrap-tokenfield": "^0.12.0",
88
"font-awesome": "^4.7.0",
99
"front-markjs": "^8.9.1-1",
10-
"handlebars": "^4.3.0",
10+
"handlebars": "^4.5.3",
1111
"highlight.js": "^9.11.0",
1212
"inline-attachment": "^2.0.3",
1313
"jquery": "^3.5.0",

plugins/feeds/public/alienvault_ip_reputation.py

+2
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ def analyze(self, item):
5151

5252
context["country"] = country
5353
context["threat"] = category
54+
context["reliability"] = item["number_1"]
55+
context["risk"] = item["number_2"]
5456

5557
ip.tag(category)
5658
ip.add_context(context)

plugins/feeds/public/feodo_tracker_binaries.py

-44
This file was deleted.

plugins/feeds/public/hostsfile_emd.py

-37
This file was deleted.

0 commit comments

Comments
 (0)