feat: skynet user stuff is now segregated to a server that is untrusted
This commit is contained in:
parent
7d7f402b6d
commit
ef6096e6e0
2 changed files with 79 additions and 19 deletions
72
applications/skynet_users.nix
Normal file
72
applications/skynet_users.nix
Normal file
|
@ -0,0 +1,72 @@
|
|||
{ config, pkgs, lib, inputs, ... }:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.services.skynet_users;
|
||||
in {
|
||||
|
||||
imports = [
|
||||
./acme.nix
|
||||
./dns.nix
|
||||
./nginx.nix
|
||||
];
|
||||
|
||||
options.services.skynet_users = {
|
||||
host = {
|
||||
ip = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
name = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
# ssh access
|
||||
|
||||
# allow more than admins access
|
||||
services.skynet_ldap_client = {
|
||||
groups = [
|
||||
"skynet-admins-linux"
|
||||
"skynet-users-linux"
|
||||
];
|
||||
};
|
||||
|
||||
|
||||
# Website config
|
||||
skynet_acme.domains = [
|
||||
"users.skynet.ie"
|
||||
"*.users.skynet.ie"
|
||||
];
|
||||
|
||||
skynet_dns.records = [
|
||||
{record ="users"; r_type="CNAME"; value=cfg.host.name;}
|
||||
{record="*.users"; r_type="CNAME"; value=cfg.host.name;}
|
||||
];
|
||||
|
||||
networking.firewall.allowedTCPPorts = [80 443];
|
||||
|
||||
# normally services cannot read home dirs
|
||||
systemd.services.nginx.serviceConfig.ProtectHome="read-only";
|
||||
|
||||
services.nginx.virtualHosts = {
|
||||
# main site
|
||||
"*.users.skynet.ie" = {
|
||||
forceSSL = true;
|
||||
useACMEHost = "skynet";
|
||||
serverName = "~^(?<user>.+)\.users\.skynet\.ie";
|
||||
|
||||
# username.users.skynet.ie/
|
||||
# user goes:
|
||||
# chmod 711 ~
|
||||
# chmod -R 755 ~/public_html
|
||||
|
||||
locations."/" = {
|
||||
alias = "/home/$user/public_html/";
|
||||
index = "index.html";
|
||||
extraConfig = "autoindex on;";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue