Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
pwd-manager,
firewall,
screenlock,
screenlock-plasma5,
secureboot,
luks,
zfs,
Expand Down
8 changes: 6 additions & 2 deletions checks/linux/password_unlock.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,14 @@ func (f *PasswordToUnlock) Run() error {
}

// Check if running KDE
if _, err := lookPath("kreadconfig5"); err == nil {
if _, err := lookPath("kreadconfig6"); err == nil {
// Plasma 6 detected
f.passed = f.checkKDE5() // Same config format, just different tools
} else if _, err := lookPath("kreadconfig5"); err == nil {
// Plasma 5 detected
f.passed = f.checkKDE5()
} else {
log.Debug("KDE environment(5) not detected for screensaver lock check")
log.Debug("KDE environment not detected for screensaver lock check")
}

// Check if running Sway
Expand Down
37 changes: 27 additions & 10 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 24 additions & 4 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
nixpkgs-2411.url = "github:NixOS/nixpkgs/nixos-24.11";
};

outputs =
inputs@{
flake-parts,
nixpkgs,
nixpkgs-2411,
...
}:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = nixpkgs.lib.systems.flakeExposed;

perSystem =
{ pkgs, ... }:
{ pkgs, system, ... }:
let
# Create pkgs from nixpkgs-24.11 for Plasma 5 testing
pkgs2411 = import nixpkgs-2411 { inherit system; };

# Extend pkgs with our paretosecurity overlay
pkgsOverlayed = pkgs.extend (
final: prev: {
Expand All @@ -33,17 +38,32 @@
packages.default = pkgsOverlayed.paretosecurity;

checks = {
autologin = pkgsOverlayed.testers.runNixOSTest ./test/integration/autologin.nix;
cli = pkgsOverlayed.testers.runNixOSTest ./test/integration/cli.nix;
firewall = pkgsOverlayed.testers.runNixOSTest ./test/integration/firewall.nix;
help = pkgsOverlayed.testers.runNixOSTest ./test/integration/help.nix;
luks = pkgsOverlayed.testers.runNixOSTest ./test/integration/luks.nix;
zfs = pkgsOverlayed.testers.runNixOSTest ./test/integration/zfs.nix;
pwd-manager = pkgsOverlayed.testers.runNixOSTest ./test/integration/pwd-manager.nix;
screenlock = pkgsOverlayed.testers.runNixOSTest ./test/integration/screenlock.nix;
secureboot = pkgsOverlayed.testers.runNixOSTest ./test/integration/secureboot.nix;
trayicon = pkgsOverlayed.testers.runNixOSTest ./test/integration/trayicon.nix;
xfce = pkgsOverlayed.testers.runNixOSTest ./test/integration/desktop/xfce.nix;
autologin = pkgsOverlayed.testers.runNixOSTest ./test/integration/autologin.nix;
zfs = pkgsOverlayed.testers.runNixOSTest ./test/integration/zfs.nix;

screenlock = pkgsOverlayed.testers.runNixOSTest ./test/integration/screenlock.nix;
screenlock-plasma5 =
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sadly needs to be a separate file to get the old 24.11 nixpkgs in there.

If someone can figure out how to merge this into screenlock.nix, I'm all ears!

let
# Extend pkgs2411 with our paretosecurity overlay
pkgs2411Overlayed = pkgs2411.extend (
_: _: {
inherit (pkgsOverlayed) paretosecurity;
}
);
in
pkgs2411Overlayed.testers.runNixOSTest (
import ./test/integration/screenlock-plasma5.nix {
inherit pkgsOverlayed;
}
);
};
};
};
Expand Down
4 changes: 2 additions & 2 deletions test/integration/autologin.nix
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@ in
];
services.paretosecurity.enable = true;
services.xserver.enable = true;
services.xserver.desktopManager.plasma5.enable = true;
services.desktopManager.plasma6.enable = true;
services.displayManager.sddm.enable = true;
services.displayManager.defaultSession = "plasma";
services.displayManager.defaultSession = "plasmax11";
services.displayManager.autoLogin = {
enable = true;
user = "testuser";
Expand Down
2 changes: 1 addition & 1 deletion test/integration/cli.nix
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ in
" • Access Security: SSH keys have password protection > [DISABLED] No private keys found in ~/.ssh directory\n"
" • Access Security: SSH keys have sufficient algorithm strength > [DISABLED] No private keys found in the ~/.ssh directory\n"
" • System Integrity: SecureBoot is enabled > [FAIL] System is not running in UEFI mode\n"
" • Application Updates: Apps are up to date > [OK] All packages are up to date\n"
" • [root] Application Updates: Apps are up to date > [OK] All packages are up to date\n"
" • Firewall & Sharing: Sharing printers is off > [OK] Sharing printers is off\n"
" • [root] System Integrity: Filesystem encryption is enabled > [FAIL] Block device encryption is disabled\n"
" • Firewall & Sharing: Remote login is disabled > [OK] No remote access services found running\n"
Expand Down
35 changes: 35 additions & 0 deletions test/integration/screenlock-plasma5.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Test for KDE Plasma 5 using nixpkgs-24.11
# This is separate because Plasma 5 was removed from newer nixpkgs
{ pkgsOverlayed }:
{
name = "Screen Lock - Plasma 5";
interactive.sshBackdoor.enable = true;

nodes = {
kde5 =
{ ... }:
{
services.paretosecurity.enable = true;
services.paretosecurity.package = pkgsOverlayed.paretosecurity;

# Install KDE Plasma 5 Desktop Environment
services.xserver.enable = true;
services.xserver.desktopManager.plasma5.enable = true;
services.displayManager.sddm.enable = true;
services.colord.enable = false;
};
};

testScript = ''
# Test KDE Plasma 5
# Test 1: Check passes with lock enabled
kde5.succeed("kwriteconfig5 --file kscreenlockerrc --group Daemon --key LockOnResume true")
out = kde5.succeed("paretosecurity check --only 37dee029-605b-4aab-96b9-5438e5aa44d8")
assert "[OK] Password after sleep or screensaver is on" in out, f"Expected check to pass, got \n{out}"

# Test 2: Check fails when lock is disabled
kde5.succeed("kwriteconfig5 --file kscreenlockerrc --group Daemon --key LockOnResume false")
status, out = kde5.execute("paretosecurity check --only 37dee029-605b-4aab-96b9-5438e5aa44d8")
assert "[FAIL] Password after sleep or screensaver is off" in out, f"Expected check to fail, got \n{out}"
'';
}
49 changes: 37 additions & 12 deletions test/integration/screenlock.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,36 @@
{
services.paretosecurity.enable = true;
# Install GNOME Desktop Environment
services.xserver.desktopManager.gnome.enable = true;
services.xserver.displayManager.gdm.enable = true;
services.desktopManager.gnome.enable = true;
services.displayManager.gdm.enable = true;
};

kde =
{ ... }:
{ pkgs, ... }:
{
services.paretosecurity.enable = true;
# Install KDE Plasma 5 Desktop Environment
# Install KDE Plasma 6 Desktop Environment
services.xserver.enable = true;
services.xserver.desktopManager.plasma5.enable = true;
services.xserver.displayManager.sddm.enable = true;
services.desktopManager.plasma6.enable = true;
services.displayManager.sddm.enable = true;
services.displayManager.autoLogin.enable = true;
services.displayManager.autoLogin.user = "alice";
services.colord.enable = false;

# Increase memory for Plasma 6
virtualisation.memorySize = 2048;

# Create alice user
users.users.alice = {
isNormalUser = true;
extraGroups = [ "wheel" ];
password = "alice";
};

# Add kconfig package which includes kwriteconfig6 and kreadconfig6
environment.systemPackages = with pkgs; [
kdePackages.kconfig
];
};

sway =
Expand Down Expand Up @@ -171,15 +188,23 @@
status, out = gnome.execute("paretosecurity check --only 37dee029-605b-4aab-96b9-5438e5aa44d8")
assert "[FAIL] Password after sleep or screensaver is off" in out, f"Expected check to fail, got \n{out}"

# Test KDE
# Test 1: Check passes with lock enabled
kde.succeed("kwriteconfig5 --file kscreenlockerrc --group Daemon --key LockOnResume true")
out = kde.succeed("paretosecurity check --only 37dee029-605b-4aab-96b9-5438e5aa44d8")
# Test KDE Plasma 6
# Wait for KDE to start and alice to be logged in
kde.wait_for_unit("graphical.target")

# First ensure lock is enabled (Plasma 6 might have different defaults)
# Run as alice user
kde.succeed("su - alice -c 'kwriteconfig6 --file kscreenlockerrc --group Daemon --key LockOnResume true'")
kde.succeed("su - alice -c 'kwriteconfig6 --file kscreenlockerrc --group Daemon --key Autolock true'")

# Test 1: Check passes with lock enabled (run as alice)
out = kde.succeed("su - alice -c 'paretosecurity check --only 37dee029-605b-4aab-96b9-5438e5aa44d8'")
assert "[OK] Password after sleep or screensaver is on" in out, f"Expected check to pass, got \n{out}"

# Test 2: Check fails when lock is disabled
kde.succeed("kwriteconfig5 --file kscreenlockerrc --group Daemon --key LockOnResume false")
status, out = kde.execute("paretosecurity check --only 37dee029-605b-4aab-96b9-5438e5aa44d8")
kde.succeed("su - alice -c 'kwriteconfig6 --file kscreenlockerrc --group Daemon --key LockOnResume false'")
kde.succeed("su - alice -c 'kwriteconfig6 --file kscreenlockerrc --group Daemon --key Autolock false'")
status, out = kde.execute("su - alice -c 'paretosecurity check --only 37dee029-605b-4aab-96b9-5438e5aa44d8'")
assert "[FAIL] Password after sleep or screensaver is off" in out, f"Expected check to fail, got \n{out}"

# Test Sway
Expand Down
4 changes: 2 additions & 2 deletions test/integration/trayicon.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ in
services.paretosecurity.enable = true;

services.xserver.enable = true;
services.xserver.displayManager.gdm.enable = true;
services.xserver.desktopManager.gnome.enable = true;
services.displayManager.gdm.enable = true;
services.desktopManager.gnome.enable = true;
services.displayManager.defaultSession = "gnome";

# Add AppIndicator extension for system tray support
Expand Down
Loading