Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dnsdist: Add a new, optional, YAML-based configuration format #14969

Merged
merged 49 commits into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
91a5e3e
dnsdist: Add yaml-based descriptions of actions and selectors
rgacogne Dec 24, 2024
baa62a6
dnsdist: Add a yaml-based description of settings
rgacogne Dec 24, 2024
8ccbe63
dnsdist: Move functions from dnsdist-actions.hh to dnsdist-actions.cc
rgacogne Dec 24, 2024
373554e
dnsdist: Fix automatic computation of the number of TCP workers
rgacogne Dec 24, 2024
1ca68f9
dnsdist: Make SNMP configuration immutable
rgacogne Dec 24, 2024
dc40ab2
dnsdist: Properly handle built-in LB policies
rgacogne Dec 24, 2024
3bb0302
dnsdist: Move handling of backend parameters out of the Lua code
rgacogne Dec 24, 2024
d8042f9
dnsdist: Stop using `LimitTTLResponseAction` to limit TTL
rgacogne Dec 24, 2024
2358044
dnsdist: Stop using Actions for regular processing
rgacogne Dec 24, 2024
0bd909b
dnsdist: Move HTTP rules to dnsdist-rules.cc
rgacogne Dec 24, 2024
91e9f1f
dnsdist: Add a dynamic block rules group register
rgacogne Dec 24, 2024
8daefa5
dnsdist: Move DNSRule declaration to dnsdist-rules.hh
rgacogne Dec 24, 2024
4458146
dnsdist: Move rules to dnsdist-rules-factory.hh
rgacogne Dec 24, 2024
a316e48
dnsdist: Fix error message for invalid TLS version
rgacogne Dec 24, 2024
02196ee
QClass: Construct from a string
rgacogne Dec 24, 2024
21f43b3
dnsdist: Move the Lua bindings for single items to a separate file
rgacogne Dec 24, 2024
b5fe615
dnsdist: Add an optional YAML configuration switch
rgacogne Aug 23, 2024
42ae11c
dnsdist: Generate C++ factory and Lua bindings code from YAML definit…
rgacogne Dec 24, 2024
d5ad413
dnsdist: Actually move selectors and actions to proper factories
rgacogne Dec 24, 2024
bc4b1be
dnsdist: Add yaml configuration
rgacogne Dec 24, 2024
64e3851
dnsdist: Use the rules factory to unit test them
rgacogne Dec 24, 2024
c493982
dnsdist: Load the yaml configuration
rgacogne Dec 24, 2024
4881df5
dnsdist: Add a tool to generate the yaml configuration
rgacogne Dec 24, 2024
541d244
dnsdist: Clean up the dnsdist protobuf header
rgacogne Dec 24, 2024
bf238d1
dnsdist: Add regression tests using the yaml configuration
rgacogne Dec 24, 2024
58727d9
dnstap: Clean up the dnstap header
rgacogne Dec 24, 2024
96b4e09
dnsdist: Generate the YAML documentation
rgacogne Dec 27, 2024
aabcee7
dnsdist: Handle DNSCrypt in the YAML configuration
rgacogne Dec 27, 2024
31467a5
dnsdist: Handle the default LB policy in YAML configuration
rgacogne Dec 27, 2024
0f09283
dnsdist: Remove unused Rust validation functions
rgacogne Dec 27, 2024
7d05eed
dnsdist: Add more YAML example to the documentation
rgacogne Dec 27, 2024
f74a03f
dnsdist: Implement XSK and eBPF via YAML
rgacogne Dec 27, 2024
759d46e
dnsdist: Reduce the complexity of the YAML loading function
rgacogne Dec 27, 2024
3b7b5cc
dnsdist: Fix a small formatting issue
rgacogne Dec 30, 2024
be6d0cd
dnsdist: Support inline and "detached to a file" Lua code in YAML
rgacogne Jan 7, 2025
31ade80
dnsdist: Fix clang-tidy warnings
rgacogne Jan 9, 2025
e72775a
dnsdist: Stop cleaning dnsdist-configuration-yaml-items-generated.cc …
rgacogne Jan 13, 2025
9d43f5d
dnsdist: Use '_' between YAML words, not '-'
rgacogne Jan 13, 2025
e176292
dnsdist: Exit on YAML configuration error
rgacogne Jan 13, 2025
70145f7
dnsdist: Fix formatting
rgacogne Jan 13, 2025
2375bcb
dnsdist: More description in the YAML settings documentation
rgacogne Jan 13, 2025
9cbb023
dnsdist: Yet more descriptions in the YAML documentation
rgacogne Jan 14, 2025
648088a
dnsdist: Use the better wording suggested by Otto in the upgrade notes
rgacogne Jan 16, 2025
5df1346
dnsdist: Fix Rust warnings, be consistent in the naming of YAML objects
rgacogne Jan 16, 2025
68b8ae9
dnsdist: Fix the handling of default values for YAML list of strings
rgacogne Jan 16, 2025
80f729f
dnsdist: Simplify the handle of flat settings from YAML
rgacogne Jan 16, 2025
01868f1
dnsdist: Add a few missing settings to the YAML configuration
rgacogne Jan 16, 2025
1530d67
dnsdist: Ad more missing description for YAML settings
rgacogne Jan 17, 2025
d9f0869
dnsdist: Fix broken refs and formatting issues in the YAML docs
rgacogne Jan 17, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/actions/spell-check/expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1212,6 +1212,7 @@ scopemask
sdfn
sdfoijdfio
sdig
secnumdepth
secpoll
securitypolicy
securitypolling
Expand All @@ -1227,6 +1228,7 @@ servfail
servicemode
setaffinity
setcontent
setcounter
setdomainmetadata
seting
setkey
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/build-and-test-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,8 @@ jobs:
path: ~/.ccache
key: dnsdist-${{ matrix.features }}-${{ matrix.sanitizers }}-ccache-${{ steps.get-stamp.outputs.stamp }}
restore-keys: dnsdist-${{ matrix.features }}-${{ matrix.sanitizers }}-ccache-
- run: inv install-lld-linker-if-needed
working-directory: ./pdns/dnsdistdist/
- run: inv ci-install-rust ${{ env.REPO_HOME }}
working-directory: ./pdns/dnsdistdist/
- run: inv ci-build-and-install-quiche ${{ env.REPO_HOME }}
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@ jobs:
if: matrix.product == 'dnsdist'
run: |
inv install-dnsdist-build-deps --skipXDP
# installing the python3-package does not work because of actions/setup-python which installs a different version in /opt/hostedtoolcache/Python
- name: Install python yaml
run: |
pip install pyyaml
- name: Autoreconf dnsdist
if: matrix.product == 'dnsdist'
working-directory: ./pdns/dnsdistdist/
Expand Down
49 changes: 47 additions & 2 deletions pdns/dnsdistdist/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,19 @@ AM_CPPFLAGS += $(SYSTEMD_CFLAGS) \
$(NGHTTP2_CFLAGS) \
$(LIBCAP_CFLAGS) \
-I$(top_srcdir)/ext/protozero/include \
-I$(top_srcdir)/dnsdist-rust-lib \
-I$(top_builddir)/dnsdist-rust-lib \
-I$(top_srcdir)/dnsdist-rust-lib/rust/src \
-DSYSCONFDIR=\"${sysconfdir}\" \
-DBOOST_CONTAINER_USE_STD_EXCEPTIONS

