[Thread] Running dnscrypt-proxy on Android #1785
Replies: 130 comments
-
Exactly how do you build it with gomobile? I tried and it makes an apk which doesn't work. I was thinking of just making a magisk module. It's either that or a root app and I don't know how to make apps. I already updated this unmaintained v1 module for the latest magisk version and some extra improvements, It should be simple enough to adapt to v2. I just need a way to make the binaries. |
Beta Was this translation helpful? Give feedback.
-
It requires an |
Beta Was this translation helpful? Give feedback.
-
Well the linux arm64 variant works seems to fine on my phone. Maybe we don't need android specific binaries after all. Also I have a request, I don't know if it's possible but could you add an option to have paths relative to dnscrypt-proxy.toml? It would be useful since I'm separating the binary from the config files (can't well keep them in /system/xbin). Otherwise every path in dnscrypt-proxy.toml must be a hardcoded absolute path. |
Beta Was this translation helpful? Give feedback.
-
This is the binary file from release page,running on termux.(arm64) Edit:Works fine when I use self-compiled binary.(set port to 5353.) edit(2019.11.03):.
|
Beta Was this translation helpful? Give feedback.
-
Hi, I am trying the arm binaries on my phone and they seem to work fine.
Here is my dnscrypt-proxy.toml: https://pastebin.com/c5HM2SMW |
Beta Was this translation helpful? Give feedback.
-
Is your network usable? |
Beta Was this translation helpful? Give feedback.
-
Ok thank you, the problem was that just after starting dnscrypt-proxy i tryed to divert all dns requests to localhost: iptables -t nat -A OUTPUT -p udp --dport 53 -j DNAT --to-destination 127.0.0.1
iptables -t nat -A OUTPUT -p tcp --dport 53 -j DNAT --to-destination 127.0.0.1 Unfortunately, i don't know how to configure my phone to use 127.0.0.1 as dns server after starting dnscrypt-proxy :( |
Beta Was this translation helpful? Give feedback.
-
I added a guide to building the Android version on a non-Android OS, if anyone's interested. https://github.com/jedisct1/dnscrypt-proxy/wiki/Building-the-Android-version-on-non-Android-OS |
Beta Was this translation helpful? Give feedback.
-
This is fantastic, thank you @Sporif! |
Beta Was this translation helpful? Give feedback.
-
@Sporif are you still planning to release a Magisk module for 15+? |
Beta Was this translation helpful? Give feedback.
-
@JERW86 Yeah I am, it's just going to be a while. Still writing the script that calls dnscrypt-proxy. |
Beta Was this translation helpful? Give feedback.
-
System: Android LOS 7.1.2 latest, amd64 compiled, root, Afwall+ (on/off) moved the folder dnscrypt-proxy to data/local/tmp, all files 777 privileges I encountered the following error while starting it with ./dnscrypt-proxy: I changed the standard configuration file: listen_addresses = ['127.0.0.1:53', '[::1]:53'] If not I got an error that there's no UDP connection possible require_dnssec = false SSH: How can I fix this and run dnscrypt-proxy permantly? |
Beta Was this translation helpful? Give feedback.
-
Looks like you are listening to the same IP and port twice. |
Beta Was this translation helpful? Give feedback.
-
Ok, changed it again to the standard listen addresses gemini:/ $ su |
Beta Was this translation helpful? Give feedback.
-
Try a single address, then: listen_addresses = ['127.0.0.1:53'] |
Beta Was this translation helpful? Give feedback.
-
Don't get me wrong. It's an impressive tutorial which I tried before, but could only get it to work in setting SELinux permissive on boot by adding a line temporarily to dnscrypt-proxy.rc. I am hanging atm in step 4 of you tutorial That seems to work for me output: "Load policy from: /sys/fs/selinux/policy" Step 5. Save and load policy file. supolicy --save /sys/fs/selinux/policy Would be great to get this working :) |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
Yes, if you want to go the hard way, following something proposed 4 years back. What I proposed recently in How to manually root a phone? goes like this:
Also what has been written in your linked answer isn't applicable (at least fully) today. Android's SELinux implementation is very near to mainline Linux kernel now. And all tools designed for the latter also work on Android. I use |
Beta Was this translation helpful? Give feedback.
-
Why are you patching |
Beta Was this translation helpful? Give feedback.
-
Step 4 I did in an adb shell supolicy --live 'allow dns_crypt system_file dir { read open }' supolicy --live 'allow dns_crypt node tcp_socket { node_bind }' supolicy --live 'allow dns_crypt proc_net file { open read }' got after every rule "Load policy from: /sys/fs/selinux/policy" Step 5. Save and load policy file supolicy --save /sys/fs/selinux/policy added to dnscrypt-proxy.rc #enforcing custom SELinux policy loading after reboot After a reboot it works like before, but now I have a separate UID 999 for Dnscrypt and disabled Apps as root (0) permission and got Internet Access. But :) |
Beta Was this translation helpful? Give feedback.
-
So if I can't patch it "live" with supolicy in Android system I need to patch it with magiskinit from PC Android supolicy errors supolicy --live 'allow init dns_crypt process *' supolicy --save /sys/fs/selinux/policy Followed the description here for patchin supolicy on PC (Linux) but supolicy --load policy --save policy.patched 'create dns_crypt' supolicy --load policy --save policy.patched 'create dns_crypt' 'allow init dns_crypt process *' 'allow dns_crypt dns_crypt * *' 'allow dns_crypt system_file dir { read open }' 'allow dns_crypt system_file file { lock entrypoint execute_no_trans }' 'allow dns_crypt node tcp_socket { node_bind }' 'allow dns_crypt node udp_socket { node_bind }' 'allow dns_crypt port tcp_socket { name_bind name_connect }' 'allow dns_crypt port udp_socket { name_bind }' 'allow dns_crypt proc_net file { open read }' 'allow dns_crypt proc_stat file { read }' 'allow dns_crypt properties_device dir { read }' 'allow dns_crypt devpts chr_file { open read write }' Load policy from: policy Can someone please help to patch policy. |
Beta Was this translation helpful? Give feedback.
-
It seems that's not a policy problem, because if I run dnscrypt in permissive mode by adding in the rc-script there's no difference. I've got Internet access, but not through dnscrypt-proxy. AfWall grant access through UID999 (custom script): rc-script adding:
[2020-06-20 10:42:54] [NOTICE] dnscrypt-proxy 2.0.44 I copied the files manual to the /system/etc/dnscrypt-proxy directory and dnscrypt is running as a service [2020-06-20 11:21:15] [NOTICE] dnscrypt-proxy 2.0.44
I got Internet access, but not through dnscrypt-proxy. How should I configure AfWall and dnscrypt to get the Internet access through dnscrypt again and that's the resolver can update the files properly. |
Beta Was this translation helpful? Give feedback.
-
@mirfatif |
Beta Was this translation helpful? Give feedback.
-
There is an issue with DNSCrypt not letting phone to go to sleep and as far as I know you can't solve with any exiting methods, it has to be implemented on the application side. |
Beta Was this translation helpful? Give feedback.
-
AFWall+ anti-leaking boot script - Fallback resolver stuck (HELP NEEDED) Probably you know about anti-leaking script that AFWall+ can put into startup directory and make the OS booting much safer. I have tried some workarounds like granting the access through the extra IPTABLES rules (additional script), but they didn't work for me. It would be nice to find a way making this script working in conjunction with the dnscrypt-proxy. AFWall+ v3.4.0 - Anti-leaking boot script
P.S. Interensting fact (over the years): if I have any kind of troubles with Fallback resolver, manual launching dnscrypt-proxy using adb always works... It would be nice to have the equal reliability by default... I need your help, freinds. |
Beta Was this translation helpful? Give feedback.
-
Before I can configure it (I had dnscrypt-proxy v1 running with custom init/config scripts just fine on my OnePlus), I need to have it built / build it for Android ARM7. My current toolchain is deprecated (OSX & go is depreicated), and I cannot build it in a VM for the same reason. Can someone please build for Android ARM7 and post? Thanks. |
Beta Was this translation helpful? Give feedback.
-
@tehcog - for Arm7, would the alpine build work? |
Beta Was this translation helpful? Give feedback.
-
Hey, I try to run dnscrypt-proxy without root privileges ( dnscrypt-proxy user in
Any ideas how to resolve this? |
Beta Was this translation helpful? Give feedback.
-
Use |
Beta Was this translation helpful? Give feedback.
-
The binary need to have |
Beta Was this translation helpful? Give feedback.
-
Current status:
gomobile
This is fantastic, but not enough for most Android users to easily install and use it.
Since my knowledge of Android is fairly limited, help would be welcome!
Beta Was this translation helpful? Give feedback.
All reactions