<span>Permissions are set so tor should be able to access through the `postfix-test-queue` user:</span><div><br></div><blockquote style="border-color:rgb(200, 200, 200);border-left:3px solid rgb(200, 200, 200);padding-left:10px;color:rgb(102, 102, 102)"><div><span>$ sudo ls -l /var/spool/postfix-test/public/smtpd </span></div><div><span>srw-rw-rw- 1 postfix-test postfix-test 0 █████ /var/spool/postfix-test/public/smtpd</span></div><div><span>$ sudo ls -l /var/spool/postfix-test</span></div><div><span># ...</span></div><div><span>drwx--x---  2 postfix-test postfix-test-queue 4096 █████ public</span></div><div><span>$ sudo -u _tor-test id</span></div><div><span>uid=130(_tor-test) gid=141(_tor-test) groups=141(_tor-test),1006(postfix-test-queue)</span></div><div><span>$ cat /etc/tor/instances/test/torrc | grep HiddenServicePort</span></div><div><span>HiddenServicePort 25 unix:/var/spool/postfix-test/public/smtpd</span></div><div><span>$ cat /run/tor-instances/test.defaults | grep User</span></div><div><span>User _tor-test</span></div></blockquote><div><br></div><div><span>Running `tor@test` via the default systemctl config shows:</span></div><div><br></div><blockquote style="border-color:rgb(200, 200, 200);border-left:3px solid rgb(200, 200, 200);padding-left:10px;color:rgb(102, 102, 102)"><div><span>$ ps -ax -o uid,gid,supgid,command | grep /usr/bin/tor</span></div><div><span>  130   141 141                  /usr/bin/tor --defaults-torrc /run/tor-instances/test.defaults -f /etc/tor/instances/test/torrc</span></div></blockquote><div><br></div><div><span>Which is missing the `postfix-test-queue` `1006` user which, for example shows up if I do:</span></div><div><br></div><blockquote style="border-color:rgb(200, 200, 200);border-left:3px solid rgb(200, 200, 200);padding-left:10px;color:rgb(102, 102, 102)"><div><span>$ sudo -u _tor-test sleep 1000 & ps -ax -o uid,gid,supgid,command | grep sleep</span></div><div><span>[1] 132314</span></div><div><span>    0   141 141,1006             sudo -u _tor-test sleep 1000</span></div></blockquote><div><br></div><div><span>Connecting using `sudo -u` works (the message indicates successful connection):</span></div><div><br></div><blockquote style="border-color:rgb(200, 200, 200);border-left:3px solid rgb(200, 200, 200);padding-left:10px;color:rgb(102, 102, 102)"><div><span>$ sudo -u _tor-test curl --unix-socket /var/spool/postfix-test/public/smtpd <a href="http://localhost" rel="noreferrer nofollow noopener" target="_blank">http://localhost</a></span></div><div><span>curl: (1) Received HTTP/0.9 when not allowed</span></div></blockquote><div><br></div><div><span>But connecting via tor does not:</span></div><blockquote style="border-color:rgb(200, 200, 200);border-left:3px solid rgb(200, 200, 200);padding-left:10px;color:rgb(102, 102, 102)"><div><span><br></span></div><div><span>$ torsocks --ipv6 curl <a href="http://█████.onion:25" rel="noreferrer nofollow noopener" target="_blank">http://█████.onion:25</a></span></div><div><span>█████ ERROR torsocks[134873]: Host unreachable (in socks5_recv_connect_reply() at socks5.c:539)</span></div><div><span>curl: (7) Couldn't connect to server</span></div></blockquote><div><br></div><div><span>But does if I allow access to the socket to everyone:</span></div><div><br></div><blockquote style="border-color:rgb(200, 200, 200);border-left:3px solid rgb(200, 200, 200);padding-left:10px;color:rgb(102, 102, 102)"><div><span>$ sudo chmod "o+x" /var/spool/postfix-test/public/</span></div><div><span>$ torsocks --ipv6 curl <a href="http://█████.onion:25" rel="noreferrer nofollow noopener" target="_blank">http://█████.onion:25</a></span></div><div><span>curl: (1) Received HTTP/0.9 when not allowed</span></div></blockquote><div><br></div><div><span>Tor's relevant source code: <a title="Tor: lib/process/setuid.c Source File" rel="noreferrer nofollow noopener" target="_blank" href="https://tpo.pages.torproject.net/core/doc/tor/setuid_8c_source.html">Tor: lib/process/setuid.c Source File</a></span></div>