dyne / sup

a "small is beautiful" tool for UNIX privilege escalation
https://sup.dyne.org
GNU Lesser General Public License v3.0
58 stars 12 forks source link

environment variables #2

Open LucidOne opened 6 years ago

LucidOne commented 6 years ago

I really like sup's minimalism but my use case requires keeping some of the environment variables.

https://serverfault.com/questions/107187/ssh-agent-forwarding-and-sudo-to-another-user#118932

Many of the container and VM build tools unfortunately require being run as root. In addition to being able to use the ssh keys to perform a git clone inside a container, env_keep can be used with pass to store passwords used for building qemu images instead of hard coding them in the preseed.cfg or worse.

jaromil commented 6 years ago

hi LucidOne, Your advice makes sense to me. And BTW we are splitting sup into two versions: one very minimal abiding to the "suckless" principles (a recent fork by @parazyd) and this one which has a bit more "bloat" inside. So would that be ok for your use-case (which seems pretty common to me anyway) if we have an env_keep field in the header and the environment variables named in it are kept? If yes, I'm open for the implementation. Not sure when I can dedicate time to it, but would certainly welcome a PR.

LucidOne commented 6 years ago

If it makes things easier, I think I only need to be able to env_keep one variable. I'm using env_keep+="VM_PASSWORD" to build VMs and env_keep+=SSH_AUTH_SOCK on a VM to build containers.

I'm not sure I have much time either but I'll see what I can do.

jaromil commented 5 years ago

Oh I see I've repeated myself in #3 while procrastinating this (as I haven't had the need for it really). I guess you solved it by now?