Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
start-server/restart-server: Drop privileges if necessary.
Alex Vandiver0115fa9c60c9
diff --git a/scripts/restart-server b/scripts/restart-serverindex 0b0a55cc2c6..c7664aa0276 100755--- a/scripts/restart-server+++ b/scripts/restart-server@@ -25,6 +25,7 @@ from scripts.lib.zulip_tools import (has_process_fts_updates,overwrite_symlink,start_arg_parser,+ su_to_zulip,)action = "restart"@@ -41,7 +42,10 @@ args = parser.parse_args()deploy_path = os.path.realpath(os.path.join(os.path.dirname(__file__), ".."))os.chdir(deploy_path)-if pwd.getpwuid(os.getuid()).pw_name != "zulip":+username = pwd.getpwuid(os.getuid()).pw_name+if username == "root":+ su_to_zulip()+elif username != "zulip":logging.error("Must be run as user 'zulip'.")sys.exit(1)diff --git a/scripts/stop-server b/scripts/stop-serverindex 1a95b5d9277..03f127758d4 100755--- a/scripts/stop-server+++ b/scripts/stop-server@@ -18,12 +18,16 @@ from scripts.lib.zulip_tools import (WARNING,has_application_server,has_process_fts_updates,+ su_to_zulip,)deploy_path = os.path.realpath(os.path.join(os.path.dirname(__file__), ".."))os.chdir(deploy_path)-if pwd.getpwuid(os.getuid()).pw_name != "zulip":+username = pwd.getpwuid(os.getuid()).pw_name+if username == "root":+ su_to_zulip()+elif username != "zulip":logging.error("Must be run as user 'zulip'.")sys.exit(1)