From grimw@siue.dnsalias.net  Wed Oct 20 01:42:40 2004
Return-Path: <grimw@siue.dnsalias.net>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 8B1D516A4CE
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 20 Oct 2004 01:42:40 +0000 (GMT)
Received: from siue.dnsalias.net (cv517-231.cv.siue.edu [146.163.219.231])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 58F8B43D2D
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 20 Oct 2004 01:42:40 +0000 (GMT)
	(envelope-from grimw@siue.dnsalias.net)
Received: by siue.dnsalias.net (Postfix, from userid 1001)
	id AEF64C0FC; Tue, 19 Oct 2004 20:42:35 -0500 (CDT)
Message-Id: <20041020014235.AEF64C0FC@siue.dnsalias.net>
Date: Tue, 19 Oct 2004 20:42:35 -0500 (CDT)
From: William Michael Grim <grimw@siue.dnsalias.net>
Reply-To: wgrim@siue.edu
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [PATCH]: Prevent printing when doing an scp (printing breaks SCP).
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         72901
>Category:       conf
>Synopsis:       [patch]: dot.profile: prevent printing when doing an scp (printing breaks SCP).
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Oct 20 01:50:24 GMT 2004
>Closed-Date:    
>Last-Modified:  Sun Oct 23 23:19:28 GMT 2005
>Originator:     William Michael Grim
>Release:        FreeBSD 5.3-BETA7 i386
>Organization:
Southern Illinois University at Edwardsville
>Environment:
System: FreeBSD siue.dnsalias.net 5.3-BETA7 FreeBSD 5.3-BETA7 #3: Mon Oct 18 23:46:43 CDT 2004 root@siue.dnsalias.net:/usr/obj/usr/src/sys/FREEBSD i386


>Description:
	When a user tries to 'scp' to another machine that is outputting
	fortunes, as bash does by default on FreeBSD, then scp will exit,
	printing only the first line of output instead of copying files.
>How-To-Repeat:
	Have a host to which you are trying to scp print some lines to stdout
	through .profile or .bashrc.
>Fix:
	The patch below is to patch /usr/share/skel/dot.profile and determines
	if the shell being run is interactive or not.  If it is not
	interactive, then it does not print out fortunes.

--- dot.profile.patch begins here ---
--- /home/grimw/dot.profile	Tue Oct 19 20:05:42 2004
+++ dot.profile	Tue Oct 19 20:06:46 2004
@@ -21,4 +21,9 @@
 # set ENV to a file invoked each time sh is started for interactive use.
 ENV=$HOME/.shrc; export ENV
 
+# Don't print anything if this is not an interactive shell.
+if [ ${-/*i*/i} != 'i' ]; then
+	return
+fi
+
 [ -x /usr/games/fortune ] && /usr/games/fortune freebsd-tips
--- dot.profile.patch ends here ---


>Release-Note:
>Audit-Trail:

From: Kris Kennaway <kris@obsecurity.org>
To: wgrim@siue.edu
Cc: FreeBSD-gnats-submit@FreeBSD.org
Subject: Re: conf/72901: [PATCH]: Prevent printing when doing an scp (printing breaks SCP).
Date: Tue, 19 Oct 2004 19:26:53 -0700

 On Tue, Oct 19, 2004 at 08:42:35PM -0500, William Michael Grim wrote:
 > 
 > >Number:         72901
 > >Category:       conf
 > >Synopsis:       [PATCH]: Prevent printing when doing an scp (printing breaks SCP).
 > >Confidential:   no
 > >Severity:       non-critical
 > >Priority:       low
 > >Responsible:    freebsd-bugs
 > >State:          open
 > >Quarter:        
 > >Keywords:       
 > >Date-Required:
 > >Class:          sw-bug
 > >Submitter-Id:   current-users
 > >Arrival-Date:   Wed Oct 20 01:50:24 GMT 2004
 > >Closed-Date:
 > >Last-Modified:
 > >Originator:     William Michael Grim
 > >Release:        FreeBSD 5.3-BETA7 i386
 > >Organization:
 > Southern Illinois University at Edwardsville
 > >Environment:
 > System: FreeBSD siue.dnsalias.net 5.3-BETA7 FreeBSD 5.3-BETA7 #3: Mon Oct 18 23:46:43 CDT 2004 root@siue.dnsalias.net:/usr/obj/usr/src/sys/FREEBSD i386
 > 
 > 
 > >Description:
 > 	When a user tries to 'scp' to another machine that is outputting
 > 	fortunes, as bash does by default on FreeBSD, then scp will exit,
 > 	printing only the first line of output instead of copying files.
 > >How-To-Repeat:
 > 	Have a host to which you are trying to scp print some lines to stdout
 > 	through .profile or .bashrc.
 
 Are you sure?  What is your sshd_config on that machine?
 
 Kris

