Opened 5 years ago

Last modified 5 months ago

#13040 new task

Get bananaphone merged in obfsproxy

Reported by: asn Owned by:
Priority: Medium Milestone:
Component: Archived/Obfsproxy Version:
Severity: Normal Keywords:
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

Let's get this PT merged upstream!

David has already done most of the job:
https://bananaphone.readthedocs.org/en/latest/

Child Tickets

Change History (5)

comment:1 Changed 5 years ago by asn

I tried david-bananaphone from https://github.com/david415/obfsproxy.git with the instructions from https://bananaphone.readthedocs.org/en/latest/ .

I tried to run it in external mode, but it crashed with:

$ ./bin/obfsproxy --log-min-severity=info bananaphone --order=1 --model=markov --corpus=/usr/share/dict/words --encoding_spec='words,sha1,4' --dest=127.0.0.1:3600 server 127.0.0.1:3601
2014-09-02 19:40:48,092 [WARNING] Obfsproxy (version: obfsproxy-0.2.12-39-gea0e1b2) starting up.
2014-09-02 19:40:48,092 [WARNING] Bananaphone: building encoder markov model
2014-09-02 19:40:49,542 [ERROR] Unrecognized option: False
Traceback (most recent call last):
  File "/home/user/obfsproxy/obfsproxy/pyobfsproxy.py", line 203, in run
    pyobfsproxy()
  File "/home/user/obfsproxy/obfsproxy/pyobfsproxy.py", line 185, in pyobfsproxy
    do_external_mode(args)
  File "/home/user/obfsproxy/obfsproxy/pyobfsproxy.py", line 101, in do_external_mode
    run_transport_setup(pt_config, args.name)
  File "/home/user/obfsproxy/obfsproxy/pyobfsproxy.py", line 150, in run_transport_setup
    transport_class['base'].setup(pt_config)
  File "/home/user/obfsproxy/obfsproxy/transports/bananaphone_transport.py", line 90, in setup
    encoder_factory, decoder_factory = cls.get_codec_factories(cls.encodingSpec, cls.modelName, cls.corpus, cls.order, cls.abridged)
  File "/home/user/obfsproxy/obfsproxy/transports/bananaphone_transport.py", line 36, in get_codec_factories
    encoder_factory = rh_build_encoder_factory(encodingSpec, modelName, *args)
  File "/home/user/obfsproxy/obfsproxy/transports/bananaphone.py", line 501, in rh_build_encoder_factory
    encodeFactory = model( tokenize, hash, bits, *args )
  File "/home/user/obfsproxy/obfsproxy/transports/bananaphone.py", line 416, in markov
    assert abridged == None, "Unrecognized option: %s" % ( abridged, )
AssertionError: Unrecognized option: False
Traceback (most recent call last):
  File "./bin/obfsproxy", line 16, in <module>
    run()
  File "/home/user/obfsproxy/obfsproxy/pyobfsproxy.py", line 203, in run
    pyobfsproxy()
  File "/home/user/obfsproxy/obfsproxy/pyobfsproxy.py", line 185, in pyobfsproxy
    do_external_mode(args)
  File "/home/user/obfsproxy/obfsproxy/pyobfsproxy.py", line 101, in do_external_mode
    run_transport_setup(pt_config, args.name)
  File "/home/user/obfsproxy/obfsproxy/pyobfsproxy.py", line 150, in run_transport_setup
    transport_class['base'].setup(pt_config)
  File "/home/user/obfsproxy/obfsproxy/transports/bananaphone_transport.py", line 90, in setup
    encoder_factory, decoder_factory = cls.get_codec_factories(cls.encodingSpec, cls.modelName, cls.corpus, cls.order, cls.abridged)
  File "/home/user/obfsproxy/obfsproxy/transports/bananaphone_transport.py", line 36, in get_codec_factories
    encoder_factory = rh_build_encoder_factory(encodingSpec, modelName, *args)
  File "/home/user/obfsproxy/obfsproxy/transports/bananaphone.py", line 501, in rh_build_encoder_factory
    encodeFactory = model( tokenize, hash, bits, *args )
  File "/home/user/obfsproxy/obfsproxy/transports/bananaphone.py", line 416, in markov
    assert abridged == None, "Unrecognized option: %s" % ( abridged, )
