Return-Path: X-Original-To: apmail-aurora-dev-archive@minotaur.apache.org Delivered-To: apmail-aurora-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A96E2196A8 for ; Tue, 12 Apr 2016 17:40:27 +0000 (UTC) Received: (qmail 72762 invoked by uid 500); 12 Apr 2016 17:40:27 -0000 Delivered-To: apmail-aurora-dev-archive@aurora.apache.org Received: (qmail 72703 invoked by uid 500); 12 Apr 2016 17:40:27 -0000 Mailing-List: contact dev-help@aurora.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@aurora.apache.org Delivered-To: mailing list dev@aurora.apache.org Received: (qmail 72691 invoked by uid 99); 12 Apr 2016 17:40:27 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 12 Apr 2016 17:40:27 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id C20C31A035A for ; Tue, 12 Apr 2016 17:40:26 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.198 X-Spam-Level: * X-Spam-Status: No, score=1.198 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd2-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id YlcqEhKdoCvA for ; Tue, 12 Apr 2016 17:40:22 +0000 (UTC) Received: from mail-vk0-f47.google.com (mail-vk0-f47.google.com [209.85.213.47]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 6696F5FAED for ; Tue, 12 Apr 2016 17:40:22 +0000 (UTC) Received: by mail-vk0-f47.google.com with SMTP id k1so35003670vkb.0 for ; Tue, 12 Apr 2016 10:40:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc; bh=NW1QSENa6Ej0er81TPQCW7jz9ma552FikbIJlaB49mQ=; b=YoRm6zwn/2FH0dfR2DfI7PvE2nZY+XkNlgUgsCFcze2zizcIRI2U81YtnSSSK32XZl hLD/m1vuySp4F1ywVaX0U6ulOGSyN4UDKB/nTpO4/gnA+mvmtt2eZaZCTSQVDakQE/rr GWpiYCTd8WWs9m4kQSi+rTqTVMwzJdr9nCoP4kmw+eYCvskBKDxAbNToyu9WMr07/Ljt eO70n3jLW6oWuQtngOR0ASs5DqdmpD97Y+C6ZL9wu0NN3neTdh7wkYgHt9FaKzohobSU GDkhO8sYgmzZOC71QscsaagIx+I46z4FlbectMo+UfHQ+5fLh+5/QtmOoMYjUDGmmu6b pDDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc; bh=NW1QSENa6Ej0er81TPQCW7jz9ma552FikbIJlaB49mQ=; b=fMhhVy+4YkNz5+Yw3Ouhe3l1yq9ucLtoHCtMoC/IS+cfMnMZHkKUM6qPEC45uTRPyT sPxm8qHwz8dPHT1ht4yIaBgySUjfxdPfKehCGfziXqGHMPhS0jOKUp4vnWgTLslx58PY +v3hipIQyYkRV/YGW6Od523cGt3hR39K8vSvj64GqAYp16MgZghavD1FLg+fDvmFBXQh JVrU6xGQ0pobhS68RVJvE8afV6GCaans/xAwEn+DIiKDyQU1k6ToU17XEI17pClHqKJC jy/F+K+3xeBtMxqHoyt/m7OJSlBAQeBRgWNnX1CVQk6qpADoltYKkx3QuHBqG7GmLXiE WiOw== X-Gm-Message-State: AOPr4FXXQ6a68UocZ/eDm/erllJl0ly+wVuT4a4HDBNNVMoX1FrXMBPx6qjDztNS50s4rfZLQ/JvHSC+1HAx7Q== MIME-Version: 1.0 X-Received: by 10.31.148.215 with SMTP id w206mr2002166vkd.65.1460482821695; Tue, 12 Apr 2016 10:40:21 -0700 (PDT) Received: by 10.31.173.4 with HTTP; Tue, 12 Apr 2016 10:40:21 -0700 (PDT) In-Reply-To: References: <1459268085253.14761@blue-yonder.com> <1460464502325.74265@blue-yonder.com> Date: Tue, 12 Apr 2016 10:40:21 -0700 Message-ID: Subject: Re: Looking for feedback - Setting CommandInfo.user by default when launching tasks. From: Zhitao Li To: dev@aurora.apache.org Cc: Bill Farner , John Sirois Content-Type: multipart/alternative; boundary=001a11425b64c9b12205304d279c --001a11425b64c9b12205304d279c Content-Type: text/plain; charset=UTF-8 Stephan and Joshua, I am working on design of an external component which will consume DiscoveryInfo from Mesos and announce it to Zookeeper. (You see why I added DiscoveryInfo to Mesos now :) ) The reason I like to delegate this component to a third party component (calling it a Mesos-ZK-Bridge) here: - it maintains loose coupling between deployment and service discovery, which are related but not the same thing; - it makes operations like reconfiguring zk path, rotating ACL and so on a bit easier; - this design enables us to support service discovery for other mesos frameworks in a multi-tenancy mesos cluster. On Tue, Apr 12, 2016 at 7:49 AM, Joshua Cohen wrote: > As things stand today, once a task is scheduled, the scheduler can die, or > be shut down for maintenance, etc. with no impact to running tasks. If the > scheduler were responsible for announcing and it maintained the current > practice of creating znodes as ephemeral, it would need to maintain a > persistent ZK connection to ensure all announceable tasks are discoverable. > This means if the scheduler went down for any reason (or just whenever it > failed over normally) all serversets would be lost. That's obviously not > acceptable, so the alternative, if we wanted the scheduler to manage > announcing tasks, would be to stop using ephemeral nodes and instead have > the scheduler create persistent znodes and manually tear them down when > tasks finish. While not as problematic as the above, this is still > potentially a degradation from the current behavior in that there can be a > long delay between a task exiting and the scheduler becoming aware of this > (e.g. task finishes during a netsplit). This might be equivalent in scope > to the issue of a zombie instance that's possible today (i.e. scheduler > thinks task has been killed and restarts it elsewhere, but Mesos fails to > clean up the cgroup for whatever reason leading to double registration for > some time). However, today, due to their ephemeral nature, cleaning up > duplicate znodes is guaranteed as soon as the executor exits. If the znodes > were persistent, we'd have to manually seek out and clean up duplicate > znodes (or build tooling to support this). > > It's certainly possible to transition responsibility for announcing from > the executor to the scheduler, but I think it would be a fairly significant > amount of work and add a fair amount of complexity. > > On Tue, Apr 12, 2016 at 7:35 AM, Erb, Stephan > > wrote: > > > I have recently run into another issue due to Thermos running as root ( > > https://issues.apache.org/jira/browse/MESOS-5187). I would therefore > like > > to re-open the discussion. > > > > IIRC there was a JIRA ticket proposing that the scheduler should be > > responsible for announcing services in Zookeeper. > > > > Would that work? It looks like this could solve a couple of issues at > once: > > > > * no need for credentials on slaves, we could therefore run the executor > > as a normal user > > * the announcement would also work for tasks using alternative executors > > > > > > ________________________________________ > > From: John Sirois > > Sent: Tuesday, March 29, 2016 23:55 > > To: Bill Farner > > Cc: dev@aurora.apache.org; John Sirois > > Subject: Re: Looking for feedback - Setting CommandInfo.user by default > > when launching tasks. > > > > On Tue, Mar 29, 2016 at 3:50 PM, Bill Farner wrote: > > > > > Aha, i think we have different notions of the proposal. I was under > the > > > impression that the executor itself would run as the target user (e.g. > > > steve), not as a system user (e.g. aurora). I find the former more > > > appealing, with the exception that it leaves us without a solution for > > > concealing the credentials file. > > > > > > > My sketch was nonsense anyhow, since thermos running as aurora couldn't > > launch a task as www-data. Fundamentally we need a priviledged executor > > (thermos) that can 1: read the creds and announce 2: run the task and > > health checks nnoth as the targeted un-privileged user. > > > > > > > > > > On Tue, Mar 29, 2016 at 2:39 PM, John Sirois > > wrote: > > > > > >> On Tue, Mar 29, 2016 at 3:26 PM, Bill Farner > > wrote: > > >> > > >> > If i'm understanding you correctly, that doesn't address preventing > > >> users > > >> > from reading the credentials though. > > >> > > > >> > > >> It does: > > >> > > >> Say: > > >> /var/lib/aurora/creds 400 root > > >> > > >> And then if the CommandInfo has user: aurora (executor user as Steve > > >> suggested), it will get a copy of /var/lib/aurora/creds in its > sandbox > > >> chowned to 400 aurora > > >> > > >> Now aurora's executor (thermos), launches a task in role www-data > > >> announcing for it using the cred. The www-data user will not be able > to > > >> read the local sandbox 400 aurora creds. > > >> > > >> > > >> > On Tue, Mar 29, 2016 at 1:52 PM, John Sirois > > >> wrote: > > >> > > > >> > > On Tue, Mar 29, 2016 at 2:31 PM, Steve Niemitz < > sniemitz@apache.org > > > > > >> > > wrote: > > >> > > > > >> > > > So maybe we add it, but don't change the current default > behavior? > > >> > > > > > >> > > > > >> > > Could we use the CommandInfo.uris [1] to solve this? IE: the > > >> scheduler > > >> > > would need to learn the credential file path, and with that > > knowledge, > > >> > the > > >> > > local mesos (root) readable credential file could be specified as > a > > >> uir > > >> > > dependency for all launched executors (or bare commands). IIUC, > if > > >> the > > >> > URI > > >> > > if a file:// the local secured credentails file will be copied > into > > >> the > > >> > > sandbox where it can be read by the executor (as aurora). > > >> > > > > >> > > [1] > > >> > > > > >> > > > >> > > > https://github.com/apache/mesos/blob/master/include/mesos/mesos.proto#L422 > > >> > > > > >> > > > > >> > > > > > >> > > > On Tue, Mar 29, 2016 at 4:26 PM, Bill Farner < > wfarner@apache.org> > > >> > wrote: > > >> > > > > > >> > > > > I'm in favor of moving forward. There's no requirement to use > > the > > >> > > > > Announcer, and a non-root executor seems like a useful option. > > >> > > > > > > >> > > > > On Tue, Mar 29, 2016 at 1:00 PM, Steve Niemitz < > > >> sniemitz@apache.org> > > >> > > > > wrote: > > >> > > > > > > >> > > > > > Makes sense, I guess it can be up to the cluster operator > > which > > >> > model > > >> > > > to > > >> > > > > > choose. Is there any interest in the feature I proposed or > > >> should > > >> > I > > >> > > > just > > >> > > > > > drop it? It's not a lot of code, but also it's not a > > >> requirement > > >> > for > > >> > > > > > anything we're working on either (the docker stuff however, > > is). > > >> > > > > > > > >> > > > > > On Tue, Mar 29, 2016 at 1:39 PM, Bill Farner < > > >> wfarner@apache.org> > > >> > > > wrote: > > >> > > > > > > > >> > > > > > > That's correct - those credentials should require > privileged > > >> > > access. > > >> > > > > > > > > >> > > > > > > On Tue, Mar 29, 2016 at 10:25 AM, Steve Niemitz < > > >> > > > > > > sniemitz@twitter.com.invalid> wrote: > > >> > > > > > > > > >> > > > > > > > Re: ZK credential files, thats an interesting issue, I > > >> assume > > >> > you > > >> > > > > don't > > >> > > > > > > > want the role user to be able to read it either, and > only > > >> root > > >> > or > > >> > > > > some > > >> > > > > > > > other privileged user? > > >> > > > > > > > > > >> > > > > > > > On Tue, Mar 29, 2016 at 12:14 PM, Erb, Stephan < > > >> > > > > > > > Stephan.Erb@blue-yonder.com> > > >> > > > > > > > wrote: > > >> > > > > > > > > > >> > > > > > > > > I am in favor of your proposal. We offer less attack > > >> surface > > >> > if > > >> > > > the > > >> > > > > > > > > executor is not running as root. > > >> > > > > > > > > > > >> > > > > > > > > Interesting though, this introduces another security > > >> problem: > > >> > > The > > >> > > > > > > > > credentials file in the incoming Zookeeper ACL patch > ( > > >> > > > > > > > > https://reviews.apache.org/r/45042/) will have to be > > >> > readable > > >> > > by > > >> > > > > > > > > everyone. That feels a little bit like being back to > > >> square > > >> > > one. > > >> > > > > > > > > ________________________________________ > > >> > > > > > > > > From: Steve Niemitz > > >> > > > > > > > > Sent: Tuesday, March 29, 2016 17:34 > > >> > > > > > > > > To: dev@aurora.apache.org > > >> > > > > > > > > Subject: Looking for feedback - Setting > CommandInfo.user > > >> by > > >> > > > default > > >> > > > > > > when > > >> > > > > > > > > launching tasks. > > >> > > > > > > > > > > >> > > > > > > > > I've been working on some changes to how aurora > submits > > >> tasks > > >> > > to > > >> > > > > > mesos, > > >> > > > > > > > > specifically around Docker tasks, but I'd also like to > > see > > >> > how > > >> > > > > people > > >> > > > > > > > feel > > >> > > > > > > > > about making it more general. > > >> > > > > > > > > > > >> > > > > > > > > Currently, when Aurora submits a task to mesos, it > does > > >> NOT > > >> > set > > >> > > > > > > > > command.user on the ExecutorInfo, this means that > mesos > > >> > > > configures > > >> > > > > > the > > >> > > > > > > > > sandbox (mesos sandbox that is) as root, and launches > > the > > >> > > > executor > > >> > > > > > > > > (thermos_executor in our case) as root as well. > > >> > > > > > > > > > > >> > > > > > > > > What then happens is that the executor then chown()s > the > > >> > > sandbox > > >> > > > it > > >> > > > > > > > creates > > >> > > > > > > > > to the aurora role/user, and also setuid()s the > runners > > it > > >> > > forks > > >> > > > to > > >> > > > > > > that > > >> > > > > > > > > role/user. However, the executor itself is still > > running > > >> as > > >> > > > root. > > >> > > > > > > > > > > >> > > > > > > > > My proposal / change is to set command.user to the > > aurora > > >> > role > > >> > > by > > >> > > > > > > > default, > > >> > > > > > > > > which will cause the executor to run as that user. > I've > > >> > tested > > >> > > > > this > > >> > > > > > > > > already, and no changes are needed to the executor, it > > >> will > > >> > > still > > >> > > > > try > > >> > > > > > > to > > >> > > > > > > > > chown the sandbox (which is fine since it already owns > > >> it), > > >> > and > > >> > > > > > > setuid() > > >> > > > > > > > > the runners it forks (again, fine, since they're > already > > >> > > running > > >> > > > as > > >> > > > > > > that > > >> > > > > > > > > user). > > >> > > > > > > > > > > >> > > > > > > > > *The controversial part of this* however is I'd like > to > > >> > enable > > >> > > > this > > >> > > > > > > > > behavior BY DEFAULT, and allow disabling it (reverting > > to > > >> the > > >> > > > > current > > >> > > > > > > > > behavior now) via a flag to the scheduler. My > reasoning > > >> here > > >> > > is > > >> > > > > two > > >> > > > > > > > fold. > > >> > > > > > > > > 1) It's a more secure default, preventing a > compromised > > >> > > executor > > >> > > > > > from > > >> > > > > > > > > doing things it shouldn't, and 2) we already have a > lot > > of > > >> > > "flag > > >> > > > > > > bloat", > > >> > > > > > > > > and flags are hard enough to discover as they are. > > >> However, > > >> > I > > >> > > do > > >> > > > > > > believe > > >> > > > > > > > > this should be considered as a "breaking change", > > >> > particularly > > >> > > > > > because > > >> > > > > > > of > > >> > > > > > > > > finicky PEX extraction for the executor. > > >> > > > > > > > > > > >> > > > > > > > > I'd like to hear people's thoughts on this. > > >> > > > > > > > > > > >> > > > > > > > > > >> > > > > > > > > >> > > > > > > > >> > > > > > > >> > > > > > >> > > > > >> > > > >> > > >> > > >> > > >> -- > > >> John Sirois > > >> 303-512-3301 > > >> > > > > > > > > > > > > -- > > John Sirois > > 303-512-3301 > > > -- Cheers, Zhitao Li --001a11425b64c9b12205304d279c--