An alternative approach would be to use setproctitle() (https://pypi.python.org/pypi/setproctitle). The original C routine is a non-portable BSDism, but the python wrapper claims to know how to correctly change this on most common systems.
setproctitle says that it simply wraps PostgreSQL's code: http://doxygen.postgresql.org/ps__status_8c_source.html The module's footprint seems to be rather small so it might not hurt to include it in obfsproxy/TBB. A less complex alternative would be to add a new command line switch to obfsproxy which allows specifying a password file.
edit: If we use setproctitle, there might be a small time window right after process invocation and before setproctitle becoming active in which an adversary might be able to get the password.
Maybe I'm missing something but did you try the _set_argv() helper I mentioned in Stem? That might provide you a simple, pure python method of doing this without taking on a compiled dependency.
Here's a draft patch implementing --password-file argument for scramblesuit transport. This is only scramblesuit specific though. I think it works but perhaps i have missed something.
Trac: Username: irregulator Cc: phw to phw, irregulator
Maybe I'm missing something but did you try the _set_argv() helper I mentioned in Stem? That might provide you a simple, pure python method of doing this without taking on a compiled dependency.
Isn't that method susceptible to a timing attack too?
Here's a draft patch implementing --password-file argument for scramblesuit transport. This is only scramblesuit specific though. I think it works but perhaps i have missed something.
Looks OK but the --password and the --password-file argument should be mutually exclusive and required. You could use subparser.add_mutually_exclusive_group(required=True) for that.
Looks OK but the --password and the --password-file argument should be mutually exclusive and required. You could use subparser.add_mutually_exclusive_group(required=True) for that.
Thanks for pointing this out. I uploaded a new version of the patch.
Isn't that method susceptible to a timing attack too?
This threw me off for a second. It's not a timing attack (or at least not by the definition I know, and wikipedia uses), but you're right that it would indeed still be vulnerable for a window. And agreed that either a password file or getpass prompt would be better options.