Artix Linux Forum

Init systems => S6 => Topic started by: Piere on 21 October 2022, 03:32:32

Title: DNSCrypt for s6
Post by: Piere on 21 October 2022, 03:32:32
How do you run DNSCrypt for s6? I have it as sudo s6-rc-bundle add default and I've followed the Arch wiki https://wiki.archlinux.org/title/Dnscrypt-proxy. Has anyone here got this working?
Title: Re: DNSCrypt for s6
Post by: Lancia on 21 October 2022, 09:09:08
What exactly is your problem? does your service not start?
Title: Re: DNSCrypt for s6
Post by: Piere on 21 October 2022, 13:49:18
Yeah it's not starting, I still have a DNS leak afterwards.
Title: Re: DNSCrypt for s6
Post by: Piere on 21 October 2022, 13:52:14
I have the s6 scripts for DNSCrypt too.
Title: Re: DNSCrypt for s6
Post by: Arch_user on 21 October 2022, 14:57:42
share logs for dnscrypt at path
/var/log/dinit/
Title: Re: DNSCrypt for s6
Post by: Piere on 21 October 2022, 15:02:39
This directory doesn't exist for me.
Title: Re: DNSCrypt for s6
Post by: Dudemanguy on 21 October 2022, 16:01:20
I've never used this service before but installing it and starting it with the usual s6 command (s6-rc -u change dnscrypt-proxy) shows that the executable runs.
Title: Re: DNSCrypt for s6
Post by: Piere on 21 October 2022, 16:17:58
I'm getting "s6-rc-u command not found"
Title: Re: DNSCrypt for s6
Post by: Dudemanguy on 21 October 2022, 16:20:07
It's
Code: [Select]
s6-rc -u change dnscrypt-proxy

Notice the space.
Title: Re: DNSCrypt for s6
Post by: Piere on 21 October 2022, 16:20:50
I tried that too and I still have a DNS leak
Title: Re: DNSCrypt for s6
Post by: Piere on 21 October 2022, 16:30:47
Does DNSCrypt only work for systemd?
Title: Re: DNSCrypt for s6
Post by: Lancia on 21 October 2022, 16:47:14
I tried that too and I still have a DNS leak
did you try setting your /etc/resolv.conf to your dnscrypt local ip?
Title: Re: DNSCrypt for s6
Post by: Piere on 21 October 2022, 16:53:24
Whatever change I make to resolv.conf it resets back to 127.0.0.1
Title: Re: DNSCrypt for s6
Post by: Dudemanguy on 21 October 2022, 18:00:44
I tried that too and I still have a DNS leak

Is the binary running? That's the important part. If dnscrypt-proxy is running, then you know it's not an s6 issue. You need to configure the application correctly (however you do that; I do not know).
Title: Re: DNSCrypt for s6
Post by: Piere on 21 October 2022, 18:26:48
It's a daemon process, I've tried dnsmasq, stubby and dnscrypt. None of these work for me for some reason. Looking around the Artix forum I've seen some people who've claimed they had it running but idk what they did to get it to work. I'm not going to bother working on this anymore unless someone can share the steps in getting this running.
Title: Re: DNSCrypt for s6
Post by: Arch_user on 22 October 2022, 05:21:53
Whatever change I make to resolv.conf it resets back to 127.0.0.1
https://wiki.archlinux.org/title/Domain_name_resolution#Overwriting_of_/etc/resolv.conf
Title: Re: DNSCrypt for s6
Post by: Lancia on 22 October 2022, 06:30:08
Run dnscrypt-proxy from the terminal and see what it says.
Title: Re: DNSCrypt for s6
Post by: Piere on 22 October 2022, 14:41:24
[FATAL] Unable to load the configuration file [dnscrypt-proxy.toml] -- Maybe use the -config command-line switch?
Title: Re: DNSCrypt for s6
Post by: Arch_user on 22 October 2022, 17:03:18
[FATAL] Unable to load the configuration file [dnscrypt-proxy.toml] -- Maybe use the -config command-line switch?

Code: [Select]
/usr/bin/dnscrypt-proxy -config /etc/dnscrypt-proxy/dnscrypt-proxy.toml
try this command

Edit : https://gitea.artixlinux.org/artix/s6-services/src/commit/f825fe17f9b24edca05a6c9cae5083fbb14acada/dnscrypt-proxy/dnscrypt-proxy-srv/run#L3

service contain same line

