Sangfor EasyConnect
I need to use EasyConnect
as a proxy to connect to a supercomputer.
The supercomputer provider gives IP and login information of SSH through the proxy.
The EasyConnect
software runs a proxy client and listens to a port (1080
by default) as SOCKS5 proxy endpoint.
Sadly, on Windows, EasyConnect
introduces unnecessary root certificate in your Windows certificate system, and runs suspicious background services even the proxy is shutdown.
See how to uninstall EasyConnect
Docker
We can use a docker environment to safely run EasyConnect.
See the Github repo for a EasyConnect Docker Image
The image is hagb/docker-easyconnect
, you may need some docker image to access it.
Simply use this bash script:
|
|
then the container will run in background.
A VNC viewer can access 127.0.0.1:5901
on the host. Password for VNC is xxxx
as specified in the arguments.
If your host is Linux, you can use xtigervncviewer
. On Windows there is RealVNC
.
If your Linux host is connected via SSH, use X11 forwarding:
|
|
On Windows, you can use MobaXterm
or PuTTY & xming
.
But I would recommend using WSLg’s graphic capabilities if you have WSL2 on your Windows.
Inside WSL2, set up your ssh host correctly and connect via ssh -Y ...
.
In the X11 forwarding enabled SSH connection, running xtigervncviewer
will open a graphic window tunneled from the host, allowing you to access EasyConnect
with GUI.
Without VNC, you can also use a web UI.
SSH through SOCKS5
To run your ssh through SOCKS5, on Linux, use configuration:
|
|
On Windows:
|
|
Where “C:\Program Files\Git\mingw64\bin\connect.exe” is a tool ported with Git for Windows
.
Keeping alive
Sometimes EasyConnect
docker container dies (maybe due to being idle).
Luckily, simply restarting the container would fix it because the login credentials are persistent.
We can use a script to check connectivity and restart docker container if needed:
restoreConnectivity.sh
:
|
|
To periodically run this script, you can use cron with is commonly ported with systemd
.
Use
|
|
to check is cron service is running.
Edit your user crontab with
|
|
And add a line like:
|
|
which means every 3 minutes the script restoreConnectivity.sh
is executed and output is appended to ~/.log/cron.log
and ~/.log/cron_stderr.log
.
To avoid the log being infinitely growing, add a log cleaning script:
refreshCronLog.sh
:
|
|
then add another line with crontab -e
:
|
|
Which means every day at 00:00:00 the refreshCronLog.sh
is executed to keep the log files short.
PS
Exposing the SOCKS5 proxy endpoint to public network is dangerous. Do not do that.