mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-08-26 12:46:08 +00:00
tor: Don't allow relay to be enabled while using upstream bridges
This commit is contained in:
parent
165e880329
commit
5483d30151
@ -151,6 +151,9 @@ def subcommand_configure(arguments):
|
|||||||
|
|
||||||
_use_upstream_bridges(arguments.use_upstream_bridges, aug=aug)
|
_use_upstream_bridges(arguments.use_upstream_bridges, aug=aug)
|
||||||
|
|
||||||
|
if arguments.use_upstream_bridges == 'enable':
|
||||||
|
arguments.relay = 'disable'
|
||||||
|
arguments.bridge_relay = 'disable'
|
||||||
_enable_relay(arguments.relay, arguments.bridge_relay, aug=aug)
|
_enable_relay(arguments.relay, arguments.bridge_relay, aug=aug)
|
||||||
|
|
||||||
if arguments.hidden_service == 'enable':
|
if arguments.hidden_service == 'enable':
|
||||||
@ -343,12 +346,14 @@ def _enable_relay(relay=None, bridge=None, aug=None):
|
|||||||
if not aug:
|
if not aug:
|
||||||
aug = augeas_load()
|
aug = augeas_load()
|
||||||
|
|
||||||
if relay == 'enable':
|
use_upstream_bridges = aug.get(TOR_CONFIG + '/UseBridges') == '1'
|
||||||
|
|
||||||
|
if relay == 'enable' and not use_upstream_bridges:
|
||||||
aug.set(TOR_CONFIG + '/ORPort', 'auto')
|
aug.set(TOR_CONFIG + '/ORPort', 'auto')
|
||||||
elif relay == 'disable':
|
elif relay == 'disable':
|
||||||
aug.remove(TOR_CONFIG + '/ORPort')
|
aug.remove(TOR_CONFIG + '/ORPort')
|
||||||
|
|
||||||
if bridge == 'enable':
|
if bridge == 'enable' and not use_upstream_bridges:
|
||||||
aug.set(TOR_CONFIG + '/BridgeRelay', '1')
|
aug.set(TOR_CONFIG + '/BridgeRelay', '1')
|
||||||
aug.set(TOR_CONFIG + '/ServerTransportPlugin',
|
aug.set(TOR_CONFIG + '/ServerTransportPlugin',
|
||||||
'obfs3,obfs4 exec /usr/bin/obfs4proxy')
|
'obfs3,obfs4 exec /usr/bin/obfs4proxy')
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user