DNSDIST_RUST_LIBS = $(top_builddir)/dnsdist-rust-lib/rust/libdnsdist_rust.a $(LIBDL)

ACLOCAL_AMFLAGS = -I m4

SUBDIRS=ext/arc4random \
SUBDIRS=dnsdist-rust-lib \
dnsdist-rust-lib/rust \
ext/arc4random \
ext/ipcrypt \
ext/yahttp

Expand All @@ -28,7 +35,13 @@ dnslabeltext.cc: dnslabeltext.rl
$(AM_V_GEN)$(RAGEL) $< -o dnslabeltext.cc

BUILT_SOURCES=htmlfiles.h \
dnsdist-actions-factory-generated.cc dnsdist-actions-factory-generated.hh \
dnsdist-lua-ffi-interface.inc \
dnsdist-lua-actions-generated.cc dnsdist-lua-response-actions-generated.cc \
dnsdist-response-actions-factory-generated.cc dnsdist-response-actions-factory-generated.hh \
dnsdist-rust-bridge-actions-generated.cc dnsdist-rust-bridge-actions-generated.hh \
dnsdist-rust-bridge-selectors-generated.cc dnsdist-rust-bridge-selectors-generated.hh \
dnsdist-selectors-factory-generated.cc dnsdist-selectors-factory-generated.hh \
dnslabeltext.cc

