-
Notifications
You must be signed in to change notification settings - Fork 1
/
config-container.yaml
301 lines (292 loc) · 9.13 KB
/
config-container.yaml
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
x-response-rules: &httpResponseRules
rules:
- Method("GET") -> Header("Accept", "application/octet-stream") => File("sample.exe")
- Method("GET") -> Header("Accept", "image/jpeg") => File("default.jpg")
- Method("GET") -> PathPattern(".*\\.(?i)(jpg|jpeg)$") => File("default.jpg")
- Method("GET") -> Header("Accept", "image/png") => File("default.png")
- Method("GET") -> PathPattern(".*\\.(?i)png$") => File("default.png")
- Method("GET") -> Header("Accept", "image/gif") => File("default.gif")
- Method("GET") -> PathPattern(".*\\.(?i)gif$") => File("default.gif")
- Method("GET") -> Header("Accept", "image/x-icon") => File("default.ico")
- Method("GET") -> PathPattern(".*\\.(?i)ico$") => File("default.ico")
- Method("GET") -> Header("Accept", "text/plain") => File("default.txt")
- Method("GET") -> PathPattern(".*\\.(?i)txt$") => File("default.txt")
- Method("GET") -> Header("Accept", "text/html") => File("default.html")
- Method("GET") -> PathPattern(".*\\.(?i)htm(l)?$") => File("default.html")
- 'Method("GET") -> Header("Accept", "application/json") => JSON(`{"name": "tester", "givenName": "ted"}`)'
- Method("GET") => File("default.html")
- => Status(204)
x-dns-response-rules: &dnsResponseRules
options:
ttl: 30s
cache:
type: inMemory
ttl: 30s
initialCapacity: 500
rules:
- A(`.*\\.google\\.com`) => IP(1.1.1.1)
- AAAA(`.*\\.google\\.com`) => IP(1.1.1.1)
- A(`.*\\.reddit\\.com`) => IP(2.2.2.2)
- AAAA(`.*\\.reddit\\.com`) => IP(2.2.2.2)
- A(`.*\\.cloudflare\\.com`) => Random(10.1.0.0/16)
- AAAA(`.*\\.cloudflare\\.com`) => Random(10.1.0.0/16)
- A(`.*\\.stackoverflow\\.com`) => Incremental(10.20.0.0/16)
default:
type: incremental
cidr: 10.1.0.0/16
x-http-handlers: &httpHandlers
endpoints:
plainHttp:
handler: http_mock
tls: false
options:
<<: *httpResponseRules
doh:
handler: doh_mock
tls: true
<<: *dnsResponseRules
https:
handler: http_mock
tls: true
options:
<<: *httpResponseRules
# Configure data directories
data:
# where to place PCAPs if no absolute path is set for recordings
pcap: /var/lib/inetmock/data/pcap
# where to place audit recording files
audit: /var/lib/inetmock/data/audit
state: /var/lib/inetmock/data/state/inetmock.db
# where to load fake files from
fakeFiles: /var/lib/inetmock/fakeFiles
caches:
dns:
ttl: 30s
initialCapacity: 500
api:
listen: unix:///var/run/inetmock/inetmock.sock
health:
client:
http:
ip: 127.0.0.1
port: 80
https:
ip: 127.0.0.1
port: 443
dns:
ip: 127.0.0.1
port: 53
proto: udp
rules:
- name: HTTP GET /index.html
rule: http.GET("https://stackoverflow.com/index.html") => Status(200) -> Header("Content-Type", "text/html") -> Contains(`<title>INetSim default HTML page</title>`)
- name: HTTP GET default ico
rule: http.GET("https://google.com/favicon.ico") => Status(200) -> SHA256("cb3f33cb0c7bae881d13be647cb928aa7fec9e9fcd6ec758751374bf7436d41a")
- name: HTTP POST - Status 204
rule: http.POST("https://api.icndb.com/jokes/new", `{"joke":"asdf","categories":[]}`) => Status(204)
- name: HTTP PUT - Status 204
rule: http.PUT("https://api.icndb.com/jokes/37", `{"joke":"asdf","categories":[]}`) => Status(204)
- name: HTTP2 GET /index.html
rule: http2.GET("https://stackoverflow.com/index.html") => Status(200) -> Header("Content-Type", "text/html") -> Contains(`<title>INetSim default HTML page</title>`)
- name: HTTP2 GET default ico
rule: http2.GET("https://google.com/favicon.ico") => Status(200) -> SHA256("cb3f33cb0c7bae881d13be647cb928aa7fec9e9fcd6ec758751374bf7436d41a")
- name: HTTP2 POST - Status 204
rule: http2.POST("https://api.icndb.com/jokes/new", `{"joke":"asdf","categories":[]}`) => Status(204)
- name: HTTP2 PUT - Status 204
rule: http2.PUT("https://api.icndb.com/jokes/37", `{"joke":"asdf","categories":[]}`) => Status(204)
- name: Plain DNS - Ensure that the Google DNS fake works
rule: dns.A("mail.google.com") => NotEmpty() -> ResolvedIP(1.1.1.1)
- name: Plain DNS - Ensure the Google reverse entry is in the cache
rule: dns.PTR(1.1.1.1) => NotEmpty() -> ResolvedHost("mail.google.com")
- name: Plain DNS - Ensure that the Reddit DNS fake works
rule: dns.A("www.reddit.com") => NotEmpty() -> ResolvedIP(2.2.2.2)
- name: Plain DNS - Ensure the Reddit reverse entry is in the cache
rule: dns.PTR(2.2.2.2) => NotEmpty() -> ResolvedHost("www.reddit.com")
- name: Plain DNS - Ensure the CloudFlare IPs are from the same CIDR
rule: dns.A("asdfawer.cloudflare.com") => InCIDR(10.1.0.0/16)
- name: DoH - Ensure that the Google DNS fake works
rule: doh.A("mail.google.com") => NotEmpty() -> ResolvedIP(1.1.1.1)
- name: DoH - Ensure that the Reddit DNS fake works
rule: doh.A("www.reddit.com") => NotEmpty() -> ResolvedIP(2.2.2.2)
- name: DoH - Ensure the CloudFlare IPs are from the same CIDR
rule: doh.A("asdfawer.cloudflare.com") => InCIDR(10.1.0.0/16)
- name: DoH2 - Ensure that the Google DNS fake works
rule: doh2.A("mail.google.com") => NotEmpty() -> ResolvedIP(1.1.1.1)
- name: DoH2 - Ensure that the Reddit DNS fake works
rule: doh2.A("www.reddit.com") => NotEmpty() -> ResolvedIP(2.2.2.2)
- name: DoH2 - Ensure the CloudFlare IPs are from the same CIDR
rule: doh2.A("asdfawer.cloudflare.com") => InCIDR(10.1.0.0/16)
tls:
curve: P256
minTLSVersion: TLS10
includeInsecureCipherSuites: false
validity:
ca:
notBeforeRelative: 17520h
notAfterRelative: 17520h
server:
NotBeforeRelative: 168h
NotAfterRelative: 168h
rootCaCert:
publicKeyPath: /var/lib/inetmock/ca/ca.pem
privateKeyPath: /var/lib/inetmock/ca/ca.key
certCachePath: /var/lib/inetmock/data/certs
listeners:
udp_53:
name: ''
protocol: udp
listenAddress: ''
port: 53
endpoints:
plainDns:
handler: dns_mock
<<: *dnsResponseRules
tcp_53:
name: ''
protocol: tcp
listenAddress: ''
port: 53
endpoints:
plainDns:
handler: dns_mock
<<: *dnsResponseRules
udp_67:
name: ''
protocol: udp
listenAddress: ''
port: 67
unmanaged: true
endpoints:
dhcp_mock:
handler: dhcp_mock
options:
rules:
- ExactMAC("54:df:83:56:2c:f3") => IP(1.3.3.7)
- MatchMAC(`00:06:7C:.*`) => Range(3.3.6.110, 3.3.6.200)
default:
serverID: 10.10.1.1
dns:
- 10.10.1.1
router: 10.10.1.1
netmask: 255.255.255.0
leaseTime: 1h
fallback:
type: range
ttl: 1h
startIP: 10.10.1.50
endIP: 10.10.1.100
tcp_80:
name: ''
protocol: tcp
listenAddress: ''
port: 80
<<: *httpHandlers
tcp_443:
name: ''
protocol: tcp
listenAddress: ''
port: 443
<<: *httpHandlers
tcp_853:
name: ''
protocol: tcp
listenAddress: ''
port: 853
endpoints:
DoT:
handler: dns_mock
tls: true
<<: *dnsResponseRules
tcp_3128:
name: ''
protocol: tcp
listenAddress: ''
port: 3128
endpoints:
proxyPlain:
handler: http_proxy
options:
target:
ipAddress: 127.0.0.1
port: 80
proxyTls:
handler: http_proxy
tls: true
options:
target:
ipAddress: 127.0.0.1
port: 443
tcp_8080:
name: ''
protocol: tcp
listenAddress: ''
port: 8080
<<: *httpHandlers
tcp_8443:
name: ''
protocol: tcp
listenAddress: ''
port: 8443
<<: *httpHandlers
tcp_9110:
name: ''
protocol: tcp
listenAddress: ''
port: 9110
endpoints:
metrics:
handler: metrics_exporter
options:
route: /metrics
tcp_9010:
name: ''
protocol: tcp
listenAddress: ''
port: 9010
endpoints:
traces:
handler: go_pprof
netFlow:
firewall:
eth0:
removeMemLock: true
defaultPolicy: pass
monitor: true
rules:
- dest: 53/tcp
policy: pass
- dest: 53/udp
policy: pass
- dest: 67/udp
policy: pass
- dest: 80/tcp
policy: pass
- dest: 443/tcp
policy: pass
- dest: 853/tcp
policy: pass
- dest: 3128/tcp
policy: pass
- dest: 8080/tcp
policy: pass
- dest: 8443/tcp
policy: pass
nat:
eth0:
translations:
- dest: 0.0.0.0:53/tcp
redirectTo: interface
- dest: 0.0.0.0:53/udp
redirectTo: interface
- dest: 0.0.0.0:80/tcp
redirectTo: interface
- dest: 0.0.0.0:443/tcp
redirectTo: interface
- dest: 0.0.0.0:853/tcp
redirectTo: interface
- dest: 0.0.0.0:3128/tcp
redirectTo: interface
- dest: 0.0.0.0:8080/tcp
redirectTo: interface
- dest: 0.0.0.0:8443/tcp
redirectTo: interface