Live data from Hacker News

iTerm2 Shell Integration

iterm2.com

41–50 of 102 posts

Re: iTerm2 Shell Integration

#41

I'm here to answer questions anyone has about this. It's a newish feature so feedback is welcome, and bug reports are greatly appreciated. Also, credit goes to FinalTerm for the inspiration. RIP.

Thanks for your hard work and generosity.

How should we think about the security story when sshing from a more trusted to a less trusted host?

Re: iTerm2 Shell Integration

#43

I'm concerned about the wget to an external server part. This file should be local to prevent excessive slowness and potential security issues. Also, is there a zsh version of this file? zsh is extremely popular on osx.

The linked page explains how to install by hand. I'd like to eliminate the curl|bash. It's tricky to deploy a shell script in a terminal emulator, so it hasn't been done yet. The ability to fix bugs without making users upgrade their client has been invaluable during early beta.

Well, if all I have to do is run the script, I can just import it into my git repo (by submoduling iterm2's git repo, if they have one; if they don't, they need one just for this script), and just call it normally (with a bit of if wrapper to not execute on non-iterm2 terms).

Re: iTerm2 Shell Integration

#44
post #18

Earlier quoted context omitted.

Except that it doesn't shell out, so it ignores ProxyCommand...

What do you use ProxyCommand for? It seems hard to support, but I'd like to know more.

I use ProxyCommand for tor hidden services, for connecting to IPv6 hosts (via a v4 connection to a host with v6 connectivity), for connecting to production past a bastion host, for triggering port knocking, all sorts of stuff.

Re: iTerm2 Shell Integration

#45
post #41

I'm here to answer questions anyone has about this. It's a newish feature so feedback is welcome, and bug reports are greatly appreciated. Also, credit goes to FinalTerm for the inspiration. RIP.

Thanks for your hard work and generosity. How should we think about the security story when sshing from a more trusted to a less trusted host?

Great question!

When installing, especially on an untrusted host, follow the manual installation instructions. The menu item will just output a curl|bash command (currently; this will likely change in the future).

If the host is really untrusted you're screwed, of course. Bad guys could modify your ~/.iterm2_shell_integration.bash and you'd never know. But this script is not special in any way (except that it's kinda complex and is run automatically). Maybe hash it from time to time if you're really paranoid.

The scripts assume that various things in your path are safe to run. printf, hostname, sed, echo, etc. If those are compromised you're in a bad way, and I don't think shell integration exposes anything that ordinary use wouldn't.

If you've been compromised badly enough that an attacker can decrypt your ssh session, your current directory will be revealed at each prompt. But it probably is since most people have that in their $PS1 anyway. Also the host's idea of its fully-qualified domain name.

Probably the most risky aspect of shell integration is the secure copy feature. It's possible that there's a bug in my use of libssh2 or that there are unpatched vulnerabilities in an out-of-date build of iTerm2 (or an up-to-date version of iTerm2 with an out-of-date libssh2). I try to stay on top of changes to libssh2 but I am human and Sparkle (the auto-updater) is not flawless either.

That's all that comes to mind. I'm sure other folks on here can think of more interesting attacks or vulnerabilities.

Re: iTerm2 Shell Integration

#46
post #18

Earlier quoted context omitted.

Except that it doesn't shell out, so it ignores ProxyCommand...

What do you use ProxyCommand for? It seems hard to support, but I'd like to know more.

Everything in the Production zone in our corporate network is only available via jumphost. The kicker is that you need to support both "ProxyCommand args" enabling and "ProxyCommand None" for disabling.

Re: iTerm2 Shell Integration

#47

Earlier quoted context omitted.

The linked page explains how to install by hand. I'd like to eliminate the curl|bash. It's tricky to deploy a shell script in a terminal emulator, so it hasn't been done yet. The ability to fix bugs without making users upgrade their client has been invaluable during early beta.

Would it be possible for iTerm to "type" the whole thing in for me? It's already executing a curl, can it do the whole thing through the host?

That's the eventual plan. There are a million niggling details, so I didn't do it yet.

Re: iTerm2 Shell Integration

#48

Earlier quoted context omitted.

The linked page explains how to install by hand. I'd like to eliminate the curl|bash. It's tricky to deploy a shell script in a terminal emulator, so it hasn't been done yet. The ability to fix bugs without making users upgrade their client has been invaluable during early beta.

Well, if all I have to do is run the script, I can just import it into my git repo (by submoduling iterm2's git repo, if they have one; if they don't, they need one just for this script), and just call it normally (with a bit of if wrapper to not execute on non-iterm2 terms).

Yes, all you have to do is source the script at https://iterm2.com/misc/${SHELL}_startup.in from your ~/.login, ~/.zshrc, ~/.bash_profile, or ~/.config/fish/config.fish as appropriate. If there's ever a major change you'll get a notification when you log in and you'll need to update it, but that hasn't happened yet.

Re: iTerm2 Shell Integration

#49
post #39

Earlier quoted context omitted.

What do you use ProxyCommand for? It seems hard to support, but I'd like to know more.

I also use a smartcard with gpg-agent speaking the ssh-agent protocol. OpenSSH commandline supports it fine. What's the harm in shelling out?

I don't get to control the UI if I shell out. I want to prompt you for your password in a native window and display a native progress bar. I want to know exactly why it failed. I want to estimate the time remaining.

Re: iTerm2 Shell Integration

#50
post #33

Earlier quoted context omitted.

I've used it in the past to ssh via bastion hosts and the like.

Yes. My config is something like this: # proxy n02 connections through bastion host n02.university.edu ProxyCommand ssh bastion.university.edu -W %h:%p 2> /dev/null Almost all my remote shells require a similar setup.

Seems like this might be a common enough pattern that I could support it. I'll have a look.
Post reply on HN