Commit Graph

48 Commits (master)

Author SHA1 Message Date
Yawning Angel efdc692691 obfs4: Clean up and modernize the codebase
While the thought of dealing with this codebase makes me reach for the
Benzodiazepines, I might as well clean this up.
10 months ago
Yawning Angel 83f01d5a74 transports/meek_lite: Remove utls support
While this was a good idea back when I did it:

 * People don't like the fact that it requires a fork of utls to fix
   compatibility issues, and would rather spend 3 years complaining
   about it instead of spending a weekend to fix the issues in
   upstream.

 * Tor over meek is trivially identifiable regardless of utls or not.

 * Malware asshats ruined domain fronting for everybody.
2 years ago
Yawning Angel e330d1b702 transports/meek_lite: Bump the version of the utls fork
And add the Chrome 83 fingerprint.
3 years ago
Philipp Winter 40245c4a1c Update Azure's root CA certificate pins.
Microsoft recently updated the root CA certificates that are served to
Azure clients.  See the following article for more details:
https://docs.microsoft.com/en-us/azure/security/fundamentals/tls-certificate-changes

This change broke meek-lite because none of its pins work anymore.  That
means that Tor Browser users can no longer use meek-azure or moat as
both rely on meek-lite.

This patch fixes the problem by updating the certificate pins.

Signed-off-by: Yawning Angel <yawning@schwanenlied.me>
4 years ago
Yawning Angel 1a6129b66f obfs4: Alter tear down behavior to be less distinctive
The old behavior closed the connection on handshake failure after:
 * The first N bytes (random on a per-server basis).
 * The first M seconds (random on a per-server basis).

Whichever came first.  As Sergey Frolov kindly points out, depending on
which conditions cause termination, the server will send either a FIN or
a RST.  This change will remove the "amount read" based termination
threshold, so that connections that cause failed handshakes will discard
all data received until the teardown time is reached.

Thanks to Sergey Frolov for bringing this issue to my attention.
5 years ago
Yawning Angel a8288437e3 Update my e-mail address (no functional changes) 5 years ago
Yawning Angel dba633c7dc transports/meek_lite: More utls related changes
* Bump the module import to a new tag
 * Bump the rest of the dependencies while I'm here
 * Add some new fingerprints from upstream
 * Disable my fork's AES timing sidechannel defenses
5 years ago
Yawning Angel ca6765e3e3 transports/meeklite: Tweak the TLS configuration 5 years ago
Yawning Angel fd44ad42fd transports/meeklite: Enable the utls fork's vartime group feature 5 years ago
Yawning Angel abf0435e18 fixup! transports/meek_lite: Switch to pinning MS's CA intermediary certs 5 years ago
Yawning Angel 0c371bcf8e transports/meek_lite: Switch to pinning MS's CA intermediary certs
This should give me more time before I need to update this.
5 years ago
Yawning Angel 3bd6beb8b2 transports/meek_lite: Add an expiry date for HPKP entries
Mostly since the built-in pins will likely become invalid once the
certificates I used to generate them start to expire.
5 years ago
Yawning Angel c65aaf6407 transports/meeklite: Add a lightweight HPKP implementation
HPKP is effectively dead as far as a standard goes, but the idea has
merit in certain use cases, this being one of them.

As a TLS MITM essentially will strip whatever obfuscation that the
transport may provide, the digests of the SubjectPublicKeyInfo fields
of the Tor Browser Azure meek host are now hardcoded.

The behavior can be disabled by passing `disableHPKP=true` on the bridge
line, for cases where comaptibility is prefered over security.
5 years ago
Yawning Angel bde8b7ff56 transports/meeklite: Use a modified version of utls
Changes:
 * Use a fork of utls with some compatibility improvements.
 * Switch the default ClientHello profile to `HelloFirefox_Auto`.
 * Add the `HelloChrome_71` profile.

The existing `HelloFirefox_Auto` profile that points to
`HelloFirefox_63` also matches the (common) behavior of Firefox 65,
assuming that 3DES ciphersuites are not disabled.
5 years ago
Yawning Angel f01e92dde7 fixup! transports/meeklite: uTLS for ClientHello camouflage
Fix `getDialTLSAddr` to always return a integer port.  Thanks to dcf for
reporting the issue.
5 years ago
Yawning Angel 5d41c674f0 transports/meeklite: Apply http.DefaultTransport timeouts etc 5 years ago
Yawning Angel e4020b18f7 transports/meeklite: Add `utls` argument to configure behavior
Per dcf:
> As for the TODO, my plan was was to expose a "utls" SOCKS arg
> to make it configurable per bridge, and just reuse the utls
> Client Hello ID names:
>	utls=HelloChrome_Auto

