Commit Graph

255 Commits

Author SHA1 Message Date
Nathan Freitas 8d8fe0ceb4 updates to improve VPN support 2015-12-30 13:21:33 -05:00
Nathan Freitas dc06eedcfd final fixes for AppsVPN mode on boot and Android 4.x support 2015-06-26 09:52:42 -04:00
Nathan Freitas e11cae883e Merge branch 'the-big-start-stop-makeover' of https://github.com/eighthave/orbot into eighthave-the-big-start-stop-makeover
Conflicts:
	src/org/torproject/android/OrbotMainActivity.java
	src/org/torproject/android/service/TorService.java
2015-06-22 12:43:42 -04:00
Nathan Freitas e132a79a61 improve status request/callback interaction and status UI layout 2015-06-22 12:25:37 -04:00
Hans-Christoph Steiner a81c0001d6 init file path variables (tor, polipo, etc) when the app starts
These file path variables can be set at the very start, OrbotApp.onCreate()
and they will not change during the lifetime of the app, so represent them
as globally accessible static variables.  This is needed for things like
OrbotMainActivity detecting whether the tor daemon is still running, even
though TorService is not.
2015-06-17 12:06:23 -04:00
Hans-Christoph Steiner e5c2e1a040 when OrbotMainActivity starts, query TorService for current status
If OrbotMainActivity gets killed while TorService is running, then when
OrbotMainActivity starts again, it needs to get the current status from
TorService to correctly represent things to the user.
2015-06-17 11:00:48 -04:00
Hans-Christoph Steiner 232098eeaf set STATUS_STARTING in TorService.onCreate(), that's where it begins
The very first place that the whole tor start sequence starts is from
TorService's onCreate(), so that is where STATUS_STARTING should be
announced from.  The open question is whether Intents besides ACTION_START
ever cause TorService to start.  In theory, TorService should already be
running when any Intent is sent besides ACTION_START.
2015-06-12 14:49:19 -04:00
Hans-Christoph Steiner 8f57b42e68 rename TorStarter to IncomingIntentRouter, it handles all Intents
TorStarter does lots of things besides starting Tor
2015-06-12 14:46:47 -04:00
Hans-Christoph Steiner ff04bde300 announce Orbot is ON once the first circuit is complete
Before, it was announcing tor was started when it had completed starting
the daemons.  But that does not guarantee that Tor is actually connected
and working.  So instead, this waits for the first circuit to be built,
then announces Tor is ON.
2015-06-12 14:24:57 -04:00
Hans-Christoph Steiner b620f828a1 include dynamic proxy config info in ACTION_STATUS replies
This includes extras in the Intents that are sent as replies to the two
different requests to start tor (ACTION_START and ACTION_START_TOR).  These
extras give all of the current SOCKS and HTTP proxy settings, so that the
app can dynamically use the correct settings.  Sometimes there are port
conflicts, so apps should dynamically adjust in order to reliably find tor.

closes #3612 https://dev.guardianproject.info/issues/3612
refs #4419 https://dev.guardianproject.info/issues/4419
refs #3690 https://dev.guardianproject.info/issues/3690
refs #3687 https://dev.guardianproject.info/issues/3687
refs #3859 https://dev.guardianproject.info/issues/3859
2015-06-11 17:02:56 -04:00
Hans-Christoph Steiner 0937c8838f use constants for setting default ports, and variables when running 2015-06-11 16:32:31 -04:00
Hans-Christoph Steiner 623084548d standardize network port constant variables
use consistent naming and types for code clarity
2015-06-11 16:31:39 -04:00
Hans-Christoph Steiner 77b1bdfbc5 on receiving ACTION_START, only send status reply if EXTRA_PACKAGE_NAME set
In order to receive a targeted reply, an app has to send its packageName to
Orbot as an String extra in an ACTION_START Intent.  Also, when Orbot
internally uses ACTION_START, it shouldn't receive replies.
2015-06-10 18:02:43 -04:00
Hans-Christoph Steiner f433a5e655 expose start action via a BroadcastReceiver that any app can send to
This allows any app to broadcast an Intent to Orbot in order to make Orbot
start in the background.

closes #3117 https://dev.guardianproject.info/issues/3117
2015-06-10 18:02:43 -04:00
Hans-Christoph Steiner 90b731cc8d strictly target local broadcasts
This sets an action for each kind of local broadcast, and uses the action
to choose how to handle it.  Before, it was a mix of the action and which
extras the Intent included.
2015-06-09 22:01:52 -04:00
Hans-Christoph Steiner 21c3bfb3c5 use "SIGNAL HUP" to request Tor re-read its config
The tor daemon supports both "SIGNAL HUP" via its control port or the UNIX
signal `kill -HUP` via the terminal as a way to trigger the tor daemon to
reload its config.  This is needed for new bridges and hidden services. It
is not necessary to restart everything to add those.

https://stem.torproject.org/faq.html#how-do-i-reload-my-torrc
2015-06-09 22:01:52 -04:00
Hans-Christoph Steiner 6ac9a2cee6 use context.stopService() to shutdown TorService instead of custom message
Since running stopService() automatically triggers Service.onDestroy(),
there is a nice way to hook in and run the shutdown procedure.  This
provides an obvious point of entry as well as simplifying the shutdown
procedure.
2015-06-09 22:01:52 -04:00
Hans-Christoph Steiner 4d8a9dab27 broadcast Tor state to any app that might want to know
In order for apps to follow the current state of Tor, this broadcasts the
state both locally, since global broadcasts are insecure, and globally, for
any app to receive.  The internal workings of Orbot need to use a local
broadcast, otherwise any app could trigger stop, start, etc or DoS in other
ways.
2015-06-09 22:01:52 -04:00
Hans-Christoph Steiner 3580cbe05d only set mCurrentStatus in sendCallbackStatus(), the one stop shop
Make sendCallbackStatus() the one thing that updates the all of the bits
related to running status.
2015-06-09 22:01:52 -04:00
Hans-Christoph Steiner 780abf003e rework start/stop procedure to have clear points for ON, OFF, STARTING, STOPPING
In order to send reliable information to any app using Tor, Orbot itself
needs reliable state broadcasts.  Before, there the ON/OFF/STARTING state
were being set multiple times during the process, and sometimes not even in
a useful order (i.e. STARTING ON STARTING ON ON).

This reworks the start/stop procedure into startTor() and stopTor().
2015-06-09 22:01:52 -04:00
Hans-Christoph Steiner 82f82e1c10 mark TorService methods from EventHandler as overridden
This keeps me from getting confused...
2015-06-09 22:01:51 -04:00
Hans-Christoph Steiner 86593df6fb rename status to STARTING and STOPPING since it also starts/stops daemons
The CONNECTING status also is starting up daemons as well as connecting to
the tor daemon.
2015-06-09 22:01:51 -04:00
Hans-Christoph Steiner cf0adc27d6 on start and tor daemon not running, kill all daemons before starting again
To make sure there are not any other daemons still running when trying to
start the whole thing again, kill all daemons before starting tor afresh.
2015-06-09 22:01:51 -04:00
Hans-Christoph Steiner 2bc85a4a3a rework killing all daemons to continue trying after a failure
Before, it would quit the process on the first exception while killing.
This makes it keep on trying each daemon.
2015-06-09 22:01:51 -04:00
Hans-Christoph Steiner 73658ce3cf use Java methods for setting permissions on native executables
As of android-9, java.io.File has native methods for setting permissions,
inherited from Java 1.6.  Using these will help deal with compatibility
across devices, since some devices might not have chmod installed.
2015-06-09 22:01:51 -04:00
Hans-Christoph Steiner a3d37e8b2a make prefs called directly when needed instead of requiring refresh
The code was using global variables that were refreshed from the prefs on
certain occasions.  That means that the global vars could easily get out of
sync with the actual values.  Instead, just read the prefs directly when
the values are needed, and they will always be up-to-date.
2015-06-09 22:01:51 -04:00
Hans-Christoph Steiner 6e13a7e369 purge dead and unused code from TorService 2015-06-09 22:01:51 -04:00
Hans-Christoph Steiner 12d92f48f5 handle logging native process Exceptions closer to the source
Instead of passing Exceptions through many layers only to log them, just
log them where they are thrown.  Keeps things neater.
2015-06-09 22:01:51 -04:00
Hans-Christoph Steiner ae83f011b2 purge CMD_INIT/initialize() from TorService, an IntentService doesn't need it
when switching to an IntentService, a new Intent will always start the
Service, and onCreate() can be used to initialize the Service.
2015-06-09 22:01:51 -04:00
Hans-Christoph Steiner f09379d86c create String constants for Intent actions and extras
Following the Android system naming convention, this uses constants for
the action and extra names for Intents.  This makes it much easier to track
which "log" is which, since there are "log" actions, extras, and messages.
2015-06-09 22:01:51 -04:00
Hans-Christoph Steiner a336a294fb convert status variable to String for easy sharing in Intents
Instead of making the apps who receive the broadcasts decipher a number
scheme, send the string of the status.  Then it'll be self-documenting.
2015-06-09 21:48:54 -04:00
Hans-Christoph Steiner 2f1ad74538 put up error notification if Orbot cannot kill a process
There are a couple of different times when Orbot will be unable to kill the
running processes.  One example is when Orbot is running, then uninstalled,
then installed again.

closes #5254 https://dev.guardianproject.info/issues/5254
2015-06-04 17:50:25 -04:00
Nathan Freitas 1bc427b50e handle NPE on number format instance 2015-04-13 10:25:58 -04:00
Nathan Freitas 421764bf33 make socksbypass local port random 2015-04-11 21:16:56 -04:00
Nathan Freitas 933b2e9b4e Small VPN and socket monitoring related fixes 2015-04-10 22:29:13 -04:00
Nathan Freitas d6c51bcc3c Fixes for bridge setup, and root/shell interaction
- If you paste bridge addresses from Gmail, you get some strange
characters that were causing problems. This looks for that, and
other formatting related gotchas.
- This also moves all configuratino to the torrc.custom file
instead of using the control port. These changes require you to
restart anyhow, and using the torrc.custom is more reliable as it
affects the tor process on launch, and not post control port interaction.
2015-04-09 13:04:28 -04:00
Nathan Freitas 7d8eea24b1 switch back to DNS on 10.0.0.1, update after VPN refresh 2015-04-09 09:10:14 -04:00
Nathan Freitas 690a8c3b69 Improved handling of VPN and Tun2Socks on Network Switch 2015-04-09 08:52:59 -04:00
Nathan Freitas 384fe1c21e fix handling of network connectivity state management 2015-04-08 16:46:40 -04:00
Nathan Freitas d6eb1dca57 fixes for network switching with VPN enabled 2015-04-04 00:36:24 -04:00
Nathan Freitas 75426bb9e2 Improve VPN service support - fix network switching handling
We now refresh the VPN and tun2socks interfaces when the network
type switches, and we do so in a way that does not cause traffic to leak.
The new interface is established before we close the old one.
2015-04-03 12:27:59 -04:00
Nathan Freitas 6a7c593353 a little bit of code re-org and new package for wizard 2015-03-28 00:39:58 -04:00
Nathan Freitas 6d05e27793 Improve Bridge and VPN support, working in tandem
You can use Bridges with VPN "App Mode" proxying
On Pre-Lollipop this uses a local loop back SOCKS server to flag outbound sockets as not for the VPN network
On Lollipop+ this uses the "disallow app" feature to set anything in the Orbot process to not be sent through the VPN
2015-03-17 13:04:20 -04:00
Nathan Freitas b278b66b62 switch obfsclient to obfs4 proxy
includes supporting SOCKS outbound proxy for VPN mode
2015-03-09 15:53:02 -04:00
Nathan Freitas 068cd05836 more bridge and proxy configuration clean up 2015-02-23 12:30:13 -05:00
Nathan Freitas 9c77526f22 move HTTP VPN bypass proxy to 9998 2015-02-14 02:30:14 -05:00
Nathan Freitas 096eae705b implementing http server for meek-client VPN bypass 2015-02-14 01:54:56 -05:00
Nathan Freitas bff6d0f567 add support for meek PT 2015-02-14 00:44:09 -05:00
Nathan Freitas c220ec9183 re-enable DNS settings after you start Tor 2015-02-04 22:02:32 -05:00
Nathan Freitas 1852cde041 enable local DNS listen on 10.0.0.1 for VPN service
also add support for stopping VPNBuilder instance
2015-02-04 14:55:57 -05:00