Skip to content

Commit d5e3059

Browse files
committed
fix: this pr is wrong place to harden ssh
1 parent 80dae49 commit d5e3059

File tree

3 files changed

+11
-15
lines changed

3 files changed

+11
-15
lines changed

nix/systemConfigs.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{ self, inputs, ... }:
22
let
33
mkModules = system: [
4-
self.systemModules.ssh-config
4+
self.systemModules.genesis
55
({
66
nixpkgs.hostPlatform = system;
77
})

nix/systemModules/default.nix

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,11 @@
55
imports = [ ./tests ];
66
flake = {
77
systemModules = {
8-
ssh-config = {
9-
environment.etc."ssh/sshd_config.d/local.conf" = {
10-
text = ''
11-
Match Address 127.0.0.1,::1
12-
ForceCommand /bin/false
13-
DisableForwarding yes
14-
PermitTunnel no
15-
'';
8+
genesis = {
9+
#this file is just a placeholder to bootstrap
10+
#the system manager, it will be replaced by real configurations
11+
environment.etc."system-manager-genesis" = {
12+
text = "";
1613
user = "root";
1714
group = "root";
1815
mode = "0644";

nix/systemModules/tests/default.nix

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,11 @@
2424
machine.activate()
2525
machine.wait_for_unit("system-manager.target")
2626
27-
with subtest("Verify ssh config"):
28-
assert machine.file("/etc/ssh/sshd_config.d/local.conf").exists, "/etc/ssh/sshd_config.d/local.conf should exist"
29-
assert machine.file("/etc/ssh/sshd_config.d/local.conf").mode == 0o644, "/etc/ssh/sshd_config.d/local.conf should have mode 0644"
30-
assert machine.file("/etc/ssh/sshd_config.d/local.conf").user == "root", "/etc/ssh/sshd_config.d/local.conf should be owned by root"
31-
assert machine.file("/etc/ssh/sshd_config.d/local.conf").group == "root", "/etc/ssh/sshd_config.d/local.conf should be owned by root"
32-
assert machine.file("/etc/ssh/sshd_config.d/local.conf").contains("Match Address"), "/etc/ssh/sshd_config.d/local.conf should contain 'Match Address'"
27+
with subtest("Verify genesis file"):
28+
assert machine.file("/etc/system-manager-genesis").exists, "/etc/system-manager-genesis should exist"
29+
assert machine.file("/etc/system-manager-genesis").mode == 0o644, "/etc/system-manager-genesis should have mode 0644"
30+
assert machine.file("/etc/system-manager-genesis").user == "root", "/etc/system-manager-genesis should be owned by root"
31+
assert machine.file("/etc/system-manager-genesis").group == "root", "/etc/system-manager-genesis should be owned by root"
3332
'';
3433
};
3534
};

0 commit comments

Comments
 (0)