inetmock/config-container.yaml
Peter Kurfer 9d4bd8d873
Refactored http_mock to use new routing rule grammar
- removed old regex router
- refactored tests to use new simplified routing rules
- updated configs
- make router behavior and filters way easier to test
2021-04-28 17:03:04 +02:00

146 lines
No EOL
3.7 KiB
YAML

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") => File("default.html")
- => Status(204)
x-http-handlers: &httpHandlers
endpoints:
plainHttp:
handler: http_mock
tls: false
options:
<<: *httpResponseRules
https:
handler: http_mock
tls: true
options:
<<: *httpResponseRules
data:
pcap: /var/lib/inetmock/data/pcap
audit: /var/lib/inetmock/data/audit
fakeFiles: /var/lib/inetmock/fakeFiles
api:
listen: unix:///var/run/inetmock/inetmock.sock
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/certs
listeners:
udp_53:
name: ''
protocol: udp
listenAddress: ''
port: 53
endpoints:
plainDns:
handler: dns_mock
options:
rules:
- pattern: ".*\\.google\\.com"
response: 1.1.1.1
- pattern: ".*\\.reddit\\.com"
response: 2.2.2.2
fallback:
strategy: incremental
args:
startIP: 10.0.10.0
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
options:
rules:
- pattern: ".*\\.google\\.com"
response: 1.1.1.1
- pattern: ".*\\.reddit\\.com"
response: 2.2.2.2
fallback:
strategy: incremental
args:
startIP: 10.0.10.0
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