AssertionError: Unrecognized option: False

Simply adding the --abridged switch didn't fix it. Didn't look into this more :(

Also, bananaphone in managed mode crashes both for client and server. I just get the notorious

Sep 02 19:55:11.000 [warn] The communication stream of managed proxy '/usr/local/bin/obfsproxy' is 'closed'. Most probably the managed proxy stopped running. This might be a bug of the managed proxy, a bug of Tor, or a misconfiguration. Please enable logging on your managed proxy and check the logs for errors.

and in the obfs logs I see:

2014-09-02 19:55:09,889 [WARNING] Obfsproxy (version: 0.2.5) starting up.
2014-09-02 19:55:09,889 [INFO] Entering client managed-mode.
2014-09-02 19:55:09,890 [ERROR] type object 'BananaphoneClient' has no attribute 'encodingSpec'
Traceback (most recent call last):
  File "build/bdist.linux-x86_64/egg/obfsproxy/pyobfsproxy.py", line 203, in run
    pyobfsproxy()
  File "build/bdist.linux-x86_64/egg/obfsproxy/pyobfsproxy.py", line 175, in pyobfsproxy
    do_managed_mode()
  File "build/bdist.linux-x86_64/egg/obfsproxy/pyobfsproxy.py", line 78, in do_managed_mode
    managed_client.do_managed_client()
  File "build/bdist.linux-x86_64/egg/obfsproxy/managed/client.py", line 58, in do_managed_client
    transport_class.setup(pt_config)
  File "build/bdist.linux-x86_64/egg/obfsproxy/transports/bananaphone_transport.py", line 90, in setup
    encoder_factory, decoder_factory = cls.get_codec_factories(cls.encodingSpec, cls.modelName, cls.corpus, cls.order, cls.abridged)
AttributeError: type object 'BananaphoneClient' has no attribute 'encodingSpec'

I wonder what's going on, maybe the merge was not clean? Maybe you want to rebase instead? Why is obfsproxy still version 0.2.5 there? It should be 0.2.12.

Also, setup() is called on startup. When should encodingSpec be init'ed?

Sorry for not being able to look at this deeper!

comment:2 Changed 5 years ago by dcf

I got these errors too recently when I was making a diagram for doc/AChildsGardenOfPluggableTransports#Bananaphone. I had to use a pre-merge commit to get it to work, maybe it was https://github.com/david415/obfsproxy/commit/cfdfbd733b3fb1b9a64317507834679821daa0ec.

With the older commit, I got it to work with these torrc files:

# https://bananaphone.readthedocs.org/en/latest/#test-bananaphone-obfsproxy-transport

SocksPort 8040
DataDirectory ./datadir-client

UseBridges 1

Bridge bananaphone 127.0.0.1:4703 modelName=markov corpus=ulysses.txt encodingSpec=words,sha1,4 order=2
ClientTransportPlugin bananaphone exec obfsproxy --log-min-severity=info --log-file=client.log managed
# https://bananaphone.readthedocs.org/en/latest/#test-bananaphone-obfsproxy-transport

SocksPort 0
ORPort 7001
ExitPolicy reject *:*
DataDirectory ./datadir-server

BridgeRelay 1
PublishServerDescriptor 0

ServerTransportListenAddr bananaphone 127.0.0.1:4703
ServerTransportPlugin bananaphone exec obfsproxy --log-min-severity=info --log-file=server.log managed
ServerTransportOptions bananaphone corpus=ulysses.txt encodingSpec=words,sha1,4 modelName=markov order=2

comment:3 Changed 20 months ago by teor

Severity: Normal

Set all open tickets without a severity to "Normal"

comment:4 Changed 6 months ago by teor

Owner: asn deleted
Status: newassigned

asn does not need to own any obfuscation tickets any more. Default owners are trouble.

comment:5 Changed 5 months ago by cohosh

Status: assignednew

tickets are unassigned, reverting to 'new'

Note: See TracTickets for help on using tickets.