<div dir="ltr"><font face="arial, helvetica, sans-serif">Google "twelve-factor app". Excerpt from a random article on <a href="http://medium.com">medium.com</a>:</font><div><font face="arial, helvetica, sans-serif">"... <span style="color:rgba(0,0,0,0.84);letter-spacing:-0.003em">most frameworks support the use of System Environment variables inside configuration files. For instance, in the Spring Boot yaml file you can write:</span></font></div><div><span style="color:rgba(0,0,0,0.84);letter-spacing:-0.003em"><font face="arial, helvetica, sans-serif">Security.oauth2.client.clientSecret: ${CL_SERVICE_PASSWORD}"</font></span></div><p name="74a7" id="gmail-74a7" class="gmail-graf gmail-graf--p gmail-graf-after--p" style="margin:29px 0px 0px;line-height:1.58"><font face="arial, helvetica, sans-serif" style="" color="#000000"><span style="letter-spacing:-0.003em">You're correct that's not a Unix security standard, and I couldn't find one - it's just a fairly common practice because environment variables are easy to use. Other systems engineers that I work with also rely on their environment being private from other users on large, multi-user research computing systems like the ones we manage. It's also a reasonable expectation that an unprivileged process can't </span><span style="letter-spacing:-0.039px">trivially</span><span style="letter-spacing:-0.003em"> obtain the contents of a 0600:root:root file under /etc, or that a user-level exploit of an unrelated service could also trivially obtain that data.</span></font><span style="color:rgb(36,41,46);letter-spacing:normal;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol""></span></p><p name="74a7" id="gmail-74a7" class="gmail-graf gmail-graf--p gmail-graf-after--p" style="margin:29px 0px 0px;line-height:1.58">I'll just go ahead and concede that I'm wrong, and that GOPHER_SLACK_TOKEN and HUBOT_SLACK_TOKEN shouldn't be in an env var, and that my co-workers are also wrong to store a particular password in their environment. Regardless, that doesn't make it OK for systemd to hand out the contents of of that file or make service environment vars available to unprivileged users. You can think I'm a stubborn damned ignoramus if you like - but I'd be surprised if you think I'm the <i>only</i> damned ignoramus who thinks that environment data should be private to the process owner and root. I'm just one of the few who happened to notice the warning in the logs and investigated it.</p><p name="74a7" id="gmail-74a7" class="gmail-graf gmail-graf--p gmail-graf-after--p" style="margin:29px 0px 0px;line-height:1.58">I think the real point here is the information disclosure vulnerability. I'm going to suggest to my team that we consider making /run/dbus/system_bus_socket 440 or 400 - no reason for these non-privileged users to have access to that, anyway.</p><p name="74a7" id="gmail-74a7" class="gmail-graf gmail-graf--p gmail-graf-after--p" style="margin:29px 0px 0px;line-height:1.58">Thanks for giving this some thought.</p><p name="74a7" id="gmail-74a7" class="gmail-graf gmail-graf--p gmail-graf-after--p" style="margin:29px 0px 0px;line-height:1.58">Regards,</p><p name="74a7" id="gmail-74a7" class="gmail-graf gmail-graf--p gmail-graf-after--p" style="margin:29px 0px 0px;line-height:1.58">-David</p><p name="74a7" id="gmail-74a7" class="gmail-graf gmail-graf--p gmail-graf-after--p" style="margin:29px 0px 0px;line-height:1.58"><br></p></div><br><div class="gmail_quote"><div dir="ltr">On Tue, Nov 13, 2018 at 9:17 AM Lennart Poettering <<a href="mailto:lennart@poettering.net">lennart@poettering.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Di, 13.11.18 07:49, David Parsley (<a href="mailto:parsley@linuxjedi.org" target="_blank">parsley@linuxjedi.org</a>) wrote:<br>
<br>
> I disagree; privacy of environment variables to individual users on the<br>
> system is as fundamental as Unix file permissions. If a privileged process<br>
> (systemd) is configured to start a service and provide environment<br>
> variables to an unprivileged service account, it is a reasonable<br>
> expectation that said environment is only available to root and the service<br>
> account (and it's child processes), and not other arbitrary<br>
> users/processes. From a system security engineering perspective, it would<br>
> be better if systemd didn't start a service at all with 0600 on the unit<br>
> file, rather than violate the principle of Unix environment privacy, and in<br>
> fact should actually just check the world-read bit.<br>
<br>
Well, you are of course welcome to ignore whatever I say, but again,<br>
environment blocks are leaky, they propagate down the process tree,<br>
and are *not* generally understood as being secret.<br>
<br>
You appear dead set on using env vars for this. It's a very bad choice<br>
however, it's a pity you ignore comments that don't fit in your view<br>
of the world though.<br>
<br>
Note that even docker got this right, and their "docker secrets"<br>
feature, stores them in a file, not in an env var:<br>
<br>
<a href="https://docs.docker.com/engine/swarm/secrets/#how-docker-manages-secrets" rel="noreferrer" target="_blank">https://docs.docker.com/engine/swarm/secrets/#how-docker-manages-secrets</a><br>
<br>
I mean, there's a lot to complain in what Docker does, but the way it<br>
looks, at least that they did get right...<br>
<br>
> Thanks aleivag; "systemctl show" was what I was looking for; unprivileged,<br>
> I was able to see the "Environment=" values, but not the contents of<br>
> /etc/gopherbot.env. I'm going to go ahead and update the Ansible role to<br>
> operate that way.<br>
<br>
Urks. I really don't hope this catches on. You are doing it wrong.<br>
<br>
Lennart<br>
<br>
-- <br>
Lennart Poettering, Red Hat<br>
</blockquote></div>