[Pkg-privacy-commits] [obfs4proxy] 02/11: The obfs4 `iat-mode` parameter is now properly configurable.
Jérémy Bobbio
lunar at moszumanska.debian.org
Wed Nov 16 18:45:01 UTC 2016
This is an automated email from the git hooks/post-receive script.
lunar pushed a commit to branch master
in repository obfs4proxy.
commit a7a2575cab8b916e33d4b85fda4bac41f2124eec
Author: Yawning Angel <yawning at schwanenlied.me>
Date: Wed Apr 13 03:02:32 2016 +0000
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.
---
ChangeLog | 3 +++
transports/obfs4/statefile.go | 26 +++++++++++++++++---------
2 files changed, 20 insertions(+), 9 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 7ab3f96..92390b4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,7 @@
Changes in version 0.0.7 - UNRELEASED:
+ - Support configuring the obfs4 IAT parameter as the sole
+ ServerTransportOption on bridges, and correctly checkpoint the argument
+ to the state file.
Changes in version 0.0.6 - 2016-01-25:
- Delay transport factory initialization till after logging has been
diff --git a/transports/obfs4/statefile.go b/transports/obfs4/statefile.go
index 6c34f35..e4ff8bf 100644
--- a/transports/obfs4/statefile.go
+++ b/transports/obfs4/statefile.go
@@ -119,7 +119,9 @@ func serverStateFromArgs(stateDir string, args *pt.Args) (*obfs4ServerState, err
js.DrbgSeed, seedOk = args.Get(seedArg)
iatStr, iatOk := args.Get(iatArg)
- if !privKeyOk && !nodeIDOk && !seedOk && !iatOk {
+ // Either a private key, node id, and seed are ALL specified, or
+ // they should be loaded from the state file.
+ if !privKeyOk && !nodeIDOk && !seedOk {
if err := jsonServerStateFromFile(stateDir, &js); err != nil {
return nil, err
}
@@ -129,11 +131,12 @@ func serverStateFromArgs(stateDir string, args *pt.Args) (*obfs4ServerState, err
return nil, fmt.Errorf("missing argument '%s'", nodeIDArg)
} else if !seedOk {
return nil, fmt.Errorf("missing argument '%s'", seedArg)
- } else if !iatOk {
- // Disable IAT if not specified.
- return nil, fmt.Errorf("missing argument '%s'", iatArg)
- } else {
- // Parse and validate the iat-mode argument.
+ }
+
+ // The IAT mode should be independently configurable.
+ if iatOk {
+ // If the IAT mode is specified, attempt to parse and apply it
+ // as an override.
iatMode, err := strconv.Atoi(iatStr)
if err != nil {
return nil, fmt.Errorf("malformed iat-mode '%s'", iatStr)
@@ -168,7 +171,8 @@ func serverStateFromJSONServerState(stateDir string, js *jsonServerState) (*obfs
return nil, err
}
- return st, nil
+ // Write back the possibly updated server state.
+ return st, writeJSONServerState(stateDir, js)
}
func jsonServerStateFromFile(stateDir string, js *jsonServerState) error {
@@ -215,11 +219,15 @@ func newJSONServerState(stateDir string, js *jsonServerState) (err error) {
js.DrbgSeed = st.drbgSeed.Hex()
js.IATMode = st.iatMode
+ return writeJSONServerState(stateDir, js)
+}
+
+func writeJSONServerState(stateDir string, js *jsonServerState) error {
+ var err error
var encoded []byte
if encoded, err = json.Marshal(js); err != nil {
- return
+ return err
}
-
if err = ioutil.WriteFile(path.Join(stateDir, stateFile), encoded, 0600); err != nil {
return err
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/obfs4proxy.git
More information about the Pkg-privacy-commits
mailing list