!jtzdZrQSXtEpeGtzAn:nixos.org

Testing with Nix

64 Members
22 Servers

Load older messages


SenderMessageTime
16 Oct 2023
@artturin:matrix.orgArtturinfailState successState06:12:13
@vengmark2:matrix.orgl0b0

Weird. I just tried this:

    service_name = "ssh-audit.service"
    ${serverName}.succeed(f"systemd-run --unit={service_name} ${pkgs.ssh-audit}/bin/ssh-audit --client-audit --port=${toString sshAuditPort}")
    ${serverName}.wait_for_unit(service_name)
    ${clientName}.execute(
        f"ssh {ssh_options} -i privkey.snakeoil -p ${toString sshAuditPort} ${sshUsername}@server true",
        check_return=False,
        timeout=10
    )
    ${serverName}.succeed(f"exit $(systemctl show --property=ExecMainStatus --value {service_name})")

Couldn't get it to fail when the configuration was bad.

06:15:40
@artturin:matrix.orgArtturin

Btw it's possible to add env vars to the systemd-run env

dbus-update-activation-environment --systemd PATH this would add the PATH

06:17:55
@artturin:matrix.orgArtturin *

Btw it's possible to add env vars to the systemd-run env

dbus-update-activation-environment --systemd PATH this would add the PATH, the sway module has dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP

06:18:27
@artturin:matrix.orgArtturin
In reply to @vengmark2:matrix.org

Weird. I just tried this:

    service_name = "ssh-audit.service"
    ${serverName}.succeed(f"systemd-run --unit={service_name} ${pkgs.ssh-audit}/bin/ssh-audit --client-audit --port=${toString sshAuditPort}")
    ${serverName}.wait_for_unit(service_name)
    ${clientName}.execute(
        f"ssh {ssh_options} -i privkey.snakeoil -p ${toString sshAuditPort} ${sshUsername}@server true",
        check_return=False,
        timeout=10
    )
    ${serverName}.succeed(f"exit $(systemctl show --property=ExecMainStatus --value {service_name})")

Couldn't get it to fail when the configuration was bad.

All the outputted thing should be in the output
06:20:24
@artturin:matrix.orgArtturindid it print the expected output but just didn't fail06:20:34
@vengmark2:matrix.orgl0b0 OIC, ${serverName}.wait_for_unit(service_name) doesn't wait long enough, so the next line just never talks to ssh-audit. 06:22:36
@vengmark2:matrix.orgl0b0 I think I might still need the sleep(5) then. 06:23:00
@artturin:matrix.orgArtturinhm yeah it just waits for active06:23:19
@vengmark2:matrix.orgl0b0 Because there's just no way to check that the port is open without shutting down ssh-audit. 06:23:28
@vengmark2:matrix.orgl0b0 Yay, it worked! This is something I've been hoping to be able to do for years. Thank you, Artturin ! 07:05:48
@artturin:matrix.orgArtturin l0b0: That tests looks like it could be added to nixpkgs 07:45:32
@artturin:matrix.orgArtturinand added to the package07:46:15
@artturin:matrix.orgArtturin * and added to the package's passthru.tests07:46:22
@artturin:matrix.orgArtturinhmm well there's your ssh-server.nix and ssh-client.nix07:47:28
@artturin:matrix.orgArtturinwell if you can think of a way im sure it would be useful07:47:48
@artturin:matrix.orgArtturinNot exactly sure what it's testing07:48:10
@vengmark2:matrix.orgl0b0 It's checking that my configuration conforms to best practices as recommended by ssh-audit. I'm no SSH/security expert, but at least some of the recommendations make sense. 07:49:19
@vengmark2:matrix.orgl0b0It might be useful as a demo for what could be considered a secure configuration (at least by some segment of users) "right now", rather than just using the OpenSSH defaults like NixOS does.07:50:41
@vengmark2:matrix.orgl0b0Just waiting for a giant 23.05 upgrade (for some reason), will have a look afterwards.07:51:16
@vengmark2:matrix.orgl0b0 * It's checking that my configuration conforms to best practices as recommended by ssh-audit. I'm no SSH/security expert, but at least some of the recommendations (like not allowing SHA-1 algos) make sense. 07:51:46
@artturin:matrix.orgArtturin
In reply to @vengmark2:matrix.org
Just waiting for a giant 23.05 upgrade (for some reason), will have a look afterwards.
staging-next-23.05 was merged a few days ago with security fixes (curl etc)
07:53:54
@vengmark2:matrix.orgl0b0https://github.com/NixOS/nixpkgs/pull/261356 - a bit quick, but I gotta sleep.08:57:20
18 Oct 2023
@ultra:beeper.comAlex S changed their display name from ultra (NixOS integrated with PackageKit wen) to Alex S.10:00:58
23 Oct 2023
@raitobezarius:matrix.orgraitobezariusI'm adopting https://github.com/NixOS/nixpkgs/pull/157161/files12:48:35
@raitobezarius:matrix.orgraitobezariusto try to get it sync with the timeout PR12:48:43
@raitobezarius:matrix.orgraitobezariusso we can have super nice tests12:48:46
@raitobezarius:matrix.orgraitobezarius nikstur: help me 12:51:07
@raitobezarius:matrix.orgraitobezariusand get blitz to help me too12:51:16
24 Oct 2023
@raitobezarius:matrix.orgraitobezarius Robert Hensing (roberth): I see that you recommended testBuildFailure but it relies on drv.overrideAttrs to perform the inversion of success internally 01:00:50

Show newer messages


Back to Room ListRoom Version: 9