Comments (20)
that functionality is not built in. you could run microsocks through proxychains-ng though and configure it for proxydns_old mode, then modify the proxyresolv script to query the nameserver of your choice. alternatively you can modify the code of microsocks to run a custom DNS resolver function instead of getaddrinfo(), for example using https://github.com/rofl0r/firedns . though you'd need to piece it together yourself.
from microsocks.
Is there a way to force it to use the client's DNS?
from microsocks.
depends on whether the client application using the proxy has a setting to force DNS being looked up before making the proxy connection. it could then send raw ipv4/ipv6 instead of host name to the server. though i think finding such an option is unlikely as its less efficient and the opposite of what most people want.
from microsocks.
Depending on what you're trying to achieve, you could run microsocks in a namespace to allow setting a different DNS server?
from microsocks.
How would that work?
from microsocks.
Good question .. you could create a whole new network namespace but that's probably overkill. Maybe something like this? (run as root)
cat >test-ns <<EOM
#! /bin/bash
echo "nameserver 1.2.3.4" >/tmp/new-resolv.conf
mount /tmp/new-resolv.conf /etc/resolv.conf -o bind
cat /etc/resolv.conf
EOM
chmod a+x ./test-ns
cat /etc/resolv.conf
unshare -m ./test-ns
cat /etc/resolv.conf
You should notice that 'test-ns' sees it's own version of resolv.conf compared to the main system .. obviously you can then just change the script to start microsocks. If using systemd you can probably configure the unit file directly somehow.
Note that if you're using systemd-resolved's nss-resolve the above might well not work .. you might need to bind mount over /etc/nsswitch.conf as well to disable it.
from microsocks.
Hmm, looks like cwrap can redirect resolv.conf as well: https://cwrap.org/resolv_wrapper.html
from microsocks.
I just gave up and changed the DNS on the server. Also, when testing it, it works fine on a computer -- but with SagerNet on Android, the latency is >1000 ms (Shadowsocks is <150 ms).
from microsocks.
the latency is >1000 ms
the socks5 protocol is kinda inefficient, it requires several packets sent hence and forth to establish a connection. that's the reason why tor defaults to using socks4a instead.
i've implemented a socks4a server here: https://github.com/rofl0r/pysocks4 . it will likely work better in regard to latency. http proxies also do not have this issue, as all the required information to establish a connection is included in the first packet. tinyproxy is a good and reasonably lightweight option for http proxying.
from microsocks.
Can pysocks4 be used with python3, or will some things need to change?
from microsocks.
Can pysocks4 be used with python3, or will some things need to change?
it will likely need changes, as py3 made the unfortunate decision to treat all string literals as unicode rather than bytes. but you might just try it out.
from microsocks.
I just tried pproxy
, apparently MacOS can't handle socks4
from microsocks.
And it seems like I was mistaken -- microsocks is pretty fast, maybe it was an one-off bad connection. For my purposes, http proxies aren't enough.
from microsocks.
Another problem I found -- while dig
, ping
, etc does reflect DNS blocks correctly, browsers do not use the system DNS, but use their own. This is on MacOS.
from microsocks.
browsers do not use the system DNS
firefox has a checkbox "use proxy to perform DNS queries (socks5 only)" which can influence this behaviour. if unchecked, it does what you want, namely use the client's nameserver rather than socks server's.
from microsocks.
from microsocks.
I have a feeling Chrome passes some stuff to the proxy and looks other stuff up (e.g. prefetches) itself, annoyingly. I remember having to do battle with that when I was trying to force everything through the proxy. Trying googling around the "--host-resolver-rules" option to Chrome..
from microsocks.
btw, i just added support for py3 to pysocks4.
from microsocks.
Yeah, apparently, MacOS doesn't have SOCKS4 support.
from microsocks.
For anyone who has come across this, here is an example proxychains.conf
that uses the proxy_dns_old
directive:
proxy_dns_old
localnet 0.0.0.0/0.0.0.0
[ProxyList]
<proto> <ip> <port>
DNS requests will be resolved by invoking the proxyresolv
script on your system $PATH
. You can choose the IP address of the DNS server by editing that file.
from microsocks.
Related Issues (20)
- Can't connect to `0.0.0.0` on client HOT 4
- Connect to server running on the same machine HOT 17
- microsocks-1.0.2-x86_64-static may contain security issues HOT 1
- EC_TTL_EXPIRED error is sent down idle connection, and treated as application-layer traffic by client
- microsocks: not found HOT 1
- Configuration of the Proxy HOT 1
- Blocking some IPs HOT 1
- Any plans to support UDP? HOT 2
- Allow passthrough of TCP/ip headers HOT 1
- a little Suggest. Change release url to https HOT 1
- Any chance of a new release with -q flag added? HOT 2
- Disconnect logging
- Using 443 Port HOT 1
- buffer overflow detected HOT 6
- Bandwidth testing tools HOT 5
- add systemd service file HOT 3
- Trying IPv6 sockets w/ IPv6 being available but down, leads to connection failures HOT 2
- segmentation fault on alpine & docker HOT 6
- Why I keep seeing the help instructions? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from microsocks.