From: William Michael Grim <wgrim@siue.edu>
To: Kris Kennaway <kris@obsecurity.org>
Cc: FreeBSD-gnats-submit@FreeBSD.org
Subject: Re: conf/72901: [PATCH]: Prevent printing when doing an scp (printing breaks SCP).
Date: Tue, 19 Oct 2004 21:53:27 -0500

 --BOKacYhQ+x31HxR3
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 
 Happens even when I scp to a linux server that has a .profile or .bashrc that
 outputs information.  I have included my sshd_config from the FBSD system.
 
 
 On Tue, Oct 19, 2004 at 07:26:53PM -0700, Kris Kennaway wrote:
 > On Tue, Oct 19, 2004 at 08:42:35PM -0500, William Michael Grim wrote:
 > > 
 > > >Number:         72901
 > > >Category:       conf
 > > >Synopsis:       [PATCH]: Prevent printing when doing an scp (printing breaks SCP).
 > > >Confidential:   no
 > > >Severity:       non-critical
 > > >Priority:       low
 > > >Responsible:    freebsd-bugs
 > > >State:          open
 > > >Quarter:        
 > > >Keywords:       
 > > >Date-Required:
 > > >Class:          sw-bug
 > > >Submitter-Id:   current-users
 > > >Arrival-Date:   Wed Oct 20 01:50:24 GMT 2004
 > > >Closed-Date:
 > > >Last-Modified:
 > > >Originator:     William Michael Grim
 > > >Release:        FreeBSD 5.3-BETA7 i386
 > > >Organization:
 > > Southern Illinois University at Edwardsville
 > > >Environment:
 > > System: FreeBSD siue.dnsalias.net 5.3-BETA7 FreeBSD 5.3-BETA7 #3: Mon Oct 18 23:46:43 CDT 2004 root@siue.dnsalias.net:/usr/obj/usr/src/sys/FREEBSD i386
 > > 
 > > 
 > > >Description:
 > > 	When a user tries to 'scp' to another machine that is outputting
 > > 	fortunes, as bash does by default on FreeBSD, then scp will exit,
 > > 	printing only the first line of output instead of copying files.
 > > >How-To-Repeat:
 > > 	Have a host to which you are trying to scp print some lines to stdout
 > > 	through .profile or .bashrc.
 > 
 > Are you sure?  What is your sshd_config on that machine?
 > 
 > Kris
 
 -- 
 William Michael Grim
 Student, Southern Illinois University at Edwardsville
 Unix Network Administrator, SIUE, Computer Science dept.
 Phone: (217) 341-6552
 Email: wgrim@siue.edu
 
 --BOKacYhQ+x31HxR3
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename=sshd_config
 
 #	$OpenBSD: sshd_config,v 1.68 2003/12/29 16:39:50 millert Exp $
 #	$FreeBSD: src/crypto/openssh/sshd_config,v 1.40 2004/04/20 09:37:29 des Exp $
 
 # This is the sshd server system-wide configuration file.  See
 # sshd_config(5) for more information.
 
 # This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin
 
 # The strategy used for options in the default sshd_config shipped with
 # OpenSSH is to specify options with their default value where
 # possible, but leave them commented.  Uncommented options change a
 # default value.
 
 # Note that some of FreeBSD's defaults differ from OpenBSD's, and
 # FreeBSD has a few additional options.
 
 #VersionAddendum FreeBSD-20040419
 
 Port 22
 Protocol 2
 #ListenAddress 0.0.0.0
 #ListenAddress ::
 
 # HostKey for protocol version 1
 #HostKey /etc/ssh/ssh_host_key
 # HostKeys for protocol version 2
 #HostKey /etc/ssh/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 no
 #StrictModes yes
 
 #RSAAuthentication yes
 #PubkeyAuthentication yes
 #AuthorizedKeysFile	.ssh/authorized_keys
 
 # For this to work you will also need host keys in /etc/ssh/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
 
 # Change to yes to enable built-in password authentication.
 #PasswordAuthentication no
 #PermitEmptyPasswords no
 
 # Change to no to disable PAM authentication
 #ChallengeResponseAuthentication yes
 
 # Kerberos options
 #KerberosAuthentication no
 #KerberosOrLocalPasswd yes
 #KerberosTicketCleanup yes
 #KerberosGetAFSToken no
 
 # GSSAPI options
 #GSSAPIAuthentication no
 #GSSAPICleanupCredentials yes
 
 # Set this to 'no' to disable PAM authentication (via challenge-response)
 # and session processing.
 #UsePAM yes
 
 #AllowTcpForwarding yes
 #GatewayPorts no
 #X11Forwarding yes
 #X11DisplayOffset 10
 #X11UseLocalhost yes
 #PrintMotd yes
 #PrintLastLog yes
 #TCPKeepAlive yes
 #UseLogin no
 #UsePrivilegeSeparation yes
 #PermitUserEnvironment no
 #Compression yes
 #ClientAliveInterval 0
 #ClientAliveCountMax 3
 UseDNS no
 #PidFile /var/run/sshd.pid
 #MaxStartups 10
 
 # no default banner path
 #Banner /some/path
 
 # override default of no subsystems
 Subsystem	sftp	/usr/libexec/sftp-server
 
 --BOKacYhQ+x31HxR3--
>Unformatted:
