-
-
Notifications
You must be signed in to change notification settings - Fork 156
Open
Description
After around 6 years, I've returned to a role where I'm using ssh, and need to integrate my assh config with some native ssh config that is generated by internal tooling.
However, I'm still seeing exactly the same as #262 , which was closed as fixed in #297, ie. the hooks are not firing, specifically the AfterConfigWrite hook is not appending ssh config to the generate config file.
This is my test assh.yml:
defaults:
# Defaults are applied to each hosts
ControlMaster: auto
# ControlMasterMkdir: true
ControlPath: ~/tmp/.ssh/cm/%h-%p-%r.sock
ControlPersist: yes
Hooks:
AfterConfigWrite:
- "exec echo {{.SSHConfigPath}}"
- "exec cat ~/.ssh/extra.config >> {{.SSHConfigPath}}"
IdentityFile:
- ~/.ssh/id_rsa
LogLevel: ERROR
Port: 22
I run assh with this command-line:
assh -D wrapper ssh -- truenas
This is the output:
2024-08-07T01:26:08.435+0100 DEBUG assh.pkg.commands commands/wrapper.go:51 Skip invalid option: {"flag": "O", "val": "false"}
2024-08-07T01:26:08.435+0100 DEBUG assh.pkg.commands commands/wrapper.go:51 Skip invalid option: {"flag": "o", "val": "false"}
2024-08-07T01:26:08.435+0100 DEBUG assh.pkg.commands commands/wrapper.go:71 Wrapper called {"bin": "/opt/homebrew/bin/ssh", "target": "truenas", "command": [], "options": [], "sshArgs": ["ssh", "truenas"]}
2024-08-07T01:26:08.435+0100 DEBUG assh.pkg.config config/config.go:516 Loading config file {"file": "/Users/robin/.ssh/assh.yml"}
2024-08-07T01:26:08.435+0100 DEBUG assh.pkg.config config/config.go:534 Loaded config file {"file": "/Users/robin/.ssh/assh.yml", "num-host-before": 0, "num-host-after": 0, "num-host-diff": 0}
2024-08-07T01:26:08.435+0100 DEBUG assh.pkg.commands commands/wrapper.go:87 Failed to load assh known_hosts {"error": "open /Users/robin/.ssh/assh_known_hosts: no such file or directory"}
2024-08-07T01:26:08.435+0100 DEBUG assh.pkg.commands commands/wrapper.go:96 The configuration file is outdated, rebuilding it before calling command {"command": "ssh"}
2024-08-07T01:26:08.435+0100 DEBUG assh.pkg.config config/config.go:469 Writing SSH config file {"file": "/Users/robin/.ssh/config"}
2024-08-07T01:26:08.435+0100 DEBUG assh.pkg.config config/config.go:482 Unable to remove tempfile {"file": "/Users/robin/.ssh/config2436378249"}
The generated config file looks like this:
# This file was automatically generated by assh vn/a (n/a)
# on 2024-08-07 01:26:08 +0100 BST, based on ~/.ssh/assh.yml
#
# more info: https://github.com/moul/assh
# host-based configuration
# global configuration
Host *
ControlMaster auto
ControlPath ~/tmp/.ssh/cm/%h-%p-%r.sock
ControlPersist yes
IdentityFile ~/.ssh/id_rsa
LogLevel ERROR
Port 22
ProxyCommand /opt/homebrew/bin/assh connect --port=%p %h
# Hooks: {"AfterConfigWrite":["exec echo {{.SSHConfigPath}}","exec cat ~/.ssh/extra.config \u003e\u003e {{.SSHConfigPath}}"]}
Am I doing something wrong, or is this still broken?
stillwaxin
Metadata
Metadata
Assignees
Labels
No labels