feat(modules): add modules for some common settings
This commit is contained in:
parent
1ce5b9ef9a
commit
ffb223d03f
4 changed files with 45 additions and 3 deletions
41
modules/nixos/common-settings/auth.nix
Normal file
41
modules/nixos/common-settings/auth.nix
Normal file
|
@ -0,0 +1,41 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
inherit (lib) mkIf mkEnableOption mkOption types;
|
||||
|
||||
cfg = config.commonSettings.auth;
|
||||
in
|
||||
{
|
||||
options.commonSettings.auth = {
|
||||
enable = mkEnableOption "Common auth settings for servers";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
custom.kanidm-client = {
|
||||
enable = true;
|
||||
uri = "https://auth.xinyang.life";
|
||||
asSSHAuth = {
|
||||
enable = true;
|
||||
allowedGroups = [ "linux_users" ];
|
||||
};
|
||||
sudoers = [ "xin@auth.xinyang.life" ];
|
||||
};
|
||||
|
||||
services.openssh = {
|
||||
settings = {
|
||||
PasswordAuthentication = false;
|
||||
KbdInteractiveAuthentication = false;
|
||||
PermitRootLogin = "no";
|
||||
GSSAPIAuthentication = "no";
|
||||
KerberosAuthentication = "no";
|
||||
};
|
||||
};
|
||||
services.fail2ban.enable = true;
|
||||
|
||||
security.sudo = {
|
||||
execWheelOnly = true;
|
||||
wheelNeedsPassword = false;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,7 +1,8 @@
|
|||
{ config, pkgs, ... }:
|
||||
{
|
||||
imports = [
|
||||
./common-nix-conf.nix
|
||||
./common-settings/auth.nix
|
||||
./common-settings/nix-conf.nix
|
||||
./restic.nix
|
||||
./vaultwarden.nix
|
||||
./prometheus.nix
|
||||
|
|
|
@ -22,8 +22,8 @@ in
|
|||
# TODO: mailserver support
|
||||
};
|
||||
};
|
||||
config = {
|
||||
services.vaultwarden = mkIf cfg.enable {
|
||||
config = mkIf cfg.enable {
|
||||
services.vaultwarden = {
|
||||
enable = true;
|
||||
dbBackend = "sqlite";
|
||||
config = {
|
||||
|
|
Loading…
Reference in a new issue