htmlfiles.h: $(srcdir)/html/* $(srcdir)/incfiles
Expand All @@ -42,6 +55,11 @@ dnsdist-lua-ffi-interface.inc: dnsdist-lua-ffi-interface.h dnsdist-lua-inspectio
SRC_JS_FILES := $(wildcard src_js/*.js)
MIN_JS_FILES := $(patsubst src_js/%.js,html/js/%.min.js,$(SRC_JS_FILES))

dnsdist%generated.cc dnsdist%generated.hh: dnsdist-rules-generator.py dnsdist-actions-definitions.yml dnsdist-response-actions-definitions.yml dnsdist-selectors-definitions.yml
@if test "$(PYTHON)" = ":"; then echo "Actions or selectors definitions have changed, python is needed to regenerate the related files but python was not found. Please install python and re-run configure"; exit 1; fi
@if ! $(PYTHON) --version | grep -q "Python 3"; then echo $(PYTHON) should be at least version 3. Please install python 3 and re-run configure; exit 1; fi
$(PYTHON) dnsdist-rules-generator.py

html/js/%.min.js: src_js/%.js
uglifyjs $< > $@

Expand Down Expand Up @@ -90,6 +108,16 @@ endif
endif

EXTRA_DIST=COPYING \
dnsdist-rules-generator.py \
dnsdist-actions-definitions.yml \
dnsdist-response-actions-definitions.yml \
dnsdist-rust-bridge.hh \
dnsdist-rust-bridge-actions-generated.cc \
dnsdist-rust-bridge-actions-generated.hh \
dnsdist-rust-bridge-selectors-generated.cc \
dnsdist-rust-bridge-selectors-generated.hh \
dnsdist-selectors-definitions.yml \
dnsdist-settings-definitions.yml \
dnslabeltext.rl \
dnsdist.conf-dist \
dnsmessage.proto \
Expand Down Expand Up @@ -144,13 +172,17 @@ dnsdist_SOURCES = \
dns.cc dns.hh \
dns_random.hh \
dnscrypt.cc dnscrypt.hh \
dnsdist-actions.hh \
dnsdist-actions-factory-generated.hh \
dnsdist-actions-factory.cc dnsdist-actions-factory.hh \
dnsdist-actions.cc dnsdist-actions.hh \
dnsdist-async.cc dnsdist-async.hh \
dnsdist-backend.cc dnsdist-backend.hh \
dnsdist-backoff.hh \
dnsdist-cache.cc dnsdist-cache.hh \
dnsdist-carbon.cc dnsdist-carbon.hh \
dnsdist-concurrent-connections.hh \
dnsdist-configuration-yaml-internal.hh \
dnsdist-configuration-yaml.cc dnsdist-configuration-yaml.hh \
dnsdist-configuration.cc dnsdist-configuration.hh \
dnsdist-console.cc dnsdist-console.hh \
dnsdist-crypto.cc dnsdist-crypto.hh \
Expand Down Expand Up @@ -180,6 +212,7 @@ dnsdist_SOURCES = \
dnsdist-lua-bindings-protobuf.cc \
dnsdist-lua-bindings-rings.cc \
dnsdist-lua-bindings.cc \
dnsdist-lua-configuration-items.cc \
dnsdist-lua-ffi-interface.h dnsdist-lua-ffi-interface.inc \
dnsdist-lua-ffi.cc dnsdist-lua-ffi.hh \
dnsdist-lua-hooks.cc dnsdist-lua-hooks.hh \
Expand All @@ -203,8 +236,11 @@ dnsdist_SOURCES = \
dnsdist-resolver.cc dnsdist-resolver.hh \
dnsdist-rings.cc dnsdist-rings.hh \
dnsdist-rule-chains.cc dnsdist-rule-chains.hh \
dnsdist-rules-factory.hh \
dnsdist-rules.cc dnsdist-rules.hh \
dnsdist-secpoll.cc dnsdist-secpoll.hh \
dnsdist-selectors-factory-generated.hh \
dnsdist-self-answers.cc dnsdist-self-answers.hh \
dnsdist-session-cache.cc dnsdist-session-cache.hh \
dnsdist-snmp.cc dnsdist-snmp.hh \
dnsdist-svc.cc dnsdist-svc.hh \
Expand Down Expand Up @@ -274,6 +310,7 @@ testrunner_SOURCES = \
credentials.cc credentials.hh \
dns.cc dns.hh \
dnscrypt.cc dnscrypt.hh \
dnsdist-actions.cc dnsdist-actions.hh \
dnsdist-async.cc dnsdist-async.hh \
dnsdist-backend.cc dnsdist-backend.hh \
dnsdist-backoff.hh \
Expand Down Expand Up @@ -310,7 +347,9 @@ testrunner_SOURCES = \
dnsdist-resolver.cc dnsdist-resolver.hh \
dnsdist-rings.cc dnsdist-rings.hh \
dnsdist-rule-chains.cc dnsdist-rule-chains.hh \
dnsdist-rules-factory.hh \
dnsdist-rules.cc dnsdist-rules.hh \
dnsdist-self-answers.cc dnsdist-self-answers.hh \
dnsdist-session-cache.cc dnsdist-session-cache.hh \
dnsdist-svc.cc dnsdist-svc.hh \
dnsdist-tcp-downstream.cc \
Expand Down Expand Up @@ -419,6 +458,7 @@ endif

if HAVE_RE2
dnsdist_LDADD += $(RE2_LIBS)
testrunner_LDADD += $(RE2_LIBS)
endif

if HAVE_LIBSSL
Expand Down Expand Up @@ -488,6 +528,11 @@ testrunner_SOURCES += doq-common.cc
testrunner_LDADD += $(QUICHE_LDFLAGS) $(QUICHE_LIBS)
endif

if HAVE_YAML_CONFIGURATION
dnsdist_SOURCES += dnsdist-rust-lib/dnsdist-configuration-yaml-items-generated.cc
dnsdist_LDADD += $(DNSDIST_RUST_LIBS)
endif

if !HAVE_LUA_HPP
BUILT_SOURCES += lua.hpp
nodist_dnsdist_SOURCES = lua.hpp
Expand Down
15 changes: 15 additions & 0 deletions pdns/dnsdistdist/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ AC_DEFINE([DNSDIST], [1],
[This is dnsdist]
)

# Warn when pkg.m4 is missing
m4_pattern_forbid([^_?PKG_[A-Z_]+$], [*** pkg.m4 missing, please install pkg-config])

LT_PREREQ([2.2.2])
LT_INIT([disable-static])

Expand Down Expand Up @@ -132,6 +135,12 @@ AS_IF([test "x$enable_dns_over_http3" != "xno"], [
])
])

DNSDIST_ENABLE_YAML

AS_IF([test "x$enable_yaml" != "xno"], [
PDNS_CHECK_CARGO([1.64])
])

DNSDIST_WITH_CDB
PDNS_CHECK_LMDB
PDNS_ENABLE_IPCIPHER
Expand Down Expand Up @@ -190,6 +199,8 @@ AS_IF([test "x$PACKAGEVERSION" != "x"],
)

AC_CONFIG_FILES([Makefile
dnsdist-rust-lib/Makefile
dnsdist-rust-lib/rust/Makefile
ext/arc4random/Makefile
ext/yahttp/Makefile
ext/yahttp/yahttp/Makefile
Expand Down Expand Up @@ -305,5 +316,9 @@ AS_IF([test "x$LMDB_LIBS" != "x"],
[AC_MSG_NOTICE([lmdb: yes])],
[AC_MSG_NOTICE([lmdb: no])]
)
AS_IF([test "x$enable_yaml" != "xno"],
[AC_MSG_NOTICE([YAML configuration: yes])],
[AC_MSG_NOTICE([YAML configuration: no])]
)

AC_MSG_NOTICE([])
Loading