]> git.pld-linux.org Git - packages/openssh.git/blobdiff - openssh-chroot.patch
do not repeat default config values for ssh client
[packages/openssh.git] / openssh-chroot.patch
index 60cb12cfa08d4dc9e98ee740dc5753a2b93cf27e..828de68ec749b3fb9fe88b749b73ce373a44d47b 100644 (file)
@@ -1,6 +1,6 @@
---- openssh-3.7.1p2/servconf.c 2003-09-23 11:24:21.000000000 +0200
-+++ openssh-3.7.1p2.pius/servconf.c    2003-10-07 20:49:08.000000000 +0200
-@@ -41,7 +41,9 @@
+--- openssh-4.4p1/servconf.c.orig      2006-08-18 16:23:15.000000000 +0200
++++ openssh-4.4p1/servconf.c   2006-10-05 10:11:17.065971000 +0200
+@@ -56,7 +56,9 @@
  
        /* Portable-specific options */
        options->use_pam = -1;
@@ -11,7 +11,7 @@
        /* Standard Options */
        options->num_ports = 0;
        options->ports_from_cmdline = 0;
-@@ -112,6 +114,9 @@
+@@ -131,6 +133,9 @@
        if (options->use_pam == -1)
                options->use_pam = 0;
  
@@ -21,7 +21,7 @@
        /* Standard Options */
        if (options->protocol == SSH_PROTO_UNKNOWN)
                options->protocol = SSH_PROTO_1|SSH_PROTO_2;
-@@ -245,6 +250,7 @@
+@@ -270,6 +275,7 @@
        sBadOption,             /* == unknown option */
        /* Portable-specific options */
        sUsePAM,
        /* Standard Options */
        sPort, sHostKeyFile, sServerKeyBits, sLoginGraceTime, sKeyRegenerationTime,
        sPermitRootLogin, sLogFacility, sLogLevel,
-@@ -278,6 +284,11 @@
+@@ -312,6 +318,11 @@
  #else
-       { "usepam", sUnsupported },
+       { "usepam", sUnsupported, SSHCFG_GLOBAL },
  #endif
 +#ifdef CHROOT
-+      { "usechroot", sUseChroot },
++      { "usechroot", sUseChroot, SSHCFG_GLOBAL },
 +#else
-+      { "usechroot", sUnsupported },
++      { "usechroot", sUnsupported, SSHCFG_GLOBAL },
 +#endif /* CHROOT */
-       { "pamauthenticationviakbdint", sDeprecated },
+       { "pamauthenticationviakbdint", sDeprecated, SSHCFG_GLOBAL },
        /* Standard Options */
-       { "port", sPort },
-@@ -437,6 +448,10 @@
+       { "port", sPort, SSHCFG_GLOBAL },
+@@ -662,6 +673,10 @@
                intptr = &options->use_pam;
                goto parse_flag;
  
        int     use_dns;
        int     client_alive_interval;  /*
                                         * poke the client this often to
---- openssh-3.7.1p2/session.c  2003-09-23 10:59:08.000000000 +0200
-+++ openssh-3.7.1p2.pius/session.c     2003-10-07 20:49:08.000000000 +0200
-@@ -1231,6 +1231,10 @@
- void
+--- openssh-7.2p1/session.c.orig       2016-03-05 10:24:44.227756638 +0100
++++ openssh-7.2p1/session.c    2016-03-05 10:24:50.237756386 +0100
+@@ -1492,6 +1492,10 @@ do_setusercontext(struct passwd *pw)
  do_setusercontext(struct passwd *pw)
  {
+       char *chroot_path, *tmp;
 +#ifdef CHROOT
 +      char *user_dir;
 +      char *new_root;
 +#endif /* CHROOT */
- #ifndef HAVE_CYGWIN
-       if (getuid() == 0 || geteuid() == 0)
- #endif /* HAVE_CYGWIN */
-@@ -1268,6 +1272,28 @@
-                       exit(1);
-               }
-               endgrent();
-+
+       platform_setusercontext(pw);
+@@ -1532,6 +1536,29 @@ do_setusercontext(struct passwd *pw)
+                       free(options.chroot_directory);
+                       options.chroot_directory = NULL;
+                       in_chroot = 1;
 +#ifdef CHROOT
