I'm trying to find a way to securely store data for the duration of a session - specifically it's for passwords on a jump box - so the user only needs to enter the password for a given target once in their jump-box session. Ideally I'd want to hide the data even from root.
Although I trust the people with root access, I don't necessarily trust all the programs which run as root - e.g. backups which might expose the data.
SELinux won't do - the policies available on RHEL would need a lot of work, it's not portable, and, of course, SELinux sucks.
Encryption won't work - then I need to work out where to store the key.
Running a daemon and putting the data in there / authenticating using socket credential passing, however there is some effort in implementing this, and I would like to be confident that the data was purged at the end of the session (which may not always end cleanly).
Using O_TMPFILE to create an un-named file looks like it solves a lot of problems of populating the data and cleaning up at the end of the session. But how can another process get access to the data? I suppose the answer would be to have the owning process also open a listening socket and handle requests that way - but is there an easier solution?
Should I be rethinking this completely?