Bug 48095

Summary: Manual page for jail(8) does not mention mounting devfs under jail.
Product: Documentation Reporter: Grzegorz Czaplinski <G.Czaplinski>
Component: Books & ArticlesAssignee: Giorgos Keramidas <keramida>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.dat none

Description Grzegorz Czaplinski 2003-02-08 20:10:07 UTC
	

	The manual for jail(8) does not mention anything about mounting devfs
	under jail's /dev.
	I created a jail for sshd daemon. While tring to ssh into the jail,
	ssh process hangs.

gregory  1161  0.0  0.7  2392 1932  p3  S+J   8:48PM   0:00.07 ssh 192.168.0.5
root     1162  0.0  0.9  5372 2360  ??  IJ    8:48PM   0:00.02 sshd: gregory [pr
iv] (sshd)
gregory  1165  0.0  0.9  5372 2404  ??  SJ    8:48PM   0:00.01 sshd: gregory@not
ty (sshd)

	Thre are no free ttys.

Fix: 

Add a comment about mounting devfs under jail's /dev.
	mount -t devfs devfs /pathtojail/dev

	Thanks to nick@garage.freebsd.pl for the hint.
How-To-Repeat: 	
	Create a jail environment according to jail(8) manual, start 
	jailed sshd.
	Try to log into the jail more than once.
Comment 1 Giorgos Keramidas freebsd_committer freebsd_triage 2003-02-09 17:55:39 UTC
On 2003-02-08 21:08, Grzegorz Czaplinski wrote:
> The manual for jail(8) does not mention anything about mounting
> devfs under jail's /dev.

This is true, but mentioning devfs only is probably incomplete.  The
proper way to handle this is to mention that

# Jailed processes that need devices should have some sort of access
# to /dev nodes when they are inside the jail, imho.  It is then up to
# the administrator to choose how to implement this.  Either by
# mounting devfs under the /jail/dev directory or by manually calling
# MAKEDEV or mknod to create only those devices that are absolutely
# necessary.

Would a note like the above paragraph be ok?
Comment 2 Grzegorz Czaplinski 2003-02-09 21:27:44 UTC
On Sun, Feb 09, 2003 at 07:55:39PM +0200, Giorgos Keramidas wrote:
> On 2003-02-08 21:08, Grzegorz Czaplinski wrote:
> > The manual for jail(8) does not mention anything about mounting
> > devfs under jail's /dev.
> 
> This is true, but mentioning devfs only is probably incomplete.  The
> proper way to handle this is to mention that
> 
> # Jailed processes that need devices should have some sort of access
> # to /dev nodes when they are inside the jail, imho.  It is then up to
> # the administrator to choose how to implement this.  Either by
> # mounting devfs under the /jail/dev directory or by manually calling
> # MAKEDEV or mknod to create only those devices that are absolutely
> # necessary.
> 
> Would a note like the above paragraph be ok?
> 


I would put it that way:
# Jailed processes that need devices should have some sort of access
# to /dev nodes when they are inside the jail. Making device nodes with
# MAKEDEV or mknod is not sufficient. To let devfs(5) allocate device
# nodes in your jail transparently do:
	mount -t devfs devfs /jail/dev

That was not sufficient for me to make device nodes with MAKEDEV or
mknod. I have tested it rather heavily.

Thanks,
	Grzegorz
--
Grzegorz Czaplinski <gregory@prioris.mini.pw.edu.pl>
"The Power to Serve, Right for the Power Users!" - http://www.FreeBSD.org/
 Fingerprint: EB77 E19D CFA2 5736 810F  847C A70F A275 2489 469F
Comment 3 Giorgos Keramidas freebsd_committer freebsd_triage 2003-02-09 21:36:26 UTC
On 2003-02-09 22:27, Grzegorz Czaplinski <G.Czaplinski@prioris.mini.pw.edu.pl> wrote:
> On Sun, Feb 09, 2003 at 07:55:39PM +0200, Giorgos Keramidas wrote:
> > # Jailed processes that need devices should have some sort of access
> > # to /dev nodes when they are inside the jail, imho.  It is then up to
> > # the administrator to choose how to implement this.  Either by
> > # mounting devfs under the /jail/dev directory or by manually calling
> > # MAKEDEV or mknod to create only those devices that are absolutely
> > # necessary.
>
> I would put it that way:
> # Jailed processes that need devices should have some sort of access
> # to /dev nodes when they are inside the jail. Making device nodes with
> # MAKEDEV or mknod is not sufficient. To let devfs(5) allocate device
> # nodes in your jail transparently do:
> 	mount -t devfs devfs /jail/dev

Hmm, odd.  Isn't mknod sufficient?  I have problems building world
right now in my current machine at home, so I can't test this by
creating a new jail, but how/why did mknod within the jail fail to
work for you?

- Giorgos
Comment 4 Grzegorz Czaplinski 2003-02-10 09:53:12 UTC
Looks like I did not send it to bug-followup@FreeBSD.org.
Sorry.

	Grzegorz 
--
Grzegorz Czaplinski <gregory@prioris.mini.pw.edu.pl>
"The Power to Serve, Right for the Power Users!" - http://www.FreeBSD.org/
 Fingerprint: EB77 E19D CFA2 5736 810F  847C A70F A275 2489 469F
