Bug 2584

Summary: make ssh-agent and sftp-server untraceable on Solaris
Product: Portable OpenSSH Reporter: huieying.lee
Component: ssh-agentAssignee: Darren Tucker <dtucker>
Status: CLOSED FIXED    
Severity: enhancement CC: djm, dtucker
Priority: P5    
Version: 7.2p1   
Hardware: SPARC   
OS: Solaris   
Bug Depends on:    
Bug Blocks: 2543    
Attachments:
Description Flags
to make ssh-agent and sftp-server untraceable on Solaris
none
Move prtctl into platform.c then add setpflags djm: ok+

Description huieying.lee 2016-06-09 08:27:11 AEST
Created attachment 2827 [details]
to make ssh-agent and sftp-server untraceable on Solaris

For Linux,  to prevent ptrace on ssh-agent and sftp-server, ssh-agent.c and sftp-server.c call prctl(PR_SET_DUMPABLE, 0). 

For Solaris, the equivalent implementation would be:
   setpflags(__PROC_PROTECT, 1); 

Attached is the patch to make ssh-agent and sftp-server untraceable on Solaris without using the sgid bit.   We would like to contribute this patch to upstream, so that our code will be more in-sync with upstream version.
Comment 1 Darren Tucker 2016-06-09 10:27:46 AEST
I'm ok with doing this however I think the code should be factored out of the mainline code and moved somewhere like platform.c.
Comment 2 Darren Tucker 2016-06-09 16:33:53 AEST
Created attachment 2828 [details]
Move prtctl into platform.c then add setpflags

Could you please confirm that this works?

Once we're happy with it I'll commit it as 2 parts (the move of existing and the addition of the new).

Thanks.
Comment 3 Damien Miller 2016-06-09 17:44:26 AEST
Comment on attachment 2828 [details]
Move prtctl into platform.c then add setpflags

Thanks - I was going to suggest refactoring it this way :)
Comment 4 Darren Tucker 2016-06-14 10:53:23 AEST
Applied, thanks.  Please let us know if any further changes are required.

https://anongit.mindrot.org/openssh.git/commit/?id=a86ec4d0737ac5879223e7cd9d68c448df46e169
Comment 5 huieying.lee 2016-06-14 12:58:48 AEST
That's all we need for this.  Thank you very much for taking this in.
Comment 6 Damien Miller 2016-08-02 10:40:47 AEST
Close all resolved bugs after 7.3p1 release