So I have a python script that is supposed to run anonymized. I use Torsocks for that. But a part of the script needs to write data into a MySQL database running on the same device. But torsocks is denying the connection since it could be leaking my ID. The error I receive is:

1560504024 WARNING torsocks[20011]: [connect] Connection to a local address are denied since it might be a TCP DNS query to a local DNS server. Rejecting it for safety reasons. (in tsocks_connect() at connect.c:192)

followed by the Python MySQL Exception with this line summarizing it:

mysql.connector.errors.InterfaceError: 2003: Can't connect to MySQL server on '127.0.0.1:3306' (1 Operation not permitted)

I have already tried editing the torsocks.conf, trying out different things as I had no idea what I was doing. The lines I added to the config are the following (of course only one at a time):

local = 127.0.0.0/127.0.0.1
local 127.0.0.0/127.0.0.1
local = 127.0.0.0/192.168.178.1
local 127.0.0.0/192.168.178.1
local = 127.0.0.0/192.168.178.0
local 127.0.0.0/192.168.178.0
local 127.0.0.0/255.255.255.255

But none of these worked. I always got the following warning, but tsocks started running the script anyway, it just stopped when it had to access the MySQL server.

1560504796 WARNING torsocks[20028]: Config file contains unknown value: *THE LINE I USED HERE* (in parse_config_line() at config-file.c:183)

I have absolutely no idea what to try next as I am quite a newbie and I would be really thankful for any help.

0

There are 0 best solutions below