obfsproxy in China

Hi, i’m trying to get obfsproxy working behind the great firewall of China. I installed it according to the nordvpn guide

https://support.nordvpn.com/hc/en-us/articles/115001724489-VPN-Obfuscation-on-Linux)

but when i try to run the command:
obfsproxy obfs3 socks 127.0.0.1:1050it fails with:

Traceback (most recent call last):
File “/usr/bin/obfsproxy”, line 11, in <module>
load_entry_point(‘obfsproxy==0.2.13’, ‘console_scripts’, ‘obfsproxy’)()
File “/usr/lib/python3.6/site-packages/pkg_resources/init.py”, line 560, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File “/usr/lib/python3.6/site-packages/pkg_resources/init.py”, line 2648, in load_entry_point
return ep.load()
File “/usr/lib/python3.6/site-packages/pkg_resources/init.py”, line 2302, in load
return self.resolve()
File “/usr/lib/python3.6/site-packages/pkg_resources/init.py”, line 2308, in resolve
module = import(self.module_name, fromlist=‘name’], level=0)
File “/usr/lib/python3.6/site-packages/obfsproxy/pyobfsproxy.py”, line 183
except ValueError, err:
^
SyntaxError: invalid syntax

Any idea how to fix this?

First,
Your reference describes the application requiring Python 2 while your log output describes using Python 3 libraries and files.
I’m speculating it might be because in the documentation your command specifies “obfs3”
You might try the same command without the 3 as follows


obfsproxy obfs socks 127.0.0.1:1050

Also,
Although it might not make a difference, you should probably install the special repositories for Python 2 and Python 3. Although I don’t see many differences from what is in the regular TW release, you will still have access to later and more Python packages.

Paste the following into an elevated console and run it to install both special Python repos


zypper ar -f http://download.opensuse.org/repositories/devel:/languages:/python3/openSUSE_Tumbleweed/ TW_Python3 &&\
zypper ar -f http://download.opensuse.org/repositories/devel:/languages:/python/openSUSE_Tumbleweed/ TW_python2 &&\
zypper --gpg-auto-import-keys ref

You can run the following to make sure that openvpn is installed, and although your reference describes launching an openvpn connection from the command line, I’m also including Network Manager support in case you want to explore that alternative

zypper in openvpn NetworkManager-openvpn

HTH,
TSU

Came across some old documentation, “run” the following command

obfsproxy obfs2 socks 127.0.0.1:105

TSU

Hi,

I added the repos and tried the command, but the errors are the same. If I simply run:

obfsproxy

the errors are still the same.

So, I suppose there is something wrong with the install process of obfsproxy using pip. It did download and compile, but there is something wrong when running it.

Since the guide I posted refers to using python2, is there a way to make it install obfsproxy without defaulting to python3?

Currently, am unable to get anything to work but am posting what I’ve been able to do in hopes maybe someone can further one of the attempts. In particular, if anyone more experienced than myself about compiling go, see what might be possible(See “**obfs4: Attempting to use Tor git source” **below).

This post describes 3 main attemptsobfsproxy installed from PyPi
obfsproxy installed from local source (cloned from github)
obfs4 from git.tor.org

The following describes in detail so my steps can be replicated…

Preparing your machine
Although probably not absolutely necessary for TW, I feel that it’s still a good idea to add the Tumbleweed Python and Python3 repos when building apps


zypper ar -f http://download.opensuse.org/repositories/devel:/languages:/python3/openSUSE_Tumbleweed/ TW_Python3 &&\
zypper ar -f http://download.opensuse.org/repositories/devel:/languages:/python/openSUSE_Tumbleweed/ TW_python2 &&\
zypper --gpg-auto-import-keys ref

For anyone who wants to try to build obfsproxy, the following dependenccies should be installed to support sources from PyPi, github and likely tor git.