Comment 5 Giorgos Keramidas freebsd_committer freebsd_triage 2003-02-13 03:00:36 UTC
Responsible Changed
From-To: freebsd-doc->keramida

I think I can handle this.
Comment 6 Giorgos Keramidas freebsd_committer freebsd_triage 2003-02-28 22:48:15 UTC
State Changed
From-To: open->patched

I have removed the reference to MAKEDEV from -current. 
MAKEDEV is no longer supported in FreeBSD 5.X.
Comment 7 Giorgos Keramidas freebsd_committer freebsd_triage 2003-02-28 23:48:10 UTC
State Changed
From-To: patched->closed

On second thought, there is nothing to MFC here.  DEVFS works fine in current, but 
we don't need to change anything in RELENG_4 manpages.
Comment 8 Grzegorz Czaplinski 2003-03-05 18:15:52 UTC
On Fri, Feb 28, 2003 at 03:49:45PM -0800, Giorgos Keramidas wrote:
> Synopsis: Manual page for jail(8) does not mention mounting devfs under jail.
> 
> State-Changed-From-To: patched->closed
> State-Changed-By: keramida
> State-Changed-When: Fri Feb 28 15:48:10 PST 2003
> State-Changed-Why: 
> On second thought, there is nothing to MFC here.  DEVFS works fine in current, but
> we don't need to change anything in RELENG_4 manpages.
> 

We don't have to, that is right.

Cheers,
	Grzegorz
--
Grzegorz Czaplinski <gregory@prioris.mini.pw.edu.pl>
"The Power to Serve, Right for the Power Users!" - http://www.FreeBSD.org/
 Fingerprint: EB77 E19D CFA2 5736 810F  847C A70F A275 2489 469F
Comment 9 Grzegorz Czaplinski 2003-03-05 18:18:29 UTC
On Fri, Feb 28, 2003 at 02:49:32PM -0800, Giorgos Keramidas wrote:
> Synopsis: Manual page for jail(8) does not mention mounting devfs under jail.
> 
> State-Changed-From-To: open->patched
> State-Changed-By: keramida
> State-Changed-When: Fri Feb 28 14:48:15 PST 2003
> State-Changed-Why: 
> I have removed the reference to MAKEDEV from -current.
> MAKEDEV is no longer supported in FreeBSD 5.X.

One question, did you add anything about mounting devfs under jail's
dev?

Thanks!
	Grzegorz
--
Grzegorz Czaplinski <gregory@prioris.mini.pw.edu.pl>
"The Power to Serve, Right for the Power Users!" - http://www.FreeBSD.org/
 Fingerprint: EB77 E19D CFA2 5736 810F  847C A70F A275 2489 469F
Comment 10 Giorgos Keramidas freebsd_committer freebsd_triage 2003-03-05 20:19:00 UTC
On 2003-03-05 19:18, Grzegorz Czaplinski <G.Czaplinski@prioris.mini.pw.edu.pl> wrote:
> On Fri, Feb 28, 2003 at 02:49:32PM -0800, Giorgos Keramidas wrote:
> > State-Changed-From-To: open->patched
> > State-Changed-By: keramida
> > State-Changed-When: Fri Feb 28 14:48:15 PST 2003
> > State-Changed-Why:
> > I have removed the reference to MAKEDEV from -current.
> > MAKEDEV is no longer supported in FreeBSD 5.X.
>
> One question, did you add anything about mounting devfs under jail's
> dev?

Yes.
The new manpage uses the following as the sample jail command set:

     D=/here/is/the/jail
     cd /usr/src
     mkdir -p $D
     make world DESTDIR=$D
     cd etc
     make distribution DESTDIR=$D
     mount_devfs devfs $D/dev
     cd $D
     ln -sf dev/null kernel

- Giorgos
Comment 11 Grzegorz Czaplinski 2003-03-05 20:22:52 UTC
On Wed, Mar 05, 2003 at 10:19:00PM +0200, Giorgos Keramidas wrote:
> > > State-Changed-From-To: open->patched
> > > State-Changed-By: keramida
> > > State-Changed-When: Fri Feb 28 14:48:15 PST 2003
> > > State-Changed-Why:
> > > I have removed the reference to MAKEDEV from -current.
> > > MAKEDEV is no longer supported in FreeBSD 5.X.
> >
> > One question, did you add anything about mounting devfs under jail's
> > dev?
> 
> Yes.
> The new manpage uses the following as the sample jail command set:
> 
>      D=/here/is/the/jail
>      cd /usr/src
>      mkdir -p $D
>      make world DESTDIR=$D
>      cd etc
>      make distribution DESTDIR=$D
>      mount_devfs devfs $D/dev
>      cd $D
>      ln -sf dev/null kernel
> 
> - Giorgos


Hi!
I just wanted to make sure.
Thanks again Giorgos!

Take care and all the best,
			Grzegorz 
--
Grzegorz Czaplinski <gregory@prioris.mini.pw.edu.pl>
"The Power to Serve, Right for the Power Users!" - http://www.FreeBSD.org/
 Fingerprint: EB77 E19D CFA2 5736 810F  847C A70F A275 2489 469F