From dkg-openssh.com at fifthhorseman.net Tue Apr 1 04:02:11 2008 From: dkg-openssh.com at fifthhorseman.net (Daniel Kahn Gillmor) Date: Mon, 31 Mar 2008 13:02:11 -0400 Subject: suggested minor improvement to ssh argument parsing In-Reply-To: (John Vincent's message of "Mon\, 31 Mar 2008 12\:41\:11 +0000") References: Message-ID: <87hcemu8rw.fsf@squeak.fifthhorseman.net> A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 826 bytes Desc: not available Url : http://lists.mindrot.org/pipermail/openssh-unix-dev/attachments/20080331/0621a442/attachment.bin From mattias.fransson at ucs.se Tue Apr 1 22:20:47 2008 From: mattias.fransson at ucs.se (Mattias Fransson) Date: Tue, 1 Apr 2008 13:20:47 +0200 Subject: Frequent "Connection reset by peer" Message-ID: <94AA0EFEABD16942931B7481CEEBB443390D43AB8A@ucsex03.ucs.se> I have the very same problem, but in a quite different environment. I have three machines, all using ubuntu, but different versions. One of the machines is supposed to be a common storage for the other two to copy data to as some sort of backup. One of the machines can connect to the "backup machine" just fine, but the other can't, receiving the exact error described in this thread. To be more specific, both the machines can connect, but one of them loses connection in everything between 0-120 seconds. Switching on verbose on the troubling machine I also get the: "debug1: channel 0: free: client-session, nchannels 1 debug3: channel 0: status: The following connections are open: #0 client-session (t4 r0 i0/0 o0/0 fd 4/5 cfd -1) debug3: channel 0: close_fds r 4 w 5 e 6 c -1 Read from remote host ucsbackup03: Connection reset by peer Connection to ucsbackup03 closed. debug1: Transferred: stdin 0, stdout 0, stderr 96 bytes in 5329.1 seconds debug1: Bytes per second: stdin 0.0, stdout 0.0, stderr 0.0 debug1: Exit status -1" And regarding the cabling, both the "client machines" are connected to the same virtual switch (they are virtual machines), so the cabling between the clients and the server is exactly the same, yet one work and one fail. Sincerely, Mattias From rapier at psc.edu Wed Apr 2 05:45:06 2008 From: rapier at psc.edu (rapier) Date: Tue, 01 Apr 2008 14:45:06 -0400 Subject: HPN-SSH for OpenSSH 4.9 Available Message-ID: <47F282B2.7040704@psc.edu> HPN-SSH is a set of high performance patches which add dynamic window sizing, none cipher switching, enhanced server logging, and a multi-threaded cipher implementation to OpenSSH. We've just updated the patches to the OpenSSH 4.9 release and made them available from http://www.psc.edu/networking/projects/hpn-ssh/ Comments, questions, and criticisms are always welcome. Thanks for your time, Chris Rapier Pittsburgh Supercomputing Center From hmouhammed at gmail.com Wed Apr 2 07:33:13 2008 From: hmouhammed at gmail.com (Hayder Mouhammed) Date: Tue, 1 Apr 2008 15:33:13 -0500 Subject: OpenSSH_4.7p1, reverse shell Message-ID: <186efa540804011333k33d930eby527a6e0adf6a66ff@mail.gmail.com> Greetings, I am using OpenSSH 4.7 and trying to use a middle machine to do reverse shell. The error I run into is the destination says getsockopt TCP_NODELAY: Connection reset by peer. The setup: 3 machines (we can call them A,B,C) with QNX Neutrino I would like machine C to be the destination. So we have A can talk to B, and B can talk to C, but A can not talk to C directly. What I am trying: On C: ssh -N -R 10000:localhost:22 root at machineB On B: running sshd On A: ssh root at machineB -p 10000 >From my understanding when A connect to B it will forward all to port 10000 which has access to port 22 on C. When I run the "On A" command I receive the error "getsockopt TCP_NODELAY: Connection reset by peer" on machine C and "ssh_exchange_identification: Connection closed by remote host" from machine A. I can SSH on A to B without using the -p just fine. My sshd_config is below: Many thanks for any suggestions you may have. --H #Port 22 #Protocol 2,1 #ListenAddress 0.0.0.0 #ListenAddress :: # HostKey for protocol version 1 HostKey /etc/openssh/ssh_host_key # HostKeys for protocol version 2 HostKey /etc/openssh/ssh_host_rsa_key HostKey /etc/openssh/ssh_host_dsa_key # Lifetime and size of ephemeral version 1 server key #KeyRegenerationInterval 1h #ServerKeyBits 768 # Logging #obsoletes QuietMode and FascistLogging #SyslogFacility AUTH #LogLevel INFO # Authentication: #LoginGraceTime 2m #PermitRootLogin yes #StrictModes yes RSAAuthentication yes PubkeyAuthentication yes AuthorizedKeysFile /root/.ssh/authorized_keys2 # For this to work you will also need host keys in /etc/openssh/ssh_known_hosts #RhostsRSAAuthentication no # similar for protocol version 2 #HostbasedAuthentication no # Change to yes if you don't trust ~/.ssh/known_hosts for # RhostsRSAAuthentication and HostbasedAuthentication #IgnoreUserKnownHosts no # Don't read the user's ~/.rhosts and ~/.shosts files #IgnoreRhosts yes # To disable tunneled clear text passwords, change to no here! #PasswordAuthentication yes #PermitEmptyPasswords no # Change to no to disable s/key passwords #ChallengeResponseAuthentication yes # Kerberos options #KerberosAuthentication no #KerberosOrLocalPasswd yes #KerberosTicketCleanup yes # GSSAPI options #GSSAPIAuthentication no #GSSAPICleanupCreds yes # Set this to 'yes' to enable PAM authentication (via challenge-response) # and session processing. Depending on your PAM configuration, this may # bypass the setting of 'PasswordAuthentication' #UsePAM yes AllowTcpForwarding yes GatewayPorts yes #X11Forwarding no #X11DisplayOffset 10 #X11UseLocalhost yes #PrintMotd yes #PrintLastLog yes KeepAlive yes UseLogin yes UsePrivilegeSeparation no #PermitUserEnvironment no #Compression yes ClientAliveInterval 0 ClientAliveCountMax 99999 #UseDNS yes #PidFile /var/run/sshd.pid #MaxStartups 10 # no default banner path #Banner /some/path # override default of no subsystems Subsystem sftp /opt/libexec/sftp-server From bob at proulx.com Wed Apr 2 09:20:16 2008 From: bob at proulx.com (Bob Proulx) Date: Tue, 1 Apr 2008 16:20:16 -0600 Subject: OpenSSH_4.7p1, reverse shell In-Reply-To: <186efa540804011333k33d930eby527a6e0adf6a66ff@mail.gmail.com> References: <186efa540804011333k33d930eby527a6e0adf6a66ff@mail.gmail.com> Message-ID: <20080401222015.GA14875@dementia.proulx.com> Hayder Mouhammed wrote: > What I am trying: > > On C: ssh -N -R 10000:localhost:22 root at machineB > On B: running sshd > On A: ssh root at machineB -p 10000 A useful tool to double check where ports are open for listening is 'netstat'. Try this to see all listening connections: netstat -na | grep LISTEN netstat -na | grep :10000 Try that on all of the involved systems and verify where you are listening. That can clear up a lot of confusion. The next thing to look for when trying to connect remotely is what IP address the listening port is bound. This is controlled by GatewayPorts=yes and I see that you set it in your sshd configuration. Did you restart the daemon after changes to make sure they could take effect? 127.0.0.1 only accepts connections from the loopback interface. 0.0.0.0 accepts connections from any network interface. Any specific IP address would be assocated with that specific network device. After this I would simply 'connect'[*], or 'telnet' if that isn't available, to the port and verify that you are getting an ssh banner. On C: connect localhost 22 On B: connect localhost 10000 On A: connect B 10000 If the port is open and available but still blocked then I would look for a firewall that is blocking the connection. Bob [*] http://www.meadowy.org/~gotoh/projects/connect From mattias.fransson at ucs.se Wed Apr 2 17:02:33 2008 From: mattias.fransson at ucs.se (Mattias Fransson) Date: Wed, 2 Apr 2008 08:02:33 +0200 Subject: Frequent "Connection reset by peer" Message-ID: <94AA0EFEABD16942931B7481CEEBB443390D43AC0E@ucsex03.ucs.se> I have the very same problem, but in a quite different environment. I have three machines, all using ubuntu, but different versions. One of the machines is supposed to be a common storage for the other two to copy data to as some sort of backup. One of the machines can connect to the "backup machine" just fine, but the other can't, receiving the exact error described in this thread. To be more specific, both the machines can connect, but one of them loses connection in everything between 0-120 seconds. Switching on verbose on the troubling machine I also get the: "debug1: channel 0: free: client-session, nchannels 1 debug3: channel 0: status: The following connections are open: #0 client-session (t4 r0 i0/0 o0/0 fd 4/5 cfd -1) debug3: channel 0: close_fds r 4 w 5 e 6 c -1 Read from remote host ucsbackup03: Connection reset by peer Connection to ucsbackup03 closed. debug1: Transferred: stdin 0, stdout 0, stderr 96 bytes in 5329.1 seconds debug1: Bytes per second: stdin 0.0, stdout 0.0, stderr 0.0 debug1: Exit status -1" And regarding the cabling, both the "client machines" are connected to the same virtual switch (they are virtual machines), so the cabling between the clients and the server is exactly the same, yet one work and one fail. Sincerely, Mattias From hmouhammed at gmail.com Thu Apr 3 05:07:49 2008 From: hmouhammed at gmail.com (Hayder Mouhammed) Date: Wed, 2 Apr 2008 13:07:49 -0500 Subject: OpenSSH_4.7p1, reverse shell In-Reply-To: <20080401222015.GA14875@dementia.proulx.com> References: <186efa540804011333k33d930eby527a6e0adf6a66ff@mail.gmail.com> <20080401222015.GA14875@dementia.proulx.com> Message-ID: <186efa540804021107nfcaac80y875a0f0500ebfb6d@mail.gmail.com> Bob, I appreciate your speedy response and your suggestions. The netstat showing all the information was very helpful. I noticed something and I'm just curious if you have any information. Machine C is running OpenSSH v3.7 and A & B are running v4.7. If I switch the scenario and use A as the destination, I have to use a -P instead of -p. However with the first method, using v4.7 as starting point, I have to use a -p instead of -P. Was their a change in case between the versions?? Many thanks once again. On Tue, Apr 1, 2008 at 5:20 PM, Bob Proulx wrote: > Hayder Mouhammed wrote: > > What I am trying: > > > > On C: ssh -N -R 10000:localhost:22 root at machineB > > On B: running sshd > > On A: ssh root at machineB -p 10000 > > A useful tool to double check where ports are open for listening is > 'netstat'. Try this to see all listening connections: > > netstat -na | grep LISTEN > > netstat -na | grep :10000 > > Try that on all of the involved systems and verify where you are > listening. That can clear up a lot of confusion. > > The next thing to look for when trying to connect remotely is what IP > address the listening port is bound. This is controlled by > GatewayPorts=yes and I see that you set it in your sshd configuration. > Did you restart the daemon after changes to make sure they could take > effect? > 127.0.0.1 only accepts connections from the loopback interface. > 0.0.0.0 accepts connections from any network interface. Any specific > IP address would be assocated with that specific network device. > > After this I would simply 'connect'[*], or 'telnet' if that isn't > available, to the port and verify that you are getting an ssh banner. > > On C: > connect localhost 22 > > On B: > connect localhost 10000 > > On A: > connect B 10000 > > If the port is open and available but still blocked then I would look > for a firewall that is blocking the connection. > > Bob > > [*] http://www.meadowy.org/~gotoh/projects/connect > -- --H From bob at proulx.com Thu Apr 3 07:10:47 2008 From: bob at proulx.com (Bob Proulx) Date: Wed, 2 Apr 2008 14:10:47 -0600 Subject: OpenSSH_4.7p1, reverse shell In-Reply-To: <186efa540804021107nfcaac80y875a0f0500ebfb6d@mail.gmail.com> References: <186efa540804011333k33d930eby527a6e0adf6a66ff@mail.gmail.com> <20080401222015.GA14875@dementia.proulx.com> <186efa540804021107nfcaac80y875a0f0500ebfb6d@mail.gmail.com> Message-ID: <20080402201047.GB26432@dementia.proulx.com> Hayder Mouhammed wrote: > I appreciate your speedy response and your suggestions. The netstat > showing all the information was very helpful. Does this imply that you have solved your problem? It is always nice to know when things come to conclusion. > I noticed something and I'm just curious if you have any > information. Machine C is running OpenSSH v3.7 and A & B are running > v4.7. If I switch the scenario and use A as the destination, I have > to use a -P instead of -p. However with the first method, using v4.7 > as starting point, I have to use a -p instead of -P. Was their a > change in case between the versions?? Many thanks once again. As far as I know it has always been a lower case -p option. I am currently using v4.3 from Debian's Stable release. You can also avoid the short option and spell out the long option. When in doubt I would use the long option. ssh -oPort=10000 I tend to prefer the long options when used in scripts because they are more self-documenting. Also it shouldn't be possible to confuse it with other options. Bob From ops at iki.fi Thu Apr 3 17:34:35 2008 From: ops at iki.fi (Olli Savia) Date: Thu, 03 Apr 2008 09:34:35 +0300 Subject: [PATCH] Fix compile-time warning Message-ID: <47F47A7B.7020304@iki.fi> Hi, Here's a trivial patch to remove compile-time warning on LynxOS. Regards, Olli --- bsd-poll.c.orig Fri Feb 29 02:57:47 2008 +++ bsd-poll.c Thu Apr 3 06:56:50 2008 @@ -23,6 +23,7 @@ # include #endif +#include #include #include "bsd-poll.h" From djm at cvs.openbsd.org Thu Apr 3 21:48:30 2008 From: djm at cvs.openbsd.org (Damien Miller) Date: Thu, 3 Apr 2008 04:48:30 -0600 (MDT) Subject: Announce: OpenSSH 5.0 released Message-ID: <200804031048.m33AmU2e025468@cvs.openbsd.org> OpenSSH 5.0 has just been released. It will be available from the mirrors listed at http://www.openssh.com/ shortly. We apologise for any inconvenience resulting from this release being made so shortly after 4.9. Unfortunately we only learned of the below security issue from the public CVE report. The Debian OpenSSH maintainers responsible for handling the initial report of this bug failed to report it via either the private OpenSSH security contact list (openssh at openssh.com) or the portable OpenSSH Bugzilla (http://bugzilla.mindrot.org/). We ask anyone wishing to report security bugs in OpenSSH to please use the openssh at openssh.com contact and to practice responsible disclosure. OpenSSH is a 100% complete SSH protocol version 1.3, 1.5 and 2.0 implementation and includes sftp client and server support. Once again, we would like to thank the OpenSSH community for their continued support of the project, especially those who contributed code or patches, reported bugs, tested snapshots and purchased T-shirts or posters. T-shirt, poster and CD sales directly support the project. Pictures and more information can be found at: http://www.openbsd.org/tshirts.html and http://www.openbsd.org/orders.html For international orders use http://https.openbsd.org/cgi-bin/order and for European orders, use http://https.openbsd.org/cgi-bin/order.eu Changes since OpenSSH 4.9: ============================ Security: * CVE-2008-1483: Avoid possible hijacking of X11-forwarded connections by refusing to listen on a port unless all address families bind successfully. Checksums: ========== - SHA1 (openssh-5.0.tar.gz) = 729fb3168edf6a68408223b5ed82e59d13b57c47 - SHA1 (openssh-5.0p1.tar.gz) = 121cea3a730c0b0353334b6f46f438de30ab4928 Reporting Bugs: =============== - please read http://www.openssh.com/report.html and http://bugzilla.mindrot.org/ OpenSSH is brought to you by Markus Friedl, Niels Provos, Theo de Raadt, Kevin Steves, Damien Miller, Darren Tucker, Jason McIntyre, Tim Rice and Ben Lindstrom. From Minstrel at minstrel.org.uk Fri Apr 4 07:51:30 2008 From: Minstrel at minstrel.org.uk (Peter SJF Bance) Date: Thu, 03 Apr 2008 21:51:30 +0100 Subject: Omission in sshd_config man page Message-ID: <47F54352.2000503@minstrel.org.uk> [Not subscribed to this list, so please respond directly if you need to speak to me] In man5/sshd_config.5, a permissible keyword in a 'Match' block is missing. It currently lists only: AllowTcpForwarding, Banner, ForceCommand, GatewayPorts, GSSApiAuthentication, KbdInteractiveAuthentication, KerberosAuthentication, PasswordAuthentication, PermitOpen, PermitRootLogin, RhostsRSAAuthentication, RSAAuthentication, X11DisplayOffset, X11Forwarding, and X11UseLocalHost. >From recent testing in setting up a chroot'd SFTP-only environment (thank you for that!), the following is also permissible: ChrootDirectory. I hope this helps. -- Peter SJF Bance http://www.minstrel.org.uk/ From djm at mindrot.org Fri Apr 4 16:15:08 2008 From: djm at mindrot.org (Damien Miller) Date: Fri, 4 Apr 2008 15:15:08 +1000 (EST) Subject: Omission in sshd_config man page In-Reply-To: <47F54352.2000503@minstrel.org.uk> References: <47F54352.2000503@minstrel.org.uk> Message-ID: Thanks - fix committed. -d On Thu, 3 Apr 2008, Peter SJF Bance wrote: > [Not subscribed to this list, so please respond directly if you need to speak to me] > > In man5/sshd_config.5, a permissible keyword in a 'Match' block is missing. It currently lists only: > > AllowTcpForwarding, Banner, ForceCommand, GatewayPorts, GSSApiAuthentication, KbdInteractiveAuthentication, KerberosAuthentication, PasswordAuthentication, PermitOpen, PermitRootLogin, RhostsRSAAuthentication, RSAAuthentication, X11DisplayOffset, X11Forwarding, and X11UseLocalHost. > > >From recent testing in setting up a chroot'd SFTP-only environment (thank you for that!), the following is also permissible: > > ChrootDirectory. > > I hope this helps. > > -- > Peter SJF Bance > http://www.minstrel.org.uk/ > > _______________________________________________ > openssh-unix-dev mailing list > openssh-unix-dev at mindrot.org > https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev > From djm at mindrot.org Fri Apr 4 16:16:47 2008 From: djm at mindrot.org (Damien Miller) Date: Fri, 4 Apr 2008 15:16:47 +1000 (EST) Subject: [PATCH] Fix compile-time warning In-Reply-To: <47F47A7B.7020304@iki.fi> References: <47F47A7B.7020304@iki.fi> Message-ID: On Thu, 3 Apr 2008, Olli Savia wrote: > Hi, > > Here's a trivial patch to remove compile-time warning on LynxOS. Applied - thanks. -d From init at kth.se Fri Apr 4 16:07:17 2008 From: init at kth.se (Ingemar Nilsson) Date: Fri, 04 Apr 2008 07:07:17 +0200 Subject: User-specific sshd_config? Message-ID: <47F5B785.3040409@kth.se> Hi. I wonder if it would be possible to implement support for a user-specific sshd_config. The primary reason is that I would like the ability to specify that I'm only allowed to login with a key pair, even though the system-wide sshd configuration still allows passwords for other users. Of course, a user-specific sshd_config file should not be able to break the security policy of the system-wide configuration, only restrict it even further. Would this be possible? Regards Ingemar From stuge-openssh-unix-dev at cdy.org Fri Apr 4 20:05:57 2008 From: stuge-openssh-unix-dev at cdy.org (Peter Stuge) Date: Fri, 4 Apr 2008 11:05:57 +0200 Subject: User-specific sshd_config? In-Reply-To: <47F5B785.3040409@kth.se> References: <47F5B785.3040409@kth.se> Message-ID: <20080404090557.26498.qmail@cdy.org> On Fri, Apr 04, 2008 at 07:07:17AM +0200, Ingemar Nilsson wrote: > I wonder if it would be possible to implement support for a > user-specific sshd_config. Sure it is. But there exists no such support. > Of course, a user-specific sshd_config file should not be able to > break the security policy of the system-wide configuration, only > restrict it even further. And it may be tricky to decide what constitutes "further restrictions". Either way I believe it will be much quicker to ask your friendly root to add the exception in a Match block in the system sshd_config. //Peter From cjwatson at debian.org Fri Apr 4 21:04:05 2008 From: cjwatson at debian.org (Colin Watson) Date: Fri, 04 Apr 2008 11:04:05 +0100 Subject: [openssh-unix-announce] Announce: OpenSSH 5.0 released In-Reply-To: <200804031048.m33AmUdo017240@cvs.openbsd.org> Message-ID: Damien Miller wrote: >We apologise for any inconvenience resulting from this release >being made so shortly after 4.9. Unfortunately we only learned of >the below security issue from the public CVE report. The Debian >OpenSSH maintainers responsible for handling the initial report of >this bug failed to report it via either the private OpenSSH security >contact list (openssh at openssh.com) or the portable OpenSSH Bugzilla >(http://bugzilla.mindrot.org/). > >We ask anyone wishing to report security bugs in OpenSSH to please use >the openssh at openssh.com contact and to practice responsible disclosure. My apologies for this; after having been in a very busy period at work for some time, I was dealing with the bug in a rush immediately before going on holiday for a week, and a comment on the bug by that point indicated that it had already been forwarded to Theo DeRaadt. Since that sounded vaguely reasonable and I was short on time, I didn't think to check further. (The bug log indicates that a member of Red Hat's Security Response Team was also aware of the same problem.) -- Colin Watson [cjwatson at debian.org] From sxw at inf.ed.ac.uk Sat Apr 5 01:03:49 2008 From: sxw at inf.ed.ac.uk (Simon Wilkinson) Date: Fri, 4 Apr 2008 15:03:49 +0100 Subject: GSSAPI Key Exchange Patch for OpenSSH 5.0p1 (plus an added extra) Message-ID: -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 It's that time again! There's been another OpenSSH release, and once again, I'm pleased to announce the availability of my GSSAPI Key Exchange patch for it. Whilst OpenSSH contains support for GSSAPI user authentication, this still relies upon SSH host keys to authenticate the server to the user. For sites with a deployed Kerberos infrastructure this adds an additional, unnecessary, key management burden. GSSAPI key exchange allows the use of security mechanisms such as Kerberos to authenticate the server to the user, removing the need for trusted ssh host keys, and allowing the use of a single security architecture. This patch adds support for the RFC4462 GSSAPI key exchange mechanisms to OpenSSH, along with adding some additional, generic, GSSAPI features. It implements *) gss-group1-sha1-*, gss-group14-sha1-* and gss-gex-sha1-* key exchange mechanisms. (#1242) *) Support for the null host key type (#1242) *) Support for CCAPI credentials caches on Mac OS X (#1245) *) Support for better error handling when an authentication exchange fails due to server misconfiguration (#1244) *) Support for GSSAPI connections to hosts behind a round-robin load balancer (#1008) *) Support for GSSAPI connections to multi-homed hosts, where each interface has a unique name (#928) (bugzilla.mindrot.org bug numbers are in brackets) This release fixes a problem where the GSSAPIStrictAcceptorCheck option was always enabled. As usual, the code is available from http://www.sxw.org.uk/computing/ patches/openssh.html In addition, with this release I'm pleased to be able to announce an additional patch which implements cascading credential support. This allows credentials provided via key exchange to be cascaded through a set of ssh connections, so that a once a user reauthenticates on their workstation, the new credentials are available on all machines to which they are currently connected. This is controlled via the new options GSSAPIRenewalForcesReKey and GSSAPIStoreCredentialsOnRekey. A pam stack, 'sshd-rekey' may be defined to trigger renewal of additional credentials, such as X509 certificates or AFS tokens, when credentials are renewed on a particular machine. Cascading credential support is implemented using the standard ssh protocol. The cascading credentials patch is also available from the above website. Whilst it has been extensively tested, it has received less peer-review than the rest of the GSSAPI code. Reports of both success, and failure, would be greatly appreciated! If anyone would like to provide face-to-face feedback, I will be at the AFS & Kerberos Best Practices Workshop in May. Cheers, Simon. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (Darwin) iD8DBQFH9jVFqWndc26pXmcRApOeAJkB7I5oCCJweGs3UeNuxpk0i9s0iACgrNav hAN00rDs+VdjeL1NF5HzxgI= =yH5d -----END PGP SIGNATURE----- From bob at proulx.com Sat Apr 5 02:46:01 2008 From: bob at proulx.com (Bob Proulx) Date: Fri, 4 Apr 2008 09:46:01 -0600 Subject: User-specific sshd_config? In-Reply-To: <20080404090557.26498.qmail@cdy.org> References: <47F5B785.3040409@kth.se> <20080404090557.26498.qmail@cdy.org> Message-ID: <20080404154601.GB24919@dementia.proulx.com> Peter Stuge wrote: > Ingemar Nilsson wrote: > > I wonder if it would be possible to implement support for a > > user-specific sshd_config. > Either way I believe it will be much quicker to ask your friendly > root to add the exception in a Match block in the system sshd_config. When faced with a similar problem I ran an additional and separate sshd and supplemented the configuration with command line arguments. In this case IIRC -oPasswordAuthentication=no -Port=2222 -oPidFile=/var/run/sshd-noppass.pid and installed a control script /etc/init.d/sshd.nopass and then adjusted firewall rules accordingly. Bob From stuge-openssh-unix-dev at cdy.org Sat Apr 5 03:32:56 2008 From: stuge-openssh-unix-dev at cdy.org (Peter Stuge) Date: Fri, 4 Apr 2008 18:32:56 +0200 Subject: User-specific sshd_config? In-Reply-To: <20080404154601.GB24919@dementia.proulx.com> References: <47F5B785.3040409@kth.se> <20080404090557.26498.qmail@cdy.org> <20080404154601.GB24919@dementia.proulx.com> Message-ID: <20080404163256.6835.qmail@cdy.org> On Fri, Apr 04, 2008 at 09:46:01AM -0600, Bob Proulx wrote: > > > I wonder if it would be possible to implement support for a > > > user-specific sshd_config. > > > > Either way I believe it will be much quicker to ask your friendly > > root to add the exception in a Match block in the system sshd_config. > > When faced with a similar problem I ran an additional and separate > sshd and supplemented the configuration with command line arguments. > In this case IIRC -oPasswordAuthentication=no -Port=2222 > -oPidFile=/var/run/sshd-noppass.pid Unfortunately the user will still be authenticated by password on port 22. //Peter From bob at proulx.com Sat Apr 5 03:41:14 2008 From: bob at proulx.com (Bob Proulx) Date: Fri, 4 Apr 2008 10:41:14 -0600 Subject: User-specific sshd_config? In-Reply-To: <20080404163256.6835.qmail@cdy.org> References: <47F5B785.3040409@kth.se> <20080404090557.26498.qmail@cdy.org> <20080404154601.GB24919@dementia.proulx.com> <20080404163256.6835.qmail@cdy.org> Message-ID: <20080404164114.GA21961@dementia.proulx.com> Peter Stuge wrote: > Bob Proulx wrote: > > When faced with a similar problem I ran an additional and separate > > sshd and supplemented the configuration with command line arguments. > > In this case IIRC -oPasswordAuthentication=no -Port=2222 > > -oPidFile=/var/run/sshd-noppass.pid > > Unfortunately the user will still be authenticated by password on > port 22. You missed reading (and subsequently trimmed out) the fact that there were firewall rules involved. Just because I am a pedant here is what I said: > -oPidFile=/var/run/sshd-noppass.pid and installed a control script > /etc/init.d/sshd.nopass and then adjusted firewall rules accordingly. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ :-) I don't know for what purpose the original poster is wanting to use specialized configuration to turn off passwords but in my case I was able to use firewall rules to ensure that only that specially configured port was accessed from an untrusted network. I was able to block the normal port and therefore able to block password access. I kept password access available from the internal private (and much more trusted) network. Bob From jmknoble at pobox.com Sat Apr 5 03:55:26 2008 From: jmknoble at pobox.com (Jim Knoble) Date: Fri, 4 Apr 2008 11:55:26 -0500 Subject: User-specific sshd_config? In-Reply-To: <20080404154601.GB24919@dementia.proulx.com> References: <47F5B785.3040409@kth.se> <20080404090557.26498.qmail@cdy.org> <20080404154601.GB24919@dementia.proulx.com> Message-ID: <20080404165526.GA22180@crawfish.ais.com> Circa 2008-04-04 10:46 dixit Bob Proulx: : Peter Stuge wrote: : > Ingemar Nilsson wrote: : > > I wonder if it would be possible to implement support for a : > > user-specific sshd_config. : > Either way I believe it will be much quicker to ask your friendly : > root to add the exception in a Match block in the system sshd_config. : : When faced with a similar problem I ran an additional and separate : sshd and supplemented the configuration with command line arguments. : In this case IIRC -oPasswordAuthentication=no -Port=2222 : -oPidFile=/var/run/sshd-noppass.pid and installed a control script : /etc/init.d/sshd.nopass and then adjusted firewall rules accordingly. I've gone even further before and done the following in addition to what Bob writes above: - Create an alternate sshd_config file, containing the restricted configuration, limiting the configuration to specific users using either the AllowUsers or AllowGroups directive. - Forbid the specific users allowed above from using the general sshd_config using DenyUsers or DenyGroups (or using a disjoint AllowUsers or AllowGroups directive). - If the users are to be severely restricted in what they're allowed to do, create a ~/.ssh/authorized_keys file with restrictions for every allowed key, and ensure that the user's home directory, ~/.ssh directory, and ~/.ssh/authorized_keys file are neither owned nor writable by the user. The StrictModes directive is often needed for this to work. If you're attempting to restrict a user to only pubkey authentication so that you can use authorized_keys to control what the user may do, then you should pay particular attention to the *Authentication directives: PubkeyAuthentication yes PasswordAuthentication no ChallengeResponseAuthentication no HostbasedAuthentication no KerberosAuthentication no GSSAPIAuthentication no UsePAM no Several of the above are defaults, but it's best to be explicit when you're creating a restricted configuration. You may wish to considier other restrictions as well, such as: AllowTcpForwarding no X11Forwarding no PermitTunnel no PermitUserEnvironment no # Remove any AcceptEnv directives that should not apply # Remove any Subsystem directives that should not apply # You may also wish to do: MaxAuthTries 1 PrintLastLog no PrintMotd no If you want to use ForceCommand, you should upgrade to OpenSSH 5.0 or 5.0p1, as there was a bugfix associated with whether ~/.ssh/rc is processed when ForceCommand is specified. Good luck. -- jim knoble | jmknoble at pobox.com | http://www.pobox.com/~jmknoble/ (GnuPG key ID: 6F39C2CC >>>>>> http://www.pobox.com/~jmknoble/keys/ ) (GnuPG fingerprint: 5024:D578:7CF4:5660:7269::F6F3:B919:9307:6F39:C2CC) +----------------------------------------------------------------------+ |[L]iberty, as we all know, cannot flourish in a country that is perma-| | nently on a war footing, or even a near-war footing. --Aldous Huxley| +----------------------------------------------------------------------+ From stuge-openssh-unix-dev at cdy.org Sat Apr 5 04:25:18 2008 From: stuge-openssh-unix-dev at cdy.org (Peter Stuge) Date: Fri, 4 Apr 2008 19:25:18 +0200 Subject: User-specific sshd_config? In-Reply-To: <20080404164114.GA21961@dementia.proulx.com> References: <47F5B785.3040409@kth.se> <20080404090557.26498.qmail@cdy.org> <20080404154601.GB24919@dementia.proulx.com> <20080404163256.6835.qmail@cdy.org> <20080404164114.GA21961@dementia.proulx.com> Message-ID: <20080404172518.27925.qmail@cdy.org> On Fri, Apr 04, 2008 at 10:41:14AM -0600, Bob Proulx wrote: > > > When faced with a similar problem I ran an additional and separate > > > sshd and supplemented the configuration with command line arguments. > > > In this case IIRC -oPasswordAuthentication=no -Port=2222 > > > -oPidFile=/var/run/sshd-noppass.pid > > > > Unfortunately the user will still be authenticated by password on > > port 22. > > You missed reading (and subsequently trimmed out) Didn't miss.. > the fact that there were firewall rules involved. .. > :-) > > I don't know for what purpose the original poster is wanting to use > specialized configuration to turn off passwords but in my case I was > able to use firewall rules .. ..but since I assumed the original poster lacked root privileges (from tone and wording) and expected root turn-around time to be a little too long, I got the impression that firewall rules could not be part of a working solution. (Since the question was about user-level rather than network-level control.) Sorry for the confusion! :) //Peter From dkg-openssh.com at fifthhorseman.net Sat Apr 5 05:20:27 2008 From: dkg-openssh.com at fifthhorseman.net (Daniel Kahn Gillmor) Date: Fri, 04 Apr 2008 14:20:27 -0400 Subject: User-specific sshd_config? In-Reply-To: <20080404165526.GA22180@crawfish.ais.com> (Jim Knoble's message of "Fri\, 4 Apr 2008 11\:55\:26 -0500") References: <47F5B785.3040409@kth.se> <20080404090557.26498.qmail@cdy.org> <20080404154601.GB24919@dementia.proulx.com> <20080404165526.GA22180@crawfish.ais.com> Message-ID: <878wztlbx0.fsf@squeak.fifthhorseman.net> A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 826 bytes Desc: not available Url : http://lists.mindrot.org/pipermail/openssh-unix-dev/attachments/20080404/f1d7200a/attachment.bin From djm at mindrot.org Sat Apr 5 18:05:06 2008 From: djm at mindrot.org (Damien Miller) Date: Sat, 5 Apr 2008 17:05:06 +1000 (EST) Subject: User-specific sshd_config? In-Reply-To: <47F5B785.3040409@kth.se> References: <47F5B785.3040409@kth.se> Message-ID: On Fri, 4 Apr 2008, Ingemar Nilsson wrote: > Hi. > > I wonder if it would be possible to implement support for a > user-specific sshd_config. The primary reason is that I would like the > ability to specify that I'm only allowed to login with a key pair, even > though the system-wide sshd configuration still allows passwords for > other users. You can do this with the "Match" keyword in sshd_config now. You need root access to configure it though. Match user djm PasswordAuthentication no KbdInteractiveAuthentication no GSSAPIAuthentication no KerberosAuthentication no HostbasedAuthentication no PubkeyAuthentication yes > Of course, a user-specific sshd_config file should not be able to break > the security policy of the system-wide configuration, only restrict it > even further. > > Would this be possible? Anything's possible :) -d From init at kth.se Sat Apr 5 23:01:22 2008 From: init at kth.se (Ingemar Nilsson) Date: Sat, 05 Apr 2008 14:01:22 +0200 Subject: User-specific sshd_config? In-Reply-To: References: <47F5B785.3040409@kth.se> Message-ID: <47F76A12.5090107@kth.se> Damien Miller wrote: > You can do this with the "Match" keyword in sshd_config now. You need > root access to configure it though. > > Match user djm > PasswordAuthentication no > KbdInteractiveAuthentication no > GSSAPIAuthentication no > KerberosAuthentication no > HostbasedAuthentication no > PubkeyAuthentication yes Sure, but that still involves the system administrator. I would like users to be able to set restrictive login policies for themselves without involving the system administrator. Regards Ingemar From stuge-openssh-unix-dev at cdy.org Sun Apr 6 03:55:02 2008 From: stuge-openssh-unix-dev at cdy.org (Peter Stuge) Date: Sat, 5 Apr 2008 19:55:02 +0200 Subject: User-specific sshd_config? In-Reply-To: <47F76A12.5090107@kth.se> References: <47F5B785.3040409@kth.se> <47F76A12.5090107@kth.se> Message-ID: <20080405175502.30835.qmail@cdy.org> On Sat, Apr 05, 2008 at 02:01:22PM +0200, Ingemar Nilsson wrote: > Sure, but that still involves the system administrator. I would > like users to be able to set restrictive login policies for > themselves without involving the system administrator. Maybe you could use PAM tricks. //Peter From openssh at roumenpetrov.info Sun Apr 6 04:10:19 2008 From: openssh at roumenpetrov.info (Roumen Petrov) Date: Sat, 05 Apr 2008 21:10:19 +0300 Subject: User-specific sshd_config? In-Reply-To: <47F76A12.5090107@kth.se> References: <47F5B785.3040409@kth.se> <47F76A12.5090107@kth.se> Message-ID: <47F7C08B.9050601@roumenpetrov.info> Ingemar Nilsson wrote: > Damien Miller wrote: > >> You can do this with the "Match" keyword in sshd_config now. You need >> root access to configure it though. >> >> Match user djm >> PasswordAuthentication no >> KbdInteractiveAuthentication no >> GSSAPIAuthentication no >> KerberosAuthentication no >> HostbasedAuthentication no >> PubkeyAuthentication yes > > Sure, but that still involves the system administrator. I would like > users to be able to set restrictive login policies for themselves > without involving the system administrator. > > Regards > Ingemar Setup isolate environment for every user with root access and left them to do administration. Note how to setup this environment is out of secure shell scope. -- Get X.509 certificates support in OpenSSH: http://roumenpetrov.info/openssh/ From djm at mindrot.org Tue Apr 8 15:19:20 2008 From: djm at mindrot.org (Damien Miller) Date: Tue, 8 Apr 2008 15:19:20 +1000 (EST) Subject: anoncvs.mindrot.org changes Message-ID: Hi, I have just converted anoncvs.mindrot.org from using GNU CVS to OpenCVS. The latter is quite a bit nicer to run as an anoncvs server, and it doesn't require write access to the repository like GNU CVS seems to. The only visible change from this should be that checkouts of particular tags or dates should now work (I didn't know they failed until today). If you experience any problems, please contact me. Thanks, Damien From vinschen at redhat.com Tue Apr 8 21:55:16 2008 From: vinschen at redhat.com (Corinna Vinschen) Date: Tue, 8 Apr 2008 13:55:16 +0200 Subject: anoncvs.mindrot.org changes In-Reply-To: References: Message-ID: <20080408115516.GZ23852@calimero.vinschen.de> On Apr 8 15:19, Damien Miller wrote: > Hi, > > I have just converted anoncvs.mindrot.org from using GNU CVS to OpenCVS. > The latter is quite a bit nicer to run as an anoncvs server, and it > doesn't require write access to the repository like GNU CVS seems to. Is the source code available? There's no link to the sources on http://www.opencvs.org/ Corinna -- Corinna Vinschen Cygwin Project Co-Leader Red Hat From martin at oneiros.de Wed Apr 9 01:05:48 2008 From: martin at oneiros.de (=?ISO-8859-1?Q?Martin_Schr=F6der?=) Date: Tue, 8 Apr 2008 17:05:48 +0200 Subject: anoncvs.mindrot.org changes In-Reply-To: <20080408115516.GZ23852@calimero.vinschen.de> References: <20080408115516.GZ23852@calimero.vinschen.de> Message-ID: <68c491a60804080805w2d6eb62ex6bf9616241e33545@mail.gmail.com> 2008/4/8, Corinna Vinschen : > Is the source code available? There's no link to the sources on > http://www.opencvs.org/ Look at the bottom most entries in the left column. Best Martin From vinschen at redhat.com Wed Apr 9 01:32:56 2008 From: vinschen at redhat.com (Corinna Vinschen) Date: Tue, 8 Apr 2008 17:32:56 +0200 Subject: anoncvs.mindrot.org changes In-Reply-To: <68c491a60804080805w2d6eb62ex6bf9616241e33545@mail.gmail.com> References: <20080408115516.GZ23852@calimero.vinschen.de> <68c491a60804080805w2d6eb62ex6bf9616241e33545@mail.gmail.com> Message-ID: <20080408153256.GB4325@calimero.vinschen.de> On Apr 8 17:05, Martin Schr?der wrote: > 2008/4/8, Corinna Vinschen : > > Is the source code available? There's no link to the sources on > > http://www.opencvs.org/ > > Look at the bottom most entries in the left column. Oh, erm... *blush* Thanks, Corinna -- Corinna Vinschen Cygwin Project Co-Leader Red Hat From desrod at gnu-designs.com Sat Apr 12 08:50:14 2008 From: desrod at gnu-designs.com (David A. Desrosiers) Date: Fri, 11 Apr 2008 18:50:14 -0400 Subject: Running tests as a different user Message-ID: I have a need to run the 5.0p1 'tests' target as another user; specifically one who has a writable $HOME so the tests can complete by creating and modifying ~/.ssh/. I tried butchering the test suite in ./regress/ and taking out all of the 'whoami', 'id -un' and other relevant '$USER' references, replacing them with the specific environment variables and/or usernames that I need, and when I run the 'tests' target, all of those changes are instantly clobbered back to non-workable defaults. I can't seem to figure out exactly where this is happening, and the only likely culprit seems to be hard-coded in the ssh-keygen binary. I'd rather not go modifying the innards of the compiled binaries just to pass the test suite. The user who configures, builds and tests software in this context, has NO writable home directory, so all of the tests immediately fail in ugly ways. What am I missing here? Is there some way to pass a different $HOME (such as /tmp/ or /var/empty) prior to running the tests? Or specify a different user to run them as? ($SUDO_USER in our case). I tried the obvious "HOME=/tmp/ make tests", but that fails, as does other similar methods. Short of tricking the tree with LD_PRELOAD or similar hacks, what is the best way to solve this problem? Thanks in advance. David A. Desrosiers e: desrod at gnu-designs.com p: 860-367-8456 From simon.tomlinson at ed.ac.uk Tue Apr 15 22:06:46 2008 From: simon.tomlinson at ed.ac.uk (Simon Tomlinson) Date: Tue, 15 Apr 2008 13:06:46 +0100 Subject: ChrootDirectory - SFTP subsystem works fine but SSH hangs Message-ID: <48049A56.2000604@ed.ac.uk> Hi I'm using Centos 5 with Openssh-5.0p1 installed (and OpenSSL 0.98b and Zlib 1.2.3-3). I've managed to get a chroot'd SFTP session using ChrootDirectory and the new built-in SFTP subsystem. However, when I use SSH to connect to the same account the session hangs rather than closing the connection. This happens whether or not I use /sbin/nologin /bin/false or even /bin/sh as the shell. I can chroot to the home directory as root and access the folder files from within a chroot as expected using /bin/sh as shell (for example). I can also login to other accounts on the machine, that do not use chroot, using SFTP and SSH. I guess for an interactive SSH session I may be missing some required system files inside the jail- but I really only need SFTP for this account. Thanks Simon The last ouput from the ssh -vvv command is below:- debug3: packet_send2: adding 48 (len 63 padlen 17 extra_pad 64) debug2: we sent a password packet, wait for reply debug1: Authentication succeeded (password). debug1: channel 0: new [client-session] debug3: ssh_session2_open: channel_new: 0 debug2: channel 0: send open debug1: Entering interactive session. debug2: callback start debug2: client_session2_setup: id 0 debug2: channel 0: request pty-req confirm 0 debug3: tty_make_modes: ospeed 38400 debug3: tty_make_modes: ispeed 38400 debug3: tty_make_modes: 1 3 debug3: tty_make_modes: 2 28 debug3: tty_make_modes: 3 127 debug3: tty_make_modes: 4 21 debug3: tty_make_modes: 5 4 debug3: tty_make_modes: 6 0 debug3: tty_make_modes: 7 0 debug3: tty_make_modes: 8 17 debug3: tty_make_modes: 9 19 debug3: tty_make_modes: 10 26 debug3: tty_make_modes: 12 18 debug3: tty_make_modes: 13 23 debug3: tty_make_modes: 14 22 debug3: tty_make_modes: 18 15 debug3: tty_make_modes: 30 0 debug3: tty_make_modes: 31 0 debug3: tty_make_modes: 32 0 debug3: tty_make_modes: 33 0 debug3: tty_make_modes: 34 0 debug3: tty_make_modes: 35 0 debug3: tty_make_modes: 36 1 debug3: tty_make_modes: 37 0 debug3: tty_make_modes: 38 1 debug3: tty_make_modes: 39 0 debug3: tty_make_modes: 40 0 debug3: tty_make_modes: 41 0 debug3: tty_make_modes: 50 1 debug3: tty_make_modes: 51 1 debug3: tty_make_modes: 52 0 debug3: tty_make_modes: 53 1 debug3: tty_make_modes: 54 1 debug3: tty_make_modes: 55 1 debug3: tty_make_modes: 56 0 debug3: tty_make_modes: 57 0 debug3: tty_make_modes: 58 0 debug3: tty_make_modes: 59 1 debug3: tty_make_modes: 60 1 debug3: tty_make_modes: 61 1 debug3: tty_make_modes: 62 0 debug3: tty_make_modes: 70 1 debug3: tty_make_modes: 71 0 debug3: tty_make_modes: 72 1 debug3: tty_make_modes: 73 0 debug3: tty_make_modes: 74 0 debug3: tty_make_modes: 75 0 debug3: tty_make_modes: 90 1 debug3: tty_make_modes: 91 1 debug3: tty_make_modes: 92 0 debug3: tty_make_modes: 93 0 debug1: Sending environment. debug3: Ignored env HOSTNAME debug3: Ignored env SHELL debug3: Ignored env TERM debug3: Ignored env HISTSIZE debug3: Ignored env SSH_CLIENT debug3: Ignored env KDE_NO_IPV6 debug3: Ignored env SSH_TTY debug3: Ignored env USER debug3: Ignored env JRE_HOME debug3: Ignored env LS_COLORS debug3: Ignored env KDEDIR debug3: Ignored env PATH debug3: Ignored env MAIL debug3: Ignored env PWD debug3: Ignored env INPUTRC debug3: Ignored env JAVA_HOME debug3: Ignored env KDE_IS_PRELINKED debug1: Sending env LANG = en_US.UTF-8 debug2: channel 0: request env confirm 0 debug3: Ignored env SSH_ASKPASS debug3: Ignored env HOME debug3: Ignored env SHLVL debug3: Ignored env LOGNAME debug3: Ignored env CVS_RSH debug3: Ignored env SSH_CONNECTION debug3: Ignored env LESSOPEN debug3: Ignored env G_BROKEN_FILENAMES debug3: Ignored env OLDPWD debug3: Ignored env _ debug2: channel 0: request shell confirm 0 debug2: fd 3 setting TCP_NODELAY debug2: callback done debug2: channel 0: open confirm rwindow 0 rmax 32768 debug2: channel 0: rcvd adjust 2097152 After Cntrl C:- debug2: channel 0: rcvd eof debug2: channel 0: output open -> drain debug2: channel 0: obuf empty debug2: channel 0: close_write debug2: channel 0: output drain -> closed debug1: client_input_channel_req: channel 0 rtype exit-signal reply 0 debug2: channel 0: rcvd close debug2: channel 0: close_read debug2: channel 0: input open -> closed debug3: channel 0: will not send data after close debug2: channel 0: almost dead debug2: channel 0: gc: notify user debug2: channel 0: gc: user detached debug2: channel 0: send close debug2: channel 0: is dead debug2: channel 0: garbage collecting debug1: channel 0: free: client-session, nchannels 1 debug3: channel 0: status: The following connections are open: #0 client-session (t4 r0 i3/0 o3/0 fd -1/-1 cfd -1) debug3: channel 0: close_fds r -1 w -1 e 6 c -1 Connection to mymachine closed. debug1: Transferred: stdin 0, stdout 0, stderr 45 bytes in 121.4 seconds debug1: Bytes per second: stdin 0.0, stdout 0.0, stderr 0.4 debug1: Exit status -1 -- The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336. From roberto.vadori at amet.it Tue Apr 15 23:12:47 2008 From: roberto.vadori at amet.it (Roberto Vadori) Date: Tue, 15 Apr 2008 15:12:47 +0200 Subject: Compilation of openssh on IRIX Message-ID: <4804A9CF.5000105@amet.it> Dear sirs, I tried to compile openssh-5.0p1 on a IRIX machine with gcc. "/sbin/uname -a" gives: IRIX o2 6.5 07202013 IP32 mips and "/sbin/uname -R" gives: 6.5 6.5.30f "gcc -v" gives: Reading specs from /usr/freeware/lib/gcc-lib/mips-sgi-irix6.5/3.3/specs Configured with: ../configure --prefix=/usr/freeware --enable-version-specific-runtime-libs --disable-shared --enable-threads --enable-haifa --enable-libgcj --disable-c-mbchar Thread model: single gcc version 3.3 Talking about OpenSSL libraries and headers, "./configure" says that: checking OpenSSL header version... 90807f (OpenSSL 0.9.8g 19 Oct 2007) checking OpenSSL library version... 90807f (OpenSSL 0.9.8g 19 Oct 2007) "./configure" complains about : [...] checking sys/stropts.h usability... no checking sys/stropts.h presence... yes configure: WARNING: sys/stropts.h: present but cannot be compiled configure: WARNING: sys/stropts.h: check for missing prerequisite headers? configure: WARNING: sys/stropts.h: see the Autoconf documentation configure: WARNING: sys/stropts.h: section "Present But Cannot Be Compiled" configure: WARNING: sys/stropts.h: proceeding with the preprocessor's result configure: WARNING: sys/stropts.h: in the future, the compiler will take precedence configure: WARNING: ## ------------------------------------------- ## configure: WARNING: ## Report this to openssh-unix-dev at mindrot.org ## configure: WARNING: ## ------------------------------------------- ## checking for sys/stropts.h... yes [...] Nevertheless a "Makefile" and "config.status" is still produced. Issuing a "make" the compilation stops at [...] gcc -g -O2 -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -std=gnu99 -I. -I.. -I. -I./.. -I/usr/local/ssl/include -DHAVE_CONFIG_H -c bsd-openpty.c saying that: In file included from bsd-openpty.c:61: /usr/include/sys/stropts.h:237: error: parse error before "t_uscalar_t" /usr/include/sys/stropts.h:261: error: parse error before "t_uscalar_t" /usr/include/sys/stropts.h:267: error: parse error before '}' token make[1]: *** [bsd-openpty.o] Error 1 make[1]: Leaving directory `/mnt/d0/software/openssh-5.0p1/openbsd-compat' make: *** [openbsd-compat/libopenbsd-compat.a] Error 2 But an IRIX-based system has , which in turns includes . So I made a "make distclean" and in: - configure - configure.ac - openbsd-compat/bsd-openpty.c - config.h.in I changed all the occurrences of the string "sys/stropts.h" to a straight "stropts.h" Something like this, I mean: *** bsd-openpty.c Mon Apr 14 09:06:12 2008 --- bsd-openpty.c.orig Mon Apr 14 09:06:50 2008 *************** *** 58,64 **** # include #endif #if defined(HAVE_DEV_PTMX) && defined(HAVE_SYS_STROPTS_H) ! # include #endif #include --- 58,64 ---- # include #endif #if defined(HAVE_DEV_PTMX) && defined(HAVE_SYS_STROPTS_H) ! # include #endif #include "configure" still complains about "present but not compiled" but I got through "make" with a successful compilation and working executables which I'm happily using right now. Conclusions: Maybe could any of that be useful for you developers? I have just a question: am I putting something nasty in my sshd daemon? Please, feel free to get in touch with me for any question regarding this topic. I realize IRIX is not a very common OS (alas, I'd say) but there are few of us out of there still using IRIX with such a delight :) Best regards. -- Roberto Vadori - AMET Italy "This paper gives wrong solutions to trivial problems. The basic error, however, is not new". Clifford Truesdell, Math. Rev., 12, p 561. From jonhson.ian at gmail.com Fri Apr 18 23:16:34 2008 From: jonhson.ian at gmail.com (Ian jonhson) Date: Fri, 18 Apr 2008 21:16:34 +0800 Subject: I got a strange "connection refused" In-Reply-To: <20080320162031.29326.qmail@cdy.org> References: <20080320162031.29326.qmail@cdy.org> Message-ID: <8f34198c0804180616u56c4d79l5d3a90208eef9f54@mail.gmail.com> I got a segment fault. It seems in a child process which calls the PAM authentication. But I have no idea how to locate the bug. Could anybody give me some advices? Thanks again. On Fri, Mar 21, 2008 at 12:20 AM, Peter Stuge wrote: > On Thu, Mar 20, 2008 at 01:04:52PM +0800, qin an wrote: > > If I run with -d, all is OK. However, when I run sshd in > > daemon, it clashed. I don't know how to collect the debug > > information in this case. > > On Linux you can use strace: > > ps $(pidof sshd) > > and then > > strace -fFs 256 -o output.txt put_proper_pid_here > > Do the connection, then send Ctrl-C to strace. It will exit. > > > //Peter > > > _______________________________________________ > openssh-unix-dev mailing list > openssh-unix-dev at mindrot.org > https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev > From dan at nf15.lightwave.net.ru Sat Apr 19 02:15:26 2008 From: dan at nf15.lightwave.net.ru (Dan Yefimov) Date: Fri, 18 Apr 2008 20:15:26 +0400 (MSD) Subject: I got a strange "connection refused" In-Reply-To: <8f34198c0804180616u56c4d79l5d3a90208eef9f54@mail.gmail.com> Message-ID: On Fri, 18 Apr 2008, Ian jonhson wrote: > I got a segment fault. It seems in a child process which calls the PAM > authentication. > But I have no idea how to locate the bug. > At what moment did you get a segmentation fault? What is in the strace log up to the moment of a child crash? > > > On Fri, Mar 21, 2008 at 12:20 AM, Peter Stuge > wrote: > > On Thu, Mar 20, 2008 at 01:04:52PM +0800, qin an wrote: > > > If I run with -d, all is OK. However, when I run sshd in > > > daemon, it clashed. I don't know how to collect the debug > > > information in this case. > > > > On Linux you can use strace: > > > > ps $(pidof sshd) > > > > and then > > > > strace -fFs 256 -o output.txt put_proper_pid_here > > > > Do the connection, then send Ctrl-C to strace. It will exit. > > > > -- Sincerely Your, Dan. From jonhson.ian at gmail.com Sat Apr 19 16:52:34 2008 From: jonhson.ian at gmail.com (Ian jonhson) Date: Sat, 19 Apr 2008 14:52:34 +0800 Subject: I got a strange "connection refused" In-Reply-To: References: <8f34198c0804180616u56c4d79l5d3a90208eef9f54@mail.gmail.com> Message-ID: <8f34198c0804182352y695ba52dlb172c1fd0588652b@mail.gmail.com> > At what moment did you get a segmentation fault? What is in the strace log up > to the moment of a child crash? > I got a "connection refused" in client. The symptom is similar with qin's: sshd can work in debug mode but deamon mode. It seems crash occurs in session open, but I am not sure. The dump of strace is as follows: ============= dump of strace ======================= 9336 write(7, "\0\0\0\7\0", 5) = 5 9336 write(7, "\0\0\0\2OK", 6) = 6 9336 poll([{fd=4, events=POLLIN, revents=POLLIN}], 1, 0) = 1 9336 read(4, "\0\0\0\7", 4) = 4 9336 read(4, "\0\0\0\0\2OK", 7) = 7 9336 write(6, "\0\0\0\0215", 5 9337 <... read resumed> "\0\0\0\21", 4) = 4 9336 <... write resumed> ) = 5 9337 read(4, 9336 write(6, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 16 9337 <... read resumed> "5", 17) = 1 9336 <... write resumed> ) = 16 9337 read(4, 9336 read(6, 9337 <... read resumed> "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 16) = 16 9337 write(3, "p\223\312\207J\272\7\214L\3762wi\317\7\335E\207\225U\307\244zc\217C\374\205v\331W\177\354z\366\252H\271j\3573u\355@\27\7\335\235", 48) = 48 9337 select(4, [3], NULL, NULL, NULL) = 1 (in [3]) 9337 read(3, "\0042\234?\337D\336\5\24\377\23\370=w7\25\361U^\312\276>\363r9\230\322\311\tv\324\30\263\23\230\311Vj\243!\0\361.a\360\266\6\365V\212\337\233\251\26\31\201\257\226P\24k\3577\17\363\3608p\235ux\305\317*\277\23\357\314!\367", 8192) = 80 9337 write(4, "\0\0\0\0056", 5 9336 <... read resumed> "\0\0\0\5", 4) = 4 9337 <... write resumed> ) = 5 9336 read(6, 9337 write(4, "\0\0\0\0", 4 9336 <... read resumed> "6", 5) = 1 9337 <... write resumed> ) = 4 9336 read(6, 9337 read(4, 9336 <... read resumed> "\0\0\0\0", 4) = 4 9336 write(6, "\0\0\0\0057", 5 9337 <... read resumed> "\0\0\0\5", 4) = 4 9336 <... write resumed> ) = 5 9337 read(4, 9336 write(6, "\0\0\0\0", 4 9337 <... read resumed> "7", 5) = 1 9336 <... write resumed> ) = 4 9337 read(4, 9336 read(6, 9337 <... read resumed> "\0\0\0\0", 4) = 4 9337 write(4, "\0\0\0\0018", 5 9336 <... read resumed> "\0\0\0\1", 4) = 4 9337 <... write resumed> ) = 5 9336 read(6, 9337 read(4, 9336 <... read resumed> "8", 1) = 1 9336 munmap(0xb755e000, 4214784) = 0 9336 close(4) = 0 9336 close(7) = 0 9336 write(6, "\0\0\0\0019", 5 9337 <... read resumed> "\0\0\0\1", 4) = 4 9336 <... write resumed> ) = 5 9337 read(4, "9", 1) = 1 9337 write(4, "\0\0\0\0010", 5) = 5 9337 read(4, 9336 read(6, "\0\0\0\1", 4) = 4 9336 read(6, "0", 1) = 1 9336 write(6, "\0\0\0\t1", 5 9337 <... read resumed> "\0\0\0\t", 4) = 4 9336 <... write resumed> ) = 5 9337 read(4, "1", 9) = 1 9337 read(4, 9336 write(6, "\0\0\0\1\0\0\0\0", 8 9337 <... read resumed> "\0\0\0\1\0\0\0\0", 8) = 8 9336 <... write resumed> ) = 8 9337 write(3, "K\354\364Lv\252\302B\6v~\304B\350\215\343V\276\327\204\201\r\351\233E\33\300\304>\266\37\361", 32 9336 time([1208226946]) = 1208226946 < ----------------- segment fault here ------------------------------------------ 9336 --- SIGSEGV (Segmentation fault) @ 0 (0) --- -----------------------------------------------------------------------------------------> 9327 <... select resumed> ) = ? ERESTARTNOHAND (To be restarted) 9337 <... write resumed> ) = 32 9327 --- SIGCHLD (Child exited) @ 0 (0) --- 9337 write(4, "\0\0\4\350\32", 5 9327 waitpid(-1, 9337 <... write resumed> ) = -1 EPIPE (Broken pipe) 9327 <... waitpid resumed> [{WIFSIGNALED(s) && WTERMSIG(s) == SIGSEGV}], WNOHANG) = 9336 9337 --- SIGPIPE (Broken pipe) @ 0 (0) --- 9327 waitpid(-1, 9337 time( 9327 <... waitpid resumed> 0xbfdb6778, WNOHANG) = -1 ECHILD (No child processes) 9337 <... time resumed> [1208226946]) = 1208226946 9327 rt_sigaction(SIGCHLD, NULL, 9337 open("/etc/localtime", O_RDONLY 9327 <... rt_sigaction resumed> {0x804d15e, [], 0}, 8) = 0 9337 <... open resumed> ) = -1 ENOENT (No such file or directory) 9327 sigreturn( 9337 open("/etc/localtime", O_RDONLY) = -1 ENOENT (No such file or directory) 9337 open("/etc/localtime", O_RDONLY) = -1 ENOENT (No such file or directory) 9337 open("/etc/localtime", O_RDONLY) = -1 ENOENT (No such file or directory) 9337 socket(PF_FILE, SOCK_DGRAM, 0) = 6 9337 fcntl64(6, F_SETFD, FD_CLOEXEC) = 0 9337 connect(6, {sa_family=AF_FILE, path="/dev/log"}, 16) = -1 ENOENT (No such file or directory) 9337 close(6) = 0 9337 exit_group(255) = ? 9327 <... sigreturn resumed> ) = ? (mask now []) 9327 select(6, [3 5], NULL, NULL, NULL) = 1 (in [5]) 9327 close(5) = 0 9327 select(6, [3], NULL, NULL, NULL ========================================================================= From anqin.qin at gmail.com Sat Apr 19 16:39:09 2008 From: anqin.qin at gmail.com (qin an) Date: Sat, 19 Apr 2008 14:39:09 +0800 Subject: I got a strange "connection refused" In-Reply-To: <8f34198c0804180616u56c4d79l5d3a90208eef9f54@mail.gmail.com> References: <20080320162031.29326.qmail@cdy.org> <8f34198c0804180616u56c4d79l5d3a90208eef9f54@mail.gmail.com> Message-ID: It seems that you met the same trouble with me. Also, I can not locate the segfault too. On Fri, Apr 18, 2008 at 9:16 PM, Ian jonhson wrote: > I got a segment fault. It seems in a child process which calls the PAM > authentication. > But I have no idea how to locate the bug. > > Could anybody give me some advices? > > Thanks again. > > > > > > On Fri, Mar 21, 2008 at 12:20 AM, Peter Stuge > wrote: > > On Thu, Mar 20, 2008 at 01:04:52PM +0800, qin an wrote: > > > If I run with -d, all is OK. However, when I run sshd in > > > daemon, it clashed. I don't know how to collect the debug > > > information in this case. > > > > On Linux you can use strace: > > > > ps $(pidof sshd) > > > > and then > > > > strace -fFs 256 -o output.txt put_proper_pid_here > > > > Do the connection, then send Ctrl-C to strace. It will exit. > > > > > > //Peter > > > > > > _______________________________________________ > > openssh-unix-dev mailing list > > openssh-unix-dev at mindrot.org > > https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev > > > _______________________________________________ > openssh-unix-dev mailing list > openssh-unix-dev at mindrot.org > https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev > From dan at nf15.lightwave.net.ru Mon Apr 21 06:00:10 2008 From: dan at nf15.lightwave.net.ru (Dan Yefimov) Date: Mon, 21 Apr 2008 00:00:10 +0400 (MSD) Subject: I got a strange "connection refused" In-Reply-To: <8f34198c0804182352y695ba52dlb172c1fd0588652b@mail.gmail.com> Message-ID: On Sat, 19 Apr 2008, Ian jonhson wrote: > > At what moment did you get a segmentation fault? What is in the strace log up > > to the moment of a child crash? > > > > I got a "connection refused" in client. > The symptom is similar with qin's: sshd can work in debug mode but deamon mode. > > It seems crash occurs in session open, but I am not sure. > As far as I can judge, according to the strace output you sent and information you granted, the crash occurs in the privsep monitor process somewhere in the key exchange code. May be somebody else in the list could either correct me or point more exact location of the crash. BTW, if you created the /var/empty/etc/localtime file populated with the content of /etc/localtime and configured your syslogd to use /var/empty/dev/log socket in addition to the standard /dev/log, you could get some output from the privsep child in one of your log files. That could give us some additional clue on what is going on. -- Sincerely Your, Dan. From jonhson.ian at gmail.com Mon Apr 21 12:45:39 2008 From: jonhson.ian at gmail.com (Ian jonhson) Date: Mon, 21 Apr 2008 10:45:39 +0800 Subject: I got a strange "connection refused" In-Reply-To: References: <8f34198c0804182352y695ba52dlb172c1fd0588652b@mail.gmail.com> Message-ID: <8f34198c0804201945g1cf3a1efh1916faf86775808@mail.gmail.com> > As far as I can judge, according to the strace output you sent and information > you granted, the crash occurs in the privsep monitor process somewhere in the > key exchange code. May be somebody else in the list could either correct me or > point more exact location of the crash. > BTW, if you created the > /var/empty/etc/localtime file populated with the content of /etc/localtime and > configured your syslogd to use /var/empty/dev/log socket in addition to the > standard /dev/log, you could get some output from the privsep child in one of > your log files. That could give us some additional clue on what is going on. mmmh..... That my be a alternative. But how to open the syslog in SSHD? I tried to add the line "syslog(LOG_INFO,"%s: here",__func__)" to get debug information, however nothing output in /var/log/messages. Anything I miss? Thanks again, Ian From dan at nf15.lightwave.net.ru Tue Apr 22 00:21:34 2008 From: dan at nf15.lightwave.net.ru (Dan Yefimov) Date: Mon, 21 Apr 2008 18:21:34 +0400 (MSD) Subject: I got a strange "connection refused" In-Reply-To: <8f34198c0804201945g1cf3a1efh1916faf86775808@mail.gmail.com> Message-ID: On Mon, 21 Apr 2008, Ian jonhson wrote: > mmmh..... That my be a alternative. But how to open the syslog in SSHD? > I tried to add the line "syslog(LOG_INFO,"%s: here",__func__)" to get debug > information, however nothing output in /var/log/messages. > > Anything I miss? > SSHD privsep child according to your strace log tried to contact syslogd right after privsep monitor crashed, so there is generally nothing you should do in addition to what I advised. But if you want to explicitly add debug logging, you should invoke openlog() right before invoking syslog(), and invoke closelog() after you are done with syslogging. Consult manpages for details of those functions. -- Sincerely Your, Dan. From oren at forescout.com Tue Apr 22 02:08:18 2008 From: oren at forescout.com (Oren Nechushtan) Date: Mon, 21 Apr 2008 19:08:18 +0300 Subject: FIPS 140-2 OpenSSL(2007) patches Message-ID: <07E688A4439C9C4ABF81C84EFBB342F301649652@TA-SAT.fsd.forescout.com> --- openssh-4.7p1/sshd.c Mon Dec 31 05:14:10 2007 +++ openssh-4.7p1/sshd.c Mon Dec 31 17:25:36 2007 @@ -75,6 +75,12 @@ #include #include #include +#ifdef OPENSSL_FIPS +#include +#include +#include +#endif + #ifdef HAVE_SECUREWARE #include #include @@ -136,6 +142,14 @@ extern char *__progname; +/* FIPS mode operation indicator */ +#ifdef OPENSSL_FIPS + int fips_mode = 1; //refined later +#else + int fips_mode = 0; +#endif + + /* Server configuration options. */ ServerOptions options; @@ -419,7 +433,11 @@ major = PROTOCOL_MAJOR_1; minor = PROTOCOL_MINOR_1; } +#ifndef OPENSSL_FIPS snprintf(buf, sizeof buf, "SSH-%d.%d-%.100s\n", major, minor, SSH_VERSION); +#else + snprintf(buf, sizeof buf, "SSH-%d.%d-%.100s FIPS\n", major, minor, SSH_VERSION); +#endif server_version_string = xstrdup(buf); /* Send our protocol version identification. */ @@ -582,15 +600,24 @@ privsep_preauth_child(void) { u_int32_t rnd[256]; + u_char* buf=(u_char*)rnd; gid_t gidset[1]; int i; /* Enable challenge-response authentication for privilege separation */ privsep_challenge_enable(); +#ifndef OPENSSL_FIPS for (i = 0; i < 256; i++) rnd[i] = arc4random(); RAND_seed(rnd, sizeof(rnd)); +#else + for (i = 0; i < 6; i++) + rnd[i] = arc4random(); + FIPS_set_prng_key(buf,buf+8); + FIPS_rand_seed(buf+16,8); + debug2("FIPS rand reseeded"); +#endif /* Demote the private keys to public keys. */ demote_sensitive_data(); @@ -621,12 +648,26 @@ { int status; pid_t pid; +#ifdef OPENSSL_FIPS +// u_int32_t rnd[6], i; +// u_char* buf=(u_char*)rnd; + u_char buf[24]; +#endif /* Set up unprivileged child process to deal with network data */ pmonitor = monitor_init(); /* Store a pointer to the kex for later rekeying */ pmonitor->m_pkex = &xxx_kex; +#ifdef OPENSSL_FIPS + if(RAND_bytes(buf,sizeof buf) <= 0) { + ERR_load_crypto_strings(); + ERR_print_errors_fp(stderr); + fatal("privsep_preauth: RAND_bytes failed"); + } +// for (i = 0; i < 6; i++) +// rnd[i] = arc4random(); +#endif pid = fork(); if (pid == -1) { fatal("fork of unprivileged child failed"); @@ -648,6 +689,13 @@ return (1); } else { /* child */ +#ifdef OPENSSL_FIPS + FIPS_rand_method()->cleanup(); + /* Always automagically seed PRNG */ + FIPS_set_prng_key(buf,buf+8); + FIPS_rand_seed(buf+16,8); + debug2("FIPS rand reseeded"); +#endif close(pmonitor->m_sendfd); @@ -662,6 +710,11 @@ static void privsep_postauth(Authctxt *authctxt) { +#ifdef OPENSSL_FIPS +// u_int32_t rnd[6], i; +// u_char* buf=(u_char*)rnd; + u_char buf[24]; +#endif #ifdef DISABLE_FD_PASSING if (1) { #else @@ -675,6 +728,15 @@ /* New socket pair */ monitor_reinit(pmonitor); +#ifdef OPENSSL_FIPS + if(RAND_bytes(buf,sizeof buf) <= 0) { + ERR_load_crypto_strings(); + ERR_print_errors_fp(stderr); + fatal("privsep_postauth: RAND_bytes failed"); + } +// for (i = 0; i < 6; i++) +// rnd[i] = arc4random(); +#endif pmonitor->m_pid = fork(); if (pmonitor->m_pid == -1) fatal("fork of unprivileged child failed"); @@ -687,7 +749,13 @@ /* NEVERREACHED */ exit(0); } - +#ifdef OPENSSL_FIPS + FIPS_rand_method()->cleanup(); + /* Always automagically seed PRNG */ + FIPS_set_prng_key(buf,buf+8); + FIPS_rand_seed(buf+16,8); + debug2("FIPS rand reseeded"); +#endif close(pmonitor->m_sendfd); /* Demote the private keys to public keys. */ @@ -1015,6 +1083,11 @@ struct sockaddr_storage from; socklen_t fromlen; pid_t pid; +#ifdef OPENSSL_FIPS +// u_int32_t rnd[6], k; +// u_char* buf=(u_char*)rnd; + u_char buf[24]; +#endif /* setup fd set for accept */ fdset = NULL; @@ -1147,6 +1220,15 @@ break; } +#ifdef OPENSSL_FIPS + if(RAND_bytes(buf,sizeof buf) <= 0) { + ERR_load_crypto_strings(); + ERR_print_errors_fp(stderr); + fatal("server_accept_loop: RAND_bytes failed"); + } +// for (k = 0; k < 6; k++) +// rnd[k] = arc4random(); +#endif /* * Normal production daemon. Fork, and have * the child process the connection. The @@ -1163,6 +1245,13 @@ * the connection. */ platform_post_fork_child(); +#ifdef OPENSSL_FIPS + FIPS_rand_method()->cleanup(); + /* Always automagically seed PRNG */ + FIPS_set_prng_key(buf,buf+8); + FIPS_rand_seed(buf+16,8); + debug2("FIPS rand reseeded"); +#endif startup_pipe = startup_p[1]; close_startup_pipes(); close_listen_socks(); @@ -1421,6 +1510,36 @@ /* Fill in default values for those options not explicitly set. */ fill_default_server_options(&options); +#ifdef OPENSSL_FIPS +/* + Priority setting: + env OPENSSH_FIPS + !env OPENSSH_NO_FIPS + sshd_config options (default: false) +*/ + if (fips_mode) { + if (getenv("OPENSSH_FIPS")) { /* env OPENSSH_FIPS */ + } + else if (getenv("OPENSSH_NO_FIPS")) { /* !env OPENSSH_NO_FIPS */ + fips_mode = 0; + } + else if (options.fips_mode == 0) { /* sshd_config options */ + fips_mode = 0; + } + } + if(fips_mode) + { + if(!FIPS_mode_set(1)) + { + ERR_load_crypto_strings(); + ERR_print_errors_fp(stderr); + exit(1); + } + else + fprintf(stderr,"*** IN FIPS MODE ***\n"); + } +#endif + /* challenge-response is implemented via keyboard interactive */ if (options.challenge_response_authentication) options.kbd_interactive_authentication = 1; @@ -1572,9 +1691,28 @@ #ifdef TIOCNOTTY int fd; #endif /* TIOCNOTTY */ +#ifdef OPENSSL_FIPS +// u_int32_t rnd[6], k; +// u_char* buf=(u_char*)rnd; + u_char buf[24]; + if(RAND_bytes(buf,sizeof buf) <= 0) { + ERR_load_crypto_strings(); + ERR_print_errors_fp(stderr); + fatal("privsep_preauth: RAND_bytes failed"); + } +// for (i = 0; i < 6; i++) +// rnd[i] = arc4random(); +#endif if (daemon(0, 0) < 0) fatal("daemon() failed: %.200s", strerror(errno)); +#ifdef OPENSSL_FIPS + FIPS_rand_method()->cleanup(); + /* Always automagically seed PRNG */ + FIPS_set_prng_key(buf,buf+8); + FIPS_rand_seed(buf+16,8); + debug2("FIPS rand reseeded"); +#endif /* Disconnect from the controlling tty. */ #ifdef TIOCNOTTY fd = open(_PATH_TTY, O_RDWR | O_NOCTTY); --- openssh-4.7p1/ssh-keygen.c Tue Dec 18 02:43:34 2007 +++ openssh-4.7p1/ssh-keygen.c Wed Dec 26 17:38:59 2007 @@ -47,6 +47,14 @@ #include "match.h" #include "hostfile.h" #include "dns.h" +#include "fips.h" + +/* + * FIPS mode operation +*/ +#ifdef OPENSSL_FIPS + int fips_mode = 0; +#endif #ifdef SMARTCARD #include "scard.h" @@ -1067,6 +1075,14 @@ extern int optind; extern char *optarg; + enum fp_type dgst_type = SSH_FP_MD5; +#ifdef OPENSSL_FIPS + if (getenv("OPENSSH_FIPS")) fips_mode = 1; + if (fips_mode) { + dgst_type = SSH_FP_SHA1; + } +#endif + /* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */ sanitise_stdfd(); @@ -1435,7 +1451,7 @@ fclose(f); if (!quiet) { - char *fp = key_fingerprint(public, SSH_FP_MD5, SSH_FP_HEX); + char *fp = key_fingerprint(public, dgst_type, SSH_FP_HEX); printf("Your public key has been saved in %s.\n", identity_file); printf("The key fingerprint is:\n"); --- openssh-4.7p1/ssh-keysign.c Tue Dec 18 02:43:37 2007 +++ openssh-4.7p1/ssh-keysign.c Wed Dec 26 18:07:17 2007 @@ -52,6 +52,15 @@ #include "pathnames.h" #include "readconf.h" #include "uidswap.h" +#include "fips.h" + +/* + * FIPS operational mode +*/ +#ifdef OPENSSL_FIPS + int fips_mode = 0; +#endif + /* XXX readconf.c needs these */ uid_t original_real_uid; @@ -158,6 +167,10 @@ u_int slen, dlen; u_int32_t rnd[256]; +#ifdef OPENSSL_FIPS + if ( getenv("OPENSSH_FIPS") ) fips_mode = 1; +#endif + /* Ensure that stdin and stdout are connected */ if ((fd = open(_PATH_DEVNULL, O_RDWR)) < 2) exit(1); --- openssh-4.7p1/ssh-keyscan.c Tue Dec 18 02:43:36 2007 +++ openssh-4.7p1/ssh-keyscan.c Wed Dec 26 18:05:15 2007 @@ -45,6 +45,14 @@ #include "atomicio.h" #include "misc.h" #include "hostfile.h" +#include "fips.h" + +/* + * FIPS mode operation +*/ +#ifdef OPENSSL_FIPS + int fips_mode = 0; +#endif /* Flag indicating whether IPv4 or IPv6. This can be set on the command line. Default value is AF_UNSPEC means both IPv4 and IPv6. */ @@ -729,6 +737,10 @@ extern int optind; extern char *optarg; +#ifdef OPENSSL_FIPS + if (getenv("OPENSSH_FIPS")) fips_mode = 1; +#endif + __progname = ssh_get_progname(argv[0]); init_rng(); seed_rng(); --- openssh-4.7p1/fips.h Tue Dec 18 03:32:54 2007 +++ openssh-4.7p1/fips.h Tue Dec 18 03:30:50 2007 @@ -0,0 +1,3 @@ +/* $OpenBSD: version.h,v 1.40 2004/02/23 15:16:46 markus Exp $ */ + +extern int fips_mode; --- openssh-4.7p1/openbsd-compat/bsd-arc4random.c Thu Dec 20 13:04:50 2007 +++ openssh-4.7p1/openbsd-compat/bsd-arc4random.c Thu Dec 20 16:39:10 2007 @@ -29,6 +29,11 @@ #include #include +#ifdef OPENSSL_FIPS +#include "fips.h" +#endif + + /* Size of key to use */ #define SEED_SIZE 20 @@ -45,13 +50,27 @@ static int first_time = 1; if (rc4_ready <= 0) { +#ifndef OPENSSL_FIPS if (first_time) seed_rng(); +#endif first_time = 0; arc4random_stir(); } - RC4(&rc4, sizeof(r), (unsigned char *)&r, (unsigned char *)&r); +#ifdef OPENSSL_FIPS + if (fips_mode) { + if (RAND_bytes(&r,sizeof(r)) <= 0) { + ERR_load_crypto_strings(); + ERR_print_errors_fp(stderr); + return 1/0; + } + rc4_ready -= sizeof(r); + + return(r); + } +#endif + RC4(&rc4, sizeof(r), (unsigned char *)&r, (unsigned char *)&r); rc4_ready -= sizeof(r); @@ -64,6 +83,13 @@ unsigned char rand_buf[SEED_SIZE]; int i; +#ifdef OPENSSL_FIPS + if (fips_mode) { + rc4_ready = REKEY_BYTES; + return; + } +#endif + memset(&rc4, 0, sizeof(rc4)); if (RAND_bytes(rand_buf, sizeof(rand_buf)) <= 0) fatal("Couldn't obtain random bytes (error %ld)", --- openssh-4.7p1/ssh-rand-helper.c Thu Dec 20 13:15:00 2007 +++ openssh-4.7p1/ssh-rand-helper.c Wed Dec 26 18:10:50 2007 @@ -62,6 +62,14 @@ #include "atomicio.h" #include "pathnames.h" #include "log.h" +#include "fips.h" + +/* + * FIPS operational mode +*/ +#ifdef OPENSSL_FIPS + int fips_mode = 0; +#endif /* Number of bytes we write out */ #define OUTPUT_SEED_SIZE 48 @@ -820,6 +828,10 @@ extern char *optarg; LogLevel ll; +#ifdef OPENSSL_FIPS + if ( getenv("OPENSSH_FIPS") ) fips_mode = 1; +#endif + __progname = ssh_get_progname(argv[0]); log_init(argv[0], SYSLOG_LEVEL_INFO, SYSLOG_FACILITY_USER, 1); --- openssh-4.7p1/buffer.c Thu Dec 20 12:55:07 2007 +++ openssh-4.7p1/buffer.c Thu Dec 20 12:55:38 2007 @@ -175,7 +175,8 @@ len, buffer->end - buffer->offset); return (-1); } - memcpy(buf, buffer->buf + buffer->offset, len); + if (len > 0) + memcpy(buf, buffer->buf + buffer->offset, len); buffer->offset += len; return (0); } --- openssh-4.7p1/sshconnect.c Thu Dec 20 15:23:57 2007 +++ openssh-4.7p1/sshconnect.c Thu Dec 20 15:40:26 2007 @@ -57,6 +57,7 @@ #include "misc.h" #include "dns.h" #include "version.h" +#include "fips.h" char *client_version_string = NULL; char *server_version_string = NULL; @@ -545,6 +546,12 @@ char msg[1024]; int len, host_line, ip_line; const char *host_file = NULL, *ip_file = NULL; + enum fp_type dgst_type = SSH_FP_MD5; +#ifdef OPENSSL_FIPS + if (fips_mode) { + dgst_type = SSH_FP_SHA1; + } +#endif /* * Force accepting of the host key for loopback/localhost. The @@ -708,7 +735,7 @@ else snprintf(msg1, sizeof(msg1), "."); /* The default */ - fp = key_fingerprint(host_key, SSH_FP_MD5, SSH_FP_HEX); + fp = key_fingerprint(host_key, dgst_type, SSH_FP_HEX); msg2[0] = '\0'; if (options.verify_host_key_dns) { if (matching_host_key_dns) @@ -999,11 +1006,17 @@ Key *found; char *fp; int line, ret; + enum fp_type dgst_type = SSH_FP_MD5; +#ifdef OPENSSL_FIPS + if (fips_mode) { + dgst_type = SSH_FP_SHA1; + } +#endif found = key_new(keytype); if ((ret = lookup_key_in_hostfile_by_type(file, host, keytype, found, &line))) { - fp = key_fingerprint(found, SSH_FP_MD5, SSH_FP_HEX); + fp = key_fingerprint(found, dgst_type, SSH_FP_HEX); logit("WARNING: %s key found for host %s\n" "in %s:%d\n" "%s key fingerprint %s.", @@ -1053,8 +1086,14 @@ { char *fp; const char *type = key_type(host_key); + enum fp_type dgst_type = SSH_FP_MD5; +#ifdef OPENSSL_FIPS + if (fips_mode) { + dgst_type = SSH_FP_SHA1; + } +#endif - fp = key_fingerprint(host_key, SSH_FP_MD5, SSH_FP_HEX); + fp = key_fingerprint(host_key, dgst_type, SSH_FP_HEX); error("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"); error("@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @"); --- openssh-4.7p1/sshconnect2.c Mon Dec 24 13:14:28 2007 +++ openssh-4.7p1/sshconnect2.c Mon Dec 24 13:17:06 2007 @@ -64,6 +64,7 @@ #include "msg.h" #include "pathnames.h" #include "uidswap.h" +#include "fips.h" #ifdef GSSAPI #include "ssh-gss.h" @@ -433,6 +434,12 @@ u_int alen, blen; char *pkalg, *fp; u_char *pkblob; + enum fp_type dgst_type = SSH_FP_MD5; +#ifdef OPENSSL_FIPS + if (fips_mode) { + dgst_type = SSH_FP_SHA1; + } +#endif if (authctxt == NULL) fatal("input_userauth_pk_ok: no authentication context"); @@ -466,7 +473,7 @@ key->type, pktype); goto done; } - fp = key_fingerprint(key, SSH_FP_MD5, SSH_FP_HEX); + fp = key_fingerprint(key, dgst_type, SSH_FP_HEX); debug2("input_userauth_pk_ok: fp %s", fp); xfree(fp); --- openssh-4.7p1/auth2-pubkey.c Thu Dec 20 15:18:22 2007 +++ openssh-4.7p1/auth2-pubkey.c Sun Dec 23 21:42:40 2007 @@ -52,6 +52,9 @@ #endif #include "monitor_wrap.h" #include "misc.h" +#ifdef OPENSSL_FIPS +#include "fips.h" +#endif /* import */ extern ServerOptions options; @@ -186,6 +189,14 @@ struct stat st; Key *found; char *fp; + enum fp_type dgst_type = SSH_FP_MD5; +#ifdef OPENSSL_FIPS + if (fips_mode) { + dgst_type = SSH_FP_SHA1; + } +#endif + + /* Temporarily use the user's uid. */ temporarily_use_uid(pw); @@ -250,7 +261,7 @@ found_key = 1; debug("matching key found: file %s, line %lu", file, linenum); - fp = key_fingerprint(found, SSH_FP_MD5, SSH_FP_HEX); + fp = key_fingerprint(found, dgst_type, SSH_FP_HEX); verbose("Found matching %s key: %s", key_type(found), fp); xfree(fp); --- openssh-4.7p1/auth-rsa.c Thu Dec 20 15:18:22 2007 +++ openssh-4.7p1/auth-rsa.c Wed Jan 2 17:01:42 2008 @@ -21,6 +21,7 @@ #include #include +#include #include #include @@ -47,6 +48,9 @@ #include "monitor_wrap.h" #include "ssh.h" #include "misc.h" +#ifdef OPENSSL_FIPS +#include "fips.h" +#endif /* import */ extern ServerOptions options; @@ -88,10 +92,11 @@ } int -auth_rsa_verify_response(Key *key, BIGNUM *challenge, u_char response[16]) +auth_rsa_verify_response(Key *key, BIGNUM *challenge, u_char response[20]) { - u_char buf[32], mdbuf[16]; + u_char buf[40], mdbuf[16], shabuf[20]; MD5_CTX md; + SHA_CTX sha; int len; /* don't allow short keys */ @@ -101,10 +106,37 @@ return (0); } - /* The response is MD5 of decrypted challenge plus session id. */ len = BN_num_bytes(challenge); + if (len <= 0 || len > 40) + fatal("auth_rsa_verify_response: bad challenge length %d", len); + + /* The response is SHA1 of decrypted challenge plus session id. */ + memset(buf, 0, 40); + BN_bn2bin(challenge, buf + 40 - len); + SHA1_Init(&sha); + SHA1_Update(&sha, buf, 40); + SHA1_Update(&sha, session_id, 16); + SHA1_Final(shabuf, &sha); + + /* Verify that the response is the original challenge. */ + if (memcmp(response, shabuf, 20) != 0) { + /* Wrong answer. */ +#ifdef OPENSSL_FIPS + if (fips_mode) { + return (0); + } +#endif + } + +#ifdef OPENSSL_FIPS + if (fips_mode) { + return (1); + } +#endif + if (len <= 0 || len > 32) fatal("auth_rsa_verify_response: bad challenge length %d", len); + /* The response is MD5 of decrypted challenge plus session id. */ memset(buf, 0, 32); BN_bn2bin(challenge, buf + 32 - len); MD5_Init(&md); @@ -131,7 +163,7 @@ auth_rsa_challenge_dialog(Key *key) { BIGNUM *challenge, *encrypted_challenge; - u_char response[16]; + u_char response[20]; int i, success; if ((encrypted_challenge = BN_new()) == NULL) @@ -153,6 +185,10 @@ packet_read_expect(SSH_CMSG_AUTH_RSA_RESPONSE); for (i = 0; i < 16; i++) response[i] = (u_char)packet_get_char(); +#ifdef OPENSSL_FIPS + for (i = 16; i < 20; i++) + response[i] = (u_char)packet_get_char(); +#endif packet_check_eom(); success = PRIVSEP(auth_rsa_verify_response(key, challenge, response)); @@ -304,6 +340,12 @@ Key *key; char *fp; struct passwd *pw = authctxt->pw; + enum fp_type dgst_type = SSH_FP_MD5; +#ifdef OPENSSL_FIPS + if (fips_mode) { + dgst_type = SSH_FP_SHA1; + } +#endif /* no user given */ if (!authctxt->valid) @@ -332,7 +374,7 @@ * options; this will be reset if the options cause the * authentication to be rejected. */ - fp = key_fingerprint(key, SSH_FP_MD5, SSH_FP_HEX); + fp = key_fingerprint(key, dgst_type, SSH_FP_HEX); verbose("Found matching %s key: %s", key_type(key), fp); xfree(fp); --- openssh-4.7p1/contrib/redhat/sshd.init Mon Dec 24 13:44:26 2007 +++ openssh-4.7p1/contrib/redhat/sshd.init Wed Dec 26 13:08:06 2007 @@ -24,7 +24,11 @@ # Some functions to make the below more readable KEYGEN=/usr/bin/ssh-keygen SSHD=/usr/sbin/sshd -RSA1_KEY=/etc/ssh/ssh_host_key +if [ "$OPENSSH_FIPS" ] ; then + EXTRA_SSH_KEYGEN_RSA_FLAGS="-b 2048" +else + RSA1_KEY=/etc/ssh/ssh_host_key +fi RSA_KEY=/etc/ssh/ssh_host_rsa_key DSA_KEY=/etc/ssh/ssh_host_dsa_key PID_FILE=/var/run/sshd.pid @@ -32,7 +36,7 @@ do_rsa1_keygen() { if [ ! -s $RSA1_KEY ]; then echo -n $"Generating SSH1 RSA host key: " - if $KEYGEN -q -t rsa1 -f $RSA1_KEY -C '' -N '' >&/dev/null; then + if $KEYGEN -q -t rsa1 -f $RSA1_KEY -C '' -N '' $EXTRA_SSH_KEYGEN_RSA_FLAGS >&/dev/null; then chmod 600 $RSA1_KEY chmod 644 $RSA1_KEY.pub if [ -x /sbin/restorecon ]; then @@ -51,7 +55,7 @@ do_rsa_keygen() { if [ ! -s $RSA_KEY ]; then echo -n $"Generating SSH2 RSA host key: " - if $KEYGEN -q -t rsa -f $RSA_KEY -C '' -N '' >&/dev/null; then + if $KEYGEN -q -t rsa -f $RSA_KEY -C '' -N '' $EXTRA_SSH_KEYGEN_RSA_FLAGS >&/dev/null; then chmod 600 $RSA_KEY chmod 644 $RSA_KEY.pub if [ -x /sbin/restorecon ]; then @@ -70,7 +74,7 @@ do_dsa_keygen() { if [ ! -s $DSA_KEY ]; then echo -n $"Generating SSH2 DSA host key: " - if $KEYGEN -q -t dsa -f $DSA_KEY -C '' -N '' >&/dev/null; then + if $KEYGEN -q -t dsa -f $DSA_KEY -C '' -N '' $EXTRA_SSH_KEYGEN_DSA_FLAGS >&/dev/null; then chmod 600 $DSA_KEY chmod 644 $DSA_KEY.pub if [ -x /sbin/restorecon ]; then --- openssh-4.7p1/ssh-add.c Wed Dec 26 17:25:22 2007 +++ openssh-4.7p1/ssh-add.c Wed Dec 26 17:35:52 2007 @@ -61,10 +61,18 @@ #include "authfile.h" #include "pathnames.h" #include "misc.h" +#include "fips.h" /* argv0 */ extern char *__progname; +/* + * FIPS mode operation +*/ +#ifdef OPENSSL_FIPS + int fips_mode = 0; +#endif + /* Default files to add */ static char *default_files[] = { _PATH_SSH_CLIENT_ID_RSA, @@ -337,6 +345,10 @@ /* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */ sanitise_stdfd(); +#ifdef OPENSSL_FIPS + if (getenv("OPENSSH_FIPS")) fips_mode=1; +#endif + __progname = ssh_get_progname(argv[0]); init_rng(); seed_rng(); --- openssh-4.7p1/ssh-agent.c Wed Dec 26 18:09:26 2007 +++ openssh-4.7p1/ssh-agent.c Wed Dec 26 18:17:05 2007 @@ -74,6 +74,14 @@ #include "compat.h" #include "log.h" #include "misc.h" +#include "fips.h" + +/* + * FIPS operational mode +*/ +#ifdef OPENSSL_FIPS + int fips_mode = 0; +#endif #ifdef SMARTCARD #include "scard.h" @@ -1047,6 +1055,10 @@ char pidstrbuf[1 + 3 * sizeof pid]; struct timeval *tvp = NULL; +#ifdef OPENSSL_FIPS + if (getenv("OPENSSH_FIPS")) fips_mode = 1; +#endif + /* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */ sanitise_stdfd(); From oren at forescout.com Tue Apr 22 02:08:03 2008 From: oren at forescout.com (Oren Nechushtan) Date: Mon, 21 Apr 2008 19:08:03 +0300 Subject: FIPS 140-2 OpenSSL(2007) patches Message-ID: <07E688A4439C9C4ABF81C84EFBB342F301649651@TA-SAT.fsd.forescout.com> Hi, I am happy to (re)send a set of patches for compiling OpenSSH 4.7p1 with FIPS 140-2 OpenSSL. These are based on previously reported patches by Steve Marquess and Ben Laurie , for ver. OpenSSH 3.8. Note that these patches are NOT OFFICIAL, and MAY be used freely by anyone. Issues [partially] handled: SSL FIPS Self test. RC4, arcfour, et. al. are not 140-2 compliant (need to use 3DES built in RNG instead) MD5 digest is not 140-2 compliant (need to use SHA instead). Make OpenSSH FIPS aware (limit the ciphers according to the FIPS mode.) fork() & FIPS RNG. openssl-fips-1.1.1 workaround. Suggestions and Todos: Retest everything. Make OpenSSH FIPS 140-2 compliant (or even certified:) Add configuration for use of SHA1 instead/in addition to/ MD5. Configure blowfish as default in non FIPS mode. Disabled RSA1 in FIPS mode. Add central [FIPS] configuration (currently each binary has its own configuration.) Improve fork() logic. Invite me for a drink. Best, Oren Nechushtan P.S. The patches are split into two due to mailing list size limitations: [openssh.spec] > %define openssldir /usr/local/ssl > %define openssllib %{openssldir}/lib > %define opensslinclude %{openssldir}/include > export LD_LIBRARY_PATH=$(LD_LIBRARY_PATH):%{openssllib} > export CC=gcc > export LD=fipsld > > # --with-md5-passwords 198d221 < --with-md5-passwords \ 209a233,240 > --with-ssl-dir=%{openssldir} \ > --with-fips \ > --with-cppflags="%{fsgccopts}" \ > --with-cflags="%{fsgccopts} -g" \ > --with-ldflags="%{fsgccopts} -L%{openssllib} -Wl,-rpath %{openssllib}" \ > > export CC=fipsld > export FIPSLD_CC=gcc 216c247 < make --- > make CC=$CC FIPSLD_CC=$FIPSLD_CC 220c251,257 < %configure --libexecdir=%{_libexecdir}/openssh --- > %configure --libexecdir=%{_libexecdir}/openssh \ > --with-ssl-dir=%{openssldir} \ > --with-fips \ > --with-cppflags="%{fsgccopts}" \ > --with-cflags="%{fsgccopts}" \ > --with-ldflags="%{fsgccopts} -L%{openssllib} -Wl,-rpath %{openssllib}" \ ------------------------------------------------------------------------ -------------------- --- openssh-4.7p1/buildpkg.sh.in 25 Jul 2007 +++ openssh-4.7p1/buildpkg.sh.in 25 Jul 2007 @@ -128,3 +128,3 @@ ## Fill in some details, like prefix and sysconfdir -for confvar in prefix exec_prefix bindir sbindir libexecdir datadir mandir sysconfdir piddir srcdir +for confvar in prefix exec_prefix bindir sbindir libexecdir datadir mandir sysconfdir piddir srcdir ssldir do diff -u -r1.1 -r1.3 --- openssh-4.7p1/ChangeLog 19 May 2004 13:05:16 -0000 1.1 +++ openssh-4.7p1/ChangeLog 28 May 2004 13:30:29 -0000 1.3 @@ -1,3 +1,7 @@ +20071224 #orig 20040419 + - Oren Nechushtan ; Added patches for FIPS 140-2; based on + - Ben Laurie , Steve Marquess ; Add + support for OPENSSL FIPS mode 20070817 - (dtucker) [sshd.8] Many Linux variants use a single "!" to denote locked accounts and that's what the code looks for, so make man page and code --- openssh-4.7p1/cipher.c Mon Dec 17 18:46:43 2007 +++ openssh-4.7p1/cipher.c Mon Dec 24 04:15:12 2007 @@ -47,6 +47,7 @@ #include "xmalloc.h" #include "log.h" #include "cipher.h" +#include "fips.h" /* compatibility with old or broken OpenSSL versions */ #include "openbsd-compat/openssl-compat.h" @@ -64,30 +65,31 @@ u_int key_len; u_int discard_len; const EVP_CIPHER *(*evptype)(void); + u_int fips_allowed; } ciphers[] = { - { "none", SSH_CIPHER_NONE, 8, 0, 0, EVP_enc_null }, - { "des", SSH_CIPHER_DES, 8, 8, 0, EVP_des_cbc }, - { "3des", SSH_CIPHER_3DES, 8, 16, 0, evp_ssh1_3des }, - { "blowfish", SSH_CIPHER_BLOWFISH, 8, 32, 0, evp_ssh1_bf }, - - { "3des-cbc", SSH_CIPHER_SSH2, 8, 24, 0, EVP_des_ede3_cbc }, - { "blowfish-cbc", SSH_CIPHER_SSH2, 8, 16, 0, EVP_bf_cbc }, - { "cast128-cbc", SSH_CIPHER_SSH2, 8, 16, 0, EVP_cast5_cbc }, - { "arcfour", SSH_CIPHER_SSH2, 8, 16, 0, EVP_rc4 }, - { "arcfour128", SSH_CIPHER_SSH2, 8, 16, 1536, EVP_rc4 }, - { "arcfour256", SSH_CIPHER_SSH2, 8, 32, 1536, EVP_rc4 }, - { "aes128-cbc", SSH_CIPHER_SSH2, 16, 16, 0, EVP_aes_128_cbc }, - { "aes192-cbc", SSH_CIPHER_SSH2, 16, 24, 0, EVP_aes_192_cbc }, - { "aes256-cbc", SSH_CIPHER_SSH2, 16, 32, 0, EVP_aes_256_cbc }, + { "none", SSH_CIPHER_NONE, 8, 0, 0, EVP_enc_null, 0 }, + { "des", SSH_CIPHER_DES, 8, 8, 0, EVP_des_cbc, 0 }, + { "3des", SSH_CIPHER_3DES, 8, 16, 0, evp_ssh1_3des, 0 }, + { "blowfish", SSH_CIPHER_BLOWFISH, 8, 32, 0, evp_ssh1_bf, 0 }, + + { "3des-cbc", SSH_CIPHER_SSH2, 8, 24, 0, EVP_des_ede3_cbc, 1 }, + { "blowfish-cbc", SSH_CIPHER_SSH2, 8, 16, 0, EVP_bf_cbc, 0 }, + { "cast128-cbc", SSH_CIPHER_SSH2, 8, 16, 0, EVP_cast5_cbc, 0 }, + { "arcfour", SSH_CIPHER_SSH2, 8, 16, 0, EVP_rc4, 0 }, + { "arcfour128", SSH_CIPHER_SSH2, 8, 16, 1536, EVP_rc4, 0 }, + { "arcfour256", SSH_CIPHER_SSH2, 8, 32, 1536, EVP_rc4, 0 }, + { "aes128-cbc", SSH_CIPHER_SSH2, 16, 16, 0, EVP_aes_128_cbc, 1 }, + { "aes192-cbc", SSH_CIPHER_SSH2, 16, 24, 0, EVP_aes_192_cbc, 1 }, + { "aes256-cbc", SSH_CIPHER_SSH2, 16, 32, 0, EVP_aes_256_cbc, 1 }, { "rijndael-cbc at lysator.liu.se", - SSH_CIPHER_SSH2, 16, 32, 0, EVP_aes_256_cbc }, - { "aes128-ctr", SSH_CIPHER_SSH2, 16, 16, 0, evp_aes_128_ctr }, - { "aes192-ctr", SSH_CIPHER_SSH2, 16, 24, 0, evp_aes_128_ctr }, - { "aes256-ctr", SSH_CIPHER_SSH2, 16, 32, 0, evp_aes_128_ctr }, + SSH_CIPHER_SSH2, 16, 32, 0, EVP_aes_256_cbc, 0 }, + { "aes128-ctr", SSH_CIPHER_SSH2, 16, 16, 0, evp_aes_128_ctr, 1 }, + { "aes192-ctr", SSH_CIPHER_SSH2, 16, 24, 0, evp_aes_128_ctr, 1 }, + { "aes256-ctr", SSH_CIPHER_SSH2, 16, 32, 0, evp_aes_128_ctr, 1 }, #ifdef USE_CIPHER_ACSS - { "acss at openssh.org", SSH_CIPHER_SSH2, 16, 5, 0, EVP_acss }, + { "acss at openssh.org", SSH_CIPHER_SSH2, 16, 5, 0, EVP_acss, 0 }, #endif - { NULL, SSH_CIPHER_INVALID, 0, 0, 0, NULL } + { NULL, SSH_CIPHER_INVALID, 0, 0, 0, NULL, 0 } }; /*--*/ @@ -156,6 +158,13 @@ for ((p = strsep(&cp, CIPHER_SEP)); p && *p != '\0'; (p = strsep(&cp, CIPHER_SEP))) { c = cipher_by_name(p); +#ifdef OPENSSL_FIPS + if (fips_mode && !(c->fips_allowed)) { + debug("cipher %s disallowed in FIPS mode [%s]", p, names); + xfree(cipher_list); + return 0; + } +#endif if (c == NULL || c->number != SSH_CIPHER_SSH2) { debug("bad cipher %s [%s]", p, names); xfree(cipher_list); @@ -291,9 +300,25 @@ cipher_set_key_string(CipherContext *cc, Cipher *cipher, const char *passphrase, int do_encrypt) { +#ifdef OPENSSL_FIPS + SHA_CTX sha; +#endif MD5_CTX md; - u_char digest[16]; + u_char digest[20]; +#ifdef OPENSSL_FIPS + if (fips_mode) { + SHA1_Init(&sha); + SHA1_Update(&sha, (const u_char *)passphrase, strlen(passphrase)); + SHA1_Final(digest, &sha); + + cipher_init(cc, cipher, digest, 20, NULL, 0, do_encrypt); + + memset(digest, 0, sizeof(digest)); + memset(&sha, 0, sizeof(sha)); + return; + } +#endif MD5_Init(&md); MD5_Update(&md, (const u_char *)passphrase, strlen(passphrase)); MD5_Final(digest, &md); --- openssh-4.7p1/configure.ac Mon Dec 17 20:25:49 2007 +++ openssh-4.7p1/configure.ac Mon Dec 17 20:29:36 2007 @@ -438,6 +438,7 @@ if test -z "$GCC"; then CFLAGS="$CFLAGS -Ae" fi + HPUX=1 ;; *-*-hpux11*) AC_DEFINE(PAM_SUN_CODEBASE, 1, @@ -449,6 +450,7 @@ AC_DEFINE(USE_BTMP, 1, [Use btmp to log bad logins]) check_for_hpux_broken_getaddrinfo=1 check_for_conflicting_getspnam=1 + HPUX=1 ;; esac @@ -460,6 +462,7 @@ protected password database]) disable_ptmx_check=yes LIBS="$LIBS -lsecpw" + HPUX=1 ;; esac ;; @@ -1768,6 +1771,8 @@ case "$withval" in # Relative paths ./*|../*) withval="`pwd`/$withval" esac + ssldir=$withval + AC_SUBST(ssldir) if test -d "$withval/lib"; then if test -n "${need_dash_r}"; then @@ -2099,6 +2104,34 @@ ) fi + +# Check for OpenSSL FIPS mode +AC_ARG_WITH(fips, + [ --with-fips Enable OpenSSL FIPS mode ], + [ + if test "x$withval" != "xno" ; then + AC_CACHE_CHECK([for FIPS mode], ac_cv_fips, [ + AC_TRY_COMPILE( + [ #include ], + [ FIPS_mode_set(1); ], + [ ac_cv_fips="yes" ], + [ ac_cv_fips="no" ] + ) + ]) + fi + ] +) +if test "x$ac_cv_fips" = "xyes" ; then + CPPFLAGS="$CPPFLAGS -DOPENSSL_FIPS" + if test "x$HPUX" = "x" ; then + LIBS=`echo $LIBS | sed 's/-lcrypto /-Wl,-Bstatic -lcrypto -Wl,-Bdynamic /'` + else + LIBS=`echo $LIBS | sed 's/-lcrypto /-Wl,-aarchive -lcrypto -Wl,-adefault /'` + fi + FIPS_MODE=yes + AC_SUBST(FIPS_MODE) +fi + # Do we want to force the use of the rand helper? AC_ARG_WITH(rand-helper, [ --with-rand-helper Use subprocess to gather strong randomness ], diff -u -r1.1 -r1.3 --- openssh-4.7p1/mac.c Mon Dec 17 20:59:35 2007 +++ openssh-4.7p1/mac.c Mon Dec 17 21:01:42 2007 @@ -41,5 +41,6 @@ #include "kex.h" #include "mac.h" #include "misc.h" +#include "fips.h" #include "umac.h" @@ -54,15 +55,16 @@ int truncatebits; /* truncate digest if != 0 */ int key_len; /* just for UMAC */ int len; /* just for UMAC */ + int fips_allowed; } macs[] = { - { "hmac-sha1", SSH_EVP, EVP_sha1, 0, -1, -1 }, - { "hmac-sha1-96", SSH_EVP, EVP_sha1, 96, -1, -1 }, - { "hmac-md5", SSH_EVP, EVP_md5, 0, -1, -1 }, - { "hmac-md5-96", SSH_EVP, EVP_md5, 96, -1, -1 }, - { "hmac-ripemd160", SSH_EVP, EVP_ripemd160, 0, -1, -1 }, - { "hmac-ripemd160 at openssh.com", SSH_EVP, EVP_ripemd160, 0, -1, -1 }, - { "umac-64 at openssh.com", SSH_UMAC, NULL, 0, 128, 64 }, - { NULL, 0, NULL, 0, -1, -1 } + { "hmac-sha1", SSH_EVP, EVP_sha1, 0, -1, -1, 1 }, + { "hmac-sha1-96", SSH_EVP, EVP_sha1, 96, -1, -1, 1 }, + { "hmac-md5", SSH_EVP, EVP_md5, 0, -1, -1, 0 }, + { "hmac-md5-96", SSH_EVP, EVP_md5, 96, -1, -1, 0 }, + { "hmac-ripemd160", SSH_EVP, EVP_ripemd160, 0, -1, -1, 0 }, + { "hmac-ripemd160 at openssh.com", SSH_EVP, EVP_ripemd160, 0, -1, -1, 0 }, + { "umac-64 at openssh.com", SSH_UMAC, NULL, 0, 128, 64, 0 }, + { NULL, 0, NULL, 0, -1, -1, 0 } }; static void @@ -91,6 +93,12 @@ for (i = 0; macs[i].name; i++) { if (strcmp(name, macs[i].name) == 0) { +#ifdef OPENSSL_FIPS + if (fips_mode && !macs[i].fips_allowed) { + debug2("mac_init: %s disallowed in fips mode", name); + return (-1); + } +#endif if (mac != NULL) mac_setup_by_id(mac, i); debug2("mac_setup: found %s", name); --- openssh-4.7p1/Makefile.in Tue Dec 18 02:42:38 2007 +++ openssh-4.7p1/Makefile.in Tue Dec 18 02:42:21 2007 @@ -18,6 +18,7 @@ piddir=@piddir@ srcdir=@srcdir@ top_srcdir=@top_srcdir@ +ssldir=@ssldir@ DESTDIR= VPATH=@srcdir@ @@ -29,6 +30,7 @@ PRIVSEP_PATH=@PRIVSEP_PATH@ SSH_PRIVSEP_USER=@SSH_PRIVSEP_USER@ STRIP_OPT=@STRIP_OPT@ +FIPS_MODE=@FIPS_MODE@ PATHS= -DSSHDIR=\"$(sysconfdir)\" \ -D_PATH_SSH_PROGRAM=\"$(SSH_PROGRAM)\" \ @@ -252,12 +254,18 @@ $(srcdir)/mkinstalldirs $(DESTDIR)$(libexecdir) (umask 022 ; $(srcdir)/mkinstalldirs $(DESTDIR)$(PRIVSEP_PATH)) $(INSTALL) -m 0755 $(STRIP_OPT) ssh $(DESTDIR)$(bindir)/ssh + if [ ! -z "FIPS_MODE" ]; then \ + $(INSTALL) -m 0755 $(STRIP_OPT) ssh $(DESTDIR)$(bindir)/ssh.sha1; \ + fi $(INSTALL) -m 0755 $(STRIP_OPT) scp $(DESTDIR)$(bindir)/scp $(INSTALL) -m 0755 $(STRIP_OPT) ssh-add $(DESTDIR)$(bindir)/ssh-add $(INSTALL) -m 0755 $(STRIP_OPT) ssh-agent $(DESTDIR)$(bindir)/ssh-agent $(INSTALL) -m 0755 $(STRIP_OPT) ssh-keygen $(DESTDIR)$(bindir)/ssh-keygen $(INSTALL) -m 0755 $(STRIP_OPT) ssh-keyscan $(DESTDIR)$(bindir)/ssh-keyscan $(INSTALL) -m 0755 $(STRIP_OPT) sshd $(DESTDIR)$(sbindir)/sshd + if [ ! -z "FIPS_MODE" ]; then \ + $(INSTALL) -m 0755 $(STRIP_OPT) sshd $(DESTDIR)$(bindir)/sshd.sha1; \ + fi if test ! -z "$(INSTALL_SSH_RAND_HELPER)" ; then \ $(INSTALL) -m 0755 $(STRIP_OPT) ssh-rand-helper $(DESTDIR)$(libexecdir)/ssh-rand-helper ; \ fi diff -u -r1.1 -r1.3 --- openssh-4.7p1/myproposal.h Mon Dec 17 21:07:18 2007 +++ openssh-4.7p1/myproposal.h Mon Dec 17 21:09:50 2007 @@ -41,6 +41,7 @@ #endif #define KEX_DEFAULT_PK_ALG "ssh-rsa,ssh-dss" +#ifndef OPENSSL_FIPS #define KEX_DEFAULT_ENCRYPT \ "aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc," \ "arcfour128,arcfour256,arcfour," \ @@ -50,6 +51,16 @@ "hmac-md5,hmac-sha1,umac-64 at openssh.com,hmac-ripemd160," \ "hmac-ripemd160 at openssh.com," \ "hmac-sha1-96,hmac-md5-96" +#else + #define KEX_DEFAULT_ENCRYPT \ + "aes128-cbc,3des-cbc," \ + "aes192-cbc,aes256-cbc,rijndael-cbc at lysator.liu.se," \ + "aes128-ctr,aes192-ctr,aes256-ctr" + #define KEX_DEFAULT_MAC \ + "hmac-sha1," \ + "hmac-sha1-96" +#endif + #define KEX_DEFAULT_COMP "none,zlib at openssh.com,zlib" #define KEX_DEFAULT_LANG "" --- openssh-4.7p1/readconf.h Mon Dec 17 03:35:58 2007 +++ openssh-4.7p1/readconf.h Mon Dec 17 03:53:57 2007 @@ -120,6 +120,7 @@ char *local_command; int permit_local_command; + int fips_mode; } Options; --- openssh-4.7p1/servconf.h Mon Dec 17 04:25:51 2007 +++ openssh-4.7p1/servconf.h Mon Dec 17 04:26:31 2007 @@ -141,6 +141,7 @@ int permit_tun; int num_permitted_opens; + int fips_mode; } ServerOptions; void initialize_server_options(ServerOptions *); --- openssh-4.7p1/readconf.c Mon Dec 17 03:46:49 2007 +++ openssh-4.7p1/readconf.c Fri Dec 21 15:40:50 2007 @@ -130,6 +130,7 @@ oServerAliveInterval, oServerAliveCountMax, oIdentitiesOnly, oSendEnv, oControlPath, oControlMaster, oHashKnownHosts, oTunnel, oTunnelDevice, oLocalCommand, oPermitLocalCommand, + oFipsMode, oDeprecated, oUnsupported } OpCodes; @@ -226,6 +227,7 @@ { "tunneldevice", oTunnelDevice }, { "localcommand", oLocalCommand }, { "permitlocalcommand", oPermitLocalCommand }, + { "fipsmode", oFipsMode}, { NULL, oBadOption } }; @@ -915,6 +917,10 @@ intptr = &options->permit_local_command; goto parse_flag; + case oFipsMode: + intptr = &options->fips_mode; + goto parse_flag; + case oDeprecated: debug("%s line %d: Deprecated option \"%s\"", filename, linenum, keyword); @@ -1065,6 +1071,7 @@ options->tun_remote = -1; options->local_command = NULL; options->permit_local_command = -1; + options->fips_mode = -1; } /* @@ -1132,9 +1139,9 @@ /* Selected in ssh_login(). */ if (options->cipher == -1) options->cipher = SSH_CIPHER_NOT_SET; - /* options->ciphers, default set in myproposals.h */ - /* options->macs, default set in myproposals.h */ - /* options->hostkeyalgorithms, default set in myproposals.h */ + /* options->ciphers, default set in myproposal.h */ + /* options->macs, default set in myproposal.h */ + /* options->hostkeyalgorithms, default set in myproposal.h */ if (options->protocol == SSH_PROTO_UNKNOWN) options->protocol = SSH_PROTO_1|SSH_PROTO_2; if (options->num_identity_files == 0) { @@ -1199,6 +1206,10 @@ options->tun_remote = SSH_TUNID_ANY; if (options->permit_local_command == -1) options->permit_local_command = 0; + if (options->fips_mode == -1) + options->fips_mode = 0; + if (options->fips_mode && options->macs == NULL) + options->macs = "hmac-sha1,hmac-sha1-96"; /* options->local_command should not be set by default */ /* options->proxy_command should not be set by default */ /* options->user will be set in the main program if appropriate */ --- openssh-4.7p1/servconf.c Mon Dec 17 04:25:51 2007 +++ openssh-4.7p1/servconf.c Fri Dec 21 15:59:15 2007 @@ -104,7 +104,11 @@ options->num_allow_groups = 0; options->num_deny_groups = 0; options->ciphers = NULL; +#ifdef OPENSSL_FIPS + options->macs = "hmac-sha1,hmac-sha1-96"; +#else options->macs = NULL; +#endif options->protocol = SSH_PROTO_UNKNOWN; options->gateway_ports = -1; options->num_subsystems = 0; @@ -122,8 +126,10 @@ options->permit_tun = -1; options->num_permitted_opens = -1; options->adm_forced_command = NULL; + options->fips_mode = -1; } + void fill_default_server_options(ServerOptions *options) { @@ -249,6 +255,8 @@ options->authorized_keys_file = _PATH_SSH_USER_PERMITTED_KEYS; if (options->permit_tun == -1) options->permit_tun = SSH_TUNMODE_NO; + if (options->fips_mode == -1) + options->fips_mode = 0; /* Turn privilege separation on by default */ if (use_privsep == -1) @@ -293,6 +301,7 @@ sGssAuthentication, sGssCleanupCreds, sAcceptEnv, sPermitTunnel, sMatch, sPermitOpen, sForceCommand, sUsePrivilegeSeparation, + sFipsMode, sDeprecated, sUnsupported } ServerOpCodes; @@ -403,6 +412,7 @@ { "match", sMatch, SSHCFG_ALL }, { "permitopen", sPermitOpen, SSHCFG_ALL }, { "forcecommand", sForceCommand, SSHCFG_ALL }, + { "fipsmode", sFipsMode, SSHCFG_GLOBAL }, { NULL, sBadOption, 0 } }; @@ -1253,6 +1263,10 @@ options->adm_forced_command = xstrdup(cp + len); return 0; + case sFipsMode: + intptr = &options->fips_mode; + goto parse_flag; + case sDeprecated: logit("%s line %d: Deprecated option %s", filename, linenum, arg); --- openssh-4.7p1/ssh.c Mon Dec 17 03:23:08 2007 +++ openssh-4.7p1/ssh.c Fri Dec 21 15:55:04 2007 @@ -72,6 +72,11 @@ #include #include +#ifdef OPENSSL_FIPS +#include +#include +#include +#endif #include "xmalloc.h" #include "ssh.h" @@ -100,6 +105,16 @@ #include "monitor_fdpass.h" #include "uidswap.h" #include "version.h" +#include "fips.h" + +/* + * FIPS mode operation +*/ +#ifdef OPENSSL_FIPS + int fips_mode = 1; //refined later +#else + int fips_mode = 0; +#endif #ifdef SMARTCARD #include "scard.h" @@ -180,12 +195,17 @@ u_int control_server_pid = 0; /* Prints a help message to the user. This function never returns. */ +#ifdef OPENSSL_FIPS +# define FIPS_OPTS "y" +#else +# define FIPS_OPTS +#endif static void usage(void) { fprintf(stderr, -"usage: ssh [-1246AaCfgKkMNnqsTtVvXxY] [-b bind_address] [-c cipher_spec]\n" +"usage: ssh [-1246AaCfgKkMNnqsTtVvXx" FIPS_OPTS "Y] [-b bind_address] [-c cipher_spec]\n" " [-D [bind_address:]port] [-e escape_char] [-F configfile]\n" " [-i identity_file] [-L [bind_address:]port:host:hostport]\n" " [-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port]\n" @@ -272,8 +292,13 @@ again: while ((opt = getopt(ac, av, - "1246ab:c:e:fgi:kl:m:no:p:qstvxACD:F:I:KL:MNO:PR:S:TVw:XY")) != -1) { + "1246ab:c:e:fgi:kl:m:no:p:qstvxACD:F:I:KL:MNO:PR:S:TVw:X" FIPS_OPTS "Y")) != -1) { switch (opt) { +#ifdef OPENSSL_FIPS + case 'y': + fips_mode = 0; + break; +#endif case '1': options.protocol = SSH_PROTO_1; break; @@ -637,6 +662,36 @@ log_init(av[0], options.log_level, SYSLOG_FACILITY_USER, 1); seed_rng(); +#ifdef OPENSSL_FIPS +/* + Priority setting: + !command line + env OPENSSH_FIPS + !env OPENSSH_NO_FIPS + ssh_config options (default: false) +*/ + if (fips_mode) { /* !command line */ + if (getenv("OPENSSH_FIPS")) { /* env OPENSSH_FIPS */ + } + else if (getenv("OPENSSH_NO_FIPS")) { /* !env OPENSSH_NO_FIPS */ + fips_mode = 0; + } + else if (options.fips_mode == 0) { /* ssh_config options */ + fips_mode = 0; + } + } + if(fips_mode) + { + if(!FIPS_mode_set(1)) + { + ERR_load_crypto_strings(); + ERR_print_errors_fp(stderr); + exit(1); + } + else + fprintf(stderr,"*** IN FIPS MODE ***\n"); + } +#endif if (options.user == NULL) options.user = xstrdup(pw->pw_name); From stuge-openssh-unix-dev at cdy.org Tue Apr 22 07:45:29 2008 From: stuge-openssh-unix-dev at cdy.org (Peter Stuge) Date: Mon, 21 Apr 2008 23:45:29 +0200 Subject: FIPS 140-2 OpenSSL(2007) patches In-Reply-To: <07E688A4439C9C4ABF81C84EFBB342F301649652@TA-SAT.fsd.forescout.com> References: <07E688A4439C9C4ABF81C84EFBB342F301649652@TA-SAT.fsd.forescout.com> Message-ID: <20080421214529.18984.qmail@cdy.org> On Mon, Apr 21, 2008 at 07:08:18PM +0300, Oren Nechushtan wrote: > +#ifdef OPENSSL_FIPS > +// u_int32_t rnd[6], i; > +// u_char* buf=(u_char*)rnd; > + u_char buf[24]; > +#endif .. > +// for (i = 0; i < 6; i++) > +// rnd[i] = arc4random(); > +#endif Not so nice to add so many comments. //Peter From tshipclark at gmail.com Thu Apr 24 02:22:53 2008 From: tshipclark at gmail.com (Terry Shiplcark) Date: Wed, 23 Apr 2008 12:22:53 -0400 Subject: CHANNEL SIZE. Message-ID: <1208967773.10163.8.camel@E214-N-SHIP-L> Recently I updated to Hardy Heron(Ubuntu beta) and with it cam openssh-client 4.7p1. In my environment we have alot of Extreme(www.extremenetworks.com) switch devices which we access via ssh. 4.7p1 would no longer allow me to connect to the switches, however 4.6p1 would. The error I received was. ' channel 0: open failed: resource shortage: Channel open failed' I did some diggin and noticed these two constants where changed between 4.6 and 4.7 #define CHAN_SES_WINDOW_DEFAULT (4*CHAN_SES_PACKET_DEFAULT) #define CHAN_TCP_WINDOW_DEFAULT (4*CHAN_TCP_PACKET_DEFAULT) Changing the new value of 64*, back to 4*, solved the issue. - markus at cvs.openbsd.org 2007/06/11 09:14:00 [channels.h] increase default channel windows; ok djm Its probably an issue with our switches, but that is something I probably cannot get rectified. From djm at mindrot.org Thu Apr 24 12:53:50 2008 From: djm at mindrot.org (Damien Miller) Date: Thu, 24 Apr 2008 12:53:50 +1000 (EST) Subject: CHANNEL SIZE. In-Reply-To: <1208967773.10163.8.camel@E214-N-SHIP-L> References: <1208967773.10163.8.camel@E214-N-SHIP-L> Message-ID: On Wed, 23 Apr 2008, Terry Shiplcark wrote: > Recently I updated to Hardy Heron(Ubuntu beta) and with it cam > openssh-client 4.7p1. In my environment we have alot of > Extreme(www.extremenetworks.com) switch devices which we access via > ssh. > > 4.7p1 would no longer allow me to connect to the switches, however 4.6p1 > would. The error I received was. > > ' channel 0: open failed: resource shortage: Channel open failed' > > I did some diggin and noticed these two constants where changed between > 4.6 and 4.7 > > #define CHAN_SES_WINDOW_DEFAULT (4*CHAN_SES_PACKET_DEFAULT) > #define CHAN_TCP_WINDOW_DEFAULT (4*CHAN_TCP_PACKET_DEFAULT) > > Changing the new value of 64*, back to 4*, solved the issue. > > - markus at cvs.openbsd.org 2007/06/11 09:14:00 > [channels.h] > increase default channel windows; ok djm > > Its probably an issue with our switches, but that is something I > probably cannot get rectified. Please send a full debug trace (from "ssh -vvv ...") - I'm particularly interested in the server banner. It appears in the debug trace like this: debug1: Remote protocol version 2.0, remote software version OpenSSH_5.0 -d From markus.r.friedl at arcor.de Thu Apr 24 17:49:13 2008 From: markus.r.friedl at arcor.de (Markus Friedl) Date: Thu, 24 Apr 2008 09:49:13 +0200 Subject: CHANNEL SIZE. In-Reply-To: <1208967773.10163.8.camel@E214-N-SHIP-L> References: <1208967773.10163.8.camel@E214-N-SHIP-L> Message-ID: <20080424074913.GA18979@folly> On Wed, Apr 23, 2008 at 12:22:53PM -0400, Terry Shiplcark wrote: > 4.7p1 would no longer allow me to connect to the switches, however 4.6p1 > would. The error I received was. > > ' channel 0: open failed: resource shortage: Channel open failed' yes, that's strange. it looks like a bug in the switch since we only increased the size that openssh claims it can receive and not the buffer sizes on the remote side. do you have the ssh version string of the switch? ssh -v prints it as debug1: Remote protocol version X.Y, remote software version ZZZ -m From tshipclark at gmail.com Thu Apr 24 22:50:20 2008 From: tshipclark at gmail.com (Terry Shipclark) Date: Thu, 24 Apr 2008 08:50:20 -0400 Subject: CHANNEL SIZE. In-Reply-To: <20080424074913.GA18979@folly> References: <1208967773.10163.8.camel@E214-N-SHIP-L> <20080424074913.GA18979@folly> Message-ID: debug1: Remote protocol version 2.0, remote software version 4.1.2 SSH Secure Shell Toolkit debug1: no match: 4.1.2 SSH Secure Shell Toolkit debug1: Enabling compatibility mode for protocol 2.0 Is the one that doesnt connect. I did some more testing, and there older hardware on the extremeware platform will still connect. Newer Hardware will not. old hardware debug1: Remote protocol version 2.0, remote software version 2.0.12 (non-commercial) debug1: match: 2.0.12 (non-commercial) pat 2.0.11*,2.0.12* debug1: Enabling compatibility mode for protocol 2.0 Like I stated earlier changing the Default window size back to 4 solved the issue, and everything else works fine. Full DEBUG output is attached On Thu, Apr 24, 2008 at 3:49 AM, Markus Friedl wrote: > On Wed, Apr 23, 2008 at 12:22:53PM -0400, Terry Shiplcark wrote: > > 4.7p1 would no longer allow me to connect to the switches, however 4.6p1 > > would. The error I received was. > > > > ' channel 0: open failed: resource shortage: Channel open failed' > > yes, that's strange. it looks like a bug in the switch since > we only increased the size that openssh claims it can receive > and not the buffer sizes on the remote side. > > do you have the ssh version string of the switch? > > ssh -v prints it as > debug1: Remote protocol version X.Y, remote software version ZZZ > > -m > -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: debug_output.txt Url: http://lists.mindrot.org/pipermail/openssh-unix-dev/attachments/20080424/bf9d2915/attachment.txt From gagnocg at mac.com Sun Apr 27 10:09:10 2008 From: gagnocg at mac.com (Chuck Gagnon) Date: Sat, 26 Apr 2008 19:09:10 -0500 Subject: patch to add utmps support for HP-UX 11.23 and above Message-ID: <200E9CCA-5B85-45A1-93B6-4D9B54D36B89@mac.com> Starting with 11.23 HP is using utmps as if we didn't already have enough (utmp, wtmp, utmpx, wtmpx,... did I miss any??) . Anyway, I added support for it in (before this patch no logins from ssh were showing up on my 11.23 and 11.31 systems). http://homepage.mac.com/gagnocg/downloads/hpux-cvs.diff From oren at forescout.com Mon Apr 28 19:08:36 2008 From: oren at forescout.com (Oren Nechushtan) Date: Mon, 28 Apr 2008 12:08:36 +0300 Subject: FIPS 140-2 OpenSSL(2007) patches Message-ID: <07E688A4439C9C4ABF81C84EFBB342F301649818@TA-SAT.fsd.forescout.com> Part 2 --- openssh-4.7p1/sshd.c Mon Dec 31 05:14:10 2007 +++ openssh-4.7p1/sshd.c Mon Dec 31 17:25:36 2007 @@ -75,6 +75,12 @@ #include #include #include +#ifdef OPENSSL_FIPS +#include +#include +#include +#endif + #ifdef HAVE_SECUREWARE #include #include @@ -136,6 +142,14 @@ extern char *__progname; +/* FIPS mode operation indicator */ +#ifdef OPENSSL_FIPS + int fips_mode = 1; //refined later +#else + int fips_mode = 0; +#endif + + /* Server configuration options. */ ServerOptions options; @@ -419,7 +433,11 @@ major = PROTOCOL_MAJOR_1; minor = PROTOCOL_MINOR_1; } +#ifndef OPENSSL_FIPS snprintf(buf, sizeof buf, "SSH-%d.%d-%.100s\n", major, minor, SSH_VERSION); +#else + snprintf(buf, sizeof buf, "SSH-%d.%d-%.100s FIPS\n", major, minor, SSH_VERSION); +#endif server_version_string = xstrdup(buf); /* Send our protocol version identification. */ @@ -582,15 +600,24 @@ privsep_preauth_child(void) { u_int32_t rnd[256]; + u_char* buf=(u_char*)rnd; gid_t gidset[1]; int i; /* Enable challenge-response authentication for privilege separation */ privsep_challenge_enable(); +#ifndef OPENSSL_FIPS for (i = 0; i < 256; i++) rnd[i] = arc4random(); RAND_seed(rnd, sizeof(rnd)); +#else + for (i = 0; i < 6; i++) + rnd[i] = arc4random(); + FIPS_set_prng_key(buf,buf+8); + FIPS_rand_seed(buf+16,8); + debug2("FIPS rand reseeded"); +#endif /* Demote the private keys to public keys. */ demote_sensitive_data(); @@ -621,12 +648,22 @@ { int status; pid_t pid; +#ifdef OPENSSL_FIPS + u_char buf[24]; +#endif /* Set up unprivileged child process to deal with network data */ pmonitor = monitor_init(); /* Store a pointer to the kex for later rekeying */ pmonitor->m_pkex = &xxx_kex; +#ifdef OPENSSL_FIPS + if(RAND_bytes(buf,sizeof buf) <= 0) { + ERR_load_crypto_strings(); + ERR_print_errors_fp(stderr); + fatal("privsep_preauth: RAND_bytes failed"); + } +#endif pid = fork(); if (pid == -1) { fatal("fork of unprivileged child failed"); @@ -648,6 +685,13 @@ return (1); } else { /* child */ +#ifdef OPENSSL_FIPS + FIPS_rand_method()->cleanup(); + /* Always automagically seed PRNG */ + FIPS_set_prng_key(buf,buf+8); + FIPS_rand_seed(buf+16,8); + debug2("FIPS rand reseeded"); +#endif close(pmonitor->m_sendfd); @@ -662,6 +706,9 @@ static void privsep_postauth(Authctxt *authctxt) { +#ifdef OPENSSL_FIPS + u_char buf[24]; +#endif #ifdef DISABLE_FD_PASSING if (1) { #else @@ -675,6 +722,13 @@ /* New socket pair */ monitor_reinit(pmonitor); +#ifdef OPENSSL_FIPS + if(RAND_bytes(buf,sizeof buf) <= 0) { + ERR_load_crypto_strings(); + ERR_print_errors_fp(stderr); + fatal("privsep_postauth: RAND_bytes failed"); + } +#endif pmonitor->m_pid = fork(); if (pmonitor->m_pid == -1) fatal("fork of unprivileged child failed"); @@ -687,7 +741,13 @@ /* NEVERREACHED */ exit(0); } - +#ifdef OPENSSL_FIPS + FIPS_rand_method()->cleanup(); + /* Always automagically seed PRNG */ + FIPS_set_prng_key(buf,buf+8); + FIPS_rand_seed(buf+16,8); + debug2("FIPS rand reseeded"); +#endif close(pmonitor->m_sendfd); /* Demote the private keys to public keys. */ @@ -1015,6 +1075,9 @@ struct sockaddr_storage from; socklen_t fromlen; pid_t pid; +#ifdef OPENSSL_FIPS + u_char buf[24]; +#endif /* setup fd set for accept */ fdset = NULL; @@ -1147,6 +1210,13 @@ break; } +#ifdef OPENSSL_FIPS + if(RAND_bytes(buf,sizeof buf) <= 0) { + ERR_load_crypto_strings(); + ERR_print_errors_fp(stderr); + fatal("server_accept_loop: RAND_bytes failed"); + } +#endif /* * Normal production daemon. Fork, and have * the child process the connection. The @@ -1163,6 +1233,13 @@ * the connection. */ platform_post_fork_child(); +#ifdef OPENSSL_FIPS + FIPS_rand_method()->cleanup(); + /* Always automagically seed PRNG */ + FIPS_set_prng_key(buf,buf+8); + FIPS_rand_seed(buf+16,8); + debug2("FIPS rand reseeded"); +#endif startup_pipe = startup_p[1]; close_startup_pipes(); close_listen_socks(); @@ -1421,6 +1498,36 @@ /* Fill in default values for those options not explicitly set. */ fill_default_server_options(&options); +#ifdef OPENSSL_FIPS +/* + Priority setting: + env OPENSSH_FIPS + !env OPENSSH_NO_FIPS + sshd_config options (default: false) +*/ + if (fips_mode) { + if (getenv("OPENSSH_FIPS")) { /* env OPENSSH_FIPS */ + } + else if (getenv("OPENSSH_NO_FIPS")) { /* !env OPENSSH_NO_FIPS */ + fips_mode = 0; + } + else if (options.fips_mode == 0) { /* sshd_config options */ + fips_mode = 0; + } + } + if(fips_mode) + { + if(!FIPS_mode_set(1)) + { + ERR_load_crypto_strings(); + ERR_print_errors_fp(stderr); + exit(1); + } + else + fprintf(stderr,"*** IN FIPS MODE ***\n"); + } +#endif + /* challenge-response is implemented via keyboard interactive */ if (options.challenge_response_authentication) options.kbd_interactive_authentication = 1; @@ -1572,9 +1679,24 @@ #ifdef TIOCNOTTY int fd; #endif /* TIOCNOTTY */ +#ifdef OPENSSL_FIPS + u_char buf[24]; + if(RAND_bytes(buf,sizeof buf) <= 0) { + ERR_load_crypto_strings(); + ERR_print_errors_fp(stderr); + fatal("privsep_preauth: RAND_bytes failed"); + } +#endif if (daemon(0, 0) < 0) fatal("daemon() failed: %.200s", strerror(errno)); +#ifdef OPENSSL_FIPS + FIPS_rand_method()->cleanup(); + /* Always automagically seed PRNG */ + FIPS_set_prng_key(buf,buf+8); + FIPS_rand_seed(buf+16,8); + debug2("FIPS rand reseeded"); +#endif /* Disconnect from the controlling tty. */ #ifdef TIOCNOTTY fd = open(_PATH_TTY, O_RDWR | O_NOCTTY); --- openssh-4.7p1/ssh-keygen.c Tue Dec 18 02:43:34 2007 +++ openssh-4.7p1/ssh-keygen.c Wed Dec 26 17:38:59 2007 @@ -47,6 +47,14 @@ #include "match.h" #include "hostfile.h" #include "dns.h" +#include "fips.h" + +/* + * FIPS mode operation +*/ +#ifdef OPENSSL_FIPS + int fips_mode = 0; +#endif #ifdef SMARTCARD #include "scard.h" @@ -1067,6 +1075,14 @@ extern int optind; extern char *optarg; + enum fp_type dgst_type = SSH_FP_MD5; +#ifdef OPENSSL_FIPS + if (getenv("OPENSSH_FIPS")) fips_mode = 1; + if (fips_mode) { + dgst_type = SSH_FP_SHA1; + } +#endif + /* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */ sanitise_stdfd(); @@ -1435,7 +1451,7 @@ fclose(f); if (!quiet) { - char *fp = key_fingerprint(public, SSH_FP_MD5, SSH_FP_HEX); + char *fp = key_fingerprint(public, dgst_type, SSH_FP_HEX); printf("Your public key has been saved in %s.\n", identity_file); printf("The key fingerprint is:\n"); --- openssh-4.7p1/ssh-keysign.c Tue Dec 18 02:43:37 2007 +++ openssh-4.7p1/ssh-keysign.c Wed Dec 26 18:07:17 2007 @@ -52,6 +52,15 @@ #include "pathnames.h" #include "readconf.h" #include "uidswap.h" +#include "fips.h" + +/* + * FIPS operational mode +*/ +#ifdef OPENSSL_FIPS + int fips_mode = 0; +#endif + /* XXX readconf.c needs these */ uid_t original_real_uid; @@ -158,6 +167,10 @@ u_int slen, dlen; u_int32_t rnd[256]; +#ifdef OPENSSL_FIPS + if ( getenv("OPENSSH_FIPS") ) fips_mode = 1; +#endif + /* Ensure that stdin and stdout are connected */ if ((fd = open(_PATH_DEVNULL, O_RDWR)) < 2) exit(1); --- openssh-4.7p1/ssh-keyscan.c Tue Dec 18 02:43:36 2007 +++ openssh-4.7p1/ssh-keyscan.c Wed Dec 26 18:05:15 2007 @@ -45,6 +45,14 @@ #include "atomicio.h" #include "misc.h" #include "hostfile.h" +#include "fips.h" + +/* + * FIPS mode operation +*/ +#ifdef OPENSSL_FIPS + int fips_mode = 0; +#endif /* Flag indicating whether IPv4 or IPv6. This can be set on the command line. Default value is AF_UNSPEC means both IPv4 and IPv6. */ @@ -729,6 +737,10 @@ extern int optind; extern char *optarg; +#ifdef OPENSSL_FIPS + if (getenv("OPENSSH_FIPS")) fips_mode = 1; +#endif + __progname = ssh_get_progname(argv[0]); init_rng(); seed_rng(); --- openssh-4.7p1/fips.h Tue Dec 18 03:32:54 2007 +++ openssh-4.7p1/fips.h Tue Dec 18 03:30:50 2007 @@ -0,0 +1,3 @@ +/* $OpenBSD: version.h,v 1.40 2004/02/23 15:16:46 markus Exp $ */ + +extern int fips_mode; --- openssh-4.7p1/openbsd-compat/bsd-arc4random.c Thu Dec 20 13:04:50 2007 +++ openssh-4.7p1/openbsd-compat/bsd-arc4random.c Thu Dec 20 16:39:10 2007 @@ -29,6 +29,11 @@ #include #include +#ifdef OPENSSL_FIPS +#include "fips.h" +#endif + + /* Size of key to use */ #define SEED_SIZE 20 @@ -45,13 +50,27 @@ static int first_time = 1; if (rc4_ready <= 0) { +#ifndef OPENSSL_FIPS if (first_time) seed_rng(); +#endif first_time = 0; arc4random_stir(); } - RC4(&rc4, sizeof(r), (unsigned char *)&r, (unsigned char *)&r); +#ifdef OPENSSL_FIPS + if (fips_mode) { + if (RAND_bytes(&r,sizeof(r)) <= 0) { + ERR_load_crypto_strings(); + ERR_print_errors_fp(stderr); + return 1/0; + } + rc4_ready -= sizeof(r); + + return(r); + } +#endif + RC4(&rc4, sizeof(r), (unsigned char *)&r, (unsigned char *)&r); rc4_ready -= sizeof(r); @@ -64,6 +83,13 @@ unsigned char rand_buf[SEED_SIZE]; int i; +#ifdef OPENSSL_FIPS + if (fips_mode) { + rc4_ready = REKEY_BYTES; + return; + } +#endif + memset(&rc4, 0, sizeof(rc4)); if (RAND_bytes(rand_buf, sizeof(rand_buf)) <= 0) fatal("Couldn't obtain random bytes (error %ld)", --- openssh-4.7p1/ssh-rand-helper.c Thu Dec 20 13:15:00 2007 +++ openssh-4.7p1/ssh-rand-helper.c Wed Dec 26 18:10:50 2007 @@ -62,6 +62,14 @@ #include "atomicio.h" #include "pathnames.h" #include "log.h" +#include "fips.h" + +/* + * FIPS operational mode +*/ +#ifdef OPENSSL_FIPS + int fips_mode = 0; +#endif /* Number of bytes we write out */ #define OUTPUT_SEED_SIZE 48 @@ -820,6 +828,10 @@ extern char *optarg; LogLevel ll; +#ifdef OPENSSL_FIPS + if ( getenv("OPENSSH_FIPS") ) fips_mode = 1; +#endif + __progname = ssh_get_progname(argv[0]); log_init(argv[0], SYSLOG_LEVEL_INFO, SYSLOG_FACILITY_USER, 1); --- openssh-4.7p1/buffer.c Thu Dec 20 12:55:07 2007 +++ openssh-4.7p1/buffer.c Thu Dec 20 12:55:38 2007 @@ -175,7 +175,8 @@ len, buffer->end - buffer->offset); return (-1); } - memcpy(buf, buffer->buf + buffer->offset, len); + if (len > 0) + memcpy(buf, buffer->buf + buffer->offset, len); buffer->offset += len; return (0); } --- openssh-4.7p1/sshconnect.c Thu Dec 20 15:23:57 2007 +++ openssh-4.7p1/sshconnect.c Thu Dec 20 15:40:26 2007 @@ -57,6 +57,7 @@ #include "misc.h" #include "dns.h" #include "version.h" +#include "fips.h" char *client_version_string = NULL; char *server_version_string = NULL; @@ -545,6 +546,12 @@ char msg[1024]; int len, host_line, ip_line; const char *host_file = NULL, *ip_file = NULL; + enum fp_type dgst_type = SSH_FP_MD5; +#ifdef OPENSSL_FIPS + if (fips_mode) { + dgst_type = SSH_FP_SHA1; + } +#endif /* * Force accepting of the host key for loopback/localhost. The @@ -708,7 +735,7 @@ else snprintf(msg1, sizeof(msg1), "."); /* The default */ - fp = key_fingerprint(host_key, SSH_FP_MD5, SSH_FP_HEX); + fp = key_fingerprint(host_key, dgst_type, SSH_FP_HEX); msg2[0] = '\0'; if (options.verify_host_key_dns) { if (matching_host_key_dns) @@ -999,11 +1006,17 @@ Key *found; char *fp; int line, ret; + enum fp_type dgst_type = SSH_FP_MD5; +#ifdef OPENSSL_FIPS + if (fips_mode) { + dgst_type = SSH_FP_SHA1; + } +#endif found = key_new(keytype); if ((ret = lookup_key_in_hostfile_by_type(file, host, keytype, found, &line))) { - fp = key_fingerprint(found, SSH_FP_MD5, SSH_FP_HEX); + fp = key_fingerprint(found, dgst_type, SSH_FP_HEX); logit("WARNING: %s key found for host %s\n" "in %s:%d\n" "%s key fingerprint %s.", @@ -1053,8 +1086,14 @@ { char *fp; const char *type = key_type(host_key); + enum fp_type dgst_type = SSH_FP_MD5; +#ifdef OPENSSL_FIPS + if (fips_mode) { + dgst_type = SSH_FP_SHA1; + } +#endif - fp = key_fingerprint(host_key, SSH_FP_MD5, SSH_FP_HEX); + fp = key_fingerprint(host_key, dgst_type, SSH_FP_HEX); error("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"); error("@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @"); --- openssh-4.7p1/sshconnect2.c Mon Dec 24 13:14:28 2007 +++ openssh-4.7p1/sshconnect2.c Mon Dec 24 13:17:06 2007 @@ -64,6 +64,7 @@ #include "msg.h" #include "pathnames.h" #include "uidswap.h" +#include "fips.h" #ifdef GSSAPI #include "ssh-gss.h" @@ -433,6 +434,12 @@ u_int alen, blen; char *pkalg, *fp; u_char *pkblob; + enum fp_type dgst_type = SSH_FP_MD5; +#ifdef OPENSSL_FIPS + if (fips_mode) { + dgst_type = SSH_FP_SHA1; + } +#endif if (authctxt == NULL) fatal("input_userauth_pk_ok: no authentication context"); @@ -466,7 +473,7 @@ key->type, pktype); goto done; } - fp = key_fingerprint(key, SSH_FP_MD5, SSH_FP_HEX); + fp = key_fingerprint(key, dgst_type, SSH_FP_HEX); debug2("input_userauth_pk_ok: fp %s", fp); xfree(fp); --- openssh-4.7p1/auth2-pubkey.c Thu Dec 20 15:18:22 2007 +++ openssh-4.7p1/auth2-pubkey.c Sun Dec 23 21:42:40 2007 @@ -52,6 +52,9 @@ #endif #include "monitor_wrap.h" #include "misc.h" +#ifdef OPENSSL_FIPS +#include "fips.h" +#endif /* import */ extern ServerOptions options; @@ -186,6 +189,14 @@ struct stat st; Key *found; char *fp; + enum fp_type dgst_type = SSH_FP_MD5; +#ifdef OPENSSL_FIPS + if (fips_mode) { + dgst_type = SSH_FP_SHA1; + } +#endif + + /* Temporarily use the user's uid. */ temporarily_use_uid(pw); @@ -250,7 +261,7 @@ found_key = 1; debug("matching key found: file %s, line %lu", file, linenum); - fp = key_fingerprint(found, SSH_FP_MD5, SSH_FP_HEX); + fp = key_fingerprint(found, dgst_type, SSH_FP_HEX); verbose("Found matching %s key: %s", key_type(found), fp); xfree(fp); --- openssh-4.7p1/auth-rsa.c Thu Dec 20 15:18:22 2007 +++ openssh-4.7p1/auth-rsa.c Wed Jan 2 17:01:42 2008 @@ -21,6 +21,7 @@ #include #include +#include #include #include @@ -47,6 +48,9 @@ #include "monitor_wrap.h" #include "ssh.h" #include "misc.h" +#ifdef OPENSSL_FIPS +#include "fips.h" +#endif /* import */ extern ServerOptions options; @@ -88,10 +92,11 @@ } int -auth_rsa_verify_response(Key *key, BIGNUM *challenge, u_char response[16]) +auth_rsa_verify_response(Key *key, BIGNUM *challenge, u_char response[20]) { - u_char buf[32], mdbuf[16]; + u_char buf[40], mdbuf[16], shabuf[20]; MD5_CTX md; + SHA_CTX sha; int len; /* don't allow short keys */ @@ -101,10 +106,37 @@ return (0); } - /* The response is MD5 of decrypted challenge plus session id. */ len = BN_num_bytes(challenge); + if (len <= 0 || len > 40) + fatal("auth_rsa_verify_response: bad challenge length %d", len); + + /* The response is SHA1 of decrypted challenge plus session id. */ + memset(buf, 0, 40); + BN_bn2bin(challenge, buf + 40 - len); + SHA1_Init(&sha); + SHA1_Update(&sha, buf, 40); + SHA1_Update(&sha, session_id, 16); + SHA1_Final(shabuf, &sha); + + /* Verify that the response is the original challenge. */ + if (memcmp(response, shabuf, 20) != 0) { + /* Wrong answer. */ +#ifdef OPENSSL_FIPS + if (fips_mode) { + return (0); + } +#endif + } + +#ifdef OPENSSL_FIPS + if (fips_mode) { + return (1); + } +#endif + if (len <= 0 || len > 32) fatal("auth_rsa_verify_response: bad challenge length %d", len); + /* The response is MD5 of decrypted challenge plus session id. */ memset(buf, 0, 32); BN_bn2bin(challenge, buf + 32 - len); MD5_Init(&md); @@ -131,7 +163,7 @@ auth_rsa_challenge_dialog(Key *key) { BIGNUM *challenge, *encrypted_challenge; - u_char response[16]; + u_char response[20]; int i, success; if ((encrypted_challenge = BN_new()) == NULL) @@ -153,6 +185,10 @@ packet_read_expect(SSH_CMSG_AUTH_RSA_RESPONSE); for (i = 0; i < 16; i++) response[i] = (u_char)packet_get_char(); +#ifdef OPENSSL_FIPS + for (i = 16; i < 20; i++) + response[i] = (u_char)packet_get_char(); +#endif packet_check_eom(); success = PRIVSEP(auth_rsa_verify_response(key, challenge, response)); @@ -304,6 +340,12 @@ Key *key; char *fp; struct passwd *pw = authctxt->pw; + enum fp_type dgst_type = SSH_FP_MD5; +#ifdef OPENSSL_FIPS + if (fips_mode) { + dgst_type = SSH_FP_SHA1; + } +#endif /* no user given */ if (!authctxt->valid) @@ -332,7 +374,7 @@ * options; this will be reset if the options cause the * authentication to be rejected. */ - fp = key_fingerprint(key, SSH_FP_MD5, SSH_FP_HEX); + fp = key_fingerprint(key, dgst_type, SSH_FP_HEX); verbose("Found matching %s key: %s", key_type(key), fp); xfree(fp); --- openssh-4.7p1/contrib/redhat/sshd.init Mon Dec 24 13:44:26 2007 +++ openssh-4.7p1/contrib/redhat/sshd.init Wed Dec 26 13:08:06 2007 @@ -24,7 +24,11 @@ # Some functions to make the below more readable KEYGEN=/usr/bin/ssh-keygen SSHD=/usr/sbin/sshd -RSA1_KEY=/etc/ssh/ssh_host_key +if [ "$OPENSSH_FIPS" ] ; then + EXTRA_SSH_KEYGEN_RSA_FLAGS="-b 2048" +else + RSA1_KEY=/etc/ssh/ssh_host_key +fi RSA_KEY=/etc/ssh/ssh_host_rsa_key DSA_KEY=/etc/ssh/ssh_host_dsa_key PID_FILE=/var/run/sshd.pid @@ -32,7 +36,7 @@ do_rsa1_keygen() { if [ ! -s $RSA1_KEY ]; then echo -n $"Generating SSH1 RSA host key: " - if $KEYGEN -q -t rsa1 -f $RSA1_KEY -C '' -N '' >&/dev/null; then + if $KEYGEN -q -t rsa1 -f $RSA1_KEY -C '' -N '' $EXTRA_SSH_KEYGEN_RSA_FLAGS >&/dev/null; then chmod 600 $RSA1_KEY chmod 644 $RSA1_KEY.pub if [ -x /sbin/restorecon ]; then @@ -51,7 +55,7 @@ do_rsa_keygen() { if [ ! -s $RSA_KEY ]; then echo -n $"Generating SSH2 RSA host key: " - if $KEYGEN -q -t rsa -f $RSA_KEY -C '' -N '' >&/dev/null; then + if $KEYGEN -q -t rsa -f $RSA_KEY -C '' -N '' $EXTRA_SSH_KEYGEN_RSA_FLAGS >&/dev/null; then chmod 600 $RSA_KEY chmod 644 $RSA_KEY.pub if [ -x /sbin/restorecon ]; then @@ -70,7 +74,7 @@ do_dsa_keygen() { if [ ! -s $DSA_KEY ]; then echo -n $"Generating SSH2 DSA host key: " - if $KEYGEN -q -t dsa -f $DSA_KEY -C '' -N '' >&/dev/null; then + if $KEYGEN -q -t dsa -f $DSA_KEY -C '' -N '' $EXTRA_SSH_KEYGEN_DSA_FLAGS >&/dev/null; then chmod 600 $DSA_KEY chmod 644 $DSA_KEY.pub if [ -x /sbin/restorecon ]; then --- openssh-4.7p1/ssh-add.c Wed Dec 26 17:25:22 2007 +++ openssh-4.7p1/ssh-add.c Wed Dec 26 17:35:52 2007 @@ -61,10 +61,18 @@ #include "authfile.h" #include "pathnames.h" #include "misc.h" +#include "fips.h" /* argv0 */ extern char *__progname; +/* + * FIPS mode operation +*/ +#ifdef OPENSSL_FIPS + int fips_mode = 0; +#endif + /* Default files to add */ static char *default_files[] = { _PATH_SSH_CLIENT_ID_RSA, @@ -337,6 +345,10 @@ /* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */ sanitise_stdfd(); +#ifdef OPENSSL_FIPS + if (getenv("OPENSSH_FIPS")) fips_mode=1; +#endif + __progname = ssh_get_progname(argv[0]); init_rng(); seed_rng(); --- openssh-4.7p1/ssh-agent.c Wed Dec 26 18:09:26 2007 +++ openssh-4.7p1/ssh-agent.c Wed Dec 26 18:17:05 2007 @@ -74,6 +74,14 @@ #include "compat.h" #include "log.h" #include "misc.h" +#include "fips.h" + +/* + * FIPS operational mode +*/ +#ifdef OPENSSL_FIPS + int fips_mode = 0; +#endif #ifdef SMARTCARD #include "scard.h" @@ -1047,6 +1055,10 @@ char pidstrbuf[1 + 3 * sizeof pid]; struct timeval *tvp = NULL; +#ifdef OPENSSL_FIPS + if (getenv("OPENSSH_FIPS")) fips_mode = 1; +#endif + /* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */ sanitise_stdfd(); From Dirk.Lammers at Bertelsmann.de Tue Apr 29 16:58:24 2008 From: Dirk.Lammers at Bertelsmann.de (Dirk.Lammers at Bertelsmann.de) Date: Tue, 29 Apr 2008 08:58:24 +0200 Subject: request for feature Message-ID: <5B2A4AE77FA1014BAAEA3B8C39D468BFF8B4EC@GTLBMLEXS0016.bagmail.net> Dear developers, I need the feature of separately jailed, user writeable and user owned home dirs very badly because I have an SFTP server with 500 users who are partly nested could you please add a feature to set non root chroots with the %h option ? Otherwise I have to rewrite the chroot patch for 4.7p1 :-( thank you very much in advance Dirk From stuge-openssh-unix-dev at cdy.org Wed Apr 30 20:05:17 2008 From: stuge-openssh-unix-dev at cdy.org (Peter Stuge) Date: Wed, 30 Apr 2008 12:05:17 +0200 Subject: request for feature In-Reply-To: <5B2A4AE77FA1014BAAEA3B8C39D468BFF8B4EC@GTLBMLEXS0016.bagmail.net> References: <5B2A4AE77FA1014BAAEA3B8C39D468BFF8B4EC@GTLBMLEXS0016.bagmail.net> Message-ID: <20080430100517.29569.qmail@cdy.org> On Tue, Apr 29, 2008 at 08:58:24AM +0200, Dirk.Lammers at Bertelsmann.de wrote: > I need the feature of separately jailed, user writeable and user > owned home dirs very badly because I have an SFTP server with 500 > users who are partly nested could you please add a feature to set > non root chroots with the %h option ? Otherwise I have to rewrite > the chroot patch for 4.7p1 :-( Hm, doesn't the built-in sftp-server and new ChrootDirectory in 4.8p1/5.0p1 work in your situation? //Peter From djm at mindrot.org Wed Apr 30 20:06:56 2008 From: djm at mindrot.org (Damien Miller) Date: Wed, 30 Apr 2008 20:06:56 +1000 (EST) Subject: request for feature In-Reply-To: <5B2A4AE77FA1014BAAEA3B8C39D468BFF8B4EC@GTLBMLEXS0016.bagmail.net> References: <5B2A4AE77FA1014BAAEA3B8C39D468BFF8B4EC@GTLBMLEXS0016.bagmail.net> Message-ID: On Tue, 29 Apr 2008, Dirk.Lammers at Bertelsmann.de wrote: > > Dear developers, > > I need the feature of separately jailed, user writeable and user owned > home dirs very badly because I have an SFTP server with 500 users who > are partly nested > could you please add a feature to set non root chroots with the %h > option ? Otherwise I have to rewrite the chroot patch for 4.7p1 :-( ChrootDirectory supports this right now. Just create one more directory under the chroot for the user's home. E.g. have your users home directory set as "/home", your ChrootDirectory as "/chroot/%u". sshd will chroot to /chroot/[user] and then chdir to /home relative to the chroot path. We will not be relaxing the permission checks, they are there for good reasons. There are lots of nasty things a user can do if they can write to what is effectively / -d From Dirk.Lammers at Bertelsmann.de Wed Apr 30 21:09:10 2008 From: Dirk.Lammers at Bertelsmann.de (Dirk.Lammers at Bertelsmann.de) Date: Wed, 30 Apr 2008 13:09:10 +0200 Subject: request for feature In-Reply-To: Message-ID: <5B2A4AE77FA1014BAAEA3B8C39D468BFF8B4F6@GTLBMLEXS0016.bagmail.net> Hi Damien, thank you very much for your answer. I have an existing filesystem structure with 500, partly nested, users and for each user I'd to insert a 'chroot base'. This will lead to a very strange directory structure like /chroot/u/uhome /chroot/u1/u1home/u2/u2home/u3/u3home /chroot/u1/u1home/u4/u4home .... Doesn't look so good to me. I don't understand what nasty things a user can do to his effective / except destroying his own environment. And that would be a problem to the user an not to the system. A switch to enable non-roots chroots would be nice and the sysadmin should decide if he wants to enable it. So please add this feature Depart from my request for feature I'd like to thank you very much for your work on openssh which proofs the power and value of free software. kind regards Dirk -----Original Message----- From: Damien Miller [mailto:djm at mindrot.org] Sent: Mittwoch, 30. April 2008 12:07 To: Lammers, Dirk, NMI-DC Cc: openssh-unix-dev at mindrot.org Subject: Re: request for feature On Tue, 29 Apr 2008, Dirk.Lammers at Bertelsmann.de wrote: > > Dear developers, > > I need the feature of separately jailed, user writeable and user > owned home dirs very badly because I have an SFTP server with 500 > users who are partly nested could you please add a feature to set non > root chroots with the %h > option ? Otherwise I have to rewrite the chroot patch for 4.7p1 :-( ChrootDirectory supports this right now. Just create one more directory under the chroot for the user's home. E.g. have your users home directory set as "/home", your ChrootDirectory as "/chroot/%u". sshd will chroot to /chroot/[user] and then chdir to /home relative to the chroot path. We will not be relaxing the permission checks, they are there for good reasons. There are lots of nasty things a user can do if they can write to what is effectively / -d