zypper in make automake gcc python-pip python-devel libyaml-devel python3-pyaml python-pyaml python-setuptools git openvpn NetworkManager-openvpn

Attempt to build obfsproxy from PyPi following the likely path of the @OP


pip install obfsproxy

Unfortunately for me, I can’t even get as far as the @OP since I can’t even build successfully, the following is my error. As noted above, python-setuptools is installed, and I also tried upgrading to the package from PyPi (no change).


Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-0z_c_4yp/PyCrypto/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('
', '
');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-qrhklvfi-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-0z_c_4yp/PyCrypto/

Attempt to build obfsproxy locally using github source


git clone https://github.com/isislovecruft/obfsproxy.git

cd to the root of the cloned download (obfsproxy)

In an elevated console,

python setup.py install

But when attempting to run, the following error is thrown… Note that unlike installing from Pypi, the correct version of Python is used but still an error is thrown… This “pkg_resources.DistributionNotFound:” error might be due to a Python environmental variable that could be addressed by running the application in virtualenv, but I’m not able to spend more time on this today…


obfsproxy obfs3 socks 127.0.0.1:1050
Traceback (most recent call last):
  File "/usr/bin/obfsproxy", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3038, in <module>
    @_call_aside
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3022, in _call_aside
    f(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3051, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 659, in _build_master
    return cls._build_from_requirements(__requires__)
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 672, in _build_from_requirements
    dists = ws.resolve(reqs, Environment())
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 857, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'constantly>=15.1' distribution was not found and is required by Twisted

**Attempt to build obfs4 **(obfourscator)
https://github.com/Yawning/obfs4

The obfsproxy project has not been maintained for over 3 years, but because it is a relatively simple application that is always built using current versions of components, it should still likely build and function securely.
But, the obfs4 project is one year newer and does support the older project’s obfuscation protocol so can be used as a substitute client, and additionally supports its own obfuscation protocol which can be implemented using modified Tor bridges (The older obfsproxy seems to require special VPN Servers which can then forward to Tor).

Maybe someone can identify what I’m overlooking.
The main problem is that to build a go application, you normally point “go build” at a master go script but I can’t identify any such thing. I’ve tried generally pointing to the “obfs4proxy” directory which is what the INSTALL instructions seem to suggest but not much to my surprise that fails.
I wonder if the github source and the gitweb.tor.org source are simply copies of each other (the directory structure is the same), they are different but independent of each other or if both are inter-related.
I’ve also tried pointing “go build” at a random go script, but the output error suggests that the “git.tor.org” namespace is hard-coded into the script so should be built using the network name as described in the stated Build statement and cannot be easily built pointing to local source.

Prerequisite:
Install go

zypper in go

obfs4: Attempting to use Tor git source
Based on the instructions from the github source (not git.tor.org), the following command should successfully build a new executable


go get git.torproject.org/pluggable-transports/obfs4.git/obfs4proxy

If the above command results in the following error, then insert “-insecure” in the above command after “get”

code:
package git.torproject.org/pluggable-transports/obfs4.git/obfs4proxy: cannot download, git.torproject.org/pluggable-transports/obfs4 uses insecure protocol

For me, the above build command throws no error, but fails silently since I see no change. I expect that somewhere there should be a bin/obfsproxy which would then be copied or moved to somewhere in the system path (probably /bin/)

obfs4: Attempting to also use github source

As I described above,
I don’t see any certain benefit from downloading source from github, but I’m providing that here if anyonw thinks it’s helpful.

From wherever you want to locate your github source,

git clone https://github.com/Yawning/obfs4.git

I see that 6 people built an obfsproxy in Docker Hub

That’s probably your best way to run obfsproxy on openSUSE.

If you’re not aware of what Docker is,
It’s a technology that allows running apps and even OS to run in isolated Linux Containers.
You can deploy the Container in a variety of ways to either share or use a different networking address.

If you decide to run obfsproxy this way and are unable to figure out how to make it work, post again.

TSU