public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: sshd privsep user still required?
Date: Wed, 13 Mar 2019 08:56:00 -0000	[thread overview]
Message-ID: <20190313085650.GS3785@calimero.vinschen.de> (raw)
In-Reply-To: <CANV9t=SWJ_65Y7jgqgDzNkaUPh1YCHfibp6vb+tmvg-wKtPLyQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1781 bytes --]

On Mar 12 16:21, Bill Stewart wrote:
> On Thu, 17 Jan 2019 Corinna Vinschen wrote:
> 
> > > Is the sshd disabled user account still required?
> >
> > No, actually it isn't.  These days the sshd server checks if the
> > the privsep chrrot environment should be used and that the process
> > is started under "root:root".  This never matches under Cygwin so
> > we could drop the sshd user requirement.
> 
> So I was exploring using the ChrootDirectory setting in sshd_config to
> configure a user as sftp only.
> 
> The following seems to work:
> 
> 1) Run sshd service as SYSTEM
> 
> 2) Specify SYSTEM as user 0 in /etc/passwd file; e.g.:
> 
> SYSTEM:*:0:18:U-NT AUTHORITY\SYSTEM,S-1-5-18:/var/empty:/bin/false
> 
> 3) Create a local sshd user account
> 
> 4) Update sshd_config settings to use something such as:
> 
> Match User sftponly
> ChrootDirectory /home/%u
> ForceCommand internal-sftp
> 
> This works.
> 
> If the sshd account is missing or disabled, I can't connect using the
> sftponly user, so it would seem that the sshd account really is required.
> 
> I have three questions:
> 
> a) Why is it necessary to specify SYSTEM as user number 0 in the
> /etc/password file?
> 
> b) Why is the sshd account required?

sshd checks for uid 0 and requires the sshd account when chroot is
requested.

> b) Why are /cygdrive and /dev directories visible when connecting using a
> sftp client?

The Cygwin chroot implementation is pure fake.  It's not backed by the
OS and it's failry easy to break out of the jail.  As such, the chroot
implementation is deprecated and only kept for backward compatibility.
I suggest not to use it.  It gives a wrong sense of security.


Corinna

-- 
Corinna Vinschen
Cygwin Maintainer

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2019-03-13  8:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-16 22:31 Bill Stewart
2019-01-17 14:23 ` Corinna Vinschen
2019-01-17 23:04   ` Charles Russell
2019-03-12 22:21 ` Bill Stewart
2019-03-13  8:56   ` Corinna Vinschen [this message]
2019-03-13 15:12     ` Bill Stewart
2019-03-13 15:29       ` Corinna Vinschen
2019-03-13 15:58         ` Bill Stewart

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190313085650.GS3785@calimero.vinschen.de \
    --to=corinna-cygwin@cygwin.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).