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

Bug#241496: openssh-server: Still seen 5 years later



On 30/03/11 12:23 +0100, Colin Watson wrote:
> On Wed, Mar 30, 2011 at 11:49:48AM +0300, Phil Carmody wrote:
> > I performed the upgrade to 1:5.5p1-6 months ago, I don't know what
> > version I was coming from. All I know is that my customised
> > sshd_config was overwritten during the upgrade. As this 'upgrade'
> > resulted in the opening of world-facing ports against my will, I 
> > consider it to not just be a grave error as it's not just a loss 
> > of data, but also a security issue.
> 
> The previous comments from Matthew and myself in this bug still stand.
> Please provide:
> 
>   * /var/log/dpkg.log* (which may show what version you were coming
>     from)

-- 8< --
# zgrep openssh /var/log/dpkg.log*
/var/log/dpkg.log.1:2011-02-09 03:06:06 upgrade openssh-server 1:5.1p1-5 1:5.5p1-6
/var/log/dpkg.log.1:2011-02-09 03:06:06 status half-configured openssh-server 1:5.1p1-5
/var/log/dpkg.log.1:2011-02-09 03:06:06 status unpacked openssh-server 1:5.1p1-5
/var/log/dpkg.log.1:2011-02-09 03:06:06 status half-installed openssh-server 1:5.1p1-5
/var/log/dpkg.log.1:2011-02-09 03:06:07 status half-installed openssh-server 1:5.1p1-5
/var/log/dpkg.log.1:2011-02-09 03:06:08 status unpacked openssh-server 1:5.5p1-6
/var/log/dpkg.log.1:2011-02-09 03:06:08 status unpacked openssh-server 1:5.5p1-6
/var/log/dpkg.log.1:2011-02-09 03:06:08 upgrade openssh-client 1:5.1p1-5 1:5.5p1-6
/var/log/dpkg.log.1:2011-02-09 03:06:08 status half-configured openssh-client 1:5.1p1-5
/var/log/dpkg.log.1:2011-02-09 03:06:08 status unpacked openssh-client 1:5.1p1-5
/var/log/dpkg.log.1:2011-02-09 03:06:08 status half-installed openssh-client 1:5.1p1-5
/var/log/dpkg.log.1:2011-02-09 03:06:08 status half-installed openssh-client 1:5.1p1-5
/var/log/dpkg.log.1:2011-02-09 03:06:08 status unpacked openssh-client 1:5.5p1-6
/var/log/dpkg.log.1:2011-02-09 03:06:08 status unpacked openssh-client 1:5.5p1-6
/var/log/dpkg.log.1:2011-02-09 03:08:39 configure openssh-client 1:5.5p1-6 1:5.5p1-6
/var/log/dpkg.log.1:2011-02-09 03:08:39 status unpacked openssh-client 1:5.5p1-6
/var/log/dpkg.log.1:2011-02-09 03:08:39 status unpacked openssh-client 1:5.5p1-6
/var/log/dpkg.log.1:2011-02-09 03:08:39 status unpacked openssh-client 1:5.5p1-6
/var/log/dpkg.log.1:2011-02-09 03:08:39 status half-configured openssh-client 1:5.5p1-6
/var/log/dpkg.log.1:2011-02-09 03:08:40 status installed openssh-client 1:5.5p1-6
/var/log/dpkg.log.1:2011-02-09 03:08:40 configure openssh-server 1:5.5p1-6 1:5.5p1-6
/var/log/dpkg.log.1:2011-02-09 03:08:40 status unpacked openssh-server 1:5.5p1-6
/var/log/dpkg.log.1:2011-02-09 03:08:40 status unpacked openssh-server 1:5.5p1-6
/var/log/dpkg.log.1:2011-02-09 03:08:40 status unpacked openssh-server 1:5.5p1-6
/var/log/dpkg.log.1:2011-02-09 03:08:40 status unpacked openssh-server 1:5.5p1-6
/var/log/dpkg.log.1:2011-02-09 03:08:40 status unpacked openssh-server 1:5.5p1-6
/var/log/dpkg.log.1:2011-02-09 03:08:40 status unpacked openssh-server 1:5.5p1-6
/var/log/dpkg.log.1:2011-02-09 03:08:40 status half-configured openssh-server 1:5.5p1-6
/var/log/dpkg.log.1:2011-02-09 03:08:41 status installed openssh-server 1:5.5p1-6
-- 8< --

>   * the output of 'debconf-show openssh-server'

-- 8< --
  ssh/new_config: true
* ssh/use_old_init_script: true
  ssh/vulnerable_host_keys:
  ssh/encrypted_host_key_but_no_keygen:
  ssh/disable_cr_auth: false
-- 8< --

>   * /etc/ssh/sshd_config

Well, right now it's the default from the package, that's the bug, see. 
However, what used to be there was something more like this, just with 
changes to the ListenAddress:

-- 8< --
# What ports, IPs and protocols we listen for
Port 22
# Use these options to restrict which interfaces/protocols sshd will bind to
#ListenAddress ::
#ListenAddress 0.0.0.0

# PC added for bazspaz
ListenAddress bazspaz

Protocol 2
# HostKeys for protocol version 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
#Privilege Separation is turned on for security
UsePrivilegeSeparation yes

# Lifetime and size of ephemeral version 1 server key
KeyRegenerationInterval 3600
ServerKeyBits 768

# Logging
SyslogFacility AUTH
LogLevel INFO

# Authentication:
LoginGraceTime 120
PermitRootLogin yes
StrictModes yes

RSAAuthentication yes
PubkeyAuthentication yes
#AuthorizedKeysFile     %h/.ssh/authorized_keys

# Don't read the user's ~/.rhosts and ~/.shosts files
IgnoreRhosts yes
# For this to work you will also need host keys in /etc/ssh_known_hosts
RhostsRSAAuthentication no
# similar for protocol version 2
HostbasedAuthentication no
# Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication
#IgnoreUserKnownHosts yes

# To enable empty passwords, change to yes (NOT RECOMMENDED)
PermitEmptyPasswords no

# Change to yes to enable challenge-response passwords (beware issues with
# some PAM modules and threads)
ChallengeResponseAuthentication no

# Change to no to disable tunnelled clear text passwords
#PasswordAuthentication yes

# Kerberos options
#KerberosAuthentication no
#KerberosGetAFSToken no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes

X11Forwarding yes
X11DisplayOffset 10
PrintMotd no
PrintLastLog yes
TCPKeepAlive yes
#UseLogin no

#MaxStartups 10:30:60
#Banner /etc/issue.net

# Allow client to pass locale environment variables
AcceptEnv LANG LC_*

Subsystem sftp /usr/lib/openssh/sftp-server

UsePAM yes
-- 8< --

>   * any other /etc/ssh/sshd_config.* files, especially
>     /etc/ssh/sshd_config.dpkg-old

No such files.
 
> > Chatting with a debian dev, the idea of this possibly being a 
> > dpkg bug was mentioned. Has that possibility been looked into at
> > all?
> 
> I don't know whom you were speaking to, but that seems highly unlikely
> here; /etc/ssh/sshd_config is managed by the openssh-server maintainer
> scripts, not by dpkg as some configuration files are.  In any event,
> this wouldn't be a productive first line of investigation - if it were
> true, we'd arrive at it by other means.

It's all very well taking a superior tone, but so far you appear to 
have made no progress in 7 years on this bug.

However, the information you provide does at least narrow down places
where the issue could be. So let's crack open the postinst, which seems
to be the only thing that really touches the ssh_config...

Apart from function definitions, the first things it does are fix_doc_symlink
which does nothing interesting, and create_sshdconfig, so let's look at that:

create_sshdconfig() {
        if [ -e /etc/ssh/sshd_config ] ; then

	   # lots of things that can modify /etc/ssh/sshd_config, 
	   # but which don't keep a backup anywhere.

            return 0
        fi

        #Preserve old sshd_config before generating a new one
        if [ -e /etc/ssh/sshd_config ] ; then

	    # How can we get here? Who is racing with us to create it?

            mv /etc/ssh/sshd_config /etc/ssh/sshd_config.dpkg-old
        fi

        # stuff
}


That script seems to explicitly document the behaviour reported in the 
bug, doesn't it?

The move should be in the first [ -e ], right at the top, surely?

Phil
-- 
I find the easiest thing to do is to k/f myself and just troll away
-- David Melville on r.a.s.f1



Reply to: