-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathenvoy.yaml
189 lines (188 loc) · 7.69 KB
/
envoy.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
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
static_resources:
listeners:
address:
socket_address:
address: 0.0.0.0
port_value: 10000
filter_chains:
- filters:
- name: envoy.filters.network.http_connection_manager
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
stat_prefix: ingress_http
codec_type: AUTO
route_config:
name: local_routes
virtual_hosts:
- name: local_service
domains:
- "*"
routes:
- match:
prefix: "/"
route:
cluster: httpbin
http_filters:
- name: envoy.filters.http.wasm
typed_config:
"@type": type.googleapis.com/udpa.type.v1.TypedStruct
type_url: type.googleapis.com/envoy.extensions.filters.http.wasm.v3.Wasm
value:
config:
name: "PoW"
configuration:
"@type": "type.googleapis.com/google.protobuf.StringValue"
value: |
mempool_upstream_name: mempool.space
log_level: trace
whitelist:
- "46.3.240.0/24"
- "2001:db8::/32"
difficulty: 100000
virtual_hosts:
- host: "example.com"
routes:
- path: "/"
rate_limit:
unit: minute
requests_per_unit: 100
- path: "/api"
rate_limit:
unit: minute
requests_per_unit: 50
children:
- path: "/users"
rate_limit:
unit: minute
requests_per_unit: 100
- path: "/posts/*"
rate_limit:
unit: minute
requests_per_unit: 100
- host: "httpbin.org"
routes:
- path: "/*"
rate_limit:
unit: minute
requests_per_unit: 10
- path: "/ip"
rate_limit:
unit: minute
requests_per_unit: 3
vm_config:
runtime: "envoy.wasm.runtime.v8"
code:
local:
filename: "/etc/envoy/proxy-wasm-plugins/pow_waf.wasm"
- name: envoy.filters.http.wasm
typed_config:
"@type": type.googleapis.com/udpa.type.v1.TypedStruct
type_url: type.googleapis.com/envoy.extensions.filters.http.wasm.v3.Wasm
value:
config:
name: "Auth"
configuration:
"@type": "type.googleapis.com/google.protobuf.StringValue"
value: |
log_level: trace
whitelist:
- "46.3.240.0/24"
- "2001:db8::/32"
virtual_hosts:
- host: "example.com"
routes:
- path: "/api"
public: null
children:
- path: "/users"
grants:
- name: "Alice"
public_key: "039e70a683d711ab788433b4cabddbd10dce4bb1f29c67cc3219b325053b0f2f1c"
- host: "httpbin.org"
routes:
- path: "/*"
public: null
- path: "/ip"
public: null
- path: "/json"
grants:
- name: "Alice"
public_key: "039e70a683d711ab788433b4cabddbd10dce4bb1f29c67cc3219b325053b0f2f1c"
vm_config:
runtime: "envoy.wasm.runtime.v8"
code:
local:
filename: "/etc/envoy/proxy-wasm-plugins/pow_auth.wasm"
- name: envoy.filters.http.router
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router
clusters:
- name: download
connect_timeout: 5s
type: STRICT_DNS
lb_policy: ROUND_ROBIN
load_assignment:
cluster_name: download
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: download
port_value: 80
- name: httpbin
connect_timeout: 5s
type: STRICT_DNS
lb_policy: ROUND_ROBIN
load_assignment:
cluster_name: httpbin
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: httpbin.org
port_value: 80
- name: mempool.space
connect_timeout: 30s
type: LOGICAL_DNS
dns_lookup_family: V4_ONLY
lb_policy: ROUND_ROBIN
load_assignment:
cluster_name: mempool.space
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: mempool.space
port_value: 443
transport_socket:
name: envoy.transport_sockets.tls
typed_config:
"@type": type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.UpstreamTlsContext
# bootstrap_extensions:
# - name: envoy.bootstrap.wasm
# typed_config:
# "@type": type.googleapis.com/envoy.extensions.wasm.v3.WasmService
# singleton: true
# config:
# name: "pow_waf"
# vm_config:
# runtime: "envoy.wasm.runtime.v8"
# code:
# local:
# filename: "/etc/envoy/proxy-wasm-plugins/pow_waf.wasm"