NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.68k stars 13.83k forks source link

munin-cron with ssh transport cannot find ssh #72309

Open ghost opened 4 years ago

ghost commented 4 years ago

Describe the bug

services.munin-cron.hosts = '' [foo] address ssh://foo -W 127.0.0.1:4949 '';

in /var/log/munin/.munin-update-wrapped.log:

2019/10/30 14:50:58 [ERROR] Munin::Master::UpdateWorker died with 'open3: exec of ssh -o ChallengeResponseAuthentication=no -o StrictHostKeyChecking=no -p 22 foo fa\ iled: No such file or directory at /nix/store/h0g8mv9v8x4kidiq24m74s92b3ps85fl-munin-2.0.43/lib/perl5/site_perl/Munin/Master/Node.pm line 112.'

manual fix:

systemd.services.munin-cron.path = [pkgs.openssh];

To Reproduce

services.munin-cron.enable = true; and configure at least one node to which can the munin user ssh

Expected behavior should work out of the box

Metadata Please run nix run nixpkgs.nix-info -c nix-info -m and paste the result.

Maintainer information:

# a list of nixpkgs attributes affected by the problem
attribute:
# a list of nixos modules affected by the problem
module:
  munin-cron
ghost commented 4 years ago

it would probably also be good if the ssh was automatically set up as recommended

something like

systemd.services.munin-cron-init = {
  description = "munin-cron-init";
  wantedBy = ["munin-cron.service"];
  unitConfig.RequiresMountsFor = "/var/lib/munin";
  script = ''
    if ! test -d ~munin/.ssh; then
      mkdir ~munin/.ssh
    fi
    if ! test -f ~munin/.ssh/id_ed25519; then
      ${pkgs.openssh}/bin/ssh-keygen \
        -t ed25519 \
        -f ~munin/.ssh/id_ed25519 \
        -N ""
    fi
    cat > ~munin/.ssh/config <<EOF
      # do not edit this automatically updated file
      Host *
        BatchMode=yes
        ConnectTimeout=10
        EscapeChar=none
        ExitOnForwardFailure=yes
        ForwardAgent=no
        ForwardX11=no
        IdentitiesOnly=yes
        PasswordAuthentication=no
        RequestTTY=no
        StrictHostKeyChecking=no
        User munin
    EOF
  '';
  serviceConfig = {
    User = "munin";
    Type = "oneshot";
    RemainAfterExit = true;
  };
};

maybe User should be also configurable and not hardcoded to munin

stale[bot] commented 4 years ago

Thank you for your contributions. This has been automatically marked as stale because it has had no activity for 180 days. If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity. Here are suggestions that might help resolve this more quickly:

  1. Search for maintainers and people that previously touched the related code and @ mention them in a comment.
  2. Ask on the NixOS Discourse. 3. Ask on the #nixos channel on irc.freenode.net.