[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#619760: openssh-server: sshd should honour TMPDIR to set up auth_sock_dir (forwarding)



Package: openssh-server
Version: 1:5.8p1-3c
Severity: wishlist
Tags: patch


Hello,

sshd should honour TMPDIR when forwarding:
when PAM is allowed, it can be done by using a pacakge as pam-tmpdir
as shown in the patch.

hth,
Jerome


-- System Information:
Debian Release: Squeeze*
  APT prefers stable
  APT policy: (990, 'stable'), (500, 'squeeze-updates')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.35-rc5-amd64-mm (SMP w/2 CPU cores)
Locale: LANG=en_GB, LC_CTYPE=en_GB (charmap=ISO-8859-1)
Shell: /bin/sh linked to /bin/dash

Versions of packages openssh-server depends on:
ii  adduser                 3.112+nmu2       add and remove users and groups
ii  debconf [debconf-2.0]   1.5.36.1         Debian configuration management sy
ii  dpkg                    1.15.8.10        Debian package management system
ii  libc6                   2.11.2-10        Embedded GNU C Library: Shared lib
ii  libcomerr2              1.41.12-2        common error description library
ii  libgssapi-krb5-2        1.8.3+dfsg-4     MIT Kerberos runtime libraries - k
ii  libkrb5-3               1.8.3+dfsg-4     MIT Kerberos runtime libraries
ii  libpam-modules          1.1.1-6.1        Pluggable Authentication Modules f
ii  libpam-runtime          1.1.1-6.1        Runtime support for the PAM librar
ii  libpam0g                1.1.1-6.1        Pluggable Authentication Modules l
ii  libselinux1             2.0.96-1         SELinux runtime shared libraries
ii  libssl0.9.8             0.9.8o-4squeeze1 SSL shared libraries
ii  libwrap0                7.6.q-19         Wietse Venema's TCP wrappers libra
ii  lsb-base                3.2-23.2squeeze1 Linux Standard Base 3.2 init scrip
ii  openssh-blacklist       0.4.1            list of default blacklisted OpenSS
ii  openssh-client          1:5.8p1-3c       secure shell (SSH) client, for sec
ii  procps                  1:3.2.8-9        /proc file system utilities
ii  zlib1g                  1:1.2.3.4.dfsg-3 compression library - runtime

Versions of packages openssh-server recommends:
ii  openssh-blacklist-extra       0.4.1      list of non-default blacklisted Op
ii  xauth                         1:1.0.4-1  X authentication utility

Versions of packages openssh-server suggests:
pn  molly-guard                   <none>     (no description available)
pn  rssh                          <none>     (no description available)
pn  ssh-askpass                   <none>     (no description available)
pn  ufw                           <none>     (no description available)

-- debconf information excluded
diff -ruN openssh-5.8p1-original/auth-pam.c openssh-5.8p1-jgmb.0.1/auth-pam.c
--- openssh-5.8p1-original/auth-pam.c	2009-07-12 14:07:21.000000000 +0200
+++ openssh-5.8p1-jgmb.0.1/auth-pam.c	2011-03-26 18:31:36.000000000 +0100
@@ -1087,6 +1087,12 @@
 	return (ret);
 }
 
+const char *
+getenv_pam_environment(const char *name)
+{
+	return (pam_getenv(sshpam_handle, name));
+}
+
 char **
 fetch_pam_child_environment(void)
 {
diff -ruN openssh-5.8p1-original/auth-pam.h openssh-5.8p1-jgmb.0.1/auth-pam.h
--- openssh-5.8p1-original/auth-pam.h	2004-09-11 14:17:26.000000000 +0200
+++ openssh-5.8p1-jgmb.0.1/auth-pam.h	2011-03-26 18:30:00.000000000 +0100
@@ -39,6 +39,7 @@
 void do_pam_setcred(int );
 void do_pam_chauthtok(void);
 int do_pam_putenv(char *, char *);
+const char * getenv_pam_environment(const char *);
 char ** fetch_pam_environment(void);
 char ** fetch_pam_child_environment(void);
 void free_pam_environment(char **);
diff -ruN openssh-5.8p1-original/session.c openssh-5.8p1-jgmb.0.1/session.c
--- openssh-5.8p1-original/session.c	2010-12-01 02:02:59.000000000 +0100
+++ openssh-5.8p1-jgmb.0.1/session.c	2011-03-26 17:48:54.000000000 +0100
@@ -175,6 +175,9 @@
 static int
 auth_input_request_forwarding(struct passwd * pw)
 {
+#ifdef USE_PAM
+	char *tmpdir = NULL;
+#endif /* USE_PAM */
 	Channel *nc;
 	int sock = -1;
 	struct sockaddr_un sunaddr;
@@ -187,8 +190,20 @@
 	/* Temporarily drop privileged uid for mkdir/bind. */
 	temporarily_use_uid(pw);
 
+#ifdef USE_PAM
+	if (options.use_pam) {
+		tmpdir=getenv_pam_environment("TMPDIR");
+		}
+#endif /* USE_PAM */
+
 	/* Allocate a buffer for the socket name, and format the name. */
-	auth_sock_dir = xstrdup("/tmp/ssh-XXXXXXXXXX");
+#ifdef USE_PAM
+	if (tmpdir != NULL) {
+		xasprintf(&auth_sock_dir, "%s/ssh-XXXXXXXXXXXX", tmpdir);
+		}
+	else
+#endif /* USE_PAM */
+		auth_sock_dir = xstrdup("/tmp/ssh-XXXXXXXXXXXX");
 
 	/* Create private directory for socket */
 	if (mkdtemp(auth_sock_dir) == NULL) {

Reply to: