mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-08-27 13:33:57 +02:00
security: disable SSH X11 forwarding on servers, keep on desktops
This commit is contained in:
@@ -7,7 +7,9 @@
|
|||||||
services.openssh = {
|
services.openssh = {
|
||||||
enable = true;
|
enable = true;
|
||||||
settings = {
|
settings = {
|
||||||
X11Forwarding = true;
|
# Secure by default: X11 forwarding off everywhere; desktops re-enable it
|
||||||
|
# in modules/nixos/desktop/ssh.nix (needed for GUI forwarding).
|
||||||
|
X11Forwarding = lib.mkDefault false;
|
||||||
# root user is used for remote deployment, so we need to allow it
|
# root user is used for remote deployment, so we need to allow it
|
||||||
PermitRootLogin = "prohibit-password";
|
PermitRootLogin = "prohibit-password";
|
||||||
PasswordAuthentication = false; # disable password login
|
PasswordAuthentication = false; # disable password login
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
# Desktops keep X11 forwarding (current behavior, needed for GUI forwarding);
|
||||||
|
# servers default to off (see modules/nixos/base/ssh.nix).
|
||||||
|
services.openssh.settings.X11Forwarding = true;
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
lib,
|
||||||
|
outputs,
|
||||||
|
}:
|
||||||
|
lib.genAttrs (builtins.attrNames outputs.nixosConfigurations) (
|
||||||
|
name: name == "ai-niri" || name == "shoukei-niri"
|
||||||
|
)
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
lib,
|
||||||
|
outputs,
|
||||||
|
}:
|
||||||
|
lib.genAttrs (builtins.attrNames outputs.nixosConfigurations) (
|
||||||
|
name: outputs.nixosConfigurations.${name}.config.services.openssh.settings.X11Forwarding
|
||||||
|
)
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
lib,
|
||||||
|
outputs,
|
||||||
|
}:
|
||||||
|
lib.genAttrs (builtins.attrNames outputs.nixosConfigurations) (
|
||||||
|
name: name == "ai-niri" || name == "shoukei-niri"
|
||||||
|
)
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
lib,
|
||||||
|
outputs,
|
||||||
|
}:
|
||||||
|
lib.genAttrs (builtins.attrNames outputs.nixosConfigurations) (
|
||||||
|
name: outputs.nixosConfigurations.${name}.config.services.openssh.settings.X11Forwarding
|
||||||
|
)
|
||||||
Reference in New Issue
Block a user