(regression) torsocks → fatal: socket: Function not implemented
torsocks version: 2.4.0-1
After upgrading from Bullseye to Bookworm, this is what happens in the logs when sending a Tor-routed message:
(/var/log/mail.log)
===8<----------------------------------------
2024-04-25T13:10:25.165542+02:00 MannysHost postfix/smtpd[*]: connect from localhost[127.0.0.1]
2024-04-25T13:10:25.186729+02:00 MannysHost postfix/smtpd[*]: 2D6EFE313A: client=localhost[127.0.0.1]
2024-04-25T13:10:25.232021+02:00 MannysHost postfix/cleanup[*]: 2D6EFE313A: message-id=<timestamp.yadayada@MannysHost>
2024-04-25T13:10:25.236765+02:00 MannysHost postfix/qmgr[*]: 2D6EFE313A: from=<[manny’s@email.addy]>, size=1181, nrcpt=1 (queue active)
2024-04-25T13:10:25.236875+02:00 MannysHost postfix/smtpd[*]: disconnect from localhost[127.0.0.1] ehlo=1 mail=1 rcpt=1 data=1 quit=1 commands=5
2024-04-25T13:10:25.298945+02:00 MannysHost postfix/smtp[*]: fatal: socket: Function not implemented
2024-04-25T13:10:26.357045+02:00 MannysHost postfix/smtp[*]: fatal: socket: Function not implemented
2024-04-25T13:10:27.444922+02:00 MannysHost postfix/smtp[*]: fatal: socket: Function not implemented
…
===8<----------------------------------------
This is what the log looked like in Bullseye just before the upgrade, when sending over Tor still worked correctly:
(/var/log/mail.log)
===8<----------------------------------------
Apr 24 09:37:17 MannysHost postfix/postfix-script[2130]: refreshing the Postfix mail system
Apr 24 09:37:17 MannysHost postfix/master[1026]: reload -- version 3.5.24, configuration /etc/postfix
Apr 24 09:37:17 MannysHost postfix/postfix-script[2168]: refreshing the Postfix mail system
Apr 24 09:37:17 MannysHost postfix/master[1026]: reload -- version 3.5.24, configuration /etc/postfix
Apr 24 12:32:42 MannysHost postfix/submission/smtpd[27946]: connect from localhost[127.0.0.1]
Apr 24 12:32:42 MannysHost postfix/submission/smtpd[27946]: 3C344E3262: client=localhost[127.0.0.1]
Apr 24 12:32:42 MannysHost postfix/submission/cleanup/cleanup[27949]: 3C344E3262: message-id=<timestamp.yadayada@MannysHost>
Apr 24 12:32:42 MannysHost postfix/submission/smtpd[27946]: disconnect from localhost[127.0.0.1] ehlo=1 mail=1 rcpt=1 data=1 quit=1 commands=5
Apr 24 12:32:42 MannysHost postfix/qmgr[2173]: 3C344E3262: from=<manny’s@email.addy>, size=1126, nrcpt=1 (queue active)
Apr 24 12:32:50 MannysHost postfix/smtptor/smtp[27956]: 3C344E3262: to=<tor@recipient.addy>, relay=recipient.mx.server[1.2.3.4]:587, delay=8.1, delays=0.07/0.13/5.8/2.1, dsn=2.0.0, status=sent (250 OK id=yadayada)
===8<----------------------------------------
Sending over clearnet has no issues in any version. It’s only when a message must go over the Tor network that there is a problem.
The configuration consists of the following:
(/etc/postfix/master.cf)
===8<----------------------------------------
# The syslog_name option is not needed. It can be set to
# anything. It’s just to add distinction in mail.log between clearnet
# and Tor mail (otherwise both kinds of transmission are prefixed as
# “postfix/smtp”).
#
smtptor unix - - n - - smtp_tor
-o smtp_address_preference=ipv4
-o smtp_dns_support_level=disabled
-o smtp_tls_security_level=none
-o debug_peer_level=2
-o syslog_name=postfix/smtptor
===8<----------------------------------------
(/usr/lib/postfix/sbin/smtp_tor)
===8<----------------------------------------
!/bin/bash
typeset -r dir_cmd=$(/usr/sbin/postconf -h command_directory)
typeset -r exec_smtp=$("$dir_cmd"/postconf -h daemon_directory)/smtp
setx_output()
{
if [[ $1 ]]; then
exec 4>>"$1"
BASH_XTRACEFD=4
PS4='\D{+%F}T\t $LINENO: '
set -x
else
set +x
#BASH_XTRACEFD=2
exec 4>&-
fi
}
setx_output /var/log/mail_${0##*/}.log
torsocks "$exec_smtp" "$@"
setx_output
===8<----------------------------------------
To setup routing, the transport db is used.
(/etc/postfix/tor_transport)
===8<----------------------------------------
…
.onion smtptor:
===8<----------------------------------------