diff --git a/changes-entries/h3_listen_address.txt b/changes-entries/h3_listen_address.txt new file mode 100644 index 00000000000..902bb955a6a --- /dev/null +++ b/changes-entries/h3_listen_address.txt @@ -0,0 +1,4 @@ + *) mod_http3: Serve HTTP/3 only on the address given to Listen, as for + TCP, rather than on every address of the host. When Listen gives the + HTTP/3 host several addresses, HTTP/3 is not started. + [Arturo Bernal] diff --git a/modules/http3/README.md b/modules/http3/README.md index 19dc07f71db..2c516547552 100644 --- a/modules/http3/README.md +++ b/modules/http3/README.md @@ -69,6 +69,8 @@ Listen 4433 https ``` +The QUIC socket follows the address of `Listen`: `Listen 192.0.2.1:4433` serves HTTP/3 on 192.0.2.1 only, as for TCP. When `Listen` gives the HTTP/3 host several addresses, one QUIC socket cannot serve them alone and HTTP/3 is not started. + ### 2. Client Discovery via `Alt-Svc` Because HTTP/3 runs over UDP, web browsers typically connect via TCP (HTTP/1.1 or HTTP/2) first. `mod_http3` automatically injects the `Alt-Svc` header into responses: diff --git a/modules/http3/h3_config.c b/modules/http3/h3_config.c index 2cd85a82730..c5ae4eed2dc 100644 --- a/modules/http3/h3_config.c +++ b/modules/http3/h3_config.c @@ -794,7 +794,7 @@ int h3_post_config(apr_pool_t* p, apr_pool_t* plog H3_UNUSED, apr_pool_t* ptemp, SSL_CTX_set_cert_cb(conf->ssl_ctx, h3_sni_select_cert, sni); h3_request_init(); - h3_server_post_config(s); + h3_server_post_config(p, s); return OK; } diff --git a/modules/http3/h3_hooks.c b/modules/http3/h3_hooks.c index 709bd505ed4..2efc0f2d7ac 100644 --- a/modules/http3/h3_hooks.c +++ b/modules/http3/h3_hooks.c @@ -82,7 +82,7 @@ int h3_hook_fixups(request_rec* r) h3_server_conf* conf = ap_get_module_config(r->server->module_config, &http3_module); - if (!conf || !conf->ssl_ctx || conf->h3_port == 0) + if (!conf || !conf->ssl_ctx || conf->h3_port == 0 || !conf->quic_addr) { return DECLINED; } diff --git a/modules/http3/h3_server.c b/modules/http3/h3_server.c index baf832d20f8..8a59d7a8164 100644 --- a/modules/http3/h3_server.c +++ b/modules/http3/h3_server.c @@ -57,6 +57,53 @@ struct port_acquire_args h3_server_conf* conf; }; +/* The QUIC socket serves the addresses httpd listens on for the TCP port of + * the HTTP/3 host: Alt-Svc names no host, so a client comes back over UDP to + * the address it reached over TCP. A host with no port (the main server, or + * a without one) is served by every listener. A wildcard Listen + * keeps the dual-stack wildcard, as does a port no Listen names. One QUIC + * socket cannot serve several addresses alone, which gives APR_EINVAL. */ +static apr_status_t choose_quic_addr(apr_pool_t* p, apr_port_t tcp_port, apr_port_t h3_port, apr_sockaddr_t** out) +{ + apr_sockaddr_t* one = NULL; + int wild4 = 0; + int wild6 = 0; + int several = 0; + for (ap_listen_rec* lr = ap_listeners; lr; lr = lr->next) + { + apr_sockaddr_t* sa = lr->bind_addr; + if (!sa || (tcp_port && sa->port != tcp_port)) + { + continue; + } + if (apr_sockaddr_is_wildcard(sa)) + { + wild4 |= sa->family == APR_INET; + wild6 |= sa->family == APR_INET6; + } + else if (!one) + { + one = sa; + } + else if (one->family != sa->family || !apr_sockaddr_equal(one, sa)) + { + several = 1; + } + } + if (several || (one && (wild4 || wild6))) + { + return APR_EINVAL; + } + if (one) + { + /* By its text, which keeps the zone of a link-local address. */ + char ip[64]; + apr_status_t rv = apr_sockaddr_ip_getbuf(ip, sizeof(ip), one); + return rv == APR_SUCCESS ? apr_sockaddr_info_get(out, ip, one->family, h3_port, 0, p) : rv; + } + return apr_sockaddr_info_get(out, NULL, wild4 && !wild6 ? APR_INET : APR_INET6, h3_port, 0, p); +} + #ifdef __linux__ /* The parent binds the QUIC sockets while still privileged and keeps them across restarts. * One SO_REUSEPORT socket per httpd listener bucket (ListenCoresBucketsRatio), so the kernel hash stays stable when children come and go. */ @@ -66,9 +113,15 @@ typedef struct int* fds; int n; apr_port_t port; + apr_sockaddr_t* addr; /* the bound address, from pool */ int routed; /* an eBPF program routes the packets by connection ID */ } h3_parent_socket; +static int same_addr(const apr_sockaddr_t* a, const apr_sockaddr_t* b) +{ + return a && b && a->family == b->family && apr_sockaddr_equal(a, b); +} + /* The same count as httpd for ListenCoresBucketsRatio: online cores / ratio. Some MPMs count their buckets after post_config. * ponytail: top-level directive only, not one inside . */ static int listen_buckets(void) @@ -133,7 +186,7 @@ static apr_status_t acquire_port(apr_pool_t* pool, server_rec* s, h3_server_conf return APR_EAGAIN; } #endif - return h3_socket_open(conf->h3_port, conf->h3_socket_buffer_size, pool, 0, fd); + return h3_socket_open(conf->quic_addr, conf->h3_socket_buffer_size, pool, 0, fd); } /* Give the port back when this child cannot serve it after all. */ @@ -238,6 +291,10 @@ void h3_child_init(apr_pool_t* pchild, server_rec* s) ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, "h3_child_init: no H3 cert/key configured, skipping"); return; } + if (!conf->quic_addr) + { + return; /* refused in post_config, which logged why */ + } apr_pool_pre_cleanup_register(pchild, NULL, child_pool_cleanup); if (h3_thread_safe_pool_create(pchild, "h3_child", &pool) != APR_SUCCESS) { @@ -314,7 +371,7 @@ int h3_server_route_bucket(server_rec* s) #endif } -void h3_server_post_config(server_rec* s) +void h3_server_post_config(apr_pool_t* p, server_rec* s) { if (!h3_server_secret(s)) { @@ -324,6 +381,37 @@ void h3_server_post_config(server_rec* s) apr_pool_userdata_set(secret, H3_SECRET_KEY, apr_pool_cleanup_null, s->process->pool); } } + server_rec* vhost = NULL; + h3_server_conf* conf = find_h3_server(s, &vhost); + apr_sockaddr_t* quic_addr = NULL; + if (conf) + { + apr_status_t rv = choose_quic_addr(p, conf->host_port, conf->h3_port, &quic_addr); + if (rv != APR_SUCCESS) + { + /* Binding the wildcard instead would serve addresses httpd was told not to. */ + if (rv == APR_EINVAL) + { + ap_log_error(APLOG_MARK, APLOG_ERR, 0, vhost, "mod_http3: Listen gives the HTTP/3 host several addresses, which one QUIC socket cannot serve alone; HTTP/3 is not started"); + } + else + { + ap_log_error(APLOG_MARK, APLOG_ERR, rv, vhost, "mod_http3: no address for the QUIC socket on port %d; HTTP/3 is not started", (int)conf->h3_port); + } + quic_addr = NULL; + conf = NULL; + } + /* Every HTTP/3 host is served by the one QUIC socket; a NULL address + * keeps Alt-Svc off for all of them. */ + for (server_rec* cur = s; cur; cur = cur->next) + { + h3_server_conf* hc = ap_get_module_config(cur->module_config, &http3_module); + if (hc && hc->ssl_ctx) + { + hc->quic_addr = quic_addr; + } + } + } #ifdef __linux__ h3_parent_socket* ps = parent_socket(s); if (!ps) @@ -331,14 +419,13 @@ void h3_server_post_config(server_rec* s) ps = apr_pcalloc(s->process->pool, sizeof(*ps)); apr_pool_userdata_set(ps, "mod_http3.parent_socket", apr_pool_cleanup_null, s->process->pool); } - server_rec* vhost = NULL; - h3_server_conf* conf = find_h3_server(s, &vhost); int n = listen_buckets(); - /* ponytail: a new port or bucket count binds again. An old single socket without SO_REUSEPORT blocks this until its children stop. */ - if (ps->n && (!conf || conf->h3_port != ps->port || n != ps->n)) + /* ponytail: a new address, port or bucket count binds again. An old single socket without SO_REUSEPORT blocks this until its children stop. */ + if (ps->n && (!conf || conf->h3_port != ps->port || n != ps->n || !same_addr(ps->addr, quic_addr))) { apr_pool_destroy(ps->pool); /* closes the old sockets */ ps->pool = NULL; + ps->addr = NULL; ps->n = 0; ps->routed = 0; } @@ -350,10 +437,13 @@ void h3_server_post_config(server_rec* s) if (ok) { ps->fds = apr_palloc(ps->pool, sizeof(int) * (size_t)n); + /* The sockets outlive this configuration, so bind them with a copy + * that lives in their pool. */ + ok = apr_sockaddr_info_copy(&ps->addr, quic_addr, ps->pool) == APR_SUCCESS; } for (int i = 0; ok && i < n; i++) { - ok = h3_socket_open(conf->h3_port, conf->h3_socket_buffer_size, ps->pool, n > 1, &ps->fds[i]) == APR_SUCCESS; + ok = h3_socket_open(ps->addr, conf->h3_socket_buffer_size, ps->pool, n > 1, &ps->fds[i]) == APR_SUCCESS; } if (!ok) { @@ -363,6 +453,7 @@ void h3_server_post_config(server_rec* s) apr_pool_destroy(ps->pool); } ps->pool = NULL; + ps->addr = NULL; return; } ps->n = n; diff --git a/modules/http3/h3_socket.c b/modules/http3/h3_socket.c index e291aeb928c..273657cc7c8 100644 --- a/modules/http3/h3_socket.c +++ b/modules/http3/h3_socket.c @@ -56,18 +56,29 @@ static void tune_buffers(apr_socket_t* sock, apr_size_t want, apr_port_t port, a } } -apr_status_t h3_socket_open(apr_port_t port, apr_size_t buffer_size, apr_pool_t* pool, int reuse_port, int* out_fd) +apr_status_t h3_socket_open(apr_sockaddr_t* addr, apr_size_t buffer_size, apr_pool_t* pool, int reuse_port, int* out_fd) { + CHECK(addr); CHECK(pool); CHECK(out_fd); + apr_port_t port = addr->port; + char ip[64]; + if (apr_sockaddr_ip_getbuf(ip, sizeof(ip), addr) != APR_SUCCESS) + { + ip[0] = '\0'; + } apr_socket_t* sock = NULL; - apr_status_t rv = apr_socket_create(&sock, APR_INET6, SOCK_DGRAM, APR_PROTO_UDP, pool); + apr_status_t rv = apr_socket_create(&sock, addr->family, SOCK_DGRAM, APR_PROTO_UDP, pool); if (rv != APR_SUCCESS) { - ap_log_perror(APLOG_MARK, APLOG_ERR, 0, pool, "h3_socket_open: apr_socket_create failed"); + ap_log_perror(APLOG_MARK, APLOG_ERR, rv, pool, "h3_socket_open: apr_socket_create failed"); return rv; } - apr_socket_opt_set(sock, APR_IPV6_V6ONLY, 0); + if (addr->family == APR_INET6) + { + /* The wildcard takes IPv4 as well; an address from Listen is served alone. */ + apr_socket_opt_set(sock, APR_IPV6_V6ONLY, apr_sockaddr_is_wildcard(addr) ? 0 : 1); + } tune_buffers(sock, buffer_size, port, pool); #ifdef SO_REUSEPORT apr_os_sock_t reuse_sock = -1; @@ -79,24 +90,16 @@ apr_status_t h3_socket_open(apr_port_t port, apr_size_t buffer_size, apr_pool_t* #else (void)reuse_port; #endif - apr_sockaddr_t* addr = NULL; - rv = apr_sockaddr_info_get(&addr, NULL, APR_INET6, port, 0, pool); - if (rv != APR_SUCCESS) - { - apr_socket_close(sock); - ap_log_perror(APLOG_MARK, APLOG_ERR, 0, pool, "h3_socket_open: apr_sockaddr_info_get failed"); - return rv; - } rv = apr_socket_bind(sock, addr); if (rv != APR_SUCCESS) { apr_socket_close(sock); if (h3_socket_os_is_eaddrinuse(rv)) { - ap_log_perror(APLOG_MARK, APLOG_DEBUG, 0, pool, "bind(%d) skipped (port already owned)", (int)port); + ap_log_perror(APLOG_MARK, APLOG_DEBUG, 0, pool, "bind(%s:%d) skipped (port already owned)", ip, (int)port); return APR_EAGAIN; } - ap_log_perror(APLOG_MARK, APLOG_ERR, 0, pool, "bind(%d) failed", (int)port); + ap_log_perror(APLOG_MARK, APLOG_ERR, rv, pool, "bind(%s:%d) failed", ip, (int)port); return rv; } rv = apr_socket_timeout_set(sock, 0); diff --git a/modules/http3/include/h3_config.h b/modules/http3/include/h3_config.h index ddbeea0e009..ceca11f0e99 100644 --- a/modules/http3/include/h3_config.h +++ b/modules/http3/include/h3_config.h @@ -40,6 +40,8 @@ struct h3_server_conf struct ssl_ctx_st* ssl_ctx; apr_port_t h3_port; + /** Address the QUIC socket binds, chosen in post_config; NULL when HTTP/3 is not started. */ + apr_sockaddr_t* quic_addr; apr_uint32_t h3_max_concurrent_streams; apr_uint32_t h3_max_connections; apr_size_t h3_stream_buffer_size; diff --git a/modules/http3/include/h3_server.h b/modules/http3/include/h3_server.h index d2933207d43..7a6920f8ccd 100644 --- a/modules/http3/include/h3_server.h +++ b/modules/http3/include/h3_server.h @@ -34,11 +34,13 @@ void h3_child_init(apr_pool_t* pchild, server_rec* s); /** - * Bind the QUIC socket in the parent while it is still privileged (Linux), and + * Choose the address of the QUIC socket from the Listen directives, then + * bind the socket in the parent while it is still privileged (Linux), and * keep it across graceful restarts for the children to inherit. + * @param p Configuration pool. * @param s Main server. */ -void h3_server_post_config(server_rec* s); +void h3_server_post_config(apr_pool_t* p, server_rec* s); /** * The QUIC token key. The parent makes it once and keeps it across restarts, diff --git a/modules/http3/include/h3_socket.h b/modules/http3/include/h3_socket.h index 7a6d5c0c7ab..652ac85ca4a 100644 --- a/modules/http3/include/h3_socket.h +++ b/modules/http3/include/h3_socket.h @@ -23,12 +23,14 @@ #include /** - * Open a non-blocking IPv6 dual-stack UDP socket and bind it to the given port. + * Open a non-blocking UDP socket and bind it to @p addr. The IPv6 wildcard + * is bound dual-stack, so it takes IPv4 too; any other address is bound + * alone, in its own family. * With @p reuse_port, sets SO_REUSEPORT (where the OS has it), so several * sockets can share the port and the kernel spreads the peers over them. * Also asks for @p buffer_size on the send and receive buffers, which the OS * may cap; a refused or capped buffer is logged, never fatal. - * @param port Port to bind; 0 lets the OS pick. + * @param addr Address and port to bind; port 0 lets the OS pick. * @param buffer_size Bytes requested for SO_RCVBUF and SO_SNDBUF; 0 keeps the * OS default. * @param pool Pool used for the underlying apr_socket_t lifetime. @@ -38,7 +40,7 @@ * @return APR_SUCCESS, APR_EAGAIN if the port is already bound, or another * APR error code. */ -apr_status_t h3_socket_open(apr_port_t port, apr_size_t buffer_size, apr_pool_t* pool, int reuse_port, int* out_fd); +apr_status_t h3_socket_open(apr_sockaddr_t* addr, apr_size_t buffer_size, apr_pool_t* pool, int reuse_port, int* out_fd); /** * Route QUIC packets by connection ID: attach an SK_REUSEPORT eBPF program diff --git a/test/modules/http3/env.py b/test/modules/http3/env.py index 2ad298e5681..b9396dae634 100644 --- a/test/modules/http3/env.py +++ b/test/modules/http3/env.py @@ -153,6 +153,15 @@ def hold_udp_port(port: int) -> socket.socket: s.bind(("::", port)) return s + def rewrite_test_conf(self, old: str, new: str): + """Replace text in the installed configuration while the server + runs, for a graceful restart to pick up; install() stops it.""" + with open(self._test_conf) as fd: + conf = fd.read() + assert old in conf, f"{old!r} not in {self._test_conf}" + with open(self._test_conf, 'w') as fd: + fd.write(conf.replace(old, new)) + def alt_svc(self, domain: str = None, port: int = None, scheme: str = "https"): """The Alt-Svc header of a TCP request to the vhost, or None.""" diff --git a/test/modules/http3/test_017_listen_address.py b/test/modules/http3/test_017_listen_address.py new file mode 100644 index 00000000000..22a1c12e795 --- /dev/null +++ b/test/modules/http3/test_017_listen_address.py @@ -0,0 +1,205 @@ +import re +import socket +import sys +import time + +import pytest + +from .env import H3Conf + +# All of 127.0.0.0/8 is local on Linux, so a second loopback address shows +# whether HTTP/3 answers on an address httpd was not told to listen on. +OTHER_ADDR = "127.0.0.2" +NOT_STARTED = r'.*HTTP/3 is not started' + + +def free_port(env) -> int: + """A port free for UDP and for TCP on 127.0.0.1.""" + for _ in range(20): + port = env.free_udp_port() + s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + try: + s.bind(("127.0.0.1", port)) + return port + except OSError: + continue + finally: + s.close() + pytest.fail("no free port for TCP and UDP") + + +def has_ipv6_loopback() -> bool: + try: + with socket.socket(socket.AF_INET6, socket.SOCK_DGRAM) as s: + s.bind(("::1", 0)) + return True + except OSError: + return False + + +def h3_vhost_on(env, port, listen, directives=None): + """The HTTP/3 host on its own port, with the given Listen lines.""" + conf = H3Conf(env) + conf.add(listen) + conf.start_vhost(domains=[env.h3_domain], port=port, + doc_root="htdocs/test1", with_ssl=True) + conf.add_h3_protocol() + conf.add(directives or []) + conf.end_vhost() + conf.install() + + +def get(env, port, addr, h3=True): + """GET /alive.json from the HTTP/3 host on port, connecting to addr.""" + url = f"https://{env.h3_domain}:{port}/alive.json" + target = f"[{addr}]" if ":" in addr else addr + options = ["--connect-to", f"{env.h3_domain}:{port}:{target}:{port}", + "--connect-timeout", "3"] + if h3: + return env.h3_get(url, options=options) + return env.curl_raw([url], options=["--http1.1"] + options) + + +def udp_bindable(addr, port) -> bool: + family = socket.AF_INET6 if ":" in addr else socket.AF_INET + s = socket.socket(family, socket.SOCK_DGRAM) + try: + s.bind((addr, port)) + return True + except OSError: + return False + finally: + s.close() + + +@pytest.mark.skipif(sys.platform != "linux", + reason="needs a second loopback address") +class TestListenAddress: + + @pytest.fixture(autouse=True, scope='class') + @classmethod + def _class_scope(cls, env): + env.require_curl_http3() + + # Listen with an address: HTTP/3 is served on that address only, like TCP + def test_h3_017_01_single_address(self, env): + port = free_port(env) + h3_vhost_on(env, port, [f"Listen 127.0.0.1:{port}"]) + assert env.apache_restart() == 0 + assert env.wait_udp_port(port) + r = get(env, port, "127.0.0.1") + assert r.exit_code == 0, f"{r}" + assert r.response["protocol"] == "HTTP/3" + assert r.response["status"] == 200 + # TCP is not served on the other address, so neither is HTTP/3 + assert get(env, port, OTHER_ADDR, h3=False).exit_code != 0 + r = get(env, port, OTHER_ADDR) + assert r.exit_code != 0, f"HTTP/3 answered on {OTHER_ADDR}: {r}" + # the QUIC socket holds 127.0.0.1 alone, not the whole port + assert udp_bindable(OTHER_ADDR, port) + + # Listen with no address: HTTP/3 is served on every address, as before + def test_h3_017_02_wildcard(self, env): + port = free_port(env) + h3_vhost_on(env, port, [f"Listen {port}"]) + assert env.apache_restart() == 0 + assert env.wait_udp_port(port) + for addr in ["127.0.0.1", OTHER_ADDR]: + r = get(env, port, addr) + assert r.exit_code == 0, f"{addr}: {r}" + assert r.response["status"] == 200 + + # Several addresses cannot share the one QUIC socket: HTTP/3 stays off + # rather than answer on every address, and TCP is served as configured + def test_h3_017_03_several_addresses(self, env): + port = free_port(env) + h3_vhost_on(env, port, [f"Listen 127.0.0.1:{port}", + f"Listen {OTHER_ADDR}:{port}"]) + assert env.apache_restart() == 0 + assert env.httpd_error_log.scan_recent(re.compile(NOT_STARTED), + timeout=5) + env.httpd_error_log.ignore_recent(matches=[NOT_STARTED]) + assert not env.udp_port_in_use(port) + for addr in ["127.0.0.1", OTHER_ADDR]: + r = get(env, port, addr, h3=False) + assert r.exit_code == 0, f"{addr}: {r}" + assert r.response["status"] == 200 + assert "alt-svc" not in r.response["header"], f"{r.response}" + + # a graceful restart to another Listen address binds the QUIC socket + # again, rather than keep serving the old address + def test_h3_017_04_graceful_new_address(self, env): + port = free_port(env) + h3_vhost_on(env, port, [f"Listen 127.0.0.1:{port}"]) + assert env.apache_restart() == 0 + assert get(env, port, "127.0.0.1").exit_code == 0 + env.rewrite_test_conf(f"Listen 127.0.0.1:{port}", + f"Listen {OTHER_ADDR}:{port}") + assert env.apache_reload() == 0 + # the old generation may drain for a moment, so allow some time + r = None + for _ in range(50): + r = get(env, port, OTHER_ADDR) + if r.exit_code == 0: + break + time.sleep(0.2) + assert r.exit_code == 0, f"{r}" + assert r.response["status"] == 200 + for _ in range(50): + r = get(env, port, "127.0.0.1") + if r.exit_code != 0: + break + time.sleep(0.2) + assert r.exit_code != 0, f"HTTP/3 still answered on 127.0.0.1: {r}" + + # an H3Port of its own keeps the address of the host's TCP Listen + def test_h3_017_05_own_h3_port(self, env): + port = free_port(env) + h3_port = free_port(env) + h3_vhost_on(env, port, [f"Listen 127.0.0.1:{port}"], + directives=[f"H3Port {h3_port}"]) + assert env.apache_restart() == 0 + assert env.wait_udp_port(h3_port) + r = get(env, h3_port, "127.0.0.1") + assert r.exit_code == 0, f"{r}" + assert r.response["status"] == 200 + r = get(env, h3_port, OTHER_ADDR) + assert r.exit_code != 0, f"HTTP/3 answered on {OTHER_ADDR}: {r}" + assert udp_bindable(OTHER_ADDR, h3_port) + + # an IPv6 address is served alone, not as a dual-stack socket + @pytest.mark.skipif(not has_ipv6_loopback(), reason="no ::1") + def test_h3_017_06_ipv6_address(self, env): + port = free_port(env) + h3_vhost_on(env, port, [f"Listen [::1]:{port}"]) + assert env.apache_restart() == 0 + r = get(env, port, "::1") + assert r.exit_code == 0, f"{r}" + assert r.response["status"] == 200 + r = get(env, port, "127.0.0.1") + assert r.exit_code != 0, f"HTTP/3 answered on 127.0.0.1: {r}" + assert udp_bindable("127.0.0.1", port) + + # a host with no port of its own is served by every listener, here the + # wildcard ones of the test setup and one address: HTTP/3 stays off + # rather than bind the wildcard + def test_h3_017_07_host_without_port(self, env): + port = free_port(env) + conf = H3Conf(env) + conf.add(f"Listen 127.0.0.3:{port}") + conf.add([ + "", + f"ServerName {env.h3_domain}", + "DocumentRoot htdocs/test1", + "SSLEngine on", + ]) + for cred in env.get_credentials_for_name(env.h3_domain): + conf.add_certificate(cred.cert_file, cred.pkey_file) + conf.add_h3_protocol() + conf.add([f"H3Port {port}", ""]) + conf.install() + assert env.apache_restart() == 0 + assert env.httpd_error_log.scan_recent(re.compile(NOT_STARTED), + timeout=5) + env.httpd_error_log.ignore_recent(matches=[NOT_STARTED]) + assert not env.udp_port_in_use(port)