#!/usr/bin/python3 """envrun.py — read NAME=base64value lines from stdin until an empty line, put them in the environment, exec argv. Lets DooPlex hand a secret to a command in the browser LXC without it ever touching a command line.""" import base64, os, sys env = dict(os.environ) for line in sys.stdin: line = line.rstrip("\n") if not line: break k, v = line.split("=", 1) env[k] = base64.b64decode(v).decode() os.execvpe(sys.argv[1], sys.argv[1:], env)