Skip to content

Commit 9b92c0d

Browse files
authored
Merge branch 'master' into update-gopacket-vendor
2 parents 52c9e6b + 565fda4 commit 9b92c0d

Some content is hidden

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

72 files changed

+5519
-1434
lines changed

‎.env.example‎

Lines changed: 67 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,44 +2,96 @@
22
# Tulip config
33
##############################
44

5-
# The connection string to connect to the mongo bd
6-
TULIP_MONGO="mongo:27017"
5+
# Timescale connection
6+
TIMESCALE="postgres://tulip@timescale:5432/tulip"
7+
78
# The location of your pcaps as seen by the host
89
TRAFFIC_DIR_HOST="./services/test_pcap"
10+
911
# The location of your pcaps (and eve.json), as seen by the container
1012
TRAFFIC_DIR_DOCKER="/traffic"
1113

14+
# Visualizer
15+
VISUALIZER_URL="http://scraper.example.com"
16+
1217
##############################
1318
# Game config
1419
##############################
1520

1621
# Start time of the CTF (or network open if you prefer)
17-
TICK_START="2018-06-27T13:00+02:00"
22+
TICK_START="2024-11-30T13:00:00Z"
23+
1824
# Tick length in ms
1925
TICK_LENGTH=180000
26+
2027
# The flag format in regex
2128
FLAG_REGEX="[A-Z0-9]{31}="
2229

30+
# VM IP (inside gamenet)
31+
# Currently ignored unless FLAGID_SCRAPE is set
32+
VM_IP="10.10.3.1"
33+
TEAM_ID="3"
34+
2335
##############################
2436
# PCAP_OVER_IP CONFIGS
2537
##############################
2638

39+
# Enable pcap-over-ip and choose server endpoint
40+
# Empty value = disabled
41+
PCAP_OVER_IP=
2742
#PCAP_OVER_IP="host.docker.internal:1337"
28-
# # For multiple PCAP_OVER_IP you can comma separate
43+
# For multiple PCAP_OVER_IP you can comma separate
2944
#PCAP_OVER_IP="host.docker.internal:1337,otherhost.com:5050"
3045

46+
##############################
47+
# DUMP_PCAPS CONFIGS
48+
##############################
49+
50+
# Enable pcap dumping and select target location
51+
# Empty value = disabled
52+
DUMP_PCAPS=
53+
#DUMP_PCAPS="/traffic"
54+
55+
# Dumping options
56+
# Ignored unless DUMP_PCAPS is set
57+
DUMP_PCAPS_INTERVAL="1m"
58+
DUMP_PCAPS_FILENAME="2006-01-02_15-04-05.pcap"
59+
3160
##############################
3261
# FLAGID CONFIGS
3362
##############################
3463

35-
# # enable flagid scrapping
36-
# FLAGID_SCRAPE=1
37-
# # enable flagid scanning
38-
# FLAGID_SCAN=1
39-
# # Flag Lifetime in Ticks (-1 for no check, pls don't use outside testing)
40-
# FLAG_LIFETIME=-1
41-
# # Flagid endpoint currently Testendpoint in docker compose
42-
# FLAGID_ENDPOINT="http://flagidendpoint:8000/flagids.json"
43-
# # VM IP (inside gamenet)
44-
# VM_IP="10.10.3.1"
45-
# TEAM_ID="10.10.3.1"
64+
# Enable flagid scrapping
65+
# Empty value = disabled
66+
FLAGID_SCRAPE=
67+
#FLAGID_SCRAPE=1
68+
69+
# Enable flagid scanning - Tags flag ids in traffic
70+
# Empty value = disabled
71+
# Does nothing unless FLAGID_SCRAPE is set
72+
FLAGID_SCAN=
73+
#FLAGID_SCAN=1
74+
75+
# Flag lifetime in ticks
76+
# Empty value = Fallback to TICK_LENGTH
77+
# -1 = No check, pls don't use outside testing
78+
FLAG_LIFETIME=
79+
#FLAG_LIFETIME=-1
80+
#FLAG_LIFETIME=5
81+
82+
# Flagid endpoint
83+
# Default value is a test container in docker-compose-test.yml, change this for production
84+
# Ignored unless FLAGID_SCRAPE is set
85+
FLAGID_ENDPOINT="http://flagidendpoint:8000/flagids.json"
86+
87+
##############################
88+
# FLAG_VALIDATOR CONFIGS
89+
##############################
90+
91+
# Enables flag validation / fake flag feature. Must be one of: faust, enowars, eno, itad
92+
# Empty value = disabled
93+
FLAG_VALIDATOR_TYPE=
94+
95+
# Some flag validators can make use of (our) team number/ID
96+
# Ignored unless FLAG_VALIDATOR_TYPE is set
97+
FLAG_VALIDATOR_TEAM=42

‎.gitignore‎

100755100644
File mode changed.

‎README.md‎

100755100644
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Tulip was developed by Team Europe for use in the first International Cyber Secu
2121
![](./demo_images/demo3.png)
2222

2323
## Configuration
24-
Before starting the stack, edit `services/configurations.py`:
24+
Before starting the stack, edit `services/api/configurations.py`:
2525

2626
```
2727
vm_ip = "10.60.4.1"

‎docker-compose.yml‎

Lines changed: 51 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,23 @@
1-
version: "3.2"
1+
version: "3.5"
22
services:
3-
mongo:
4-
image: mongo:5
3+
timescale:
4+
build: services/timescale
5+
image: tulip-timescale:latest
6+
restart: unless-stopped
7+
volumes:
8+
- timescale-data:/var/lib/postgresql/data
9+
- ./services/schema/system.sql:/docker-entrypoint-initdb.d/100_system.sql:ro
10+
- ./services/schema/functions.sql:/docker-entrypoint-initdb.d/101_functions.sql:ro
11+
- ./services/schema/schema.sql:/docker-entrypoint-initdb.d/102_schema.sql:ro
512
networks:
613
- internal
7-
restart: always
8-
ports:
9-
- "27017:27017"
14+
environment:
15+
POSTGRES_HOST_AUTH_METHOD: trust
16+
POSTGRES_USER: tulip
17+
POSTGRES_DB: tulip
18+
# This does not need to be adjusted, unless you actually want to limit it
19+
# Postgres uses shared memory for caching, and docker assigns just 64 MB by default
20+
shm_size: '128g'
1021

1122
frontend:
1223
build:
@@ -16,13 +27,16 @@ services:
1627
restart: unless-stopped
1728
ports:
1829
- "3000:3000"
30+
expose:
31+
- 3000
1932
depends_on:
20-
- mongo
33+
- timescale
2134
- api
2235
networks:
2336
- internal
2437
environment:
2538
API_SERVER_ENDPOINT: http://api:5000/
39+
VIRTUAL_HOST: tulip.h4xx.eu
2640

2741
api:
2842
build:
@@ -31,35 +45,37 @@ services:
3145
image: tulip-api:latest
3246
restart: unless-stopped
3347
depends_on:
34-
- mongo
48+
- timescale
3549
networks:
3650
- internal
3751
volumes:
3852
- ${TRAFFIC_DIR_HOST}:${TRAFFIC_DIR_DOCKER}:ro
3953
environment:
40-
TULIP_MONGO: ${TULIP_MONGO}
54+
TIMESCALE: ${TIMESCALE}
4155
TULIP_TRAFFIC_DIR: ${TRAFFIC_DIR_DOCKER}
4256
FLAG_REGEX: ${FLAG_REGEX}
4357
TICK_START: ${TICK_START}
4458
TICK_LENGTH: ${TICK_LENGTH}
4559
VM_IP: ${VM_IP}
4660

4761
flagids:
48-
restart: on-failure
62+
restart: unless-stopped
4963
build:
5064
context: services/flagids
5165
image: tulip-flagids:latest
5266
depends_on:
53-
- mongo
67+
- timescale
5468
networks:
5569
- internal
5670
environment:
57-
TULIP_MONGO: ${TULIP_MONGO}
71+
TIMESCALE: ${TIMESCALE}
5872
TICK_START: ${TICK_START}
5973
TICK_LENGTH: ${TICK_LENGTH}
6074
FLAGID_SCRAPE: ${FLAGID_SCRAPE}
6175
TEAM_ID: ${TEAM_ID}
6276
FLAGID_ENDPOINT: ${FLAGID_ENDPOINT}
77+
VISUALIZER_URL: ${VISUALIZER_URL}
78+
DUMP_PCAPS: ${DUMP_PCAPS}
6379

6480
assembler:
6581
build:
@@ -68,38 +84,53 @@ services:
6884
image: tulip-assembler:latest
6985
restart: unless-stopped
7086
depends_on:
71-
- mongo
87+
- timescale
7288
networks:
7389
- internal
7490
volumes:
75-
- ${TRAFFIC_DIR_HOST}:${TRAFFIC_DIR_DOCKER}:ro
76-
command: "./assembler -dir ${TRAFFIC_DIR_DOCKER}"
91+
- ${TRAFFIC_DIR_HOST}:${TRAFFIC_DIR_DOCKER}:ro,z
92+
# Command line flags most likely to fix a tulip issue:
93+
# - -http-session-tracking: enable HTTP session tracking
94+
# - -dir: directory to read traffic from
95+
# - -skipchecksum: skip checksum validation
96+
# - -flush-after: i.e. 2m Not needed in pcap rotation mode
97+
# - -disable-converters: disable converters
98+
# - -discard-extra-data: dont split large flow items, just discard them
99+
command: "./assembler -http-session-tracking -skipchecksum -disable-converters -dir ${TRAFFIC_DIR_DOCKER}"
77100
environment:
78-
TULIP_MONGO: ${TULIP_MONGO}
101+
TIMESCALE: ${TIMESCALE}
79102
FLAG_REGEX: ${FLAG_REGEX}
103+
TICK_START: ${TICK_START}
80104
TICK_LENGTH: ${TICK_LENGTH}
81105
FLAGID_SCAN: ${FLAGID_SCAN}
82106
FLAG_LIFETIME: ${FLAG_LIFETIME}
107+
FLAG_VALIDATOR_TYPE: ${FLAG_VALIDATOR_TYPE}
108+
FLAG_VALIDATOR_TEAM: ${FLAG_VALIDATOR_TEAM}
83109
PCAP_OVER_IP: ${PCAP_OVER_IP}
110+
DUMP_PCAPS: ${DUMP_PCAPS}
111+
DUMP_PCAPS_INTERVAL: ${DUMP_PCAPS_INTERVAL}
112+
DUMP_PCAPS_FILENAME: ${DUMP_PCAPS_FILENAME}
84113
extra_hosts:
85114
- "host.docker.internal:host-gateway"
86115

87-
88116
enricher:
89117
build:
90118
context: services/go-importer
91119
dockerfile: Dockerfile-enricher
92120
image: tulip-enricher:latest
93121
restart: unless-stopped
94122
depends_on:
95-
- mongo
123+
- timescale
96124
networks:
97125
- internal
98126
volumes:
99-
- ${TRAFFIC_DIR_HOST}:${TRAFFIC_DIR_DOCKER}:ro
127+
- ${TRAFFIC_DIR_HOST}:${TRAFFIC_DIR_DOCKER}:ro,z
100128
command: "./enricher -eve ${TRAFFIC_DIR_DOCKER}/eve.json"
101129
environment:
102-
TULIP_MONGO: ${TULIP_MONGO}
130+
TIMESCALE: ${TIMESCALE}
131+
132+
volumes:
133+
timescale-data:
103134

104135
networks:
105136
internal:

‎frontend/Dockerfile-frontend‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ RUN yarn run build
1313

1414
EXPOSE 3000
1515

16-
CMD yarn run preview --host --port 3000
16+
CMD ["yarn", "run", "preview", "--host", "--port", "3000"]

0 commit comments

Comments
 (0)