Bug 2584 - make ssh-agent and sftp-server untraceable on Solaris
Summary: make ssh-agent and sftp-server untraceable on Solaris
Status: CLOSED FIXED
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: ssh-agent (show other bugs)
Version: 7.2p1
Hardware: SPARC Solaris
: P5 enhancement
Assignee: Darren Tucker
URL:
Keywords:
Depends on:
Blocks: V_7_3
  Show dependency treegraph
 
Reported: 2016-06-09 08:27 AEST by huieying.lee
Modified: 2016-08-02 10:40 AEST (History)
2 users (show)

See Also:


Attachments
to make ssh-agent and sftp-server untraceable on Solaris (2.57 KB, patch)
2016-06-09 08:27 AEST, huieying.lee
no flags Details | Diff
Move prtctl into platform.c then add setpflags (4.10 KB, patch)
2016-06-09 16:33 AEST, Darren Tucker
djm: ok+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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