This adds support for all currently supported utls ClientHello IDs
with the following caveats/differences:

 * `none` - Disables using utls entirely, forces `crypto/tls`.
 * `HelloGolang` - Alias of `none`, since using utls is pointless.
 * `HelloCustom` - Omitted as pointless.
5 years ago
Yawning Angel 4d453dab21 transports/meeklite: uTLS for ClientHello camouflage
There's still some interesting oddities depending on remote server and
what fingerprint is chosen, but I can watch videos online with the
chosen settings and the TBB Azure bridge.

Note: Despite what people are claiming in the Tor Browser bug tracker
it isn't all that hard to use the built in http client with utls.  And
yes, the `transport.go` code does negotiate correctly in a standalone
test case (apart from compatibility related oddities).
5 years ago
Yawning Angel 816cff15f4 transports/meeklite: Cleanups, bugfixes and improvements
* Properly close the response body on HTTP error.
 * Cleanup close signaling.
 * Write() should return faster on closed connections.
5 years ago
Yawning Angel 5b4397bff8 Clean up static analysis warnings
Mostly but not entirely discarding error return values of things that
can not possibly fail despite the API returning errors.
5 years ago
Yawning Angel 70d0e90c86 Change the canonical upstream repo location to gitlab
This commit changes the upstream repo location to:
  https://gitlab.com/yawning/obfs4.git

Additionally all the non-`main` sub-packages now have an import
comment annotation.  As a matter of courtesy, I will continue to
push to both the existing github.com and git.torproject.org repos
for the foreseeable future, though I reserve the right to stop
doing so at any time.
5 years ago
Yawning Angel 89c21805c2 (meek_lite) Explicitly set Content-Length to zero when there is no data to send.
https://gitweb.torproject.org/pluggable-transports/meek.git/commit/?h=0.28&id=0ea861efe5873b517fbd08c4bc48027e4db16a95
6 years ago
Ox Cart df6aeeca8c Reusing read buffer for readPackets 8 years ago
Yawning Angel 62057625ea Use the correct epoch hour when crafting the obfs4 server ntor response.
It's supposed to use the one derived from the client's handshake
(assuming the clock skew is within acceptable limits), but it was using
the one based off the current system time.
8 years ago
Yawning Angel a7a2575cab The obfs4 `iat-mode` parameter is now properly configurable.
It used to be that all of the bridge side parameters needed to be
manually specified together.  This was somewhat nonsensical, and the IAT
mode can now be set as the only obfs4 option in a `ServerTransportOptions`
torrc directive.

Thanks to dcf for reporting the issue.
8 years ago
Yawning Angel 2cbefcfcd2 Fix other instances of attempting to close `nil` on handshake failure.
Bug introduced in e52258edac, not in any
released version of obfs4proxy.
8 years ago
pminmax945 c0e8866c13 fix incorrect connection close
when obfs4 connection create failed,conn variable is
set to nil already.
8 years ago
Yawning Angel 672e70000a meek-lite: Don't send a "User-Agent" header. 9 years ago
Yawning Angel 43cdc20e7e meek-lite: combine small writes at request dispatch time.
This dramatically improves bulk upload performance, from totally shit
to just shit.
9 years ago
Yawning Angel 611205be68 Add the "meek_lite" transport, which does what one would expect.
This is a meek client only implementation, with the following
differences with dcf's `meek-client`:

 - It is named `meek_lite` to differentiate it from the real thing.
 - It does not support using an external helper to normalize TLS
   signatures, so adversaries can look for someone using the Go
   TLS library to do HTTP.
 - It does the right thing with TOR_PT_PROXY, even when a helper is
   not present.

Most of the credit goes to dcf, who's code I librerally cribbed and
stole.  It is intended primarily as a "better than nothina" option
for enviornments that do not or can not presently use an external
Firefox helper.
9 years ago
Yawning Angel e52258edac Make establishing outgoing connections the transport's responsibility.
ClientFactories now have a Dial() method instead of a WrapConn()
method, so that it is possible to write something like meek-client
using the obfs4proxy framework.

This breaks the external interface if anyone is using obfs4proxy as
a library, but the new way of doing things is a trivial modification,
to a single routine that shouldn't have been very large to begin with.
9 years ago
Yawning Angel 69ffcc39c6 Delay transport initialization till after logging has been setup. 9 years ago
Daniel Martí 398b795c87 Simplify some err and return logic 9 years ago
Daniel Martí ced244c09f Reduce some if err != nil logic lines 9 years ago
Daniel Martí 19dcb424be Fix all go vet issues 9 years ago
Daniel Martí 08647ec580 Run go fmt 9 years ago
Yawning Angel 0066cfc393 Add support for acting as a ScrambleSuit client.
This allows obfs4proxy to be used as a ScrambleSuit client that is wire
compatible with the obfs4proxy implementation, including session ticket
support, and length obfuscation.

