node.js - Why do I get "SOCKS connection failed. Connection not allowed by ruleset" for some .onion sites? -
i'm experimenting node , socks5-https-client. reason, tor hidden service (.onion
) sites return connection error.
for example, connecting duckduckgo (3g2upl4pq6kufc4m.onion
) works , returns html.
however, connecting pirate bay (uj3wazyk5u4hnvtk.onion
) or torch (xmh57jrzrnw6insl.onion
) returns...
error: socks connection failed. connection not allowed ruleset.
what error mean? how can avoid it?
here's code reproduce it:
var shttps = require('socks5-https-client'); shttps.get({ hostname: '3g2upl4pq6kufc4m.onion', path: '', sockshost: '127.0.0.1', socksport: 9150, rejectunauthorized: false }, function(res) { res.setencoding('utf8'); res.on('readable', function() { console.log(res.read()); // log response console. }); });
the error seems caused 0x02
value in field 2 of server response.
in summary
the servers you're failing access don't support https. in other words, port 443 closed. tor's error message unhelpful.
if security needs permit it, can fix falling socks5-http-client.
steps took conclude that
your code got me same results on 64-bit linux tor 0.2.5.10, socks5-https-client 1.0.1, node 0.12.0.
i grep
ped socks5-https-client
's codebase error , got hit in dependency socks5-client
on line. translates underlying socks connection's error code human-readable message. wikipedia's explanation of socks5 error codes lines that, unhelpfully vague
i found related tor bug report 5 years ago complaining similar error, same type of socks connection. turns out error means server rejected connection.
just confirm, tcping
ed tpb on port 443 (https) through tor. doesn't reply tcp
syn
, , fails same consistently confusing error:
$ torify tcping uj3wazyk5u4hnvtk.onion 443 [mar 22 22:40:59] error torsocks[18560]: connection not allowed ruleset (in socks5_recv_connect_reply() @ socks5.c:520) error: uj3wazyk5u4hnvtk.onion port 443: software caused connection abort
their port 80 (http) replies though:
$ torify tcping uj3wazyk5u4hnvtk.onion 80 uj3wazyk5u4hnvtk.onion port 80 open.
consequently, code works me if use socks5-http-client instead of socks5-https-client.
Comments
Post a Comment