force tails users to run as root (#42)

This commit is contained in:
Micah Lee 2014-06-10 21:55:58 +00:00
parent c2ab0206dd
commit 28b9140afd
2 changed files with 10 additions and 1 deletions

View File

@ -64,6 +64,9 @@ def get_platform():
p = 'Tails'
return p
def is_root():
return os.geteuid() == 0
def get_hidden_service_dir(port):
if get_platform() == "Windows":
if 'Temp' in os.environ:
@ -154,6 +157,11 @@ def start_hidden_service(port):
def main():
load_strings()
# check for root in Tails
if get_platform() == 'Tails' and not is_root():
sys.exit(strings["tails_requires_root"])
# parse arguments
parser = argparse.ArgumentParser()
parser.add_argument('--local-only', action='store_true', dest='local_only', help='Do not attempt to use tor: for development only')
parser.add_argument('filename', nargs=1)

View File

@ -13,7 +13,8 @@
"download_page_loaded": "Download page loaded",
"download_started": "Download started",
"download_finished": "Download finished",
"other_page_loaded": "Other page has been loaded"
"other_page_loaded": "Other page has been loaded",
"tails_requires_root": "You must run OnionShare as root in Tails"
}, "no": {
"punching_a_hole": "Åpner port i brannmuren.",
"closing_hole": "Lukker port i brannmuren.",