-+              if (options.use_chroot) {
++              } else if (!in_chroot && options.use_chroot) {
 +                      user_dir = xstrdup(pw->pw_dir);
 +                      new_root = user_dir + 1;
 +
-+                      while((new_root = strchr(new_root, '.')) != NULL) {
++                      while ((new_root = strchr(new_root, '.')) != NULL) {
 +                              new_root--;
-+                              if(strncmp(new_root, "/./", 3) == 0) {
++                              if (strncmp(new_root, "/./", 3) == 0) {
 +                                      *new_root = '\0';
 +                                      new_root += 2;
 +
-+                                      if(chroot(user_dir) != 0)
++                                      if (chroot(user_dir) != 0)
 +                                              fatal("Couldn't chroot to user directory %s", user_dir);
-+                                              pw->pw_dir = new_root;
-+                                              break;
-+                                      }
-+                                      new_root += 2;
++                                      /* NOTE: session->pw comes from pwcopy(), so replace pw_dir this way (incompatible with plain getpwnam() or getpwnam_r()) */
++                                      free(pw->pw_dir);
++                                      pw->pw_dir = xstrdup(new_root);
++                                      in_chroot = 1;
++                                      break;
++                              }
++                              new_root += 2;
 +                      }
-+              }
++                      free(user_dir);
 +#endif /* CHROOT */
-+
- # ifdef USE_PAM
-               /*
-                * PAM credentials may take the form of supplementary groups. 
+               }
+ #ifdef HAVE_LOGIN_CAP
 --- openssh-3.7.1p2/sshd_config        2003-09-02 14:51:18.000000000 +0200
 +++ openssh-3.7.1p2.pius/sshd_config   2003-10-07 20:49:08.000000000 +0200
-@@ -71,6 +71,10 @@
- # bypass the setting of 'PasswordAuthentication'
#UsePAM yes
+@@ -91,6 +91,10 @@
+ # and ChallengeResponseAuthentication to 'no'.
+ UsePAM yes
  
 +# Set this to 'yes' to enable support for chrooted user environment.
-+# You must create such environment before you can use this feature. 
++# You must create such environment before you can use this feature.
 +#UseChroot yes
 +
- #AllowTcpForwarding yes
- #GatewayPorts no
- #X11Forwarding no
---- openssh-3.7.1p2/sshd_config.0      2003-09-23 11:55:19.000000000 +0200
-+++ openssh-3.7.1p2.pius/sshd_config.0 2003-10-07 20:49:08.000000000 +0200
-@@ -349,6 +349,16 @@
-              CAL1, LOCAL2, LOCAL3, LOCAL4, LOCAL5, LOCAL6, LOCAL7.  The de-
-              fault is AUTH.
+ #AllowAgentForwarding yes
+ # Security advisory:
+ # http://securitytracker.com/alerts/2004/Sep/1011143.html
+--- openssh-4.4p1/sshd_config.0.orig   2006-09-26 13:03:48.000000000 +0200
++++ openssh-4.4p1/sshd_config.0        2006-10-05 10:11:41.615971000 +0200
+@@ -921,6 +921,16 @@ DESCRIPTION
+              TrustedUserCAKeys.  For more details on certificates, see the
+              CERTIFICATES section in ssh-keygen(1).
  
 +     UseChroot
 +             Specifies whether to use chroot-jail environment with ssh/sftp,
 +             For this to work properly you have to create special chroot-jail
 +             environment in a /path/to/chroot directory.
 +
-      UseDNS  Specifies whether sshd should lookup the remote host name and
-              check that the resolved host name for the remote IP address maps
-              back to the very same IP address.  The default is ``yes''.
+      UseDNS  Specifies whether sshd(8) should look up the remote host name,
+              and to check that the resolved host name for the remote IP
+              address maps back to the very same IP address.
 --- openssh-3.8p1/sshd_config.5.orig   2004-02-18 04:31:24.000000000 +0100
 +++ openssh-3.8p1/sshd_config.5        2004-02-25 21:17:23.000000000 +0100
 @@ -552,6 +552,16 @@
This page took 0.067007 seconds and 4 git commands to generate.