Skip to content

Commit

Permalink
LibDNS+LibWeb+Ladybird+RequestServer: Let there be DNS over TLS
Browse files Browse the repository at this point in the history
This commit adds our own DNS resolver, with the aim of implementing DoT
(and eventually DoH, maybe even DNSSEC etc.)
  • Loading branch information
alimpfard committed Nov 2, 2024
1 parent 655e109 commit 73e401a
Show file tree
Hide file tree
Showing 14 changed files with 2,582 additions and 2 deletions.
14 changes: 13 additions & 1 deletion Ladybird/HelperProcess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,19 @@ ErrorOr<NonnullRefPtr<Requests::RequestClient>> launch_request_server_process(Re
arguments.append(server.value());
}

return launch_server_process<Requests::RequestClient>("RequestServer"sv, candidate_request_server_paths, move(arguments));
auto client = TRY(launch_server_process<Requests::RequestClient>("RequestServer"sv, candidate_request_server_paths, move(arguments)));
WebView::Application::chrome_options().dns_settings.visit(
[](WebView::SystemDNS) {},
[&](WebView::DNSOverTLS const& dns_over_tls) {
dbgln("Setting DNS server to {}:{} with TLS", dns_over_tls.server_address, dns_over_tls.port);
client->async_set_dns_server(dns_over_tls.server_address, dns_over_tls.port, true);
},
[&](WebView::DNSOverUDP const& dns_over_udp) {
dbgln("Setting DNS server to {}:{}", dns_over_udp.server_address, dns_over_udp.port);
client->async_set_dns_server(dns_over_udp.server_address, dns_over_udp.port, false);
});

return client;
}

ErrorOr<IPC::File> connect_new_request_server_client(Requests::RequestClient& client)
Expand Down
1 change: 1 addition & 0 deletions Ladybird/RequestServer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ find_package(CURL REQUIRED)

add_executable(RequestServer main.cpp)
target_link_libraries(RequestServer PRIVATE requestserverservice)
target_link_libraries(RequestServer PRIVATE LibDNS)

target_include_directories(requestserverservice PRIVATE ${LADYBIRD_SOURCE_DIR}/Userland/Services/)
target_include_directories(requestserverservice PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/..)
Expand Down
3 changes: 3 additions & 0 deletions Meta/Lagom/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@ set(lagom_standard_libraries
Compress
Crypto
Diff
DNS
HTTP
IPC
JS
Expand Down Expand Up @@ -448,6 +449,8 @@ endif()
# Lagom Utilities
lagom_utility(abench SOURCES ../../Userland/Utilities/abench.cpp LIBS LibMain LibFileSystem LibMedia)

lagom_utility(dns SOURCES ../../Userland/Utilities/dns.cpp LIBS LibDNS LibMain LibTLS LibCrypto)

if (ENABLE_GUI_TARGETS)
lagom_utility(animation SOURCES ../../Userland/Utilities/animation.cpp LIBS LibGfx LibMain)
lagom_utility(icc SOURCES ../../Userland/Utilities/icc.cpp LIBS LibGfx LibMain LibURL)
Expand Down
6 changes: 6 additions & 0 deletions Userland/Libraries/LibDNS/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
set(SOURCES
Message.cpp
)

serenity_lib(LibDNS dns)
target_link_libraries(LibDNS PRIVATE LibCore)
Loading

0 comments on commit 73e401a

Please sign in to comment.