The current implementation has the following limitations:
 * IAT obfuscation is not supported (and is disabled in all other
   ScrambleSuit implementations by default).
 * The length distribution and probabilites are different from those
   generated by obfsproxy and obfsclient due to a different DRBG.
 * Server support is missing and is unlikely to be implemented.
9 years ago
Yawning Angel cdeda57241 Change the import path for go.crypto.
The Go developers decided to move the go.crypto repository to
golang.org/x/crypto, and also to transition from hg to git.  The tip of
tree code.google.com copy of the code is broken due to the import paths
pointing at the new repository.

While the change here is simple (just update the import location), this
affects packagers as it now expects the updated package.  Sorry for the
inconveneince, I blame the Go people.
9 years ago
Yawning Angel 6ba5b4921f Fix minor issues pointed out by "go vet". 10 years ago
Yawning Angel 4932821bda Improve the performance of the obfs4 handshake test.
Exhaustively testing padding combinations is really slow, and was
causing timeouts during the Debian ARM package build process.  Attempt
to improve the situation by:

 * Reusing the client and server keypair for all of the tests, to cut
   runtime down by  ~50%.
 * Splitting the client side and server side tests up, as it appears
   the timeout is per-test case.

If this doesn't fix things, the next thing to try would be to reduce
the actual number of padding lengths tested, but that is a last resort
at the moment.
10 years ago
Yawning Angel 6cd81ec42f Change the bridge line format to be more compact.
Instead of "node-id" and "public-key" that are Base16 encoded, use
"cert" which contains the "node-id" and "public-key" in Base64 encoded
form.  This is more compact and cuts the length down by 49 characters.
10 years ago
Yawning Angel 514c3c6053 Write an example obfs4 bridge line to "obfs4_bridgeline.txt".
Write an example client bridge line suitable for use with the running
obfs4 server instance to "obfs4_bridgeline.txt" for the convenience of
bridge operators.
10 years ago
Yawning Angel bfca92cf16 Various IAT related changes.
* Unbreak inbound TYPE_PRNG_SEED processing.

 * IAT obfuscation is now a per-bridge argument (iat-mode).
   * 0 (default) = Disabled.
   * 1 = Enabled, ScrambleSuit-style with bulk throughput optimizations.
   * 2 = Paranoid, Each IAT write will send a length sampled from the
     length distribution. (EXPENSIVE).

The "iat-mode" argument is mandatory on the Bridge lines, and as a
ServerTransportOption.  Old statefiles will continue to load and use
the default value, edit it if your hat is made of tin foil.
10 years ago
Yawning Angel 468cd4bde8 Display a more useful error on JSON Unmarshall failure. 10 years ago
Yawning Angel 1e574942d5 Change all the arguments to use base16 from base64.
WARNING: THIS BREAKS BACKWARD COMPATIBILITY.

This is primarily to work around bug #12930.  Base16 was chosen over
unpadded Base64 because the go runtime Base64 decoder does not handle
omitting the padding.

May $deity have mercy on anyone who needs to hand-enter an obfs4 bridge
line because I will not.
10 years ago
Yawning Angel f32f01ba01 Change the drbg seed field in the state file.
Changing from "drbgSeed" to "drbg-seed" to be consistent with the
ServerTransportOptions to allow for easier copy/paste.
10 years ago
Yawning Angel 22c9dc3f48 Add support for enabling IAT obfuscation and biased WDist.
Golang's command line parser is slightly cumbersome to use with
subcommands, so the arguments are "obfs4-iatObufscation" and
"obfs-distBias" instead of obfsproxy style subcommands.
10 years ago
Yawning Angel 339c63f0c8 Massive cleanup/code reorg.
* Changed obfs4proxy to be more like obfsproxy in terms of design,
   including being an easy framework for developing new TCP/IP style
   pluggable transports.
 * Added support for also acting as an obfs2/obfs3 client or bridge
   as a transition measure (and because the code itself is trivial).
 * Massively cleaned up the obfs4 and related code to be easier to
   read, and more idiomatic Go-like in style.
 * To ease deployment, obfs4proxy will now autogenerate the node-id,
   curve25519 keypair, and drbg seed if none are specified, and save
   them to a JSON file in the pt_state directory (Fixes Tor bug #12605).
10 years ago