Live data from Hacker News

iTerm2 Shell Integration

iterm2.com

51–60 of 102 posts

Re: iTerm2 Shell Integration

#51
I like the idea of these features, but the "run this random shellscript from the internet" part really bugs me. Could / will you integrate it another way when it comes out of the nightly releases?

Re: iTerm2 Shell Integration

#52
post #51

I like the idea of these features, but the "run this random shellscript from the internet" part really bugs me. Could / will you integrate it another way when it comes out of the nightly releases?

Totally reasonable thing to ask, but if you'd scrolled down a few more pixels you'd have had your answer. Directly underneath:

    The easiest way to install shell integration is to select the iTerm2>Install Shell Integration menu item. It will download and run a shell script as described below.
...you'll see:

    "Don't care for piping curl to bash? Do it by hand. First, download the right script for your shell...."

Re: iTerm2 Shell Integration

#55

I'd love to use a terminal with similar features on linux

When I still used Linux on the desktop, I just used urxvt.

Simply in case anyone is not already aware, there are some phenomenal add-on features for urxvt through the perl extensions: https://github.com/muennich/urxvt-perls/

Notably, keyboard-select allows you to cut/paste things into the X buffer from anywhere in the terminal scrollback using only keyboard shortcuts. url-select, conversely, allows you to cycle through any visible URLs and either open them in an external browser or copy them to the X buffer.

Re: iTerm2 Shell Integration

#56
post #34

I'd love to use a terminal with similar features on linux

Terminator comes close, but to be honest, iTerm2 still beats it with its user friendliness and features. It's really interesting how OS X is the one that has a terminal emulator with the most features out there. iTerm2 now comes with 24-bit colors, command completion popup, notifications, triggers, profiles, mouseless copy, split panes, search, and you can even have inline images/gifs all out of the box with zero or…

> It's really interesting how OS X is the one that has a terminal emulator with the most features out there.

In my experience, the vast majority of web developers use OS X. Those of us doing server side and devops work spend a lot of time in the terminal

Re: iTerm2 Shell Integration

#58

Earlier quoted context omitted.

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.

That works for me.

Re: iTerm2 Shell Integration

#59

Earlier quoted context omitted.

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

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

You can also use ProxyCommand to perform filtering via sed / awk / some shell script on the hostname passed in. Examples: https://wiki.gentoo.org/wiki/SSH_jump_host

I have over 300 hosts defined in my .ssh/config file and it's indispensable to have all these options, especially when mixing in 2FA jump hosts into the mix.

Re: iTerm2 Shell Integration

#60
post #41

Earlier quoted context omitted.

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…

Is there a risk of the untrusted host injecting things into the shell output without permission? It looks like there's no authentication, so if I SSH somewhere untrusted that can output raw characters to my shell (which, I believe, includes git pushing over SSH, etc.), it can output the right escape sequence and insert false things into my shell history. With further cleverness, it could almost certainly inject things that look like commands I would have run but actually run evil things.

I don't have a great solution to suggest for this. One option is to add some sort of per-user static password to the escape sequence, and insert it in the file that's copied to each (trusted) host, but that just seems questionable. A better one might be to make the communication use a socket instead of an escape sequence, and forward the socket (recent OpenSSH can forward UNIX domain sockets) to trusted hosts, but that's its own mess.

This is such a useful feature, though, especially with remote hosts. It'd be a pity if it can't be done securely. :/

(While we're on the subject of security, there's an obscure attack involving interrupting the download of a `curl | sh` script -- which a MITM can do, even over SSH -- and relying on the shell to execute a partial command line. I learned about this from the Sandstorm folks, who have a workaround in https://install.sandstorm.io/ involving the sh equivalent of an IIFE.)

Post reply on HN