moul / assh

:computer: make your ssh client smarter
https://manfred.life/assh
MIT License
3.05k stars 156 forks source link

Notifications don't work when using gateways. #359

Open lvets opened 4 years ago

lvets commented 4 years ago

Hello,

I'm playing around with the Hooks examples in https://github.com/moul/assh/blob/master/examples/readme-full-example/assh.yml and notifications on macOS 10.15.6. All our connections require a bastion host, so I do the following:

hosts:
  bastion:
    Hostname: <hostname>
  server:
    Hostname: <hostname>
    Gateways: bastion

I also have the following from the examples I mentioned:

defaults:
  Hooks:
    AfterConfigWrite:
      # Alert me with a Desktop notification
      - notify "{{.SSHConfigPath}} has been rewritten"

    OnConnect:
      # Alert me with a Desktop notification
      - notify "New SSH connection to {{.Host.Prototype}} at {{.Stats.ConnectedAt}}."

    OnDisconnect:
      # write on terminal and in a Desktop notification some statistics about the finished connection
      - "write SSH connection to {{.Host.HostName}} closed, {{.Stats.WrittenBytes }} bytes written in {{.Stats.ConnectionDuration}} ({{.Stats.AverageSpeed}}bps)."
      - "notify SSH connection to {{.Host.HostName}} closed, {{.Stats.WrittenBytes }} bytes written in {{.Stats.ConnectionDuration}} ({{.Stats.AverageSpeed}}bps)."

I always get the "{{.SSHConfigPath}} has been rewritten" notification correctly, but I do not get the others at all. I tested with another server that has a direct ssh connection (so no bastion) and I do get the notifications for that connection consistently.

Any idea what I might be doing wrong?

srajasimman commented 2 years ago

same issue for me too