Be less hostile to users in --allow-root help

This commit is contained in:
James Lu 2020-01-05 11:25:47 -08:00
parent d080edce00
commit 9e03e0e6e2
2 changed files with 10 additions and 10 deletions

View File

@ -178,14 +178,14 @@ if __name__ == '__main__':
help='Determines whether the bot will allow its '
'defaultCapabilities not to include "-owner", thus '
'giving all users the owner capability by default. '
' This is dumb, hence we require a command-line '
'option. Don\'t do this.')
'This is a security risk since it allows anyone to run '
'any command on your bot, so we advise not to use this.')
parser.add_option('', '--allow-root', action='store_true',
dest='allowRoot',
help='Determines whether the bot will be allowed to run '
'as root. You don\'t want this. Don\'t do it. '
'Even if you think you want it, you don\'t. '
'You\'re probably dumb if you do this.')
'as root. This should not be used except in special '
'circumstances, such as running inside a containerized '
'environment.')
parser.add_option('', '--debug', action='store_true', dest='debug',
help='Determines whether some extra debugging stuff '
'will be logged in this script.')
@ -198,7 +198,7 @@ if __name__ == '__main__':
if os.name == 'posix':
if (os.getuid() == 0 or os.geteuid() == 0) and not options.allowRoot:
sys.stderr.write('Don\'t even try to run this as root.')
sys.stderr.write('Running as root is not supported by default (see --allow-root).')
sys.stderr.write(os.linesep)
sys.exit(-1)

View File

@ -175,9 +175,9 @@ def main():
parser.add_option('', '--allow-root', action='store_true',
dest='allowRoot',
help='Determines whether the wizard will be allowed to '
'run as root. You don\'t want this. Don\'t do it.'
' Even if you think you want it, you don\'t. '
'You\'re probably dumb if you do this.')
'as root. This should not be used except in special '
'circumstances, such as running inside a containerized '
'environment.')
parser.add_option('', '--allow-home', action='store_true',
dest='allowHome',
help='Determines whether the wizard will be allowed to '
@ -199,7 +199,7 @@ def main():
(options, args) = parser.parse_args()
if os.name == 'posix':
if (os.getuid() == 0 or os.geteuid() == 0) and not options.allowRoot:
error('Please, don\'t run this as root.')
error('Running as root is not supported by default (see --allow-root).')
if os.name == 'posix':
if (os.getcwd() == os.path.expanduser('~')) and not options.allowHome:
error('Please, don\'t run this in your HOME directory.')