This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Running eggdrop in a chroot jail?

Old posts that have not been replied to for several years.
Locked
s
skiprosebaugh

Post by skiprosebaugh »

Is it possible to run eggdrop in a chroot jail?
g
guppy
eggdrop engineer
Posts: 199
Joined: Mon Sep 24, 2001 8:00 pm
Location: Canada
Contact:

Post by guppy »

Yup -- I've done it a few times .. long as you know a bit of c it can be done very easily. It is possible to run pretty much every program in a chroot jail.

I'll look later to see if I still have the .diff I made of my changes.
P
Petersen
Owner
Posts: 685
Joined: Thu Sep 27, 2001 8:00 pm
Location: Blackpool, UK

Post by Petersen »

well, there's 2 ways to do it. first way is to start the bot within a chrooted shell (ie /bin/sh chroots to somewhere first). as long as the bot is compiled statically it should work (though it might need access to a /dev/null and /dev/zero relative to its chroot dir).
the second way is more interesting. it involves you starting the bot as a root process (which means you gotta remove the check that prevents this), then get it to call chroot() and then setuid() so it ain't running as root anymore.
User avatar
Yourname
Master
Posts: 358
Joined: Mon Sep 24, 2001 8:00 pm
Location: Toronto

Post by Yourname »

Outta curiosity, whats a chroot jail?

<font size=-1>[ This Message was edited by: Yourname on 2002-03-14 10:36 ]</font>
P
Petersen
Owner
Posts: 685
Joined: Thu Sep 27, 2001 8:00 pm
Location: Blackpool, UK

Post by Petersen »

read chroot(2)
g
guppy
eggdrop engineer
Posts: 199
Joined: Mon Sep 24, 2001 8:00 pm
Location: Canada
Contact:

Post by guppy »

http://www.techmonkeys.org/~guppy/eggdr ... hroot.diff

Quick patch to chroot eggdrop -- all you should have to do is edit src/chroot.h properly. Also, you have to setup your /chroot directory with the proper libs and such that eggdrop requires.

Jeff
P
Petersen
Owner
Posts: 685
Joined: Thu Sep 27, 2001 8:00 pm
Location: Blackpool, UK

Post by Petersen »

heh, almost exactly the same as how i did it :grin:
g
guppy
eggdrop engineer
Posts: 199
Joined: Mon Sep 24, 2001 8:00 pm
Location: Canada
Contact:

Post by guppy »

NO! You stole my code .. I am suing you under that stupid US law for hacking me and reverse engineering my binary!! :razz:~

Jeff
Locked