cloudflare / quiche

🥧 Savoury implementation of the QUIC transport protocol and HTTP/3
https://docs.quic.tech/quiche/
BSD 2-Clause "Simplified" License
9.35k stars 705 forks source link

Nginx Server with QUICHE: - QLogs option #869

Open iamPerfPro opened 3 years ago

iamPerfPro commented 3 years ago

I 'm able to run Nginx with the QUICHE patch and server pages over both H2 and H3. Is there a way to enable qlogs switch so that Qlogs can generated by NGINX when serving webpages on H3 using QUICHE with Nginx as server.

Any guidance would be great.

LPardue commented 3 years ago

It's possible yes. At the most basic level, on Linux you can just call quiche_conn_set_qlog_fd() in ngx_event_quic.c:ngx_quic_create_connection()`

You need to decide on what file descriptor you want to pass, and that's the more complex bit. But for a quick fix I'd recommend trying it out with a file named after the CID.

I've got code that handles things more elegantly but I've never had the time to polish up enough get it landed in our patch.

iamPerfPro commented 3 years ago

Thanks for your reply. I was thinking about where and how to put the switch for qlog after i try to call the above method.

I start the nginx like ./nginx.c -c nginx.conf

The below command is just for reference I don't use it to start the nginx. I use it to start the quiche server. I give the parameters as follows and was thinking that the q log will also be another parameter like --qlogs /Desktop/ when starting the quiche server.

cargo run --manifest-path=tools/apps/Cargo.toml --bin quiche-server -- \ --cert tools/apps/src/bin/cert.crt \ --key tools/apps/src/bin/cert.key \ --root /Desktop/root/ \ --index index.html

Now in case of nginx Server should I pass the parameters in the main command or somewhere else. Example: - ./nginx.c -c nginx.conf --qlogs /Desktop

Thanks

LPardue commented 3 years ago

Yeah this is where all the complexity comes from. My patch aligned with other logging configuration strategies.

If you're patching something yourself in the short term, I'd just suggest doing the most simple thing.

iamPerfPro commented 3 years ago

Hi thanks again for your reply. Can you please guide me more about when you say: - "recommend trying it out with a file named after the CID." What is CID here. I'm little confused with that.

iamPerfPro commented 3 years ago

I tried to call the function like quiche_conn_set_qlog_fd(conn,100,description,title);

by setting the variables as

char description= "description"; char title= "title";

but I get this error when I call it. Is there any lead as to why is this happening : - /usr/bin/ld: objs/src/event/ngx_event_quic.o: in function ngx_quic_create_connection': Desktop/newnginx/nginx-1.16.1/src/event/ngx_event_quic.c:191: undefined reference toquiche_conn_set_qlog_fd' /usr/bin/ld: ../quiche/target/release/libquiche.a(quiche.quiche.beisisz9-cgu.0.rcgu.o): in function `quiche::tls::Handshake::use_legacy_codepoint':

/Desktop/newnginx/quiche/src/tls.rs:343: undefined reference to SSL_set_quic_use_legacy_codepoint' /usr/bin/ld: /home/parallels/Desktop/newnginx/quiche/src/tls.rs:343: undefined reference toSSL_set_quic_use_legacy_codepoint' /usr/bin/ld: ../quiche/target/release/libquiche.a(quiche.quiche.beisisz9-cgu.11.rcgu.o): in function quiche::tls::Handshake::use_legacy_codepoint': /Desktop/newnginx/quiche/src/tls.rs:343: undefined reference toSSL_set_quic_use_legacy_codepoint' collect2: error: ld returned 1 exit status make[1]: [objs/Makefile:260: objs/nginx] Error 1 make[1]: Leaving directory 'Desktop/newnginx/nginx-1.16.1' make: [Makefile:8: build] Error 2

LPardue commented 3 years ago

What OS are you using? I think the fd option only works on Linux.

iamPerfPro commented 3 years ago

I'm using Ubuntu 20.04.2 LTS.

LPardue commented 3 years ago

ah you might need to enable the qlog feature when building quiche otherwise its not included and the linking will fail.

iamPerfPro commented 3 years ago

So the build is working with qlog feature enabled. Can you tell me the process to enable the normal logging in QUICHE. I can see via nginx logs the execution is hitting quiche_conn_set_qlog_fd() function. But nothing gets printed in the qlog file. So I wanted to debug the QUICHE side. Can you guide how to enable the logging on QUICHE when used after patching with nginx.

Ryenum commented 10 months ago

Hello, I encountered some problems when configuring the quic service of NGINX. My configuration is the same as that of the official website, but I still cannot use the quic protocol when accessing the server. The h2 protocol is still used. Here is my compilation information: nginx version: nginx/1.16.1 (quiche-83d9168a) built by gcc 11.4.0 (Ubuntu 11.4.0-1ubuntu1~22.04) built with OpenSSL 1.1.1 (compatible; BoringSSL) (running with BoringSSL) TLS SNI support enabled configure arguments: --prefix=/usr/local/nginx --build=quiche-83d9168a --with-http_v3_module --with-http_v2_module --with-quiche=/quiche --with-http_ssl_module --with-openssl=/quiche/quiche/deps/boringssl --add-module=/connect