News for hackers. Stuff that matters.
Re:The sad state of sysadmin in the age of containers (2015) by jve on Monday December 09, 2019 @05:49AM (#21741657)
This all boils down to trust.

`curl | sudo bash` is no different than .\install.exe. The question is about trusting the SOURCE and trusting the DISTRIBUTION channel (that HTTP download from scala-lang.org violates this).

Where did you get it? from https://microsoft.com/... or from https://micro.soft.com/...? Whom you trust more? The same with pre-built VM image or whatever... do you trust the party that made this image/container available?

Re:The sad state of sysadmin in the age of containers (2015) by peterwwillis on Monday December 09, 2019 @09:51AM (#21743085)
Trust, but verify.

> `curl | sudo bash` is no different than .\install.exe

.\install.exe runs a binary you already have. If it's windows, you can see if it's a signed binary, and it will prompt you for admin access. If it's not signed, you can compare a signature of it to one you got from a secure source.

`curl | sudo bash` downloads the file from a remote source. The URL isn't listed here; was it http? In that case, now a MITM can modify the file before you run it. If it's HTTPS, that's better, but you still haven't compared it to a signature of the original file, meaning it could have been modified on the download site. And hopefully you're one of the seemingly few users that turn on password prompting for sudo access (and hopefully running it in a new terminal, to avoid an earlier sudo's session...)

So they are different. And containers and VMs are the same: if you can compare checksums before running them, or build them from source, you have confidence that they came from a source you trust. Dockerfiles in particular make rebuilding even more trivial than with source Linux packages, so there's not much reason to fret.

Re:The sad state of sysadmin in the age of containers (2015) by cuillevel3 on Monday December 09, 2019 @01:59PM (#21745277)
It also no different from using 'make install' or installing packages from a community repository, like Ubuntu Universe, homebrew, Arch AUR and so on.

There is an absurd amount of trust put in distributions and their package managers. Unless people are paying for it, or use very old software, they probably don't get the level of security they expect.

Re:The sad state of sysadmin in the age of containers (2015) by eeZah7Ux on Monday December 09, 2019 @08:10AM (#21742240)
On the contrary, it's much worse. There's no way for 3rd parties to collect, test and redistribute installers in an organized way.
Re:The sad state of sysadmin in the age of containers (2015) by LockAndLol on Monday December 09, 2019 @06:17AM (#21741760)
`curl | sudo bash` should never have become a thing in the first place. To me, it's the most "WTF?" mode of installing anything. Especially when the source is HTTP.

In what world is that secure?

Pity Qubes is so heavy, otherwise I'd be using it

Re:The sad state of sysadmin in the age of containers (2015) by eejjjj82 on Monday December 09, 2019 @06:39AM (#21741849)
would you feel better if your Makefile looks like this:

    install:
        [ $(id -u) -ne 0 ] && echo 'please run sudo make install' || curl https//my.thing | /bin/sh

it goes back to what jve said - it's a matter of trust. how often do you blindly run 'sudo make install' w/o reading the entirety of the build script? all the time I bet - it's because you trust the source
Re:The sad state of sysadmin in the age of containers (2015) by LockAndLol on Monday December 09, 2019 @07:18AM (#21741984)
No.

I think I have never run `sudo make install`. Things I install come from package managers. Docker or a VM is used to test other software.

And of course trust is important, but if I encounter things like `curl | bash`, my trust is lost.

Re:The sad state of sysadmin in the age of containers (2015) by yori on Monday December 09, 2019 @08:05AM (#21742218)
What difference does it make if you run `make install` or `curl | bash`? In both cases, you are running code you have not audited yourself. Or are you the kind who inspects every Makefile and installer script before installing? If not, why is one better than the other?
Re:The sad state of sysadmin in the age of containers (2015) by sudosysgen on Monday December 09, 2019 @08:43AM (#21742520)
Because at least with make install you can have some trust in the delivery method, ie encrypted git or whatever. If you use just plain http....
Re:The sad state of sysadmin in the age of containers (2015) by yori on Monday December 09, 2019 @10:42AM (#21743521)
So wget https://example.com/installer.tar.gz; tar -xvzf installer.tar.gz; cd installer; make install is okay for you?

But curl https://example.com/installer.sh | bash is not? Why?

Re:The sad state of sysadmin in the age of containers (2015) by sudosysgen on Monday December 09, 2019 @11:32AM (#21743949)
I'm fine with the second too as long as the host is trustworthy and it's always https. Most of the time it isn't.
Re:The sad state of sysadmin in the age of containers (2015) by GordonS on Monday December 09, 2019 @08:44AM (#21742535)
Whether it's `sudo make install` or `curl | bash`, in both cases you have the opportunity to first inspect the code that will be executed.
Re:The sad state of sysadmin in the age of containers (2015) by Avamander on Monday December 09, 2019 @09:40AM (#21742994)
You don't have the opportunity in the latter case.

https://www.idontplaydarts.com/2016/04/detecting-curl-pipe-b...

Re:The sad state of sysadmin in the age of containers (2015) by GordonS on Monday December 09, 2019 @10:01AM (#21743176)
Sorry, I don't follow.

If I have a makefile, I can inspect it and see what it does.

If I have shell script (or indeed a makefile!) that calls `curl | bash`, I can inspect that shell script and see the URL that is used with curl, and then inspect the contents that the URL returns.

Re:The sad state of sysadmin in the age of containers (2015) by Avamander on Monday December 09, 2019 @10:31AM (#21743427)
You can't see what comes from `curl | bash` before you actually pipe it to bash, click the link and read the article please.
Re:The sad state of sysadmin in the age of containers (2015) by GordonS on Monday December 09, 2019 @10:56AM (#21743672)
OK, I see - in theory, an attacker in control of the backend could write a handler that could craft a bash script that writes different content when `curl | bash` is used.

TBH, while I take your point, I do think it's a little disingenuous of you to claim that "You don't have the opportunity" to inspect the script prior to executing it - you ordinarily will, but can't in the unlikely event of an attack like the article describes, which would require an attacker to be in full control of the web server.

Off the top of my head, this could be mitigated in a couple of ways:

1. Hash a known-good script and check the hash matches prior to executing (this does however mean that you need to update the hash every time the remote script is changed)

2. Use curl to download the remote script to a local file first, and provide the opportunity to inspect it prior to piping it into bash

Re:The sad state of sysadmin in the age of containers (2015) by Avamander on Monday December 09, 2019 @12:37PM (#21744549)
> Off the top of my head, this could be mitigated in a couple of ways:

Or the third opportunity of not piping curl to bash and using a proper repository that has all these integrity and authenticity checks built-in.

Re:The sad state of sysadmin in the age of containers (2015) by Doxin on Monday December 09, 2019 @07:49AM (#21742133)
Basically all makefiles you run into in the wild for mature projects allow you to install it with a prefix. e.g. into the home folder. No need to sudo anything if you do that.
Re:The sad state of sysadmin in the age of containers (2015) by markhahn on Monday December 09, 2019 @10:35AM (#21743467)
This is an important point lost in the noise.

The problem is that cattle should apply only to containers, not hosts or VMs. Why? root. Which is also why Docker is a nonstarter for anyone who wants to use containers securely.