Compare commits

..

3 Commits

  1. 3
      cathedral.py
  2. 1
      config.json
  3. 1
      tools/add_users.py
  4. 2
      towers/fiefdom.py

@ -12,8 +12,7 @@ class cathedral():
async def handle_http(self, r): async def handle_http(self, r):
for t in self.towers: for t in self.towers:
for h in t.hooks: for h in t.hooks:
print(str(r.host)[str(r.host).find(self.cfg.get("host")):]) if compile(h.replace("$HOST", str(r.host)[str(r.host).find(self.cfg.get("base")):])).match(str(r.url)):
if compile(h.replace("$HOST", str(r.host)[str(r.host).find(self.cfg.get("host")):])).match(str(r.url)):
return web.Response(**t.run(self, r)) return web.Response(**t.run(self, r))
return web.Response(body=f"usergroup homepage") return web.Response(body=f"usergroup homepage")
async def start_http(self): async def start_http(self):

@ -1,5 +1,6 @@
{ {
"host": "localhost", "host": "localhost",
"base": "f.q.d.n",
"port": 1337, "port": 1337,
"PLUGIN_PATH": "./towers" "PLUGIN_PATH": "./towers"
} }

@ -13,6 +13,7 @@ def add_user(u, p):
subprocess.run(["useradd", "-m", "-p", p, u]) subprocess.run(["useradd", "-m", "-p", p, u])
# adding a new user resets the permission table... # adding a new user resets the permission table...
subprocess.run(["setfacl", "-m", "u:cathedral:r", "/etc/shadow"]) subprocess.run(["setfacl", "-m", "u:cathedral:r", "/etc/shadow"])
subprocess.run(["setfacl", "-R", "-m", "user:cathedral:rx", f"/home/{u}"])
""" """
e.g. e.g.

@ -9,7 +9,7 @@ def run(ctx, r):
if not(user in ctx.auth.get_real_users()): if not(user in ctx.auth.get_real_users()):
return { return {
"body": f"<h3>404! no such user!</h3><br>consult <b>users.{ctx.cfg.get('host')}</b> to see all registered users", "body": f"<h3>404! no such user!</h3><br>consult <b>users.{ctx.cfg.get('base')}</b> to see all registered users",
"status": 404, "content_type": "text/html" "status": 404, "content_type": "text/html"
} }

Loading…
Cancel
Save