4 ms·
One legitimate use case for agent forwarding that I've used in the past is ssh-ing in to a development server and doing a pull from a github repo. Without agen
by lisper 12y ago
One legitimate use case for agent forwarding that I've used in the past is ssh-ing in to a development server and doing a pull from a github repo. Without agent forwarding to authenticate from the dev server to github that gets really annoying really fast. Whatever vulnerabilities are introduced by agent forwarding they pale in comparison to those you get by leaving your private key on the dev server.
- deleted 12y ago[deleted]
- Tharkun 12y agoThe point of ProxyCommand is that you don't have to leave your private key on the server..
- mjs 12y agoIt can be password protected, though.
- lisper 12y agoYes, but then if I have to update 100 devhosts I have to type my password 100 times.
- pyre 12y agoThis could be automated. For example, both Ansible and Fabric allow you to enter your sudo password once (per run), and then it will enter it into the sudo prompt for you when executing remote commands. The same thing could be worked out for this (though I agree that it's a less flexible solution).
- lisper 12y agoHow is sudo supposed to help? I'm not trying to do anything that requires privileges on my machine, I'm trying to authenticate to github.
- pyre 12y agoIt's the same method. It uses something like expect to scrape the output of the commands, and determine that it needs to enter a password. That framework could be extended to do the same thing for git/ssh prompts on the remote machine. These tools don't currently do this, but I was just stating that it would be possible to enter the password once even when running this across multiple machines. Note that I'm not necessarily encouraging that as a solution. For example, I know that one of them (probably Fabric) defines the sudo prompt (via the -p flag or SUDO_PROMPT environment variable) to be able to pick out a sudo prompt in the text output of the command, so that it knows it needs to respond with the password.
- simcop2387 12y agoThe problem with that is that then to automate it you need the password in cleartext in memory. A core dump, ptrace, or anything like that and you've just given up all access.
- lisper 12y agoYes, obviously, but ProxyCommand won't work for this use case (AFAICT). I don't need to ssh from my home machine through my devhost to github, I need to execute a git comment on devhost that authenticates to github.
- teacup50 12y agoThis is only legitimate if you consider designing a system that requires this to be legitimate. A simpler solution: 1) Use a "real" deployment mechanism, not an authenticated git pull from Github. 2) Write software to be easy to deploy. If you require a ton of external fiddly work to get the code running, that's what necessitates the use of a shared development server.
- lisper 12y agoThe whole point of deploying via a git pull is so that you don't have to do "a ton of external fiddly work" to get the code running. By deploying via a git pull I ensure that the files in the data center are exactly the same as the files on the laptop that I wrote the code on, and so if it worked on my laptop it is very likely to work in the datacenter.
- semi-extrinsic 12y agoWhy can't you just authenticate to github with your password when you pull from the dev server?
- lazaroclapp 12y agoBecause then you are exposing your password to a potentially untrusted dev server? Unless you are making a new password for that server, in which case you are still better of by giving each server their own private key and registering the corresponding public keys for read-only access in your remote repo. Another option: mount the corresponding directory of the dev server using sshfs, run git commands locally, run everything else remotely. Although I am not sure if there are any risks of mounting an untrusted directory via sshfs.
- lisper 12y agohttps://news.ycombinator.com/item?id=9428545 https://news.ycombinator.com/item?id=9428545
- jlgaddis 12y agoAn alternative would be to create an independent key (I forget what Github calls them) that has read-only permissions to access your repo.
- akerl_ 12y agoI didn't realize this when I first started using them, but Github's deploy keys are read/write as of the last time I tried them, with no option to make them read-only. I actually used Bitbucket for a while because their repo-level keys are read-only.
- hobarrera 12y agoYou can use read-only keys. Github has this, as do most other similar solutions. > Whatever vulnerabilities are introduced by agent forwarding they pale in comparison to those you get by leaving your private key on the dev server. Not really. "pale in comparison" is way off. Leaving the key on the server, and using agent forwarding are almost the same: anyone with access to the server has access to the key. There's only a minor difference in how hard it is for the attacker to get the key.