I’m running a service on my raspberry PI that is not allowed to be “root”, so in my docker file I create a local user “acme”, group “acme”, and with systemctl it gets started up correctly with the correct permissions and ownership.
As the acme user, I want to get access to my device’s uuid so that I can use it to to uniquely identify my device when connecting to api services etc etc. However, the problem is that the local user doesn’t get access to the environment variables created within the resin system. The root account is fine:
[root shell] export |grep RESIN
declare -x RESIN="1"
declare -x RESIN_API_KEY="aaaabbbbccccdddd"
declare -x RESIN_APP_ID="12345"
declare -x RESIN_APP_NAME="MyCoolApplication"
declare -x RESIN_APP_RELEASE="asd65utausdtfuatsdfaudst3"
declare -x RESIN_DEVICE_NAME_AT_INIT="my-device-name"
declare -x RESIN_DEVICE_TYPE="raspberrypi3"
declare -x RESIN_DEVICE_UUID="cd30b2b12c29dffee398ef4a21c74f6c"
declare -x RESIN_HOST_OS_VERSION="Resin OS 2.7.8+rev1"
declare -x RESIN_SUPERVISOR_ADDRESS="http://127.0.0.1:48484"
declare -x RESIN_SUPERVISOR_API_KEY="e273f0e426a54b87d19d8a43cbe4398adeff55gga5ddcf905edd0a197b"
declare -x RESIN_SUPERVISOR_HOST="127.0.0.1"
declare -x RESIN_SUPERVISOR_PORT="48484"
declare -x RESIN_SUPERVISOR_VERSION=“6.4.2”
But not in my newly created account “acme”:
[local shell] export |grep RESIN
If I had access to the device UUID in the Dockerfile.template, I could easy ensure that the value gets injected into the acme’s .profile or .bashrc acc, but it looks like resin doesn’t support that yet?
Am I missing something? Is there an easy way in which I can get this value? Or any environment value from a non root account?
The environment vars for root are stored in /proc/1/environ, but the security is tight (Which is as it should be):
-r-------- 1 root root 0 Feb 15 10:53 /proc/1/environ
So my local user cannot get access.
Anyone have any ideas?