From owner-freebsd-questions@FreeBSD.ORG Tue Aug 10 13:08:37 2010 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DE8C81065672 for ; Tue, 10 Aug 2010 13:08:36 +0000 (UTC) (envelope-from rsmith@xs4all.nl) Received: from smtp-vbr11.xs4all.nl (smtp-vbr11.xs4all.nl [194.109.24.31]) by mx1.freebsd.org (Postfix) with ESMTP id 776458FC19 for ; Tue, 10 Aug 2010 13:08:36 +0000 (UTC) Received: from slackbox.erewhon.net (slackbox.xs4all.nl [213.84.242.160]) by smtp-vbr11.xs4all.nl (8.13.8/8.13.8) with ESMTP id o7AD8YX8097841; Tue, 10 Aug 2010 15:08:35 +0200 (CEST) (envelope-from rsmith@xs4all.nl) Received: by slackbox.erewhon.net (Postfix, from userid 1001) id A0A10BA98; Tue, 10 Aug 2010 15:08:34 +0200 (CEST) Date: Tue, 10 Aug 2010 15:08:34 +0200 From: Roland Smith To: Brice ERRANDONEA Message-ID: <20100810130834.GA48376@slackbox.erewhon.net> References: <268321.67123.qm@web24608.mail.ird.yahoo.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Nq2Wo0NMKNjxTN9z" Content-Disposition: inline In-Reply-To: <268321.67123.qm@web24608.mail.ird.yahoo.com> X-GPG-Fingerprint: 1A2B 477F 9970 BA3C 2914 B7CE 1277 EFB0 C321 A725 X-GPG-Key: http://www.xs4all.nl/~rsmith/pubkey.txt X-GPG-Notice: If this message is not signed, don't assume I sent it! User-Agent: Mutt/1.5.20 (2009-06-14) X-Virus-Scanned: by XS4ALL Virus Scanner Cc: freebsd-questions@freebsd.org Subject: Re: How to connect a jail to the web ? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Aug 2010 13:08:37 -0000 --Nq2Wo0NMKNjxTN9z Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Aug 10, 2010 at 11:01:24AM +0000, Brice ERRANDONEA wrote: > Hello, >=20 > I've just created my first FreeBSD jail in order to install a web server > inside. But I don't know how to connect it to the web. When I try pingin= g a > http website, it doesn't work. Of course, it works when I do it from outs= ide > the jail. There are a couple of things you need to keep in mind. - The IP address you're using for a jail is usually an alias for an exist= ing interface. I think this is done to make routing easier. My system is configured as a gateway, and I've aliased the IP adresses for my jails = to the interaface of the internal trusted network. - You should really use the rc interface for starting jails; it's much ea= sier.=20 > Another problem, probably linked to the first one, I can't run rc within = the=20 > jail, even as the jail's root. It says : permission denied. See below. =20 > Here's how I built and started my jail. I had already run make buildworld= when=20 > upgrading to 8.1 release : >=20 > # mkdir /usr/prison > # cd /usr/src > # make installworld DESTDIR=3D/usr/prison > # make distribution DESTDIR=3D/usr/prison Do not forget to create an empty /etc/fstab in your jail; # touch /usr/prison/etc/fstab You'll also need to create an appropriate /etc/rc.conf file in the jail. The following should be a starting point; devfs_system_ruleset=3D"devfsrules_jail" network_interfaces=3D"" sshd_enable=3D"YES" sendmail_enable=3D"NO" rpcbind_enable=3D"NO" > # mount -t devfs devfs /usr/prison/dev > # jail -c path=3D/usr/prison host.hostname=3DServeurWeb ip4.addr=3D192.1.= 1.1 persist > # jail /usr/prison ServeurWeb 192.1.1.1 csh You should use the full path name of the program you want to run. # jail /usr/prison ServeurWeb 192.1.1.1 /bin/csh If you want to start the rc system in the jail; # jail /usr/prison ServeurWeb 192.1.1.1 /bin/sh /etc/rc I've detailed my setpup on a webpage. Maybe it will be of use to you; http://www.xs4all.nl/~rsmith/unix/misc.xhtml#creatingavirtualserveronfreebs= dwithajail8 Roland --=20 R.F.Smith http://www.xs4all.nl/~rsmith/ [plain text _non-HTML_ PGP/GnuPG encrypted/signed email much appreciated] pgp: 1A2B 477F 9970 BA3C 2914 B7CE 1277 EFB0 C321 A725 (KeyID: C321A725) --Nq2Wo0NMKNjxTN9z Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (FreeBSD) iEYEARECAAYFAkxhT1IACgkQEnfvsMMhpyWYBACfSmJI4+xnqLsRqD0ALViXOxOk 7r0Ani9XJ39b0ZkJt0c43UU8pg/K8DhU =FNve -----END PGP SIGNATURE----- --Nq2Wo0NMKNjxTN9z--