Skip to content

Commit 6f44531

Browse files
authored
Merge pull request #1092 from unfetter-discover/v0.3.7
V0.3.7
2 parents 59fba55 + ca9617c commit 6f44531

File tree

160 files changed

+147605
-1911
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

160 files changed

+147605
-1911
lines changed

.gitignore

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ certs/
22
.idea/
33
*.iml
44
gateway/dist
5-
5+
test-certs/output/*
6+
!test-certs/output/.gitkeep
67
# keep the data/db folder but not the files
78
data/db/*
89
# need at least one file in the folder
9-
!data/db/.gitkeep
10+
!data/db/.gitkeep

ansible/.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
virtualenv
2+
data
3+
*.retry
4+

ansible/ansible.cfg

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[defaults]
2+
hostfile = hosts
+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
- hosts: localhost
3+
vars:
4+
tag: "0.3.6"
5+
prepath: "../../"
6+
7+
# For building from local source
8+
build_action: "local"
9+
registry: ""
10+
run_mode: "dev"
11+
12+
# for running in UAC mode
13+
run_action: true
14+
use_unfetter_ui: true
15+
use_uac: true
16+
use_taxii: true
17+
use_taxii_tls: false
18+
19+
tasks:
20+
- import_tasks: discover-tasks.yml

ansible/discover-build-repository.yml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
- hosts: localhost
3+
vars:
4+
tag: "0.3.6"
5+
prepath: "../../"
6+
7+
# For building from a repository
8+
build_action: "pull"
9+
registry: "unfetter/"
10+
run_mode: "production"
11+
12+
# For running in demo mode
13+
use_unfetter_ui: false
14+
run_action: false
15+
use_uac: false
16+
use_taxii: false
17+
use_taxii_tls: false
18+
#prepath: "../../"
19+
#build_action: "local"
20+
#build_action: ""
21+
#run_action: ""
22+
#registry: ""
23+
24+
tasks:
25+
- import_tasks: discover-tasks.yml

ansible/discover-run-dev.yml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
- hosts: localhost
3+
vars:
4+
tag: "0.3.6"
5+
prepath: "../../"
6+
#build_action: "local"
7+
#build_action: "pull"
8+
build_action: "local"
9+
#run_action: "demo"
10+
run_action: true
11+
use_unfetter_ui: true
12+
use_uac: true
13+
use_taxii: false
14+
use_taxii_tls: false
15+
run_mode: "dev"
16+
#run_mode: prod
17+
#registry: "unfetter/"
18+
registry: ""
19+
20+
tasks:
21+
- import_tasks: discover-tasks.yml

ansible/discover-run-prod.yml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
- hosts: localhost
3+
vars:
4+
tag: "0.3.6"
5+
prepath: "../../"
6+
# For building from a repository
7+
build_action: "pull"
8+
registry: "unfetter/"
9+
run_mode: "production"
10+
# For running in demo mode
11+
use_unfetter_ui: false
12+
run_action: true
13+
use_uac: false
14+
use_taxii: false
15+
use_taxii_tls: false
16+
17+
tasks:
18+
- import_tasks: discover-tasks.yml

ansible/discover-tasks.yml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
- include_role:
3+
name: common
4+
- include_role:
5+
name: openssl
6+
- include_role:
7+
name: pattern-handler
8+
- include_role:
9+
name: socket-server
10+
- include_role:
11+
name: api
12+
- include_role:
13+
name: explorer
14+
- include_role:
15+
name: processor
16+
- include_role:
17+
name: ui
18+
- include_role:
19+
name: ingest
20+
- include_role:
21+
name: gateway
22+
vars:
23+
image_name: "nginx:1.13.5-alpine"
24+
when:
25+
- run_mode == 'dev'
26+
- include_role:
27+
name: gateway
28+
when:
29+
- run_mode != 'dev'

ansible/discover.yml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
- hosts: localhost
3+
roles:
4+
- common
5+
- gateway
6+

ansible/hosts

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[localhost]
2+
localhost ansible_connection=local
3+
localhost ansible_python_interpreter=python
4+

ansible/roles/api/handlers/main.yml

Whitespace-only changes.

ansible/roles/api/meta/main.yml

Whitespace-only changes.

ansible/roles/api/tasks/main.yml

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
2+
- name: "Create {{ container_name }}"
3+
docker_image:
4+
name: "{{ image_name }}"
5+
state: present
6+
path: "{{ path }}"
7+
when: "build_action == 'local'"
8+
9+
- name: "Pull {{ container_name }}"
10+
docker_image:
11+
name: "{{ image_name }}"
12+
state: present
13+
pull: yes
14+
when: "build_action == 'pull'"
15+
16+
17+
- name: dev volume
18+
set_fact:
19+
volume_list: "{{ volume_list }} + {{ dev_volume_list }}"
20+
when: run_mode=='dev'
21+
22+
- name: uac volume and link list
23+
set_fact:
24+
volume_list: "{{ volume_list }} + {{ uac_volume_list }}"
25+
api_link_list: "{{ api_link_list }} + {{ api_uac_link_list }}"
26+
when: use_uac
27+
28+
- debug:
29+
msg: "This is the volume list {{ volume_list }}"
30+
31+
- debug:
32+
msg: "This is the link list {{ api_link_list }}"
33+
34+
- name: Create API
35+
docker_container:
36+
name: "{{ container_name }}"
37+
image: "{{ image_name }}"
38+
state: started
39+
links: "{{ api_link_list }}"
40+
volumes: "{{ volume_list }}"
41+
env:
42+
CTF_PARSE_HOST: http://unfetter-ctf-ingest
43+
STIX_API_PROTOCOL: http
44+
STIX_API_HOST: cti-stix-store
45+
STIX_API_PORT: 3000
46+
STIX_API_PATH: cti-stix-store-api
47+
MONGO_REPOSITORY: cti-stix-store-repository
48+
MONGO_PORT: 27017
49+
MONGO_DBNAME: stix
50+
ENV: dev
51+
# Options: UAC, TEST, DEMO
52+
RUN_MODE: "{{ 'UAC' if use_uac else 'DEMO' }}"
53+
# If deployed in a proxy, add the proxy's URL here
54+
HTTPS_PROXY_URL: ""
55+
PATTERN_HANDLER_DOMAIN: unfetter-pattern-handler
56+
PATTERN_HANDLER_PORT: 5000
57+
SOCKET_SERVER_DOMAIN: "{{ 'socketserver' if use_uac else '' }}"
58+
SOCKET_SERVER_PORT: "{{ '3333' if use_uac else '' }}"
59+
#MONGO_DEBUG: "{{ 'false' if use_uac else '' }}"
60+
MONGO_DEBUG: "true"
61+
entrypoint:
62+
- npm
63+
# - run
64+
- start
65+
#- "{{ 'start' if run_mode != 'dev' else 'run debugdev' }}"
66+
when: run_action

ansible/roles/api/vars/main.yml

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
3+
dir: "unfetter-store/unfetter-discover-api"
4+
path: "{{ prepath + dir}}"
5+
container_name: unfetter-discover-api
6+
image_name: "{{registry}}{{ container_name }}:{{tag}}"
7+
8+
9+
volume_list:
10+
- "{{ prepath }}unfetter/certs/:/etc/pki/tls/certs"
11+
12+
dev_volume_list:
13+
# If we are in dev, and thus we are linking in code
14+
- "{{ prepath+'unfetter-store/unfetter-discover-api/test:/usr/share/unfetter-discover-api/test'}}"
15+
- "{{ prepath+'unfetter-store/unfetter-discover-api/api:/usr/share/unfetter-discover-api/api'}}"
16+
- "{{ prepath+'unfetter-store/unfetter-discover-api/app.js:/usr/share/unfetter-discover-api/app.js'}}"
17+
18+
uac_volume_list:
19+
# If we are in UAC, and thus need the private-config.json
20+
- "{{ prepath+'unfetter-store/unfetter-discover-api/config/private-config.json:/usr/share/unfetter-discover-api/config/private-config.json' }}"
21+
22+
api_link_list:
23+
- "cti-stix-store-repository:cti-stix-store-repository"
24+
- "unfetter-pattern-handler:unfetter-pattern-handler"
25+
26+
api_uac_link_list:
27+
- "unfetter-socket-server:socketserver"

0 commit comments

Comments
 (0)