A python program P running on server S1, listening port 8443.
Some other services can send id_isa, ip pair to P. P could use this pair and make a ssh connection to the ip (create a ssh process).
How to make protect the id_rsa file even the machine S1 is cracked ? How to let root user can't get the id_rsa content (It seems ssh can use -i keyfile only)?
The main problem is P must save the id_rsa file to the disk,so that ssh can use it to conect to the ip.
Why don't you just add an ssh-daemon on Port 8443 and use ssh-Agent forwarding?
That way the private key never gets written down on P and you don't have to write and maintain your own program.
how to design this security demands?