GNU bug report logs - #53941
27.2; socks + tor dont work with https

Previous Next

Package: emacs;

Reported by: Jacobo <gnuhacker <at> member.fsf.org>

Date: Fri, 11 Feb 2022 14:32:01 UTC

Severity: normal

Tags: patch

Found in version 27.2

Full log


View this message in rfc822 format

From: "J.P." <jp <at> neverwas.me>
To: Jacobo <gnuhacker <at> member.fsf.org>
Cc: 53941 <at> debbugs.gnu.org
Subject: bug#53941: 27.2; socks + tor dont work with https
Date: Thu, 10 Mar 2022 00:58:42 -0800
[Message part 1 (text/plain, inline)]
v5. Forgot to account for look-up failures (shocking not shocking).
Also removed hard-coded port numbers from tests.

The EWW example from earlier needs some adapting:

  ;; M-x eww RET https://check.torproject.org RET

  (require 'socks)
  (require 'gnutls)
  (require 'nsm)

  (defun my-socks-open-https (name buffer host service &rest params)
    (let ((proc (apply #'socks-open-network-stream-legacy
                       name buffer host service params)))
      (advice-add 'network-lookup-address-info :override #'socks-tor-resolve)
      (unwind-protect
          (when (eq service 443)
            (gnutls-negotiate :process proc :hostname host)
            (unless (string-suffix-p ".onion" host)
              (nsm-verify-connection proc host service)))
        (advice-remove 'network-lookup-address-info #'socks-tor-resolve))
      proc))

  (setq socks-server '("tor" "127.0.0.1" 9050 5)
        socks-username ""
        socks-password ""
        url-gateway-method 'socks
        socks-open-network-stream-function #'my-socks-open-https)

Let me know if you need help. Thanks.

[0000-NOT-A-PATCH-v4-v5.diff (text/x-patch, attachment)]
[0001-Simplify-network-stream-opener-in-socks.el.patch (text/x-patch, attachment)]
[0002-lisp-url-url-gw.el-url-open-stream-Honor-socks-gatew.patch (text/x-patch, attachment)]
[0003-Fix-string-encoding-bug-in-socks-tests.patch (text/x-patch, attachment)]
[0004-Add-support-for-SOCKS-4a.patch (text/x-patch, attachment)]
[0005-Support-SOCKS-resolve-extension.patch (text/x-patch, attachment)]
[0006-POC-Demo-SOCKS-resolve-with-HTTPS.patch (text/x-patch, attachment)]

This bug report was last modified 274 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.