PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Serveur - Sécurité et techniques > linux.debian.user > chroot question
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
linux.debian.user debian-user@lists.debian.org.

chroot question

Réponse
 
LinkBack Outils de la discussion
Vieux 20/01/2007, 17h50   #1
Anton Piatek
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut chroot question

Hi,
I have a amd64 install of debian with a 32bit chroot for a couple of apps.
This works great, but I have a question.

Is it possible to have an application inside the 32bit chroot launch an
application on my main 64 bit system? (e.g. a photo browsing program in the
32bit chroot launching gimp, which is installed in my main 64 bit system).
I currently launch my 32bit programs with schroot and am hoping I can set
something to make specific programs outside the chroot available...

I cannot think of how this can be achieved, so any ideas are welcomed.

Regards,

Anton

--
Anton Piatek
email: anton@piatek.co.uk
blog/photos: http://www.strangeparty.com
pgp: [0xB307BAEF] (http://tastycake.net/~anton/anton.asc)
fingerprint: 116A 5F01 1E5F 1ADE 78C6 EDB3 B9B6 E622 B307 BAEF

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQBFslW8ubbmIrMHuu8RAg7bAJ9uSItFajOyenNizc1xct uts3Pm2gCgkAI7
wkbcH3TDyjNsFhyyEkSpOhE=
=7FXz
-----END PGP SIGNATURE-----

  Réponse avec citation
Vieux 20/01/2007, 20h40   #2
Douglas Allan Tutty
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: chroot question

On Sat, Jan 20, 2007 at 05:47:36PM +0000, Anton Piatek wrote:
> Hi,
> I have a amd64 install of debian with a 32bit chroot for a couple of apps.
> This works great, but I have a question.
>
> Is it possible to have an application inside the 32bit chroot launch an
> application on my main 64 bit system? (e.g. a photo browsing program in the
> 32bit chroot launching gimp, which is installed in my main 64 bit system).
> I currently launch my 32bit programs with schroot and am hoping I can set
> something to make specific programs outside the chroot available...
>
> I cannot think of how this can be achieved, so any ideas are welcomed.
>


I've never played with chroot but if you add ssh to the chroot could you
ssh the main box from within the chroot? If so, you could set up ssh
with public-key so no passwords were required and it would be
transparent.

I wonder.

Doug.


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
  Réponse avec citation
Vieux 20/01/2007, 21h30   #3
Rick Thomas
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: chroot question


On Jan 20, 2007, at 2:37 PM, Douglas Allan Tutty wrote:

> On Sat, Jan 20, 2007 at 05:47:36PM +0000, Anton Piatek wrote:
>> Hi,
>> I have a amd64 install of debian with a 32bit chroot for a couple
>> of apps.
>> This works great, but I have a question.
>>
>> Is it possible to have an application inside the 32bit chroot
>> launch an
>> application on my main 64 bit system? (e.g. a photo browsing
>> program in the
>> 32bit chroot launching gimp, which is installed in my main 64 bit
>> system).
>> I currently launch my 32bit programs with schroot and am hoping I
>> can set
>> something to make specific programs outside the chroot available...
>>
>> I cannot think of how this can be achieved, so any ideas are
>> welcomed.
>>

>
> I've never played with chroot but if you add ssh to the chroot
> could you
> ssh the main box from within the chroot? If so, you could set up ssh
> with public-key so no passwords were required and it would be
> transparent.
>
> I wonder.
>
> Doug.


That might work. Here's another way that might be a little less
resource intensive but would require some development effort to
package-up for easy use:

Create a named-pipe (also called "fifo" -- see "man fifo") in the /
tmp directory of the chroot area. This will be available to the 32-
bit processes inside the chroot and also to the 64-bit processes
(because the chroot area is a subset of the main 64-bit file-system
space). Write to it in the 32-bit area and read from it in the 64-
bit area. If you need full-duplex communication, you'll have to have
two pipes (I think.)

I haven't tried it myself, but it should work.

Rick


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
  Réponse avec citation
Vieux 20/01/2007, 23h00   #4
Andrew Sackville-West
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: chroot question

On Sat, Jan 20, 2007 at 04:21:19PM -0500, Rick Thomas wrote:
>
> On Jan 20, 2007, at 2:37 PM, Douglas Allan Tutty wrote:
>
> >On Sat, Jan 20, 2007 at 05:47:36PM +0000, Anton Piatek wrote:
> >>Hi,
> >>I have a amd64 install of debian with a 32bit chroot for a couple
> >>of apps.
> >>This works great, but I have a question.
> >>
> >>Is it possible to have an application inside the 32bit chroot
> >>launch an
> >>application on my main 64 bit system? (e.g. a photo browsing
> >>program in the
> >>32bit chroot launching gimp, which is installed in my main 64 bit
> >>system).
> >>

> >
> >I've never played with chroot but if you add ssh to the chroot
> >could you
> >ssh the main box from within the chroot? If so, you could set up ssh
> >with public-key so no passwords were required and it would be
> >transparent.


>
> That might work. Here's another way that might be a little less
> resource intensive but would require some development effort to
> package-up for easy use:
>
> Create a named-pipe (also called "fifo" -- see "man fifo") in the /
> tmp directory of the chroot area. This will be available to the 32-
> bit processes inside the chroot and also to the 64-bit processes
> (because the chroot area is a subset of the main 64-bit file-system
> space). Write to it in the 32-bit area and read from it in the 64-
> bit area. If you need full-duplex communication, you'll have to have
> two pipes (I think.)


here's another idea. can you symlink from inside to outside the
chroot? maybe a link like /chroot/usr/bin/gimp -->/realroot/usr/bin/gimpwrapper.sh
and then setup gimpwrapper.sh to reset the paths to point to 64 bit
libs and then launch gimp. just a thought.

A

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFFsp3vaIeIEqwil4YRAgoOAKDGA/gq6AUCv7s1MSsHliOn8xDBYgCgoLDb
Ltbi5vFEf+Yoe/we8E+YMxo=
=vkhF
-----END PGP SIGNATURE-----

  Réponse avec citation
Vieux 21/01/2007, 10h10   #5
Rick Thomas
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: chroot question


On Jan 20, 2007, at 5:55 PM, Andrew Sackville-West wrote:

> can you symlink from inside to outside the
> chroot?


Fraid not. The kernel evaluates the symlink's destination in the
environment it came from.

Rick


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
  Réponse avec citation
Vieux 22/01/2007, 04h00   #6
Scott Gifford
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: chroot question

Anton Piatek <anton@piatek.co.uk> writes:

> I have a amd64 install of debian with a 32bit chroot for a couple of
> apps. This works great, but I have a question.
>
> Is it possible to have an application inside the 32bit chroot launch
> an application on my main 64 bit system? (e.g. a photo browsing
> program in the 32bit chroot launching gimp, which is installed in my
> main 64 bit system). I currently launch my 32bit programs with
> schroot and am hoping I can set something to make specific programs
> outside the chroot available...
>
> I cannot think of how this can be achieved, so any ideas are
> welcomed.


root can break out of a chroot environment, so if you wrote a small
program to break out of the chroot, switch back to the original user,
then run another program, it would do roughly what you're asking for.
It might also completely destroy security on your system, so if I were
you I would think a lot harder than I have before doing that.

Here's a program that seems to work for me. In the 10 minutes I've
been thinking about it, I haven't found any glaring security problems,
apart from allowing any user on the system to break out of a chroot.

#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>

void die(char *why)
{
perror(why);
exit(1);
}

int main(int argc, char *argv[])
{
struct stat st, last_st;
int i;

if (chroot("/tmp") == -1)
die("chroot failed");
if (stat(".",&st) == -1)
die("stat . failed");
if (stat("..",&last_st) == -1)
die("stat .. failed");
while ( (st.st_dev != last_st.st_dev) || (st.st_ino !=
last_st.st_ino) ) {
if (chdir("..") == -1)
die("chdir failed");
st = last_st;
if (stat("..",&last_st) == -1)
die("stat .. failed");
}
if (chroot(".") == -1)
die("chroot failed");

setreuid(getuid(),getuid());

/* Shift arguments over 1 to make room for NULL. */
for(i=0;i<argc-1;i++)
argv[i]=argv[i+1];
argv[argc-1]=NULL;

execvp(argv[0],argv);

die("exec failed");
}


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 20h02.


Édité par : vBulletin® version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,16611 seconds with 14 queries