Debian Bug report logs - #556644
openssh-server: Patch to make chroot work with selinux

version graph

Package: openssh-server; Maintainer for openssh-server is Debian OpenSSH Maintainers <>; Source for openssh-server is src:openssh.

Reported by: Russell Coker <>

Date: Tue, 17 Nov 2009 11:18:01 UTC

Severity: important

Found in version openssh/1:5.1p1-8

Fixed in version openssh/1:5.2p1-1

Done: Colin Watson <>

Bug is archived. No further changes may be made.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox

Report forwarded to, Debian OpenSSH Maintainers <>:
Bug#556644; Package openssh-server. (Tue, 17 Nov 2009 11:18:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to Russell Coker <>:
New Bug report received and forwarded. Copy sent to Debian OpenSSH Maintainers <>. (Tue, 17 Nov 2009 11:18:04 GMT) Full text and rfc822 format available.

Message #5 received at (full text, mbox):

From: Russell Coker <>
To: Debian Bug Tracking System <>
Subject: openssh-server: Patch to make chroot work with selinux
Date: Tue, 17 Nov 2009 22:01:23 +1100
Package: openssh-server
Version: 1:5.1p1-8
Severity: important

The following patch allows the chroot functionality for sftp (and probably
regular logins) work with SE Linux.  After chroot() is called the SE Linux
context setting won't work unless /selinux and /proc are mounted in the
chroot environment.  Even worse, if the user has control over the chroot
environment then they may be able to control the context that they get (I
haven't verified this).

I have given this severity "important" because being forced to choose between
two alternate security features is a bad thing.  It's also a bad thing to
preclude the possibility of a SE Linux system being used to test a
configuration that will later be deployed on a non-SE system.

diff -ru openssh-5.1p1.orig/session.c openssh-5.1p1/session.c
--- openssh-5.1p1.orig/session.c	2008-06-16 23:29:18.000000000 +1000
+++ openssh-5.1p1/session.c	2009-11-17 21:13:27.000000000 +1100
@@ -1523,6 +1523,10 @@
 # endif /* USE_LIBIAF */
+	ssh_selinux_setup_exec_context(pw->pw_name);
 		if (options.chroot_directory != NULL &&
 		    strcasecmp(options.chroot_directory, "none") != 0) {
                         tmp = tilde_expand_filename(options.chroot_directory,
@@ -1550,10 +1554,6 @@
 	if (getuid() != pw->pw_uid || geteuid() != pw->pw_uid)
 		fatal("Failed to set uids to %u.", (u_int) pw->pw_uid);
-	ssh_selinux_setup_exec_context(pw->pw_name);
 static void

Information forwarded to, Debian OpenSSH Maintainers <>:
Bug#556644; Package openssh-server. (Tue, 17 Nov 2009 11:39:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to
Extra info received and forwarded to list. Copy sent to Debian OpenSSH Maintainers <>. (Tue, 17 Nov 2009 11:39:03 GMT) Full text and rfc822 format available.

Message #10 received at (full text, mbox):

From: Russell Coker <>
Subject: Sorry, that needs more testing
Date: Tue, 17 Nov 2009 22:29:44 +1100
The patch I just sent hides the problem but doesn't fix it properly.  I'll 
send another shortly.

Information forwarded to, Debian OpenSSH Maintainers <>:
Bug#556644; Package openssh-server. (Tue, 17 Nov 2009 12:03:08 GMT) Full text and rfc822 format available.

Acknowledgement sent to
Extra info received and forwarded to list. Copy sent to Debian OpenSSH Maintainers <>. (Tue, 17 Nov 2009 12:03:09 GMT) Full text and rfc822 format available.

Message #15 received at (full text, mbox):

From: Russell Coker <>
Subject: actually the patch is good
Date: Tue, 17 Nov 2009 22:58:53 +1100
I made a mistake in my second round of testing.  The patch is good.

Added tag(s) pending. Request was from Colin Watson <> to (Sat, 02 Jan 2010 00:51:08 GMT) Full text and rfc822 format available.

Reply sent to Colin Watson <>:
You have taken responsibility. (Mon, 04 Jan 2010 15:49:35 GMT) Full text and rfc822 format available.

Notification sent to Russell Coker <>:
Bug acknowledged by developer. (Mon, 04 Jan 2010 15:49:36 GMT) Full text and rfc822 format available.

Message #22 received at (full text, mbox):

From: Colin Watson <>
Subject: Bug#556644: fixed in openssh 1:5.2p1-1
Date: Mon, 04 Jan 2010 15:44:23 +0000
Source: openssh
Source-Version: 1:5.2p1-1

We believe that the bug you reported is fixed in the latest version of
openssh, which is due to be installed in the Debian FTP archive:

  to main/o/openssh/openssh-client-udeb_5.2p1-1_i386.udeb
  to main/o/openssh/openssh-client_5.2p1-1_i386.deb
  to main/o/openssh/openssh-server-udeb_5.2p1-1_i386.udeb
  to main/o/openssh/openssh-server_5.2p1-1_i386.deb
  to main/o/openssh/openssh_5.2p1-1.diff.gz
  to main/o/openssh/openssh_5.2p1-1.dsc
  to main/o/openssh/openssh_5.2p1.orig.tar.gz
  to main/o/openssh/ssh-askpass-gnome_5.2p1-1_i386.deb
  to main/o/openssh/ssh-krb5_5.2p1-1_all.deb
  to main/o/openssh/ssh_5.2p1-1_all.deb

A summary of the changes between this version and the previous one is

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
Colin Watson <> (supplier of updated openssh package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing

Hash: SHA1

Format: 1.8
Date: Mon, 04 Jan 2010 13:23:35 +0000
Source: openssh
Binary: openssh-client openssh-server ssh ssh-krb5 ssh-askpass-gnome openssh-client-udeb openssh-server-udeb
Architecture: source all i386
Version: 1:5.2p1-1
Distribution: unstable
Urgency: low
Maintainer: Debian OpenSSH Maintainers <>
Changed-By: Colin Watson <>
 openssh-client - secure shell (SSH) client, for secure access to remote machines
 openssh-client-udeb - secure shell client for the Debian installer (udeb)
 openssh-server - secure shell (SSH) server, for secure access from remote machines
 openssh-server-udeb - secure shell server for the Debian installer (udeb)
 ssh        - secure shell client and server (metapackage)
 ssh-askpass-gnome - interactive X program to prompt users for a passphrase for ssh-ad
 ssh-krb5   - secure shell client and server (transitional package)
Closes: 154434 415008 420682 496017 498684 505378 506115 507541 512198 513417 514313 524423 530692 536182 540623 555951 556644 561887
 openssh (1:5.2p1-1) unstable; urgency=low
   * New upstream release (closes: #536182). Yes, I know 5.3p1 has been out
     for a while, but there's no GSSAPI patch available for it yet.
     - Change the default cipher order to prefer the AES CTR modes and the
       revised "arcfour256" mode to CBC mode ciphers that are susceptible to
       CPNI-957037 "Plaintext Recovery Attack Against SSH".
     - Add countermeasures to mitigate CPNI-957037-style attacks against the
       SSH protocol's use of CBC-mode ciphers. Upon detection of an invalid
       packet length or Message Authentication Code, ssh/sshd will continue
       reading up to the maximum supported packet length rather than
       immediately terminating the connection. This eliminates most of the
       known differences in behaviour that leaked information about the
       plaintext of injected data which formed the basis of this attack
       (closes: #506115, LP: #379329).
     - ForceCommand directive now accepts commandline arguments for the
       internal-sftp server (closes: #524423, LP: #362511).
     - Add AllowAgentForwarding to available Match keywords list (closes:
     - Make ssh(1) send the correct channel number for
       avoid triggering 'Non-public channel' error messages on sshd(8) in
     - Avoid printing 'Non-public channel' warnings in sshd(8), since the
       ssh(1) has sent incorrect channel numbers since ~2004 (this reverts a
       behaviour introduced in openssh-5.1; closes: #496017).
     - Disable nonfunctional ssh(1) ~C escape handler in multiplex slave
       connections (closes: #507541).
     - Fix "whitepsace" typo in ssh_config(5) (closes: #514313, LP: #303835).
   * Update to GSSAPI patch from,
     including cascading credentials support (LP: #416958).
   * Use x11.pc when compiling/linking gnome-ssh-askpass2 (closes: #555951).
   * Moved to; add Vcs-Bzr and Vcs-Browser control fields.
   * Add debian/README.source with instructions on bzr handling.
   * Make ChrootDirectory work with SELinux (thanks, Russell Coker; closes:
   * Initialise sc to NULL in ssh_selinux_getctxbyname (thanks, Václav Ovsík;
     closes: #498684).
   * Don't duplicate backslashes when displaying server banner (thanks,
     Michał Górny; closes: #505378, LP: #425346).
   * Use hardening-includes for hardening logic (thanks, Kees Cook; closes:
   * Update OpenSSH FAQ to revision 1.110.
   * Remove ssh/new_config, only needed for direct upgrades from potato which
     are no longer particularly feasible anyway (closes: #420682).
   * Cope with insserv reordering of init script links.
   * Remove init script stop link in rc1, as killprocs handles it already.
   * Adjust short descriptions to avoid relying on previous experience with
     rsh, based on suggestions from Reuben Thomas (closes: #512198).
   * Remove manual page references to login.conf, which aren't applicable on
     non-BSD systems (closes: #154434).
   * Remove/adjust manual page references to BSD-specific /etc/rc (closes:
   * Refer to sshd_config(5) rather than sshd(8) in postinst-written
     /etc/ssh/sshd_config, and add UsePAM commentary from upstream-shipped
     configuration file (closes: #415008, although unfortunately this will
     only be conveniently visible on new installations).
   * Include URL to OpenBSD's ssl(8) in ssh(1), since I don't see a better
     source for the same information among Debian's manual pages (closes:
     #530692, LP: #456660).
 dcfd8d5b9f2f28a0c7c5bfbc773cb3d6bbb6e314 1645 openssh_5.2p1-1.dsc
 8273a0237db98179fbdc412207ff8eb14ff3d6de 1016612 openssh_5.2p1.orig.tar.gz
 48c8d2b45c6b55004697ac2d3424b36820914457 231152 openssh_5.2p1-1.diff.gz
 643bf9c4800636ddf25f6dddd1c0cfa4855cbf99 1206 ssh_5.2p1-1_all.deb
 1c2874277d4b2e553c2462604094bc852c18d0a8 72730 ssh-krb5_5.2p1-1_all.deb
 7866ae1fd2763e7b5eb437c39ec4123e2f2daef3 747462 openssh-client_5.2p1-1_i386.deb
 5ea79b9ca3050439a0751c68b90bea1aa928583e 278672 openssh-server_5.2p1-1_i386.deb
 e2e74e87b6243ecdf387d97686539cbed2477f76 80262 ssh-askpass-gnome_5.2p1-1_i386.deb
 99f40e535037814aa7332437666f0ab23686e638 175744 openssh-client-udeb_5.2p1-1_i386.udeb
 cbafe9341bfb14d561941d001936c02adbf76598 197886 openssh-server-udeb_5.2p1-1_i386.udeb
 d7b3aed3402ac67385faf91fe19ad04faaa9902fd5863dcc46c30f4372dabf14 1645 openssh_5.2p1-1.dsc
 4023710c37d0b3d79e6299cb79b6de2a31db7d581fe59e775a5351784034ecae 1016612 openssh_5.2p1.orig.tar.gz
 88878592bc4ed2f2cabc183a9efb2475704f0d7a2bb966c7828229efdf8f6683 231152 openssh_5.2p1-1.diff.gz
 1f303238ddb46e4c94c26984dba47f1932770278896cfd54cd10dcd7401abf2f 1206 ssh_5.2p1-1_all.deb
 16986d0b24d8211a0303de21627351a509ceab186b0857131462b5ed5f0cd378 72730 ssh-krb5_5.2p1-1_all.deb
 b9842297f615f85dd7c2ef01f7eed2ca9f1b374b1972f3d3d152162b92c7e4e3 747462 openssh-client_5.2p1-1_i386.deb
 f8f7e7a29cd05fe6787c2976e48b2e389b7ee12dd9b2d81b3a5170c35664ea4e 278672 openssh-server_5.2p1-1_i386.deb
 cb4f258674ea4a408a9cc33789aa90ce804227e76615efed3c1aeebb2837ec64 80262 ssh-askpass-gnome_5.2p1-1_i386.deb
 46f4acd8ba5b4fb58601e2cc357b4f4a561f07f50be9424f666427a0e186ceb4 175744 openssh-client-udeb_5.2p1-1_i386.udeb
 02ec1defbc6ef4f5068c9c19eb735220837ab79838a6465b0d8550403c20075c 197886 openssh-server-udeb_5.2p1-1_i386.udeb
 bdf4750700a34040c354a58fb3928f87 1645 net standard openssh_5.2p1-1.dsc
 ada79c7328a8551bdf55c95e631e7dad 1016612 net standard openssh_5.2p1.orig.tar.gz
 8b71afc010637d3145bbb60f92d5b471 231152 net standard openssh_5.2p1-1.diff.gz
 c9352daad4b15ca1c5fb46cdaa30eb79 1206 net extra ssh_5.2p1-1_all.deb
 d07b23f2478946bc53b906338dd6d7a5 72730 net extra ssh-krb5_5.2p1-1_all.deb
 0c6bc933f6956693cc88bac78f1b471d 747462 net standard openssh-client_5.2p1-1_i386.deb
 ca68b2ce567a74d8821ab7674e4ed248 278672 net optional openssh-server_5.2p1-1_i386.deb
 dd3e7d6c11ae89f950afdf97453a96a7 80262 gnome optional ssh-askpass-gnome_5.2p1-1_i386.deb
 6645f49bdcb0a5d71a74a69dca72393f 175744 debian-installer optional openssh-client-udeb_5.2p1-1_i386.udeb
 334c4f56384deabe748e545d5c244e78 197886 debian-installer optional openssh-server-udeb_5.2p1-1_i386.udeb
Package-Type: udeb

Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Colin Watson <> -- Debian developer


Bug archived. Request was from Debbugs Internal Request <> to (Fri, 12 Feb 2010 07:34:08 GMT) Full text and rfc822 format available.

Send a report that this bug log contains spam.

Debian bug tracking system administrator <>. Last modified: Sat Apr 19 12:21:25 2014; Machine Name:

Debian Bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.