diff --git a/clanModules/admin/README.md b/clanModules/admin/README.md new file mode 100644 index 000000000..c27c8d19b --- /dev/null +++ b/clanModules/admin/README.md @@ -0,0 +1,5 @@ +--- +description = "Convenient Administration for the Clan App" +categories = ["Utility"] +features = [ "inventory", "deprecated" ] +--- diff --git a/clanModules/admin/default.nix b/clanModules/admin/default.nix index a53791e1d..8fdf356eb 100644 --- a/clanModules/admin/default.nix +++ b/clanModules/admin/default.nix @@ -1,12 +1,3 @@ -{ config, ... }: { - config.assertions = [ - { - assertion = config.clan.inventory.services.admin != { }; - message = '' - The admin module has been migrated from `clan.services` to `clan.instances` - See https://docs.clan.lol/TODO for updated usage. - ''; - } - ]; + imports = [ ./roles/default.nix ]; } diff --git a/clanModules/admin/roles/default.nix b/clanModules/admin/roles/default.nix new file mode 100644 index 000000000..cc236459b --- /dev/null +++ b/clanModules/admin/roles/default.nix @@ -0,0 +1,31 @@ +{ lib, config, ... }: +{ + + options.clan.admin = { + allowedKeys = lib.mkOption { + default = { }; + type = lib.types.attrsOf lib.types.str; + description = "The allowed public keys for ssh access to the admin user"; + example = { + "key_1" = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD..."; + }; + }; + }; + # Bad practice. + # Should we add 'clanModules' to specialArgs? + imports = [ + ../../sshd + ../../root-password + ]; + config = { + + warnings = [ + '' + The admin module has been migrated from `clan.services` to `clan.instances` + See https://docs.clan.lol/manual/distributed-services for usage. + '' + ]; + + users.users.root.openssh.authorizedKeys.keys = builtins.attrValues config.clan.admin.allowedKeys; + }; +} diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index 8407c4977..7512e3578 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -90,7 +90,7 @@ nav: - reference/clanModules/index.md - reference/clanModules/frontmatter/index.md # TODO: display the docs of the clan.service modules - # - reference/clanServices/admin.md + - reference/clanModules/admin.md # This is the module overview and should stay at the top - reference/clanModules/borgbackup-static.md - reference/clanModules/data-mesher.md