Skip to content

Conversation

@hodorogandrei
Copy link

This PR aims to address #5162

Problem

When multiple bootstrap resolvers are configured in the "Fallback Resolver" field (e.g., 1.1.1.1:53,9.9.9.9:53), the template generates invalid TOML:

bootstrap_resolvers = ['1.1.1.1:53,9.9.9.9:53']

This causes dnscrypt-proxy to fail to start with:

[FATAL] Bootstrap resolver [...]: Host does not parse as IP '1.1.1.1:53,9.9.9.9:53'

Root Cause

This bug seems to have been introduced introduced in commit 1eec51a which renamed fallback_resolver (a single string) to bootstrap_resolvers (a TOML array) but did not update the template syntax.

Solution

Applied the same split/join pattern already used for listen_addresses, server_names, disabled_server_names, and relaylist in the same template file.

Testing

Tested on OPNsense 25.7.10 with os-dnscrypt-proxy 1.16 - dnscrypt-proxy starts successfully with multiple bootstrap resolvers.

…ated servers

When multiple bootstrap resolvers are configured in the "Fallback Resolver"
field (e.g., "1.1.1.1:53,9.9.9.9:53"), the generated config incorrectly
places the comma inside a single string:

  bootstrap_resolvers = ['1.1.1.1:53,9.9.9.9:53']

This causes dnscrypt-proxy to fail with:

  [FATAL] Bootstrap resolver [...]: Host does not parse as IP '1.1.1.1:53,9.9.9.9:53'

The fix applies the same split/join pattern already used for listen_addresses,
server_names, disabled_server_names, and relaylist in the same template:

  bootstrap_resolvers = ['1.1.1.1:53','9.9.9.9:53']

This bug was introduced in commit 1eec51a which renamed fallback_resolver
to bootstrap_resolvers but did not update the template syntax from a single
string to a TOML array format.
{% endif %}

bootstrap_resolvers = ['{{ OPNsense.dnscryptproxy.general.fallback_resolver }}']
bootstrap_resolvers = [{{ "'" + ("','".join(OPNsense.dnscryptproxy.general.fallback_resolver.split(','))) + "'" }}]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we do this to keep closer to the original and move join to the end?

Suggested change
bootstrap_resolvers = [{{ "'" + ("','".join(OPNsense.dnscryptproxy.general.fallback_resolver.split(','))) + "'" }}]
bootstrap_resolvers = ['{{ OPNsense.dnscryptproxy.general.fallback_resolver.split(',') | join("','") }}']

Copy link
Author

@hodorogandrei hodorogandrei Jan 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fichtner Thank you for the suggestion! 🙏 The Jinja2 filter syntax is indeed more readable and idiomatic:

bootstrap_resolvers = ['{{ OPNsense.dnscryptproxy.general.fallback_resolver.split(',') | join("','") }}']

However, I intentionally matched the existing pattern used elsewhere in this template for consistency.

Line 4:

server_names = [{{ "'" + ("','".join(OPNsense.dnscryptproxy.general.serverlist.split(','))) + "'" }}]

Line 8:

disabled_server_names = [{{ "'" + ("','".join(OPNsense.dnscryptproxy.general.disabled_serverlist.split(','))) + "'" }}]

Line 12:

listen_addresses = [{{ "'" + ("','".join(OPNsense.dnscryptproxy.general.listen_addresses.split(','))) + "'" }}]

Line 192:

via=[{{ "'" + ("','".join(OPNsense.dnscryptproxy.general.relaylist.split(','))) + "'" }}]

Options (I'm happy to go either way):

  • Option A — Keep current syntax for consistency with existing code

  • Option B — Use the suggested Jinja2 filter syntax and update all occurrences (lines 4, 8, 12, 98, 192) to standardise

NOTE: If you prefer Option B, I can submit a follow-up commit refactoring all five occurrences to the cleaner filter syntax.

Please let me know your preference!

@fichtner fichtner self-assigned this Jan 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants