Commit Graph
49 Commits
Author SHA1 Message Date
Sunil Mohan Adapa df76e6afa4 tor: Use fixed 9001 port for relaying
When ORPort is set to 'auto', Tor automatically allocates a port for it. During
it's first run, we able to extract the port number and open the firewall port.
However, unlike for pluggable transports, Tor does not seem to store this port
for future reuse in the state file. It hence opens a new port every time it is
started. This leads to a new port being assigned on next Tor startup and leads
to relay functionality not being reachable from outside.

According to the documentation, only possible values for ORPort are a fixed
number or 0 (disable) or auto (current behavior). Choose 9001 as this is the
commonly used port number for ORPort. The recommended port number of 443 is not
possible in FreedomBox due it is use for other purposes.

Closes: #1495.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-02-18 07:13:19 -05:00
Sunil Mohan Adapa 595997ff7c tor: Styling changes due to yapf
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-02-18 07:13:15 -05:00
Sunil Mohan Adapa dea4af17fb Rename Plinth to FreedomBox in license headers
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-02-16 20:10:09 -05:00
Johannes Keyser 634afef1c9 actions: Make subparsers mandatory, fixes calls without arguments
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2017-04-10 11:54:23 +05:30
Sunil Mohan Adapa 7f948d1111 tor: Simplify upstream bridges action code
- There is no need for separate subcommand as arguments can be passed in
  even when they have special characters such as \n in them.

- Enable obfs3 and scramblesuit transports also.  Since it is easy to
  support them and bridges site still provides them.  scramblesuit is
  also a nice alternative to obfs4.

- Minor refactoring/fixes.
2017-01-29 11:21:03 +05:30
James Valleroy 31f95cfb12 tor: Support obfs4 for upstream bridges
Refactor augeas lens for readability.
2017-01-29 11:19:34 +05:30
James Valleroy 5483d30151 tor: Don't allow relay to be enabled while using upstream bridges 2017-01-29 11:19:01 +05:30
James Valleroy 165e880329 tor: Move restart logic into plinth module 2017-01-29 11:18:42 +05:30
James Valleroy 6430ebbc71 tor: Re-use loaded augeas 2017-01-29 11:18:31 +05:30
James Valleroy 09b58a8b99 tor: Add option to use upstream bridges 2017-01-29 11:17:41 +05:30
James Valleroy 85b87268b4 tor: Fix various issues related to plinth instance
- Remove extra newlines added to torrc.
- Remove comments added in random places to torrc.
- Enable tor instance during setup.
- Fix restarts to use tor instance.
- Revert change to augeas lens to attempt handling +.
- Add support for hyphens in values to augeas lens.
- Increment module version so setup can run again.
2017-01-08 15:36:59 -05:00
mridulnagpal 658e52f6cd tor: Remove +SocksPort line from instance torrc
Not supported by augeas tor lens.
2017-01-08 14:55:42 -05:00
mridulnagpal 7afd5dd32d tor: Disable tor service (replaced by tor@plinth) 2017-01-08 14:55:40 -05:00
mridulnagpal fdac901181 tor: Run tor-instance-create during setup 2017-01-08 14:55:37 -05:00
mridulnagpal 9f2521ce76 tor: Use plinth instance 2017-01-08 14:55:31 -05:00
Sunil Mohan Adapa 038fec97a6 tor: Ability to run regular relays
- Allow users to run regular relays.  In addition to that users will be
  able to turn them into bridge relays.  Like before, by default,
  relaying is enabled and the relay type bridge relay.

- Show obfs3/4 transport ports as needing firewall port forwarding only
  if bridge relay is enabled.

- Remove pluggable transports configuration from configuration when
  bridge rely is disabled.

- Improve description message for relays and bridge relays.
2016-07-16 13:43:29 -04:00
Sunil Mohan Adapa 70001c841f tor: Minor improvements
- Minimize loading of Augeas since it takes time.

- Make some methods private

- PEP8 fixes
2016-07-16 13:43:23 -04:00
James Valleroy 38382ec09c tor: Add option to toggle bridge relay 2016-07-08 23:19:16 +05:30
James Valleroy 1c98d1272f tor: Use single command to get status
Merge get_ports and get_hs into get_status.
2016-07-08 23:19:09 +05:30
fonfon bc2cba0cbf tor: remove circular import 2016-05-11 18:19:49 -04:00
fonfon f419c28596 Services: Explicitly use ServiceForm and ServiceView
- adapted all modules to not use views.ConfigurationView anymore
- removed templates that are not needed anymore
- no more implicit 'enabled' and 'get_status' functions in __init__.py files
- (more coherent/explicit use of Django functionality)
2016-05-11 18:19:31 -04:00
James Valleroy a6417c59a7 tor: Use augeas to modify configuration.
- Use json to get info from action script.
- Add SSH port to hidden service.
- Enable hidden service during setup.
2016-03-15 18:50:51 -04:00
Sunil Mohan Adapa 65a1985cc0 tor: Minor fixes and styling
- Add note about resetarting firewalld.

- Refactor checking for running configuration process.

- Fix error message being show as info message.

- Minor indentation fixes.
2016-01-30 19:41:13 +05:30
James Valleroy 1e67fcb61a tor: After enabling hidden service, wait for info 2016-01-30 18:08:47 +05:30
James Valleroy 07130b6007 tor: Run configuration update as background task
- Closes: #294.
2016-01-30 18:08:40 +05:30
James Valleroy a22595af77 tor: Avoid unneeded service restarts
- Fix an import error.
2016-01-30 18:08:33 +05:30
James Valleroy 0844151244 tor: Combine all configuration actions 2016-01-30 18:07:42 +05:30
James Valleroy a3845e2b28 tor: Add service for bridge relay ports 2016-01-30 18:07:34 +05:30
James Valleroy 0695ee5abb tor: Switch to obfs4proxy.
Replaces scramblesuit, and also supports obfs3.
Also add tor-geoipdb which is useful for bridges.
2015-12-06 12:21:22 +05:30
James Valleroy 66625c35a3 Handle error where /etc/tor/torrc does not exist when checking hidden service config.
Handle error where tor state file does not exist when getting list of ports.

Add test for checking if apt-transport-tor is enabled.
2015-12-04 09:16:06 +05:30
Sunil Mohan Adapa bff8dd5a5c tor: Fixes for APT transport setup
- When Deb822 formatted source files are present, error out and don't
  show as enabled.

- When /etc/apt/sources.list.d/*.sources files are present, error out
  and don't show as enabled.

- Handle files /etc/apt/sources.list.d/*.list.

- Workaround Augeas lens not understanding '[options]' in sources.list.
2015-09-04 15:38:16 +05:30
Sunil Mohan Adapa 09f64f6a4b tor: Disable APT transport when Tor is disabled
- To make sure that APT is not unusable.
2015-09-04 15:38:16 +05:30
James Valleroy f25ce0216f tor: Add control to enable/disable apt-transport-tor (Closes: #78). 2015-09-04 15:38:15 +05:30
Sunil Mohan Adapa 13655f05bc tor: Configure for IPv6 also 2015-08-21 19:24:07 +05:30
Sunil Mohan Adapa ee521e098f tor: Move Tor setup from freedombox-setup
We are still overwriting the entire configuration file instead of
modifying it.
2015-08-18 21:25:01 +05:30
Sunil Mohan Adapa 3d5f68381d tor: Reimplement getting ports in Python 2015-07-28 16:40:51 +05:30
Sunil Mohan Adapa 07e2c0ce14 Don't use actions to check if service is running
- To check whether a service is running does not require root
  privileges.  This can directly be done from a module without any
  action.

- Since actions are allowed to be run using sudo, introducing
  unnecessary sub-commands increases attack surface.

- Simple functions calls are unnecessarily being converted to command
  line invocations and involve parsing response.

- There is a lot of repeated code because of this that can be
  eliminated.

- To generalize this, we need to make all non-root system operations
  directly from module instead of delegating to action commands.
2015-07-19 19:54:13 -04:00
Sunil Mohan Adapa 3b6af2f29c Use only action utilities for service management
- When disabling a service, ignore if unable to stop the service.
2015-07-19 19:54:13 -04:00
Sunil Mohan Adapa 517c364559 pagekite: Move to using python3-augeas
- Merge actions/pagekite_util.py into plinth/modules/pagekite/util.py.

- Rename plinth/modules/pagekite/util.py to utils.py.

- Add python-augeus as dependency.

- Move actions/util.py to plinth/action_utils.py and update services
  that use it.

- Rename _run() method to run() as it is being used publicly.

- Import the utils in a more conventional manner.

- Move all python2 bits to python3.
2015-07-19 15:37:43 -04:00
fonfon b3da314560 use util.service_is_running for tor also 2015-05-03 09:44:46 +02:00
Sunil Mohan Adapa c7f27e493e Use package framework for installing tor 2015-01-05 00:13:20 +05:30
James Valleroy 28cc7f14c7 Handle errors with Tor HS configuration. 2014-11-10 21:42:40 -05:00
James Valleroy e5de76401d Check if tor is installed before running some commands. 2014-11-10 21:22:21 -05:00
Sunil Mohan Adapa 84640560b5 Update actions/tor to Python3 and minor other updates
- Update to use Python3

- Use os.path.join to combine parts of path

- Fix documentation strings

- Use single quotes for regular strings merely for consistency

- Minor refactorings
2014-10-20 00:22:09 +05:30
James Valleroy 500cfd11e3 Add comment to mark end of Plinth Hidden Service configuration block. 2014-10-20 00:20:51 +05:30
James Valleroy 4e493c1ac5 Add Tor form to enable/disable hidden service. 2014-10-20 00:20:32 +05:30
James Valleroy 50797f9a92 Enable/disable Tor hidden service.
Currently only supports a single hidden service for HTTP/HTTPS.
2014-10-20 00:20:18 +05:30
James Valleroy cf52bf5029 Display Tor hidden service configuration on Tor page.
Currently assumes that there is no more than 1 hidden service.
2014-10-20 00:19:42 +05:30
fonfon 7794893947 added tor actions: is-running, start, stop; display tor status at tor app page (enabling/disabling will be integrated later) 2014-10-20 00:14:35 +05:30