#810933 Please support connecting to SMTP via a SOCKS proxy

#810933#3
Date:
2016-01-13 22:08:36 UTC
From:
To:
reportbug supports an HTTP proxy if set in the environment; however,
when it subsequently tries to submit the report, it tries to connect
directly to the specified SMTP server, and does not seem to support
using a proxy for that connection.

Please consider adding support for using a SOCKS proxy to connect to
reportbug.debian.org, and obtaining that proxy from the environment (via
the all_proxy environment variable, and respecting no_proxy).

#810933#8
Date:
2022-06-20 10:20:36 UTC
From:
To:
I concur that SMTP proxying would be useful.

I also have a workaround using firejail. Firejail makes it possible to
restrict an app to a network namespace. So if you can configure your
proxy to be a network namespace that appears in
/proc/sys/net/ipv4/conf/, then firejail can do the rest. Restricting
apps to use Firejail is generally a good security practice anyway.

I managed to create a network (proxynet0). So running reportbug in
firejail to force use of proxynet0 looks like this:

===8<------------------------------
  $ firejail --net=proxynet0\
             --dns="$(ip address show dev proxynet0 | awk '/inet\>/{gsub(/[/].*/,""); print $2 }')"\
             --whitelist="$HOME"/.reportbugrc\
             --whitelist="$draft_folder"\
             --whitelist="$app_specific_configs"\
             --whitelist=/etc/passwd\
             --whitelist=/var/lib/apt/lists/\
             --whitelist=/var/lib/dpkg/status\
             --whitelist=/etc/apt/sources.list\
             --whitelist=/etc/apt/sources.d\
             reportbug --draftpath="$draft_folder" --no-cc

  Reading profile /etc/firejail/default.profile
  Reading profile /etc/firejail/disable-common.inc
  Reading profile /etc/firejail/disable-passwdmgr.inc
  Reading profile /etc/firejail/disable-programs.inc

  ** Note: you can use --noprofile to disable default.profile **

  Parent pid 25268, child pid 25271

  Interface        MAC                IP               Mask             Status
  lo                                  127.0.0.1        255.0.0.0        UP
  eth0…
  Default gateway…
  DNS server…

  Child process initialized in 1877.72 ms

  (reportbug:11): dbind-WARNING **: 10:06:51.011: Couldn't connect to accessibility bus: Failed to connect to socket /tmp/dbus-jLt9P0UVaA: Connection refused
  Please enter the name of the package in which you have found a problem, or type 'other' to report a more general problem. If you don't know
  what package the bug is in, please contact debian-user@lists.debian.org for assistance.
  >
===8<------------------------------

Be sure to also add a --whitelist path for the config file of the app
the bug is reported on because reportbug will try to access that as
well. The placeholder “$app_specific_configs” was used above.

The reportbug app uses dbus for accessbility features, which firejail
blocks by default. The warning can be ignored if you don’t need
accessibility features. Otherwise Firejail offers the following
options to make dbus accessible:

#810933#13
Date:
2023-09-30 09:01:06 UTC
From:
To:
(Note: I'm not on Debian but on a derivative with the same issue)

I use tsocks as a workaround, however this causes reportbug to fail checking for newer versions and other bug reports:

	~$ tsocks reportbug -d

		Please enter the name of the package in which you have found a problem, or type 'other' to report a more general problem. If you don't know what package the bug is in, please contact debian-
		user@lists.debian.org for assistance.
		> reportbug
		Is "reportbug" actually the package you are having problems with [Y|n|q|?]?
		*** Welcome to reportbug.  Use ? for help at prompts. ***
		Note: bug reports are publicly archived (including the email address of the submitter).
		Detected character set: UTF-8
		Please change your locale if this is incorrect.

		Using 'Bug reporter xyz <mxuser1234@morke.org>' as your from address.
		Getting status for reportbug...
		Checking for newer versions at madison...
		Will send report to Debian (per lsb_release).
		Querying Debian BTS for reports on reportbug src:reportbug...
		Error retrieving information on existing bug reports from the BTS. The following error was detected:
		Unable to connect to Debian BTS (error: "TimeoutError('timed out')");
		Do you still want to file a report [y|N|q|?]? n

Firewall logs in dmesg and netstat both show that reportbug successfully connects to the proxy server (I micromanage loopback connections...):
	tcp        0      0 127.0.0.1:39016         127.0.0.1:9050          ESTABLISHED 324914/python3

I have verified:
	1. My DNS server works and reportbug can use it (that DNS leak should be addressed btw, maybe add socks5 protocol support?)
	2. My Proxy server works and has access to the internet
	3. My Proxy's IP address is not blacklisted or else the workaround below would not work

Workaround:
	1. Set a custom http proxy when creating the bug report (I use privoxy):
		reportbug --proxy http://127.0.0.1:8118
	2. Go through the steps, create bug report
	3. Don't send bug report, quit reportbug
	4. Resume bug reporting using tsocks:
		tsocks reportbug -r /tmp/reportbug-reportbug-[...]
	5. Send bug report; drink tea

I have verified:
	tsocks is set up correctly, all data is proxified, no direct internet access permitted or attempted (except for the DNS lookup which I proxy too).