Question : Do you use network manager? if so have you disabled network manager dns ?
Title: Re: DNSCrypt for s6
Post by: Piere on 22 October 2022, 17:51:58
I do but I've tried with and without network manager.
Title: Re: DNSCrypt for s6
Post by: Piere on 22 October 2022, 21:47:11
You want me to replace the command at the bottom of the script to [ /usr/bin/dnscrypt-proxy -config /etc/dnscrypt-proxy/dnscrypt-proxy.toml ] ?
Title: Re: DNSCrypt for s6
Post by: Piere on 22 October 2022, 22:02:55
What's the equivalent to a "socket" for s6? saw it in this tutorial https://youtube.com/watch?v=587F2-eKBqc

Also I did everything in this vid exactly the way he did it except for the systemd socket parts.

Title: Re: DNSCrypt for s6
Post by: Dudemanguy on 22 October 2022, 22:46:40
All unix systems have sockets. Systemd has a file format for specifying socket paths that can be used as part of the dependencies/services (no other init systems have that). This shouldn't actually matter though. Again, I have no idea how this program works, but presumably it just uses a path to make some socket file somewhere and it should be totally capable of doing that on its own.
Title: Re: DNSCrypt for s6
Post by: Piere on 22 October 2022, 23:33:47
Tried the systemd routing thing by making some dummy type files and it didn't work either
Title: Re: DNSCrypt for s6
Post by: Lancia on 23 October 2022, 18:48:37
Tried the systemd routing thing by making some dummy type files and it didn't work either
Stop going off track, what did executing /usr/bin/dnscrypt-proxy -config /etc/dnscrypt-proxy/dnscrypt-proxy.toml on the command line give you?
Title: Re: DNSCrypt for s6
Post by: Piere on 23 October 2022, 19:34:30
No need to be rude, the command did nothing.
Title: Re: DNSCrypt for s6
Post by: Piere on 24 October 2022, 03:36:44
There's a package called "s6-dns" would there be any useful commands in there for configuring dnscrypt?
Title: Re: DNSCrypt for s6
Post by: Dudemanguy on 24 October 2022, 16:24:02
That's completely different, unrelated software.
Title: Re: DNSCrypt for s6
Post by: Arch_user on 25 October 2022, 20:28:58
I do but I've tried with and without network manager.
resolve.conf must be configured (https://wiki.archlinux.org/title/Dnscrypt-proxy#Modify_resolv.conf) inorder to work dnscrypt-proxy
Some programs overwrite this file . i.e NetworkManager Read this section and apply what is written there https://wiki.archlinux.org/title/NetworkManager#Unmanaged_/etc/resolv.conf
Then restart NetworkManager and dnscrypt service file and read logs
Title: Re: DNSCrypt for s6
Post by: Arch_user on 25 October 2022, 20:33:36
share logs for dnscrypt at path
/var/log/dinit/
There was mistake by me , you need to look logs at /var/log/ directory
Title: Re: DNSCrypt for s6
Post by: Piere on 25 October 2022, 22:14:29
There's a folder called dnscrypt-proxy which contain 3 readable files but they're all empty
Title: Re: DNSCrypt for s6
Post by: Piere on 25 October 2022, 22:16:07
Even when I do this https://wiki.archlinux.org/title/NetworkManager#Unmanaged_/etc/resolv.conf the resolv.conf goes back to

nameserver ::1
nameserver 127.0.0.1

When I add options edns0, it doesn't save.
Title: Re: DNSCrypt for s6
Post by: Lancia on 26 October 2022, 13:26:10
At this point you're just better off making the file immutable so you can see if dnscrypt-proxy works at all, execute chattr +i /etc/resolv.conf

No need to be rude, the command did nothing.

As in what? what output did it give?
Title: Re: DNSCrypt for s6
Post by: Piere on 26 October 2022, 13:47:05
It gave no output.

The same goes for  chattr +i /etc/resolv.conf. I tried running it as sudo too with no result.





Title: Re: DNSCrypt for s6
Post by: Arch_user on 26 October 2022, 18:22:57
On my system
when I run : sudo dnscrypt-proxy -config /etc/dnscrypt-proxy/dnscrypt-proxy.toml
output
Code: [Select]
[2022-10-26 21:19:33] [NOTICE] dnscrypt-proxy 2.1.2
[2022-10-26 21:19:33] [NOTICE] Network connectivity detected
[2022-10-26 21:19:33] [NOTICE] Now listening to 127.0.0.1:53 [UDP]
[2022-10-26 21:19:33] [NOTICE] Now listening to 127.0.0.1:53 [TCP]
[2022-10-26 21:19:33] [NOTICE] Now listening to [::1]:53 [UDP]
[2022-10-26 21:19:33] [NOTICE] Now listening to [::1]:53 [TCP]
[2022-10-26 21:19:35] [WARNING] /var/cache/dnscrypt-proxy/public-resolvers.md: open /var/cache/dnscrypt-proxy/sf-ks4l7qiijhbbmspo.tmp: no such file or directory
[2022-10-26 21:19:35] [NOTICE] Source [public-resolvers] loaded
[2022-10-26 21:19:35] [NOTICE] Firefox workaround initialized
[2022-10-26 21:19:41] [NOTICE] [scaleway-fr] TIMEOUT
[2022-10-26 21:19:46] [NOTICE] [resolver4.dns.openinternet.io] TIMEOUT
[2022-10-26 21:19:52] [NOTICE] [quad9-dnscrypt-ip4-nofilter-pri] TIMEOUT
[2022-10-26 21:19:54] [NOTICE] [doh.ffmuc.net] OK (DoH) - rtt: 610ms
[2022-10-26 21:19:56] [NOTICE] [uncensoreddns-ipv4] OK (DoH) - rtt: 409ms
[2022-10-26 21:19:59] [NOTICE] [nextdns-ultralow] OK (DoH) - rtt: 283ms
[2022-10-26 21:20:05] [NOTICE] [dnscrypt.ca-2] TIMEOUT
[2022-10-26 21:20:06] [NOTICE] [sby-doh-limotelu] OK (DoH) - rtt: 407ms
[2022-10-26 21:20:12] [NOTICE] [saldns01-conoha-ipv4] TIMEOUT
[2022-10-26 21:20:14] [NOTICE] [ams-doh-nl] OK (DoH) - rtt: 307ms
[2022-10-26 21:20:20] [NOTICE] [saldns03-conoha-ipv4] TIMEOUT
[2022-10-26 21:20:22] [NOTICE] [jp.tiar.app-doh] OK (DoH) - rtt: 270ms
[2022-10-26 21:20:23] [NOTICE] [dns.ryan-palmer] OK (DoH) - rtt: 204ms
[2022-10-26 21:20:23] [NOTICE] [quad9-doh-ip4-port443-nofilter-pri] OK (DoH) - rtt: 201ms
[2022-10-26 21:20:29] [NOTICE] [dnscrypt.be] TIMEOUT
[2022-10-26 21:20:34] [NOTICE] [altername] TIMEOUT
[2022-10-26 21:20:35] [NOTICE] [quad9-doh-ip4-port5053-nofilter-pri] OK (DoH) - rtt: 162ms
[2022-10-26 21:20:37] [NOTICE] [dnscrypt.ca-2-doh] OK (DoH) - rtt: 309ms
[2022-10-26 21:20:43] [NOTICE] [plan9dns-fl] TIMEOUT
[2022-10-26 21:20:43] [NOTICE] [bortzmeyer] OK (DoH) - rtt: 208ms

cat /etc/resolv.conf
Code: [Select]
# Generated by NetworkManager
nameserver 192.168.1.1
Title: Re: DNSCrypt for s6
Post by: Piere on 26 October 2022, 20:13:19
I think I might've found the reason why my resolv.conf changes, I had connman still installed after I installed NetworkManager. Issue now is that I can't connect to the internet since I've removed connman.

The command you posted above still doesn't show anything for me for some reason.
Title: Re: DNSCrypt for s6
Post by: Lancia on 26 October 2022, 20:15:54
>The same goes for  chattr +i /etc/resolv.conf. I tried running it as sudo too with no result.

That's natural, you can verify that the immutable flag has been set using lsattr(1)
Title: Re: DNSCrypt for s6
Post by: Piere on 26 October 2022, 20:25:49
I changed it back to -i earlier so I could edit resolv.conf again to see if something I did worked. Now i'm stuck with "fatal: networkmanager is not a recognized identifier in run/s6-db/state" when I try to run networkmanager instead of connman. Btw yes I have the networkmanager s6 script.
Title: Re: DNSCrypt for s6
Post by: Arch_user on 26 October 2022, 20:55:30
there is no need to remove connman pkg , connman and networkmanager should not running at same time
Title: Re: DNSCrypt for s6
Post by: Piere on 26 October 2022, 21:19:30
Connman was altering my resolv.conf which is the reason why I removed it.

Anyone got any ideas how to run networkmanager through s6 without the  "fatal: networkmanager is not a recognized identifier in run/s6-db/state" message?
Title: Re: DNSCrypt for s6
Post by: Arch_user on 26 October 2022, 21:34:01
update s6 db
Title: Re: DNSCrypt for s6
Post by: Piere on 26 October 2022, 21:37:46
That's what I did right after I installed the s6 script for it earlier, I also made it a default service.
Title: Re: DNSCrypt for s6
Post by: Piere on 26 October 2022, 21:50:47
Figured out the internet issue I had to rename the service from networkmanager to NetworkManager
Title: Re: DNSCrypt for s6
Post by: Piere on 26 October 2022, 21:56:25
Conman was the issue. I've fixed my DNS leak and my connectivity issue. Thanks for helping me everyone for the past couple of days.