Skip to content
This repository was archived by the owner on Aug 14, 2020. It is now read-only.

spec: reconsider SHELL/HOME environment variables #273

Merged
merged 1 commit into from
May 7, 2015

Conversation

jonboulle
Copy link
Contributor

As of c8559a2 the environment variables mandated by the spec are as follows:

  1. PATH
  2. USER
  3. LOGNAME (same as USER)
  4. HOME
  5. SHELL
  6. AC_APP_NAME
  7. AC_METADATA_URL

1, 2 and 3 seem relatively uncontroversial - it's reasonable to assume every app executing on a modern OS has these concepts (inherently associated with the process). 6 and 7 are similarly straightforward expectations defined clearly in the spec itself.

4 and 5 are slightly more problematic because, although part of the POSIX passwd, their significance and relevance for applications executing in containers is murky. They are conceptually really associated with an interactive user (--> login session), and it seems to me it should be possible to completely implement the execution side of the appc spec without introducing such a notion. Also, these are traditionally looked up from a database like /etc/passwd and it is unclear how this should be discussed (if at all) in the spec. Related: #231

Throwing out a few ideas for clarifying this:

  • Declare only that HOME and SHELL should have "sensible" values but do not have any particular significance or requirements in the spec itself
  • Remove SHELL entirely from the list of required environment variables (now that we have relaxed the restrictions on what can be set)
  • Make SHELL optional and mandate (or recommend?) that it be used iff interactive sessions are to be supported
  • Stipulate that HOME must reference a directory in the rootfs that is writeable by the user (i.e. the app.User field)

@jonboulle jonboulle changed the title spec: remove SHELL environment variable? spec: reconsider SHELL/HOME environment variables Mar 30, 2015
@vcaputo
Copy link
Contributor

vcaputo commented Mar 30, 2015

I think the spec should only require PATH, AC_APP_NAME, and AC_METADATA_URL.

After that things get muddy, is the spec going to require a user database @ /etc/passwd where USER/LOGNAME may be looked up? These names have no meaning to the kernel as it works only with numeric identifiers, userspace gives meaning to this stuff, where do we want the line drawn?

Even PATH can be argued as a userspace detail, execvp() is libc, not a kernel interface.

I understand many applications will assume these environment variables are set, but I think this is probably something actool should cater to when building the ACI, not something the ACE should magically make happen.

@eyakubovich
Copy link

I agree with @vcaputo. Let's just have the AC_* vars and have the rest be set to reasonable defaults during the authoring process (e.g. via actool). actool can then provide a way to override the defaults. It can also then generate these extra files files like expected by libc: /etc/passwd, /etc/services, etc.

@jonboulle
Copy link
Contributor Author

@vcaputo yes, you are right, I overlooked the ambiguity of 2 and 3. This is really something we need to clarify with #231 (what significance is there, if any, to the user specified in the image?)

@eyakubovich whoah, that behaviour sounds like a bit of a non sequitur/feature creep. Why should actool be in the business of generating passwd databases and other libc files? At that point we basically need to mandate them in the spec. Unless you are talking about some kind of actool build --with-libc mode or something. And what about other ACI building workflows?

@vcaputo
Copy link
Contributor

vcaputo commented Mar 30, 2015

@jonboulle it's just that at the end of the day we want users to be successful. That may require the tooling used to build these images to do more hand-holding, especially if the ACE isn't going to be attempting to magically fill the potential gaps.

@eyakubovich
Copy link

@jonboulle yeah, definitely with --with-libc. What we want is ACI to be as self sufficient and explicit as possible (it would contain all the needed files and env vars in manifest). But to ease the creation of all these "systemsy" bits, the tooling can help. So actool can add some boilerplate, if asked.

@jonboulle
Copy link
Contributor Author

I agree with the goals you're both pushing, and that tooling should be able to help with creating fully functional ACIs. But I think it would still behoove us to discuss this in the spec (particularly the parts intimately related to #231) without just completely throwing out all of the vars.

@jonboulle jonboulle added this to the v0.7.0 milestone May 1, 2015
@thockin
Copy link
Contributor

thockin commented May 4, 2015

I flagged this issue on my read-through this weekend.

USER, LOGNAME, HOME, and SHELL all imply some standard passwd structure. I don't think you want to make that assumption.

I could MAYBE see these rules:

  • Set LOGNAME and USER iff the uid was set to non-numeric, but that's a whole other issue I realized with the spec as it is - it may be unreasonable to actually parse non-numeric uid/gid - nsswitch can be arbitrarily complicated -- are you going to make ACE process nsswitch, talk to LDAP or NIS+, process arbitrary on-disk files, etc? That seems like an attack vector to me.
  • Set HOME to $workingDir

@jonboulle
Copy link
Contributor Author

@thockin @eyakubovich @vcaputo took a swing at this, ptal

@@ -7,12 +7,23 @@ This document attempts to define a minimal set of things that must exist for mos

ACIs that define the label `os=linux` can expect this environment by default.

## Execution Environment

It is RECOMMENDED that the following environment variables be set for each application's main process and any lifecycle processes:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there some real requirement driving the desire for these? I feel like this is soft enough that it doesn't matter at all and should just be stricken entirely.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was anticipating that there is still a nontrivial amount of software that does depend on these things and so it would be worth gently nudging implementers in that direction. But I don't feel strongly enough about it to keep fighting this :-)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing says an implementation CAN'T do it, I just don't know that this
adds much to the spec.

On Thu, May 7, 2015 at 4:13 PM, Jonathan Boulle notifications@github.com
wrote:

In OS-SPEC.md #273 (comment)
:

@@ -7,12 +7,23 @@ This document attempts to define a minimal set of things that must exist for mos

ACIs that define the label os=linux can expect this environment by default.

+## Execution Environment
+
+It is RECOMMENDED that the following environment variables be set for each application's main process and any lifecycle processes:

I was anticipating that there is still a nontrivial amount of software
that does depend on these things and so it would be worth gently nudging
implementers in that direction. But I don't feel strongly enough about it
to keep fighting this :-)


Reply to this email directly or view it on GitHub
https://github.com/appc/spec/pull/273/files#r29905247.

Removes USER/LOGNAME/SHELL/HOME as required environment variables;
this leaves only PATH, AC_APP_NAME and AC_METADATA_URL
@jonboulle
Copy link
Contributor Author

updated

@thockin
Copy link
Contributor

thockin commented May 7, 2015

beautiful

@jonboulle
Copy link
Contributor Author

@thockin you need to use more gifs to express yourself IMO

@thockin
Copy link
Contributor

thockin commented May 7, 2015

beautiful

@jonboulle
Copy link
Contributor Author

very good

jonboulle added a commit that referenced this pull request May 7, 2015
spec: reconsider SHELL/HOME environment variables
@jonboulle jonboulle merged commit 7094a7b into appc:master May 7, 2015
@jonboulle jonboulle deleted the 273 branch May 7, 2015 23:55
uiri added a commit to uiri/appc-spec that referenced this pull request Nov 17, 2016
These environment variables are no longer mandated by the spec per
    appc#273. It makes sense to remove them from the validator.
indradhanush pushed a commit to kinvolk-archives/appc-spec that referenced this pull request Jan 24, 2018
These environment variables are no longer mandated by the spec per
    appc#273. It makes sense to remove them from the validator.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants