Skip to content

Commit

Permalink
Add support for %h and %r escape characters in IdentityFile for SSH. (#…
Browse files Browse the repository at this point in the history
…10343)

* Add support for %h and %r escape characters in IdentityFile for SSH.
See section "IdentityFile" on https://linux.die.net/man/5/ssh_config for
details.

* Fix lint warnings.
  • Loading branch information
mannjani authored Mar 5, 2025
1 parent b83b2e5 commit 4a515d9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tabby-ssh/src/session/ssh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,11 @@ export class SSHSession {
this.allAuthMethods = [{ type: 'none' }]
if (!this.profile.options.auth || this.profile.options.auth === 'publicKey') {
if (this.profile.options.privateKeys?.length) {
for (const pk of this.profile.options.privateKeys) {
for (let pk of this.profile.options.privateKeys) {
// eslint-disable-next-line @typescript-eslint/init-declarations
let contents: Buffer
pk = pk.replace('%h', this.profile.options.host)
pk = pk.replace('%r', this.profile.options.user)
try {
contents = await this.fileProviders.retrieveFile(pk)
} catch (error) {
Expand Down

0 comments on commit 4a515d9

Please sign in to comment.