Comments (1)
The proxy might not be strictly following the spec?
It should send type 32
(0x20
) and subtype 34
(0x22
)
However the raw bytes you shared has type (not subtype) 34
, which is unknown to EMQX.
Tried to send the raw bytes you provided and traced the ppv2 header parse results as below
{proxy_socket,inet4,#Port<0.58>,
{83,251,192,246},
{34,36,135,60},
48046,1883,
[{pp2_ssl,
[{pp2_ssl_client,true},
{pp2_ssl_client_cert_conn,true},
{pp2_ssl_client_cert_sess,true},
{pp2_ssl_verify,success}]},
{{pp2_raw,33},<<"TLSv1_3">>},
{{pp2_raw,34},
<<"test-username-from-common-name">>},
{{pp2_raw,35},
<<"ECDHE-RSA-AES128-GCM-SHA256">>},
{{pp2_raw,36},<<"SHA256">>},
{{pp2_raw,37},<<"RSA2048">>}]}}
For compare, my test (see details at the end of this post) is traced as below:
% 08:30:44 <0.5223.0>({emqx_connection,init,4})
% esockd_proxy_protocol:parse_v2(1, 1, <<172,19,0,1,172,19,0,4,180,156,34,179,32,0,24,7,0,0,0,0,33,0,7,84,76,83,118,
49,46,51,34,0,6,67,108,105,101,110,116>>, {proxy_socket,inet4,#Port<0.60>,undefined,undefined,undefined,undefined,[]})
% 08:30:44 <0.5223.0>({emqx_connection,init,4})
% esockd_proxy_protocol:parse_v2/4 -> {ok,
{proxy_socket,inet4,#Port<0.60>,
{172,19,0,1},
{172,19,0,4},
46236,8883,
[{pp2_ssl,
[{pp2_ssl_client,true},
{pp2_ssl_client_cert_conn,true},
{pp2_ssl_client_cert_sess,true},
{pp2_ssl_verify,success},
{pp2_ssl_version,<<"TLSv1.3">>},
{pp2_ssl_cn,<<"Client">>}]}]}}
Tested with this script: https://github.com/emqx/emqx/blob/v5.6.0/scripts/test/start-two-nodes-in-docker.sh
and patched with:
--- a/scripts/test/start-two-nodes-in-docker.sh
+++ b/scripts/test/start-two-nodes-in-docker.sh
@@ -84,6 +84,7 @@ docker run -d -t --restart=always --name "$NODE1" \
-e EMQX_listeners__wss__default__enable=false \
-e EMQX_listeners__tcp__default__proxy_protocol=true \
-e EMQX_listeners__ws__default__proxy_protocol=true \
+ -e EMQX_mqtt__peer_cert_as_username=cn \
"$IMAGE1"
docker run -d -t --restart=always --name "$NODE2" \
@@ -98,6 +99,7 @@ docker run -d -t --restart=always --name "$NODE2" \
-e EMQX_listeners__wss__default__enable=false \
-e EMQX_listeners__tcp__default__proxy_protocol=true \
-e EMQX_listeners__ws__default__proxy_protocol=true \
+ -e EMQX_mqtt__peer_cert_as_username=cn \
"$IMAGE2"
mkdir -p tmp
To trace the parse functions your self:
- run
emqx remote_consol
- in erlang console, evaluate this expression
redbug:start("esockd_proxy_protocol:parse_v2 -> return",[{msgs,1000},{time,60000}]).
- this will give you 60 seconds to observe the inputs and outputs of ppv2 parse function.
from emqx.
Related Issues (20)
- Connector to MQTT host fails with bad username/password, other clients connect normally HOT 2
- But I found that it was sent successfully, and I also subscribed to this topic. Should return 200 and messageid HOT 1
- Feature Request: Add exact_match Parameter to JWT ACL HOT 17
- The unit of max packet size is wrong
- Default Value of fail_if_no_peer_cert HOT 10
- Backup and Restore | Rule Configuration Missing
- Placeholders such as ${cert_subject} in JWT AuthN do not work HOT 4
- SSL listener's check for "CA Cert" HOT 5
- The statistics of disconnection reasons do not include malformed packets HOT 3
- Clearer disconnection reasons
- Add "topic_subscribe_filter" field to JWT ACL (or some acl behavior like this) HOT 21
- Add curl to docker image HOT 5
- 消息重传机制只会在重连的时候触发么 HOT 3
- api/v5/prometheus/stats not have erlang_vm_* 指标没了吗? HOT 3
- 延迟subscribe可能导致消息消费不到 HOT 6
- runq_overload alert on using MongoDB for authz/authn and also alert gets stuck for days sometimes HOT 5
- Helm Chart: MQTT ingress proxies HTTP to MQTT port HOT 3
- docker can't pull emqx:5.7.0 HOT 3
- Connect to ws emqx and the respons is 400 bad request HOT 1
- The client is powered off, but one month later EMQX still shows that the client is connected HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from emqx.