github alajmo/sake v0.17.0

one hour ago

Features

  • Support ProxyCommand in the ssh config for sake run, sake exec and the rest, and for sake ssh, like ProxyCommand sh -c "aws ssm start-session --target %h --parameters portNumber=%p" for AWS SSM. The tokens of ssh_config like %h, %n, %p, %r, %u, %C and %% are expanded, and the command ends with the connection. It competes with a ProxyJump of the ssh config as in ssh, where whichever is set first wins, and is ignored for a server with a bastion in sake
  • Use the ssh-agent that IdentityAgent sets in the ssh config, like 1Password's, instead of only SSH_AUTH_SOCK. It's read as ssh reads it: the first value of the matching Host sections in the file's order, also from Host * and Included files, from a Match block whose criteria are all, host, originalhost, user or localuser (others, like exec, are skipped), with ? and ! patterns, a quoted path, ~, ${VAR}, $VAR, the %d, %u, %i, %L, %l, %h, %r, %p, %C tokens, SSH_AUTH_SOCK and none. An unset $VAR means no agent, and an invalid variable name, an unset ${VAR} or an unknown token is an error for that server
  • A bastion uses the ssh-agent and IdentityFile of its own host in the ssh config, as ssh does for a ProxyJump, with the server's identity_file and password after them. A bastion whose agent can't be reached still connects with its own IdentityFile. A bastion with no section of its own, like a bare IP in ProxyJump, gets the settings of the wildcard sections that match it, like the User and IdentityFile of Host *

Breaking

  • A ProxyCommand in your ssh config now takes effect for the servers that have a Host section of their own, where sake ignored it, and its command has no terminal, so it can't ask for input
  • An Include with a glob in the ssh config, like Include config.d/*, is now read instead of skipped, so the hosts it defines get their HostName, User, Port, IdentityFile and ProxyJump
  • The settings of a Match block in the ssh config no longer join the Host section before it. Match all applies to every host, and other Match blocks are skipped, as sake doesn't evaluate their criteria for these settings
  • Host patterns in the ssh config are matched as ssh matches them, so more hosts can get a section's settings: ? is one character (Host web? gives web1 its settings, where web? was a host of its own), a negated pattern excludes a host (Host *.lab !bad.lab no longer applies to bad.lab), and case is ignored, also for a server's own section. Patterns like [ab] and {a,b}, which ssh doesn't have, no longer match
  • A bastion no longer uses the server's ssh-agent, but its own: SSH_AUTH_SOCK, or its host's IdentityAgent
  • A bastion's own IdentityFile in the ssh config is now read, so sake can ask for its passphrase
  • A ProxyJump hop that sets no user or port, and whose ssh config section sets none, is on port 22 and the local user's, as in ssh, instead of the server's port and user, --user included
  • A user or port written for a bastion in sake.yaml, like bob@jump:2200, now wins over its ssh config section's, which won before
  • An ssh-agent has default_timeout to connect and list its keys, where sake waited before. An agent that waits for the user first, like a locked agent app, can now time out: that server then connects without it

Fixes

  • Fix host names that only the system's resolver knows, like libvirt VMs, systemd-machined containers and mDNS (.local) hosts, being unreachable with lookup host1vm on 127.0.0.53:53: server misbehaving, where ssh and ping find them. sake is built without cgo, so it resolves names itself, with the DNS servers of /etc/resolv.conf and not the sources of /etc/nsswitch.conf. When it can't find a name, it now asks getent ahosts, where that exists (Linux and BSD), and connects to what it finds
  • Fix an alias in a ProxyJump list, like ProxyJump jump1,jump2, being dialed as a host name: each hop gets its section's HostName, User and Port, where a user or port the hop sets wins, as in ssh. A bastion set in sake gets the User and Port it sets when its section has none, instead of the server's
  • Fix sake ssh giving ssh the resolved address of a jump host, which lost the host's own ssh config section, like its IdentityFile: it gets the host as written, and sake's ssh config with -F, which may not be the one ssh reads
  • Fix a host's own IdentityFile coming after the one of Host *, so sake used the wildcard's for a host with its own
  • Fix ProxyJump none, which turns off a ProxyJump from Host *, being dialed as a bastion named none
  • Fix --user and --identity-file being replaced by the User and IdentityFile of the server's ssh config section: the flags win, as ssh -l and -i do. --identity-file also replaces the server's .pub file, which matched the server's own key in the agent instead
  • Fix Key=value and Key = value lines in the ssh config, which gave the value = value, like the user = root
  • Fix quoted values in the ssh config keeping their quotes, like IdentityFile "~/.ssh/my key", and a trailing comment joining a value, like User root # admin
  • Fix a relative Include in the ssh config, like Include config.d/work, failing the parse, as it was opened from the current directory: it's read from ~/.ssh, or /etc/ssh for a config there, as ssh does. An Include that can't be read or parsed is skipped, and an Include loop ends
  • Fix a host name with a port without a dot, like jump:2222 in ProxyJump or bastion, which was read as the host jump:2222, and an ssh:// host, which was an error
  • Fix an ssh-agent that never answers hanging the run: connecting to it and listing its keys take at most default_timeout, all the agents together, not each
  • Fix "too many authentication failures" when the ssh-agent holds many keys: a server's identity_file key is offered first, as ssh does
  • An ssh-agent that can't be reached no longer fails the whole run: a server still connects with its identity_file or password, as with ssh, and one with neither is unreachable with the agent's error. The agent is only opened when a remote server uses it

Don't miss a new sake release

NewReleases is sending notifications on new releases.