Giter Club home page Giter Club logo

Comments (9)

olili avatar olili commented on July 3, 2024 2

from microsocks.

rofl0r avatar rofl0r commented on July 3, 2024

usually one listens on "0.0.0.0" which means all interfaces. though i guess it wouldn't be hard to modify bind option to take a delimited list of addresses to listen on

from microsocks.

olili avatar olili commented on July 3, 2024

from microsocks.

olili avatar olili commented on July 3, 2024

spent some more time for investigations.
I'm running 4 VPSs (deb9, OVZ, different providers) and one deb10 bare ,etal machine.
On all systems I face the following problems.

Listening to 0.0.0.0 seems not work .
Listening to ipv4 or ipv6 secified with -i paramter is okay
Listnenig to DNS (with A and AAAA record) only binds to ipv4 or ipv6, but not on both

"-b"-Binding to destination is on all my machines not working correctly.
In most cases the b-Parameter is ignored and mostly the "receiving" address is re-used.

Oliver

from microsocks.

rofl0r avatar rofl0r commented on July 3, 2024

Listening to 0.0.0.0 seems not work .

that's a bit vague.

can you show strace log of starting microsocks with -i 0.0.0.0 including one try to connect to it and what's visible in netstat -ltan | grep port (where "port" is whatever port number you requested)

from microsocks.

olili avatar olili commented on July 3, 2024

sure. Here you are:;
ok, first I make the positiv probe with NOT-0.0.0.0 bound:

strace ./microsocks -i 2001:41d0:1:777c:200:c0a8:6695:0 and challenging with curl -6 -x socks5h://[2001:41d0:1:777c:200:c0a8:6695:0] from outside is working as expexted:

STRACE:

root@11456:~/microsocks# strace ./microsocks -i 2001:41d0:1:777c:200:c0a8:6695:0
execve("./microsocks", ["./microsocks", "-i", "2001:41d0:1:777c:200:c0a8:6695:0"], [/* 16 vars */]) = 0
brk(0)                                  = 0x24a4000
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f88d6581000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=70510, ...}) = 0
mmap(NULL, 70510, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f88d6563000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\320n\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=137384, ...}) = 0
mmap(NULL, 2213008, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f88d6133000
mprotect(0x7f88d614b000, 2093056, PROT_NONE) = 0
mmap(0x7f88d634a000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x17000) = 0x7f88d634a000
mmap(0x7f88d634c000, 13456, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f88d634c000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0P\34\2\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1738176, ...}) = 0
mmap(NULL, 3844640, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f88d5d83000
mprotect(0x7f88d5f24000, 2097152, PROT_NONE) = 0
mmap(0x7f88d6124000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1a1000) = 0x7f88d6124000
mmap(0x7f88d612a000, 14880, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f88d612a000
close(3)                                = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f88d6580000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f88d657f000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f88d657e000
arch_prctl(ARCH_SET_FS, 0x7f88d657f700) = 0
mprotect(0x7f88d6124000, 16384, PROT_READ) = 0
mprotect(0x7f88d634a000, 4096, PROT_READ) = 0
mprotect(0x7f88d657b000, 4096, PROT_READ) = 0
munmap(0x7f88d6563000, 70510)           = 0
set_tid_address(0x7f88d657f9d0)         = 23423
set_robust_list(0x7f88d657f9e0, 24)     = 0
rt_sigaction(SIGRTMIN, {0x7f88d61399b0, [], SA_RESTORER|SA_SIGINFO, 0x7f88d6142890}, NULL, 8) = 0
rt_sigaction(SIGRT_1, {0x7f88d6139a40, [], SA_RESTORER|SA_RESTART|SA_SIGINFO, 0x7f88d6142890}, NULL, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [RTMIN RT_1], NULL, 8) = 0
getrlimit(RLIMIT_STACK, {rlim_cur=10240*1024, rlim_max=RLIM64_INFINITY}) = 0
rt_sigaction(SIGPIPE, {SIG_IGN, [PIPE], SA_RESTORER|SA_RESTART, 0x7f88d5db80e0}, {SIG_DFL, [], 0}, 8) = 0
brk(0)                                  = 0x24a4000
brk(0x24c5000)                          = 0x24c5000
socket(PF_INET6, SOCK_STREAM, IPPROTO_TCP) = 3
setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
bind(3, {sa_family=AF_INET6, sin6_port=htons(1080), inet_pton(AF_INET6, "2001:41d0:1:777c:200:c0a8:6695:0", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, 28) = 0
listen(3, 128)                          = 0
accept(3, {sa_family=AF_INET6, sin6_port=htons(62510), inet_pton(AF_INET6, "2a02:8070:2180:f000:d0f2:ebba:e812:a065", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, [28]) = 4
mmap(NULL, 32768, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_STACK, -1, 0) = 0x7f88d6573000
mprotect(0x7f88d6573000, 4096, PROT_NONE) = 0
clone(child_stack=0x7f88d6579ff0, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, parent_tidptr=0x7f88d657a9d0, tls=0x7f88d657a700, child_tidptr=0x7f88d657a9d0) = 23424
accept(3, client[4] 2a02:8070:2180:f000:d0f2:ebba:e812:a065: connected to ident.me:80
root@11456:~# netstat -ltan | grep :1080
tcp6       0      0 2001:41d0:1:777c:2:1080 :::*                    LISTEN

With binding to 0.0.0.0 and with curl -6 -x socks5h://[2001:41d0:1:777c:200:c0a8:6695:0] I get the following bahvior:

root@11456:~/microsocks# strace ./microsocks -i 0.0.0.0
execve("./microsocks", ["./microsocks", "-i", "0.0.0.0"], [/* 16 vars */]) = 0
brk(0)                                  = 0x1bf2000
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f6cd572f000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=70510, ...}) = 0
mmap(NULL, 70510, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f6cd570b000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\320n\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=137384, ...}) = 0
mmap(NULL, 2213008, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f6cd52db000
mprotect(0x7f6cd52f3000, 2093056, PROT_NONE) = 0
mmap(0x7f6cd54f2000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x17000) = 0x7f6cd54f2000
mmap(0x7f6cd54f4000, 13456, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f6cd54f4000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0P\34\2\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1738176, ...}) = 0
mmap(NULL, 3844640, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f6cd4f2b000
mprotect(0x7f6cd50cc000, 2097152, PROT_NONE) = 0
mmap(0x7f6cd52cc000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1a1000) = 0x7f6cd52cc000
mmap(0x7f6cd52d2000, 14880, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f6cd52d2000
close(3)                                = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f6cd572e000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f6cd572d000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f6cd572c000
arch_prctl(ARCH_SET_FS, 0x7f6cd572d700) = 0
mprotect(0x7f6cd52cc000, 16384, PROT_READ) = 0
mprotect(0x7f6cd54f2000, 4096, PROT_READ) = 0
mprotect(0x7f6cd5723000, 4096, PROT_READ) = 0
munmap(0x7f6cd570b000, 70510)           = 0
set_tid_address(0x7f6cd572d9d0)         = 23433
set_robust_list(0x7f6cd572d9e0, 24)     = 0
rt_sigaction(SIGRTMIN, {0x7f6cd52e19b0, [], SA_RESTORER|SA_SIGINFO, 0x7f6cd52ea890}, NULL, 8) = 0
rt_sigaction(SIGRT_1, {0x7f6cd52e1a40, [], SA_RESTORER|SA_RESTART|SA_SIGINFO, 0x7f6cd52ea890}, NULL, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [RTMIN RT_1], NULL, 8) = 0
getrlimit(RLIMIT_STACK, {rlim_cur=10240*1024, rlim_max=RLIM64_INFINITY}) = 0
rt_sigaction(SIGPIPE, {SIG_IGN, [PIPE], SA_RESTORER|SA_RESTART, 0x7f6cd4f600e0}, {SIG_DFL, [], 0}, 8) = 0
brk(0)                                  = 0x1bf2000
brk(0x1c13000)                          = 0x1c13000
socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 3
setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
bind(3, {sa_family=AF_INET, sin_port=htons(1080), sin_addr=inet_addr("0.0.0.0")}, 16) = 0
listen(3, 128)                          = 0
accept(3,
C:\Users\Oli\Desktop\curl>curl -6 -x socks5h://[2001:41d0:1:777c:200:c0a8:6695:0
] ident.me
curl: (7) Failed to connect to 2001:41d0:1:777c:200:c0a8:6695:0 port 1080 after
1078 ms: Connection refused

 netstat -ltan | grep :1080  is delivering a listing "0.0.0.0"
tcp        0      0 0.0.0.0:1080            0.0.0.0:*               LISTEN

add. informaton: 
 ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: venet0: <BROADCAST,POINTOPOINT,NOARP> mtu 1500 qdisc noop state DOWN
    link/void
3: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN
    link/ether 02:00:c0:a8:66:95 brd ff:ff:ff:ff:ff:ff
    inet 192.168.102.149/24 scope global eth0
    inet6 2001:41d0:1:777c:200:c0a8:6695:0/112 scope global
       valid_lft forever preferred_lft forever
    inet6 fe80::c0ff:fea8:6695/64 scope link
       valid_lft forever preferred_lft forever



from microsocks.

rofl0r avatar rofl0r commented on July 3, 2024

thanks for info.
can you try each of those addresses for -i parameter and report back what's visible in netstat ? (also whether you can connect to v4 and v6 each).

::ffff:0.0.0.0 and ::.

if none of those work, we might want to experiment with setsockopt(socket.IPPROTO_IPV6, socket.IPV6_V6ONLY, 0)

from microsocks.

olili avatar olili commented on July 3, 2024

thx. "-i ::" provides a working binding to "0.0.0.0".
So the listen issue is for me resolved with that.
(By the way "::ffff:0.0.0.0" behaves like "0.0.0.0" and is not working.)

But I have still problems with the target binding/address.
"-b ipv4" is not considered and ignored. Microsocks is still using the IPV6 port.

Any hint?
Shall I provide for this issue some traces as well?

Add. Info
-i ::
netstat -ltan | grep :1080
tcp6 0 0 :::1080 :::* LISTEN
-> Working as ecpected

-i ::ffff:0.0.0.0
netstat -ltan | grep :1080
tcp6 0 0 0.0.0.0:1080 :::* LISTEN
-> not working, behaves like "-i 0.0.0.0"

from microsocks.

rofl0r avatar rofl0r commented on July 3, 2024

-> Working as ecpected

means you can connect through both ipv4 and v6 ?

from microsocks.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.