mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-20 10:34:30 +00:00
If creating a new user db, make sure it's permission is 640.
This commit is contained in:
parent
d48ecb6722
commit
3f36781fdf
14
plinth.py
14
plinth.py
@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
import os, sys, argparse
|
import os, stat, sys, argparse
|
||||||
from gettext import gettext as _
|
from gettext import gettext as _
|
||||||
import cfg
|
import cfg
|
||||||
if not os.path.join(cfg.file_root, "vendor") in sys.path:
|
if not os.path.join(cfg.file_root, "vendor") in sys.path:
|
||||||
@ -135,7 +135,19 @@ def setup():
|
|||||||
cfg.log = Logger()
|
cfg.log = Logger()
|
||||||
load_modules()
|
load_modules()
|
||||||
cfg.html_root = Root()
|
cfg.html_root = Root()
|
||||||
|
|
||||||
|
# check if we are creating a new user db
|
||||||
|
userdb_fname = '{}.sqlite3'.format(cfg.user_db)
|
||||||
|
try:
|
||||||
|
with open(userdb_fname):
|
||||||
|
userdb_exists = True
|
||||||
|
except IOError:
|
||||||
|
userdb_exists = False
|
||||||
cfg.users = plugin_mount.UserStoreModule.get_plugins()[0]
|
cfg.users = plugin_mount.UserStoreModule.get_plugins()[0]
|
||||||
|
# if we created a new user db, make sure it can't be read by everyone
|
||||||
|
if not userdb_exists:
|
||||||
|
os.chmod(userdb_fname, stat.S_IRUSR | stat.S_IWUSR | stat.S_IRGRP)
|
||||||
|
|
||||||
cfg.page_plugins = plugin_mount.PagePlugin.get_plugins()
|
cfg.page_plugins = plugin_mount.PagePlugin.get_plugins()
|
||||||
cfg.log("Loaded %d page plugins" % len(cfg.page_plugins))
|
cfg.log("Loaded %d page plugins" % len(cfg.page_plugins))
|
||||||
cfg.forms = plugin_mount.FormPlugin.get_plugins()
|
cfg.forms = plugin_mount.FormPlugin.get_plugins()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user