Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Electron] Add SOCKS proxy support #1430

Closed
1 task done
xortim opened this issue Sep 5, 2017 · 28 comments
Closed
1 task done

[Electron] Add SOCKS proxy support #1430

xortim opened this issue Sep 5, 2017 · 28 comments

Comments

@xortim
Copy link

xortim commented Sep 5, 2017

  • I have searched open and closed issues for duplicates

Bug description

Certain networks are designed to block traffic which the administrators cannot effectively intercept. Namely those which employ Blue Coat appliances.

It appears that there is no way to start Signal Desktop (Electron version) in a way that will force its traffic through a SOCKS proxy. In the previous Chrome app I was able to use a combination of SSH port forwarding and my hosts file allow the app to work. That is not the case with standalone Electron version. Adding proxy support (specifically SOCKS) would go a long way in allowing users to work around restrictive networks and censorship.

Steps to reproduce

Block traffic on ports 443, 80, 8443, and 4433.

Actual result: Describe here what happens after you run the steps above (i.e. the buggy behaviour)
Expected result: Describe here what should happen after you run the steps above (i.e. what would be the correct behaviour)

Platform info

Operating System: macOS Siera
Browser: Electron

Signal version: 1.0.23 (1)

@riyapenn
Copy link

riyapenn commented Sep 5, 2017

Related: #926

@lunim
Copy link

lunim commented Oct 31, 2017

Version 1.0.34 (Electron, Windows 10) also does not work behind a corporate proxy and I haven't found any options to specify the server.

@ghost
Copy link

ghost commented Apr 23, 2018

https://electronjs.org/docs/api/session#sessetproxyconfig-callback

electron can setproxy by this api.

I guess we can provided an proxy config options at the preference UI.

@DiagonalArg
Copy link

torify signal-desktop does not work. It produces no output at all.

@ernstblaauw
Copy link

I can setup a dynamic tunnel using Putty and use it with Signal Desktop on Windows.
In a command prompt window, I type:

> set HTTP_PROXY=socks://localhost:8912
> set HTTPS_PROXY=%HTTP_PROXY%
> start %LOCALAPPDATA%\Programs\signal-desktop\Signal.exe

This works on my pc with Signal Desktop 1.12.0

@k3vy
Copy link

k3vy commented Jun 20, 2018

@ernstblaauw thanks for this tipp, for me it's working via SSH on Windows 7.
BUT Signal can't fetch my contacts, I only see a blank signal interface. Do you can confirm this or is it just me?
"msg":"using proxy url socks://localhost:8080"

@ernstblaauw
Copy link

ernstblaauw commented Jun 20, 2018

For me, it works exactly like when I have a (working) direct connection to the internet. However, I'm running this on a laptop so maybe the app already fetched and cached the contacts when I was directly connected and now (behind a firewall), just uses the earlier loaded contacts. I just don't know if that's the case, I just can tell here it is working fine.

@scottnonnenberg-signal
Copy link
Contributor

@k3vy If you provide your log, I can take a look at the specific error message regarding that failed contact sync.

@ghost ghost mentioned this issue Jan 24, 2019
1 task
@pastly
Copy link

pastly commented Sep 23, 2019

I can setup a dynamic tunnel using Putty and use it with Signal Desktop on Windows.
In a command prompt window, I type:

> set HTTP_PROXY=socks://localhost:8912
> set HTTPS_PROXY=%HTTP_PROXY%
> start %LOCALAPPDATA%\Programs\signal-desktop\Signal.exe

This works on my pc with Signal Desktop 1.12.0

The analogous thing works on macOS, thus I would assume it works on Linux too. On macOS:

export HTTP_PROXY=socks://127.0.0.1:2343
export HTTPS_PROXY=$HTTP_PROXY
/Applications/Signal.app/Contents/MacOS/Signal

Adjust the path to your Signal executable as necessary, and obvious point to whatever socks port you have opened.

Signal Desktop 1.27.2

@stevleibelt
Copy link

I can setup a dynamic tunnel using Putty and use it with Signal Desktop on Windows.
In a command prompt window, I type:

> set HTTP_PROXY=socks://localhost:8912
> set HTTPS_PROXY=%HTTP_PROXY%
> start %LOCALAPPDATA%\Programs\signal-desktop\Signal.exe

This works on my pc with Signal Desktop 1.12.0

Thanks @ernstblaauw, this is working perfectly on windows 10.

Just to ease up the copy past mechanism a bit more, this is the content of the "set_proxy_and_start_signal.bat.template".
You just have to replace section <your proxy with your proxy definition.

####
# Sets http and https proxy variables and starts signal.
####
# @see: https://github.com/signalapp/Signal-Desktop/issues/1430#issuecomment-397229333
# @since: 2020-02-14
# @author: stev leibelt <artodeto@bazzline.net>
####

set HTTP_PROXY=<your proxy>
set HTTPS_PROXY=%HTTP_PROXY%
start %LOCALAPPDATA%\Programs\signal-desktop\Signal.exe

@jfjallid
Copy link

jfjallid commented Jul 3, 2020

Is it possible to instruct Signal Desktop to let the SOCKS proxy handle the DNS lookups? This is necessary for proxies that whitelist domain names.

@OliverJurkschat
Copy link

If you don't want that ugly batch-window to stay open try this:

set HTTP_PROXY=<your proxy>
set HTTPS_PROXY=%HTTP_PROXY%
explorer %LOCALAPPDATA%\Programs\signal-desktop\Signal.exe

@sunduda
Copy link

sunduda commented Mar 17, 2021

I can setup a dynamic tunnel using Putty and use it with Signal Desktop on Windows.
In a command prompt window, I type:

> set HTTP_PROXY=socks://localhost:8912
> set HTTPS_PROXY=%HTTP_PROXY%
> start %LOCALAPPDATA%\Programs\signal-desktop\Signal.exe

This works on my pc with Signal Desktop 1.12.0

Thanks bro, it works!

@timrhaynes
Copy link

This used to work, but doesn't work for me with Signal 6.27.1 on my fully patched Windows 10 anymore.

set HTTP_PROXY=socks://localhost:8912
set HTTPS_PROXY=%HTTP_PROXY%
start %LOCALAPPDATA%\Programs\signal-desktop\Signal.exe

I downgraded to Signal 6.26.0 and still no love.

Is it still working for others?

@dengelsma
Copy link

This used to work, but doesn't work for me with Signal 6.27.1 on my fully patched Windows 10 anymore.

set HTTP_PROXY=socks://localhost:8912
set HTTPS_PROXY=%HTTP_PROXY%
start %LOCALAPPDATA%\Programs\signal-desktop\Signal.exe

I downgraded to Signal 6.26.0 and still no love.

Is it still working for others?

Not working for me either.

@norstbox
Copy link
Contributor

@timrhaynes @dengelsma you can try to use 127.0.0.1 instead of localhost, #6434 (comment)

@indutny-signal
Copy link
Contributor

This should be fixed in the next beta release and the production release week after. Thanks for your reports!

@timrhaynes
Copy link

@norstbox doesn't work with 127.0.0.1 instead of localhost
@indutny-signal doesn't work in 6.30.1 yet
Hopefully it will work soon, though? Why it's not a preference setting is a mystery to me. At one point, proxy settings were commonplace in windows communication apps.

@indutny-signal
Copy link
Contributor

@timrhaynes our release schedule got delayed and it was released only 6.31.0-beta.1 so far. Could you give it a try, please?

@timrhaynes
Copy link

@timrhaynes our release schedule got delayed and it was released only 6.31.0-beta.1 so far. Could you give it a try, please?

Tested with 6.30.2, still not working.
Tested with 6.31.1 beta, and it works!
Fantastic, thank you for your help :-) :-)

@indutny-signal
Copy link
Contributor

Hooray! Thank you!

@queesamor
Copy link

I can setup a dynamic tunnel using Putty and use it with Signal Desktop on Windows. In a command prompt window, I type:

> set HTTP_PROXY=socks://localhost:8912
> set HTTPS_PROXY=%HTTP_PROXY%
> start %LOCALAPPDATA%\Programs\signal-desktop\Signal.exe

This works on my pc with Signal Desktop 1.12.0

@ernstblaauw Can you explain how you configured Putty to provide the HTTP/HTTPS proxy on port 8912 which would then send that traffic out via your tor-provided SOCKS proxy? I have tor running a SOCKS5 port but can't figure out what precisely to do in Putty that offers this HTTP/HTTPS protocol translation which your comment suggests should be seemingly simple. 🤔

@obygyv
Copy link

obygyv commented Mar 19, 2024

The simple script was working fine for me but today it stopped working? Did something change in my config or do you also have the same problem? Signal desktop can't connect anymore.

@scottnonnenberg-signal
Copy link
Contributor

@obygyv What version are you running? A debug log View -> Debug Log would help us understand what's going on!

@obygyv
Copy link

obygyv commented Mar 20, 2024

Signal_debuglog.txt
Here is the log attached.
I'm apparently running the version 7.2.0. I usually auto-update when Signal could connect to the proxy but since it can't anymore, I can't auto-update...
Note that I'm in a Enterprise environment with limited network access (under Zscaler security), that's why I'm using my own proxy (socket open via putty).

@scottnonnenberg-signal
Copy link
Contributor

@obygyv You've got the error we just fixed in 7.2.1:

Caused by: Error: createProxyAgent: all=true lookup is not supported

You can go to signal.org/download and install the latest version on top of what you have right now, with no impact to your data. That should fix your connectivity!

@obygyv
Copy link

obygyv commented Mar 21, 2024

@obygyv You've got the error we just fixed in 7.2.1:
You can go to signal.org/download and install the latest version on top of what you have right now, with no impact to your data. That should fix your connectivity!

Indeed, I had to reinstall manually because the auto-update was unable to proceed without proxy support. Now on 7.3.0 and it works again.
Thanks

@dimaslanjaka
Copy link

i dont know this will work

const { app, BrowserWindow } = require('electron');
const { socksGlobalAgent } = require('global-agent');

// Configure SOCKS proxy
socksGlobalAgent.initialize();

// Set your SOCKS proxy server
socksGlobalAgent.proxy = `socks://YOUR_SOCKS_PROXY_ADDRESS:YOUR_SOCKS_PROXY_PORT`;

// Create the browser window
app.whenReady().then(() => {
    const mainWindow = new BrowserWindow();

    // Load your desired URL
    mainWindow.loadURL('https://example.com');

    // Additional event listeners and configurations can be added as needed

    // Example: Close the app when the window is closed
    mainWindow.on('closed', () => {
        app.quit();
    });
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests