diff options
Diffstat (limited to 'gitautodeploy/gitautodeploy.py')
-rw-r--r-- | gitautodeploy/gitautodeploy.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/gitautodeploy/gitautodeploy.py b/gitautodeploy/gitautodeploy.py index 6bf8693..31e1696 100644 --- a/gitautodeploy/gitautodeploy.py +++ b/gitautodeploy/gitautodeploy.py @@ -172,6 +172,7 @@ class GitAutoDeploy(object): import logging import base64 from .lock import Lock + import getpass # This solves https://github.com/olipo186/Git-Auto-Deploy/issues/118 try: @@ -218,6 +219,11 @@ class GitAutoDeploy(object): fileHandler.setFormatter(logFormatter) logger.addHandler(fileHandler) + # Display a warning when trying to run as root + if not self._config['allow-root-user'] and getpass.getuser() == 'root': + logger.critical("Refusing to start. This application shouldn't run as root. Please run it as a different user. To disregard this warning and start anyway, set the config option \"allow-root-user\" to true, or use the command line argument --allow-root-user") + sys.exit() + if 'ssh-keyscan' in self._config and self._config['ssh-keyscan']: self._startup_event.log_info('Scanning repository hosts for ssh keys...') self.ssh_key_scan() |