-
-
Notifications
You must be signed in to change notification settings - Fork 116
Add Virtual DNS for IPv6 #558
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
Open
1cho1ce
wants to merge
9
commits into
QubesOS:main
Choose a base branch
from
1cho1ce:add-ipv6-dns
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
2f08148
Add Virtual DNS for IPv6
1cho1ce 98b184c
Add IPv6 DNS if netvm has ipv6 feature enabled. For this there is a n…
1cho1ce f6b43b3
Add IPv6 Virtual DNS support. Also some IPv6 fixes and tests.
1cho1ce 4beee6b
Add support for supported-feature.ipv6 template feature in tests
1cho1ce 4495d21
Fix tests
1cho1ce 58a884d
Fix test
1cho1ce 9b21f78
Fix test
1cho1ce 75503a1
Remove feature supported-feature.ipv6 and add feature supported-featu…
1cho1ce 751518b
Fix test
1cho1ce File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2251,8 +2251,9 @@ def create_qdb_entries(self): | |
str(self.gateway6)) | ||
self.untrusted_qdb.write('/qubes-netvm-netmask', str(self.netmask)) | ||
|
||
for i, addr in zip(('primary', 'secondary'), self.dns): | ||
self.untrusted_qdb.write('/qubes-netvm-{}-dns'.format(i), addr) | ||
if self.netvm is not None: | ||
|
||
for i, addr in zip(('primary', 'secondary'), self.dns): | ||
self.untrusted_qdb.write('/qubes-netvm-{}-dns'.format(i), addr) | ||
|
||
if self.netvm is not None: | ||
self.untrusted_qdb.write('/qubes-mac', str(self.mac)) | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was
self.netvm is not None or self.provides_network
specifically to have virtual DNS addresses in sys-net too. Since you useself.netvm
.features in a line below, you should check forself.features
in case of no netvm. This asymmetric handling of sys-net is a bit weird, I agree, but since the addresses are constant anyway, it works just fine.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way to check if the qube has netvm or not from inside it?
This change was mainly so I could add reject rules to sys-net here based on whatever this qube's netvm DNS servers are set. Without it I couldn't find a way to check if qube is connected to a netvm to determine if it should pass or reject the "virtual" DNS queries.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to note the reason as to why did I check
self.netvm.features.check_with_netvm
is because I wanted to pass the qube usable primary and secondary virtual DNS servers.For example, with ipv6 feature enabled only in sys-vpn and all qubes connected to it, if I just check if sys-vpn has ipv6 feature and give it IPv6 primary and IPv4 secondary virtual DNS servers then it won't be able to use the primary IPv6 server because the sys-vpn's netvm doesn't support IPv6 so it's better to give sys-vpn two IPv4 virtual DNS from netvm that are supported by the qube's netvm.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess I should just check if
/qubes-ip
is set.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That very much depends what your VPN does. If it tunnels all the traffic (IPv4 + IPv6) inside a IPv4 tunnel, then IPv6 DNS should also work. And in that case, the VPN software will set DNS in sys-vpn (in /etc/resolv.conf, or systemd-resolved) to something else than virtual DNS, so all should be fine.
We have two sets of DNS addresses in the qubesdb:
/qubes-primary-dns
,/qubes-secondary-dns
- this is what qube itself should use (and when providing network to others - where should redirect DNS traffic to)/qubes-netvm-primary-dns
,/qubes-netvm-secondary-dns
- this is what addresses should be intercepted and redirected to the actual DNS (which may be the virtual one in connected netvm)The first set in a qube should match the second set in the qube's netvm. I wouldn't be surprised if it's mixed up right now (because we had just one possibility there).
So, lets suppose setup like this: sys-net (no ipv6) -> sys-vpn (ipv6) -> some-vm (ipv6 too, because connected to sys-vpn)
In sys-vpn, if it doesn't tunnel IPv6 DNS into VPN (to some real DNS server), it should have a reject rule on IPv6 virtual DNS address, because sys-net doesn't support it. This can be done by having virtual IPv6 DNS reject rule in postrouting instead of prerouting - then if VPN redirects the IPv6 DNS to somewhere else, it will bypass the reject rule and will work; otherwise it will get rejected (and hopefully the ICMP response will be forwarded back to the client - requires testing).
Yes, that works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've decided to add jump from
dnat-dns
to separate chaincustom-dnat-dns
for VPN rules instead of adding reject rules inpostrouting
orforward
chains for the sake of uniformity in the same way as chaininput
has chaincustom-input
and chainforward
has chaincustom-forward
.VPN should add its DNS redirects to
custom-dnat-dns
chain.I think the PR is ready for a review now.