Bugzilla – Attachment 2827 Details for
Bug 2584
make ssh-agent and sftp-server untraceable on Solaris
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
to make ssh-agent and sftp-server untraceable on Solaris
protect_agent_sftpserver_for_solaris.patch (text/plain), 2.57 KB, created by
huieying.lee
on 2016-06-09 08:27:11 AEST
(
hide
)
Description:
to make ssh-agent and sftp-server untraceable on Solaris
Filename:
MIME Type:
Creator:
huieying.lee
Created:
2016-06-09 08:27:11 AEST
Size:
2.57 KB
patch
obsolete
># ># This patch is to make ssh-agent and sftp-server untraceable on Solaris ># without using the sgid bit. The OpenSSH upstream contains code for ># Linux to disable ptrace on these two programs. This patch provides the ># equivalent Solaris implementation. ># >--- orig/config.h.in Wed Jun 8 13:59:46 2016 >+++ new/config.h.in Wed Jun 8 14:11:52 2016 >@@ -962,6 +962,9 @@ > /* Define to 1 if you have the `setpcred' function. */ > #undef HAVE_SETPCRED > >+/* Define to 1 if you have the `setpflags' function. */ >+#undef HAVE_SETPFLAGS >+ > /* Define to 1 if you have the `setppriv' function. */ > #undef HAVE_SETPPRIV > >--- orig/configure.ac Wed Jun 8 13:59:47 2016 >+++ new/configure.ac Wed Jun 8 14:11:52 2016 >@@ -899,6 +899,8 @@ > else > AC_MSG_RESULT([no]) > fi >+ >+ AC_CHECK_FUNCS([setpflags]) > AC_CHECK_FUNCS([setppriv]) > AC_CHECK_FUNCS([priv_basicset]) > AC_CHECK_HEADERS([priv.h]) >--- orig/sftp-server.c Wed Jun 8 13:59:47 2016 >+++ new/sftp-server.c Wed Jun 8 14:11:52 2016 >@@ -32,6 +32,9 @@ > #ifdef HAVE_SYS_PRCTL_H > #include <sys/prctl.h> > #endif >+#ifdef HAVE_PRIV_H >+#include <priv.h> /* For setpflags() and __PROC_PROTECT */ >+#endif > > #include <dirent.h> > #include <errno.h> >@@ -1588,6 +1591,11 @@ > > log_init(__progname, log_level, log_facility, log_stderr); > >+#if defined(HAVE_SETPFLAGS) && defined(__PROC_PROTECT) >+ /* On Solaris, we should make this process untraceable */ >+ if (setpflags(__PROC_PROTECT, 1) != 0) >+ fatal("unable to make the process untraceable"); >+#else > #if defined(HAVE_PRCTL) && defined(PR_SET_DUMPABLE) > /* > * On Linux, we should try to avoid making /proc/self/{mem,maps} >@@ -1598,6 +1606,7 @@ > if (prctl(PR_SET_DUMPABLE, 0) != 0) > fatal("unable to make the process undumpable"); > #endif /* defined(HAVE_PRCTL) && defined(PR_SET_DUMPABLE) */ >+#endif > > /* Drop any fine-grained privileges we don't need */ > platform_pledge_sftp_server(); >--- orig/ssh-agent.c Wed Jun 8 14:11:17 2016 >+++ new/ssh-agent.c Wed Jun 8 14:47:07 2016 >@@ -92,6 +92,10 @@ > #include <sys/prctl.h> /* For prctl() and PR_SET_DUMPABLE */ > #endif > >+#if defined(HAVE_PRIV_H) >+#include <priv.h> /* For setpflags() and __PROC_PROTECT */ >+#endif >+ > typedef enum { > AUTH_UNUSED, > AUTH_SOCKET, >@@ -1208,10 +1212,16 @@ > setegid(getgid()); > setgid(getgid()); > >+#if defined(HAVE_SETPFLAGS) && defined(__PROC_PROTECT) >+ /* make it untraceable on Solaris */ >+ (void) setpflags(__PROC_PROTECT, 1); >+ >+#else > #if defined(HAVE_PRCTL) && defined(PR_SET_DUMPABLE) > /* Disable ptrace on Linux without sgid bit */ > prctl(PR_SET_DUMPABLE, 0); > #endif >+#endif > > #ifdef WITH_OPENSSL > OpenSSL_add_all_algorithms();
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 2584
:
2827
|
2828