Slashdot Mirror


When Not to Use chroot

Hyena writes "Linux guru Alan Cox is quoted as saying 'chroot is not and never has been a security tool' in a KernelTrap article summarizing a lengthy thread on the Linux Kernel mailing list. The discussion began with a patch attempting to 'fix a security hole' in the Unix chroot command, trying to improve the ability of chroot to contain a process. When it was pointed out that people have been using chroot as a security tool for years, another kernel hacker retorted, 'incompetent people implementing security solutions are a real problem.' A quick search on the terms 'chroot+security' quickly reveals that many people have long thought (wrongly) that chroot's purpose was for improving security."

407 comments

  1. Then what is it for? by Anonymous Coward · · Score: 0, Insightful

    Next up ls is not for directory listings, and rm is not for removing files.

    1. Re:Then what is it for? by larry+bagina · · Score: 5, Informative

      Actually, Bill Joy invented chroot as a hack to use a custom /usr/include directory in a compiler that didn't support alternate include paths.

      --
      Do you even lift?

      These aren't the 'roids you're looking for.

    2. Re:Then what is it for? by soloport · · Score: 5, Interesting
      What's it for?

      https://portal.mytesting.org:8080/ (including)
      * tinyHTTP (AppWeb, Apache, etc.)
      * SQLite (MySQL, Postgres, etc.)
      * [chroot-path-0]/www/html/*
      * Other ([chroot-path-0]/usr/lib, [chroot-path-0]/bin, etc.)
      and repeat...

      https://my-test-env.org:8081/

      https://my-test-env.org:8082/

      https://my-test-env.org:8083/

      https://my-test-env.org:8084/ Next, bind /proc to all 5. Then make a script to easily update them from SVN. Done.

      Now you have 5 chroot'ed web environments to help your test team (of 5) speed up Alpha testing. May be fraught with bad security? That's not the point.
    3. Re:Then what is it for? by SL+Baur · · Score: 1

      That sounds about right. My first serious use of chroot(2) was dealing with b0rken systems when my emergency root floppy had different versions of critical shared libraries (HJ Lu's forked libc5 was always much more space efficient than the GNU version). It is also useful building userland from scratch bootstrapped off a system with much older or different shared libraries, not much different than Joy's original usage it seems.

      Useful, oh yes. Something to secure your system with, hell no.

      RIP Turbolinux 7 for the DEC/Alpha.

    4. Re:Then what is it for? by Meeuw · · Score: 2

      Exactly, we are using chroot for our testing environment, it is much faster than virtual machines. The only two downsides are the shared resources (listening TCP ports, shared memory, shared kernel) and the bad security. The conflicting TCP ports can be resolved by NAT (iptables), the shared memory can be increased and the shared kernel version didn't cause any trouble (yet). Bad security isn't a real problem in a trusted environment.

    5. Re:Then what is it for? by Fordiman · · Score: 1

      chroot is for sandboxing build processes, far as I know. I don't understand how *anyone* could think it would be a good idea to use it for security. Essentially, even if you su to a non-root user to 'jail' someone, they can just exit out of their jail, and suddenly be a superuser. That would be *beyond* stupid.

      So, here it is: chroot is not, never was a security tool, at least, not for anyone competent.

      --
      110100 1101000 1101000 1100110 0 1101111 1101000 1100011 1
    6. Re:Then what is it for? by AndroSyn · · Score: 1

      Perhaps you should read the other posts here because you could not be further from the truth. Non-root users cannot just exit out of their chroot any time they want to and they certainly don't automagically be a super user. Now if they somehow elevated their privs via some method(kernel flaw or something) then yes root can typically break out of the chroot.

    7. Re:Then what is it for? by orangesquid · · Score: 1

      What you put in the chroot jail also matters. setuid/setgid programs can elevate priveleges, and then you might be able to break out of the jail, especially if a user is able to play tricks with his chroot'ed filesystem (check those directory permissions!); you don't need LD_PRELOAD (which is ignored for setuid programs, obviously, to prevent libc hacks) if you can mess with ld.so and /lib. A procfs mounted in the chroot jail (so 'ps' works) has /proc/1/cwd being the root of the real filesystem.

      Of course, the best practice is to put the minimum of what is necessary in a chroot jail (and be careful about what you might be tempted to hard-link to save on disk space) and have tripwire daemons spying on the chroot jail just in case.

      VMS has had the philosophy of "users who need a little administrative ability get those special permissions and ONLY those special permissions" for years, and modern security-enhanced UNIX and Linux distributions have implemented that functionality. If any users need to do anything fancy, you should be running a security-enhanced distribution by now :)

      --
      --TheOrangeSquid Is it any wonder things seem so awry? We swim in a sea of confusion and don't have to think to survive
    8. Re:Then what is it for? by Lord+Ender · · Score: 1

      chroot is used in Gentoo installation. After bootstrapping, you chroot to the new install to finish the installation steps (grub install, etc.) before rebooting.

      --
      A slashdotter who didn't build his own computer is like a Jedi who didn't build his own lightsaber.
    9. Re:Then what is it for? by Dare+nMc · · Score: 1

      chroot is for sandboxing build processes, far as I know.

      http://en.wikipedia.org/wiki/Sandbox
      # Sandbox (computer security), a virtual container in which untrusted programs can be safely run
      # Sandbox (software development), an online environment in which code or content changes can be tested without affecting the original system(s)

      So, here it is: chroot is not, never was a security tool


      By any definition, isn't something used as a "Sandbox" a security tool to protect the system?

      I know you probably intend to say it is not intended to contain malicious intent, but honest mistake/negligent programs. That would be like saying most locks are not for security, since they only discourage the honest.
    10. Re:Then what is it for? by Orkie · · Score: 1

      I work on Open2x (a firmware replacement for the GP2X) and I used chroot to allow backwards compatibility with the official firmware. Nearly all of the incompatibilities lie with different versions of libraries included (the official one uses ancient glibc 2.2.5 and Open2x, glibc 2.3.6 for example) so what I did to work around the issue is to package the whole of the official firmware's filesystem into a loopback image. This is then mounted using a script from the Open2x menu, it chroots into the image and launches the appropriate scripts to get the official firmware running. Of course this doesn't help with kernel incompatibilities, but it seems to do nicely for dealing with different library versions.

  2. misleading... by onemorehour · · Score: 5, Informative

    This summary is truly and terribly misleading--the discussion simply says that a root user can break out of a chroot jail. Is this news? chroot can still be effectively used to contain processes that do not run as root.

    1. Re:misleading... by QuantumG · · Score: 1

      A process running as a regular user can break out too. There's a variety of tricks. Virtualization solutions are much more secure.

      --
      How we know is more important than what we know.
    2. Re:misleading... by Brandybuck · · Score: 1

      That's the problem, you're assuming chroot is a jail. They serve two different purposes. If you need a jail, use a jail (or equivalent).

      --
      Don't blame me, I didn't vote for either of them!
    3. Re:misleading... by Anonymous Coward · · Score: 0

      Breaking out of chroot is done via various pretty standard techniques, which can be blocked by patchsets like grsecurity. Not perfect, but properly applied you're likely to be protected from most 0day exploit scripts.

    4. Re:misleading... by onemorehour · · Score: 1

      there are tricks that don't involve privilege escalation? I'd be curious to see what these are.

    5. Re:misleading... by QuantumG · · Score: 1

      Obviously they involve privilege escalation.

      --
      How we know is more important than what we know.
    6. Re:misleading... by risk+one · · Score: 2, Interesting

      So is the point of chroot safety rather than security? Ie. used to circumvent the "don't do stuff as root, because mistakes can have bad consequences" thing? I'm not intimately familiar with chroot, but this is how I understand it. It's possible to break out of a chroot jail (therefore don't use it for security), but it's unlikely that you'll do so accidentally (therefore feel free to use it for safety).

      Is that about right?

    7. Re:misleading... by onemorehour · · Score: 2, Insightful

      Then I don't see how this is different from saying that root privileges can escape from a chroot jail.

    8. Re:misleading... by fooDfighter · · Score: 1

      The only purpose for chroot I've ever known is for testing, (ie. chroot into a dummy linux install and play with stuff) or to repair a broken linux install by booting from floppy/cd and chrooting into the mounted linux partition. I don't think I'd trust it for security and there are better solutions to making mistakes as root (such as frequent backups).

    9. Re:misleading... by hedwards · · Score: 1

      Exactly, I thought chroot was for times like when you're compiling the OS for a live cd and need to install the binaries in the cd staging directory rather than in /.

    10. Re:misleading... by NNKK · · Score: 3, Informative

      It can be used as a safety mechanism for testing non-malicious code. It can also be used to setup an environment that uses different versions of key libraries or utilities from the host to run code that might not otherwise work. Linux distributions tend to make use of the chroot facility for installation tasks, as well.

      Using chroot on a process is like handing a person a map with an X on the destination. You've shown them where they're supposed to go, you haven't really done anything to prevent them from running off in another direction.

    11. Re:misleading... by QuantumG · · Score: 1

      Well there's kernel exploits for a start.. but yeah, ok, close enough.

      --
      How we know is more important than what we know.
    12. Re:misleading... by nine-times · · Score: 5, Insightful

      Honestly, I might be in the classification of people who don't understand, but I resent the implication of "incompetent". I really hate the idea that you have to be an all-knowledgeable ubergeek, or else stay completely away from computers.

      It seems like a simple issue: people have obviously felt the need to jail users for security reasons. They've been lead by someone to believe that chroot is a solution. If chroot isn't the solution, then why not give people a better solution instead of calling them incompetent.

      It reminds me of a discussion that I was involved in a while back. I'll tell the story:

      I posted to a forum asking what the best method was to jail SFTP users. I wanted something like FTP, but secure, and I didn't want users to be able to browse the whole filesystem. Some security expert chimed in basically calling me a moron, that if I didn't want people to browse the whole filesystem, I should use FTP and jail people. A lot of people in the forum agreed.

      I tried to explain that I didn't want to use FTP because authentication wasn't encrypted, but if I must use FTP did anyone know how to get encryption on the login. The same security expert chimed in again to inform me that there wasn't actually a good implementation for SSL on FTP. A lot of people in the forum agreed.

      I replied again asking more general advice. I wanted some kind of FTP-type login where authentication was encrypted and users were jailed. Again, it was implied that I was a moron. I was told I didn't understand security at all. I was told: If you trust your users, you shouldn't need to keep them from browsing the filesystem. If I didn't trust my users, then I should only worry about protecting my system from users, and jailed FTP logins were a good solution.

      I tried to explain again that I didn't want to trust my users, but I wanted to protect my users' information by providing a secure method for login. The reply again was that I was stupid and incompetent, didn't understand security, and shouldn't be running a server anyway. Many people in the forum agreed.

      So all I wanted was to know how to do something, and everyone thought it was a lot of fun to tell me how incompetent I was. If the answer is so obvious, why not explain it? More to the point, if you're such a fricken genius, why not figure out a way to get people the functionality they want in a form they'll understand? I still don't understand why secure authentication is a silly thing to want.

      Assuming that everyone running a server is going to be a super-genius who wants to spend all day researching everything-- having that expectation is retarded. I've been working in IT for a while, and I'll tell you right now that there are an awful lot of admins that are way dumber than I am. A solution that only super-geniuses can figure out isn't a practical solution because no one will use it.

      So if a lot of people want to jail users into a specific directory for various reasons, why can't we have that functionality? If one particular method (in this case, chroot) doesn't do a good job of jailing users, then can one of the super-geniuses out there come up with a good/real/practical/secure method for accomplishing that?

      If you can't, please refrain from name-calling because they want to do something that you can't figure out how to accomplish.

    13. Re:misleading... by risk+one · · Score: 1

      I know that postfix runs chroot (in a lot of distro's anyway). I figured they had some solid technical reason for this, but it turns out they actually use this as asecurity mechanism (see here). They know that chroot jails can be broken out of, but they claim that 'every little bit helps'. My intuition says that 'every little bit helps' is not an effective way to think about security, though.

    14. Re:misleading... by mgkimsal2 · · Score: 2, Insightful

      No, you can't actually have that. See, the majority of "open source" development is all about scratching an itch. Most developers don't have that same itch that you're having. They don't have "users" - they run their own machines, maybe give accounts to a few friends/colleagues, but they don't have the problem that you have. Therefore, the secure FTP with jailing is probably not on the horizon.

      Honestly, I've had the same problem, and what you're asking for is something that would benefit many people. It's just that this probably won't come about in the 'open source' development world because it's a pretty non-sexy problem, and is moderately low-level to deal with (sockets, ssl, etc.)

    15. Re:misleading... by evilviper · · Score: 0, Troll

      Assuming that everyone running a server is going to be a super-genius who wants to spend all day researching everything-- having that expectation is retarded.

      No, what's stupid is suggesting that a mailing-list or forum full of unpaid experts should be compelled to answer your trivial questions is the 'retarded' part.

      So you get to save a couple hours, not having to search the archives for the last 100Xs they answered the exact same question, and they get to give that 5 minute answer to you, and also the 100,000 people who ask that question after you, because they, too, didn't want to spend any of their own time looking for the answers themselves.

      If you ask the experts, and don't get as much advice as you wanted, you're still better off than when you started. Insults aren't good, but of course I don't know that anyone was really insulted, as this is just one person's account of what happened... Some people have extremely thin skin, and will also often leave out the fact that they were spewing insults left and right when they didn't get the answer they wanted...
      --
      Slashdot gets worse every day... Pipedot: News for nerds, without the corporate slant
    16. Re:misleading... by Anonymous Coward · · Score: 0

      methinks thou dos protest to much...

    17. Re:misleading... by Anonymous Coward · · Score: 0

      Use SFTP. It uses SSH internally, so communications are secure. Also, it only grants a user access he would have if logged in locally. Use that to your advantage.

    18. Re:misleading... by Aladrin · · Score: 1

      That's only 'insightful' if the list really -had- answered the question already. From his story, I'm going to assume they hadn't, didn't have the answer, and simply wanted to appear that they knew what they were talking about. If the answer was really that simple, it would have been easier to give him a link or just tell him how, rather than repeatedly insult him. Insulting him as well is optional.

      No, he doesn't have the right to expect an answer from them, but he -can- expect a civil response, or no response at all if they can't be civil. I don't know what list it was, and I didn't really pay attention to the question other than that he wanted a secure FTP setup. It doesn't really matter, though, as being civil should be the standard, not the exception. All too many lists and forums yell first and help later.

      --
      "If you make people think they're thinking, they'll love you; But if you really make them think, they'll hate you." - DM
    19. Re:misleading... by Anonymous Coward · · Score: 0

      Do you have a link to your forum thread? I ask because I'm often on the other side of these questions, the one trying to at least occasionally provide answers, and your summary points to a fair amount of pathological behavior. First you asked about a specific method (jailing SFTP) when all you cared about was the general case (FTP-alike with secure authentication) but you didn't actually mention why you wanted this. Then you ask about using FTP with SSL, still not saying what your overall goal is. Only after all this do you mention the general goal, and I bet this was poorly phrased too. By this time they were probably pretty frustrated at your time-wasting antics and weren't really giving their full attention to solving your problems for free.

      I do agree with your resentment of the term "incompetent", however. I think that should be reserved for people who are clearly unaware of their own limitations, such as those who constantly give bad advice that has the sound of coming from an expert, or those who are in a position of great responsibility without anything near the skills which are required for the position.

    20. Re:misleading... by thePsychologist · · Score: 1

      Honestly, I might be in the classification of people who don't understand, but I resent the implication of "incompetent". I really hate the idea that you have to be an all-knowledgeable ubergeek, or else stay completely away from computers.


      This is a general thing: most people when they know something that other people obviously do not, they call those people incompetent or stupid, even though they are ignorant of many things that other people are not. People do it to make them feel better and compensate for their inadequacies. People who are very capable in a single area are especially known for this partially because their lack of self confidence drove them to that area of expertise in the first place.
      --
      "What lies behind us, and what lies before us are tiny matters compared to what lies within us." Ralph Waldo Emerson
    21. Re:misleading... by Ice+Station+Zebra · · Score: 0, Troll

      This is why I use qmail. After all, the RFC for smtp hasn't changed in how long, so why isn't postfix finished yet.

    22. Re:misleading... by evilviper · · Score: 1

      From his story, I'm going to assume they hadn't, didn't have the answer, and simply wanted to appear that they knew what they were talking about.

      You're assuming a ridiculous amount of decidedly non-obvious facts...

      If the answer was really that simple, it would have been easier to give him a link or just tell him how, rather than repeatedly insult him. Insulting him as well is optional.

      People don't tend to maintain a list of links to every subject they've ever discussed. So somebody has to do the searching, rightfully it should be the one who wants to know the answer...

      And also: No. Insulting someone is really much quicker and easier than posting a link of typing an answer... umm... you idiot.

      but he -can- expect a civil response, or no response at all if they can't be civil.

      Again, you're assuming that's what happened, as opposed to just what he SAID happened. I've seen several people on /. complaining about their experiences with mailing list XYZ, and gone through the trouble of looking the threads up in the archive, only to find people almost always VASTLY exaggerate their experiences, if not outright lie.

      --
      Slashdot gets worse every day... Pipedot: News for nerds, without the corporate slant
    23. Re:misleading... by nine-times · · Score: 1

      No, what's stupid is suggesting that a mailing-list or forum full of unpaid experts should be compelled to answer your trivial questions is the 'retarded' part.

      Ummm... I don't know how to explain this to you since you seem to be somehow impaired, but it was a HELP FORUM. It was a forum specifically set up so that people could ask those sorts of questions, it was posted in the right place, and I had already searched the forum and many others to see if the question had already been asked and answered. Not one single person in the forum was questioning whether it was appropriate to ask the question, but they were all just blowing me off anyway and calling names.

      So what the hell is your problem? Seriously. I'm asking.

    24. Re:misleading... by evilviper · · Score: 1

      If it's a true story, link to the forum, and the actual thread if at all possible. It would certainly make it easy for readers to form a non-biased opinion of what actually happened.

      I've seen far too many examples where people vastly exaggerate their experiences.

      --
      Slashdot gets worse every day... Pipedot: News for nerds, without the corporate slant
    25. Re:misleading... by zippthorne · · Score: 1

      If they don't know the answer and don't have any desire to help him, what gives them the right to call him a moron? I mean, wouldn't it be easier to just say, "You can't do that with the tools available, and none of us are interested in making tools that would. You're on your own on this, so good luck." Or, y'know, not said anything at all?

      --
      Can you be Even More Awesome?!
    26. Re:misleading... by nine-times · · Score: 1

      This happened 3-5 years ago on a forum that I never revisited because the people were so utterly rude. It would take my hours to find the thread, assuming it's even still available.

      But my karma is generally good here, and you have access to my post history if you want to review it. Of all the things that people could accuse me of, no one who knows me would accuse me of being impolite when unprovoked or even particularly hot-tempered when provoked. I know lots of people are rude, but I'm almost always (at least!) less rude than the person I'm talking with.

    27. Re:misleading... by nine-times · · Score: 3, Funny

      People don't tend to maintain a list of links to every subject they've ever discussed. So somebody has to do the searching, rightfully it should be the one who wants to know the answer...

      Weren't you the one who just asked me elsewhere to post a link to the thread I was referring to?

    28. Re:misleading... by syzler · · Score: 1

      I know the frustration of trying to find a solution to a problem when other people do not see the merit of your objectives. I had a similar problem. I was unable to find a solution so I developed a program that basically calls a shell within a chrooted directory. The program drops the perms from root to the calling user after calling chroot(). You might give it a try if you are still looking for a solution since it should work for rsync and scp chrooted access:

      http://cvs.syzdek.net/projects/shail/

    29. Re:misleading... by xsspd2004 · · Score: 1

      Here are some places to start:

        * Look into Apache Webdav. It will run over SSL and allow Windows users access.
        * Depending on what your goal is, a CVS or some document management system may be a good solution.
        * A Wiki? Something like Dokuwiki or PMWiki allow you to share all sorts of files.

      I think there may be multiple solutions. That is, if you are willing to look at your problem from the perspective of what you are trying to accomplish, rather than trying to force a particular technology to apply to your problem.

      --
      This is not an illusion, a rip-off, or a ninja technique!
    30. Re:misleading... by gmack · · Score: 1

      Security is more than just the ability to gain root on a machine.. Qmail has good security in that regard however the ease of which it can be used for reflector spam (spam with bogus return address) means it's unusable without addon patches.

      I used to use Qmail for everything until spammers started to fill my mailq with bounces.. now it's postfix for everything.

    31. Re:misleading... by Phroggy · · Score: 1

      Here's the answer to your question:
      http://www.minstrel.org.uk/papers/sftp/

      You'll need to compile your own version of OpenSSH.  I'm running two instances of sshd, the default one that I can log into for administration and a hacked one for users (not on the same interface/port, obviously).  I mostly followed the instructions from that page, but with this setup I don't need to use his crazy hack that uses /./ in the user's home directory (which could interfere with other things), so I applied this patch to minstrel's sftp-server.c:

      --- sftp-server.c.minstrel      2007-09-04 23:54:06.000000000 -0700
      +++ sftp-server.c       2007-09-25 14:41:59.000000000 -0700
      @@ -1230,22 +1230,12 @@
              if (!user_dir)
                      fatal("HOME isn't in environment");

      -       new_root = user_dir + 1;
      +       /* Begin phroggy's hack */
      +       if (chroot(user_dir) != 0)
      +              fatal("Couldn't chroot to user directory %s: %s", user_dir, strerror(errno));
      +       setenv("HOME", "/", 1);
      +       /* End phroggy's hack */

      -       while ((new_root = strchr(new_root, '.')) != NULL) {
      -               new_root--;
      -               if (strncmp(new_root, "/./", 3) == 0) {
      -                       *new_root = '\0';
      -                       new_root += 2;
      -
      -                       if (chroot(user_dir) != 0)
      -                               fatal("Couldn't chroot to user directory %s: %s", user_dir, strerror(errno));
      -
      -                       setenv("HOME", new_root, 1);
      -                       break;
      -               }
      -               new_root += 2;
      -       }
      }
      #endif /* CHROOT */

      If you choose to run two sshds, you'll need to make sure they're not both trying to listen to the same interface/port, they use different PID files, etc. etc.

      Disclaimer:  if any of this turns out to be horribly insecure and your server gets hacked, it's not my fault.

      --
      $x='S24;r)>63/* h@<5+oZ)32"5cz';$me='phroggy'x$];
      $x=~y+ -xz+\0-Tx+;print$_^chop$me for split'',$x;
    32. Re:misleading... by SirSlud · · Score: 1

      Using chroot on a process is like handing a person a map with an X on the destination. You've shown them where they're supposed to go, you haven't really done anything to prevent them from running off in another direction.

      What a succinct way of putting it.

      --
      "Old man yells at systemd"
    33. Re:misleading... by evilviper · · Score: 1

      Let's see... In your first post you called random people "retarded" and then you unprovokedly called me "somehow impaired."

      I think I'll reserve judgment on just how incredibly polite you are.

      Besides, that was only one of the points I brought up. I'm not going to take the rest of your assertions on faith, either.

      --
      Slashdot gets worse every day... Pipedot: News for nerds, without the corporate slant
    34. Re:misleading... by TerranFury · · Score: 1

      I too have wanted the exact same thing.

      In fact, it is starting to bother the heck out of me that servers rely on filesystem permissions to begin with, and I'm starting to think that it's something Unixes simply do wrong. Isn't it a security risk? Why do we let a user roam free around a drive, and hope that we set our permissions strictly enough everywhere?

      Simply, I see no reason why an FTP or SFTP server needs to be tied to the filesystem at all. Why are FTP permissions associated with the files; they should be associated with the FTP server! (In a config file, say). And why does an FTP user need to be a 'nix user, anyway?

      Most of the servers I've used on Linux were too big and too tied to the underlying system. I want nice, lightweight things that do a simple job well, and which do not require that I modify other parts of the system.

      My all-time favorite FTP server was a little Windows program called SlimFTP. It was lightweight, and used a simple text file for configuration. It looked kind of like this:


      <User "bob">
      Password "god"
      Mount /Upload c:\ftp-upload\
      Mount /Software d:\downloads\programs
      Mount /Music e:\media\music
      Allow / Read List
      Allow /Upload Read Write List
      </User>

      <User "ezekiel">
      Mount / c:\home\zeke
      Allow / Read List
      </User>

      It was beautiful! I would love to have an SFTD daemon that took a config file like that.

      Alas, the only thing I can do is kludge together a login script per user that sets up a chroot jail, mounts directories outside the jail to directories inside the jail using loopback filesystems, etc. It's (1) a pain, and (2) error-prone. For a supposedly-secure operating system, "The Linux Way" seems to include surprisingly few nice little self-contained services.

    35. Re:misleading... by Vellmont · · Score: 1


      So if a lot of people want to jail users into a specific directory for various reasons, why can't we have that functionality?

      I don't know exactly how chroot works on the OS level, but I've never felt it was a complete method that's sure to keep people from doing what they shouldn't.

      If you want to give people access to a storage, but keep them safe from browing, I'd look into using something like webdav. There's an implementation of it in apache, which is well tested and accepted as secure, and it works over plain old https as well as http. It's also pretty well supported. SFTP is really more of an afterthought on functionality patched onto ssh (IMO at least), and thus doesn't have more advanced functionality like defining it's own root directory you can't get past.

      FTP is the devil as far as I'm concerned. It's a sucky protocol that's outlived it's usefulness, and doesn't play well with NATs (and obviously isn't secure either). I guess it's OK if all you care about is bulk insecure downloads, and your firewall plays well with it, but otherwise I hate it.

      (Btw, I do know what you mean about the self appointed experts. The sad thing is those people probably know one or two things really well, and know nothing about anything else in IT)

      --
      AccountKiller
    36. Re:misleading... by VGPowerlord · · Score: 1

      Too bad I wasn't in that discussion. I would have recommend using FTP over SSL/TLS. I know proftpd server and Filezilla client (and presumably server) support it.

      --
      GLaDOS for President 2016! "Well here we are again. It's always such a pleasure." -- GLaDOS, 2011
    37. Re:misleading... by quenda · · Score: 1

      > I really hate the idea that you have to be an all-knowledgeable ubergeek, or else stay completely away from computers.

      Nonsense - you are making a wild extrapolation there.
      Security is a VERY special case. With anything else you can muck about until it works, but to design a secure system, you really do need to be an expert. How do you know when a security system works?

      As for the earlier incidient, it sounds awful, but did they _really_ call you "stupid and incompetent" or are you taking offense too easily? Maybe you demanded a simple answer and there was none.
          Your line about "super-genius who wants to spend all day researching everything" suggests an attitude that may have caused much annoyance and offence.

    38. Re:misleading... by sco08y · · Score: 1

      It reminds me of a discussion that I was involved in a while back.

      That reminds me of a whole lot of discussions I've read.

      People simply can't answer the fucking question. "I need to use product A, how can I accomplish B?" "Well, you need to use product C and then you wouldn't need to worry about B!"

      I really hate the idea that you have to be an all-knowledgeable ubergeek, or else stay completely away from computers.

      You have to have a thick skin. The person reading your question might be bored, impatient, a troll, or might have exactly the answer you need. Don't take it personally.

    39. Re:misleading... by nine-times · · Score: 1

      Wow, I appreciate the info and think I'll probably squirrel it away for later. However, the story I was telling was from several years ago, and I a coworker eventually found a script that makes sure some users are limited to using a particular shell that (as I understand it) effectively limits users using that shell to jailed SFTP access. It seems to work.

      My larger point, though, is that something *like* jailed SFTP is a genuine need. Lots of people want jailed FTP functionality with secure authentication, and possibly even encrypted transfers (why not?). So though I've been told by security experts who seemed quite knowledgeable that what I was asking for was stupid, it still seems to be a need. And it's also the sort of need that shouldn't need to be hacked together.

      IMHO, FTP should be upgraded in order to be secure and encrypted (at least in authentication), or someone should write a good daemon to run a SFTP server that allows jailed SFTP sessions, even if it needs to be totally separated from the SSH daemon. Or, as a third option, someone could write something entirely new that would allow easy CLI-based file transfers in a secure method. I wouldn't claim to be expert enough to know which of those three are the best option, or whether there's a fourth option-- someone suggested to me that I should be looking at webdav instead. Whatever the best solution is, it should be standard, well engineered, and be able to be reasonably installed by a non-genius without needing special hacks.

      Ignoring the particulars, people do in fact need secure file transfers. They want to be able to move files between Internet accessible computer in such a way that authentication and data are encrypted, and neither computer involved in the transfer has its own security compromised. I think that's a reasonable thing to be looking for, but if someone has a real argument why what I'm saying is stupid, that's fine. I'd love to hear that argument, just so long as it consists of something more decent than saying, "you're an incompetent moron."

      And I don't know that this is the same sort of problem as what's being discussed about chroot jails, but it reminded me of it. Returning to the topic at hand: In abstract, I can't think of why it's unreasonable to want to jail someone in a limited environment within a non-limited server. I'm willing to accept that chroot isn't a good solution, but I wouldn't call someone incompetent just for trying.

      In any event, thanks for sharing your solution. It's nice to see patient and helpful people on the Internet.

    40. Re:misleading... by grumbel · · Score: 1

      ### And why does an FTP user need to be a 'nix user, anyway?

      Because thats how it all started many years ago and nobody ever bothered to fix it. One of the problems is that there has been virtually no fixing of usability going on the command-line/server side of things. When people talk about usability they always focus on the desktop side, which is all fine and good, the command-line/server one however is often even more broken, which is sad, since especially security would profit a lot when people would actually understand what they are doing and not just patching together snippets that they have picked up from some howto/mailinglist/random-webpage, like way to many do these days due to programs simply being both to hard to understand and simply unsuited for the job they are used for.

    41. Re:misleading... by DougWebb · · Score: 2, Insightful

      Can't you do something like this with Apache?

      • You can map URL paths to filesystem directories (separate URL path for each user)
      • You have all sorts of ways to do user authentication and authorization (your users aren't system users)
      • You can control permissions for GET, PUT, DELETE, etc separately (very fine-grained permissions)
      • HTTP gives you browsing and retrieval, WEBDAV gives you a virtual filesystem, other protocol modules are available.

      It's not as straightforward to configure as SlimFTP seems, but it's a lot more flexible, and it's available.

    42. Re:misleading... by nine-times · · Score: 1

      In your first post you called random people "retarded"

      No, in my first post I called a certain sort of expectation "retarded".

      then you unprovokedly called me "somehow impaired."

      An "unprovoked" response to a message where you're saying that my thoughts are stupid and retarded, my questions are trivial, and implied that I was a lazy liar. Like I said, "I'm almost always (at least!) less rude than the person I'm talking with."

      I'm not going to take the rest of your assertions on faith, either.

      Aww... that makes me very sad. I think I'll go into my timeout corner and cry.

    43. Re:misleading... by FreakWent · · Score: 1

      I suspect that pure-ftpd does what you're asking. Please take a look.

    44. Re:misleading... by Anonymous Coward · · Score: 0

      you're such an incompetent carma whore, the only reason you succeeded was the editors, they're worse :D

    45. Re:misleading... by Anonymous Coward · · Score: 0

      Your post could have been really usefull a bunch of eons ago, when virtualization didn't exist.

      Regards.

    46. Re:misleading... by nine-times · · Score: 1

      You have to have a thick skin. The person reading your question might be bored, impatient, a troll, or might have exactly the answer you need. Don't take it personally.

      Oh, I'm fine with it. Didn't get too upset. But I just don't appreciate the attitude of calling someone "incompetent" just because they want to be able to set up a secure system with basic services without a huge hassle. IMHO, you should be able to set up a relatively secure Linux server with basic services (web, FTP, SSH) without knowing any more than I do. In fact, I believe that you can. Also, I know that there are far less knowledgeable people than me setting up servers with those basic services.

      So I may not be a genius, but if I'm too stupid to set up a server properly, then we're all in trouble because pretty much everything is going to be set up wrong (actually, that would explain a lot). That leads to the big idea that I'm really trying to push: If you come up with a really brilliant security design, but only a small percentage of the people implementing that design are going to be smart enough and knowledgeable enough to set it up properly, then you should consider that it might not be such a great design.

    47. Re:misleading... by Rutulian · · Score: 1

      I realize this wasn't your point, but you should have a look at kerberized ftp and ftpd.

      I sympathize with your indignation. I don't see why people can't just recognize what you are trying to do and suggest a better way (if there is one). Ok, so chroot is not the equivalent of BSD "jails" or Solaris "containers." Is there an equivalent for linux? Shouldn't there be? It seems like these are important questions. Calling someone incompetent for wanting this functionality and not finding it is just an attempt to distract from deficiencies in linux.

    48. Re:misleading... by dfn_deux · · Score: 1

      For equivalents or close approximations I *believe* that linux + grsec can accomplish the task of creating a chroot which can be used as a security tool. In as much as you can create one that cannot be easily escaped, even as a root user.

      --
      -*The above statement is printed entirely on recycled electrons*-
    49. Re:misleading... by m0nkyman · · Score: 1

      So pay someone to do it. Being unable to program doesn't mean you're unable to pay someone to program. Works out the same in the end.

      --
      ~ a low user id is no indication I have a clue what I'm talking about.
    50. Re:misleading... by McKing · · Score: 1

      Another solution is (unfortunately) a commercial one. Tectia SSH from ssh.com has an option to prevent the user from cd'ing up out of their home directory.

      I have no real idea why openssh doesn't have this same ability. Makes no sense to me, except the the openssh devs probably don't see a need for it.

      --
      If only "common" sense was actually that common...
    51. Re:misleading... by evilviper · · Score: 1

      Continuing to provide evidence of your wonderful manners...

      --
      Slashdot gets worse every day... Pipedot: News for nerds, without the corporate slant
    52. Re:misleading... by rgaginol · · Score: 1

      I feel your pain dude... I think the problem with securing a system is that it's very similar to code performance optimization without any real indicator as to what isn't performing. Basically, you've got your regular set of security principals (removing uneeded processes, closing ports, regular patching etc) and then a whole host of "super secure" stuff which, at the end of the day, if you've got people who're that smart attacking you, you're probably already screwed anyway - or they'll get in anyway since Larry in Marketing has "Larry" as his password. The path of least resistance is always the rule here, and if you haven't kept the people factor on board then hackers would probably go for that option.

      The problem with "133t" security experts, or even just condescending security experts, is that a big part about staying on the top is bashing other peoples egos. In their minds, they know the perfect solution: A computer with no network cable which isn't accessible by users. At some point, everyone has to take on board the fact that plugging a computer into the Internet is a risk. It's the rule of having 6 billion people on earth (nicely identified by Homer): "No matter how good you are at something, there's always a million people better then you".

      Finally, I totally agree with you regarding the role of security "experts" - it's the job of security people to try make existing processes more secure, and only change the way people work as a last resort (due to things like inherent flaws in a protocol, like FTP). They shouldn't be stopping any sort of valid business function. It's about compromises, not absolutes.

    53. Re:misleading... by ledow · · Score: 1

      Firstly, I'd recommend finding yourself a better forum.

      Secondly, no matter where you post, there is always a signal-to-noise ratio that you have to deal with when receiving answers to technical questions. This is also true of any technical support, from the phoneline for your kettle manufacturer up to your online e-help assistant for your mainframe. You just have to fight through the crap. Usually this means that I just say "put me through to someone who KNOWS what they are talking about" repeatedly until they get the hint. Yeah, it's rude, but I'm not being paid to go around in circles dealing with people reading from automated scripts (or paying them for the privilege).

      I work in IT support for schools and I'll tell you now - the ratio of "people who are talking on the same level" to "people who have no clue what I'm talking about" is about 1:100. That's not being insulting to them - you can't expect everybody to know. And equally somewhere they might be helping lots of people that DON'T know how to do the simple stuff.

      The problem is that the more you learn, the more becomes "easy" or "obvious". So once you've been doing it for so many years you tend to get brusque with people. People don't have to be polite... it's just helpful if they are, but the older you get and the more you learn, the more you tire of explaining the "obvious" and the ruder you come over. But that's not an excuse for being rude or condescending... you should still try to be polite. I don't know how many times I've had people ask me certain questions ("Well, why can't I just run my wireless network without WEP, it's so much easier to set up without all these passwords." etc.) but I do tire of it and yet I try to remain polite (try being the operative word!).

      Also, I've tended to find that when someone says that "you can't" do something, they don't know what they are talking about. The ones who KNOW tend to say "well, you can, but it's not recommended because..." instead. Think how you would answer the FTP vs SFTP (or telnet vs SSH) question. It's not that you CAN'T do FTP or telnet, it's that there are very good reasons not to.

      As with all things, you'll get idiots. Try to ignore them. If you were in a store and the clerk was trying to tell you what computer game you REALLY want, you'd be polite for a while, explain that you'll choose yourself, and after a certain amount of badgering you'd either a) blank them out completely or b) leave the store.

      If someone can't talk at your level, then it most probably means they've never BEEN at your level (i.e. they are bullshitting or repeating what they've heard elsewhere) or that they aren't really interested in helping you. Move on and find someone else.

    54. Re:misleading... by Anonymous Coward · · Score: 2, Insightful

      Why is this so hard to believe?? #Linux on efnet at one time was horrible for this type of behaviour. There were a number of people in there who thought they were gurus (and had channel op status which went straight to their heads) and then when someone came in with a question they didn't know the answer to, they'd insult the guy and question his motives rather than just staying silent or admitting they didn't know the answer.

      One instance in particular was a fellow who joined and asked if there was a way to get his new 3D video card working in Linux (I can't recall the brand/model, but it was around the ATI Rage Pro era, quite some time ago). Instead of saying "no idea" or "sorry, that just won't work", he was met with ridicule. "Why the hell do idiots buy brand new 3D cards and expect them to work in Linux, blah blah blah". In most cases, if the victim tried to defend his actions, he was just kicked and banned. Real mature. People like this are NOT helpful and the community would be better off if they'd simply fuck off and die.

    55. Re:misleading... by BZ · · Score: 1

      One possible solution to your problem might be a Kerberos-enabled FTP client and server. It's a bit of overkill, perhaps, because you have to set up Kerberos to start with, but I think it should give you exactly what you want: FTP with its jail features, but with the authentication taking place over an encrypted data channel.

    56. Re:misleading... by musicmaker · · Score: 1

      Have you ever heard of Passive mode? Plays just fine with NATs

      --
      Everyone is living in a personal delusion, just some are more delusional than others.
    57. Re:misleading... by Eli+Gottlieb · · Score: 1

      So all I wanted was to know how to do something, and everyone thought it was a lot of fun to tell me how incompetent I was. If the answer is so obvious, why not explain it? More to the point, if you're such a fricken genius, why not figure out a way to get people the functionality they want in a form they'll understand? I still don't understand why secure authentication is a silly thing to want. Why not tell you? Because depriving the forum-going admin of his superiority complex would make him realize the truth about his own life: that he's a 37-year-old IT server admin for a low-end government contracting firm in construction and that he hasn't had a meaningful human relationship (let alone an S.O.) in twelve years because he spends all his time outside of work on World of Warcraft.
    58. Re:misleading... by Jimithing+DMB · · Score: 1

      I posted to a forum asking what the best method was to jail SFTP users. I wanted something like FTP, but secure, and I didn't want users to be able to browse the whole filesystem. Some security expert chimed in basically calling me a moron, that if I didn't want people to browse the whole filesystem, I should use FTP and jail people. A lot of people in the forum agreed.

      Forums are generally the blind leading the blind. The solution to your problem lies in the way SFTP works. Basically, the SFTP client builds atop an SSH client which connects to the SSH server asking for the SFTP subsystem (the sftp-server process). I've never done it but it ought to be possible to make a chroot environment containing a bare-minimum environment (specifically you'd need at least the sftp-server binary and any dependent libraries and /dev entries). You then ought to be able to configure sshd (see sshd_config manpage) with a different Subsystem sftp that uses your custom binary. Assuming you do it right (e.g. /sbin/nologin for login shell) and don't write any security holes in your binary that chroot's and runs the real sftp you should be fine.

      Keep in mind that in order to call chroot successfully you must have root privileges which means your binary (that you'll have to write) needs to be setuid root. It should be able to chroot to the proper dir, drop effective root privileges (thus reverting back to the real user ID that ran it) then run the real sftp-server.

      To avoid having to create a billion jails I'd probably recommend using just one for all users and depending on the users new "home directories" simply not having group or world rwx permissions.

      If you have a bit of knowledge about C you ought to be able to write the program using the manpage from chroot, seteuid, and execve. If you don't know how to roll your own, then you could always pay someone to do it, such as myself.

    59. Re:misleading... by NitroWolf · · Score: 0

      Sounds like you want ProFTPd for Linux. Does everything you ask, with the configuration file almost identical to what you just posted.

      ProFTPd is somewhat of a standard ftp daemon to include in Linux distro's now adays, I'm surprised you never came across it.

    60. Re:misleading... by zerocool^ · · Score: 1


      http://www.ssh.com/support/downloads/secureshellwks/non-commercial.html

      This is the answer to your problems.

      This SSH client comes with bot the standard terminal program for SSHing and getting a shell, but it also comes with an SCP component. It looks like most FTP clients I've seen - Click a button to open a connection, in the resulting dialogue box, put in the server to connect to and the username to use to connect, click connect, type in password when prompted, and then Voila', you're given on the Left-hand side of the program, a list of your local files, and on the right side of the program, a list of the remote computer's files. To upload or download, drag and drop (from either inside the program from the left to right or right to left; or drag and drop works from the Windows explorer).

      See? Encrypted (it's ssh). FTP-like. Keeps security in mind without jailing users, at the same time that it keeps their passwords safe, at the expense of a little speed.

      ~Wx

      --
      sig?
    61. Re:misleading... by Vellmont · · Score: 1


      Have you ever heard of Passive mode? Plays just fine with NATs

      I have, and it's problematic as well. It's been at least 3 years since I had to deal with setting up an FTP server, but IIRC passive FTP requires a range of open ports on the server end. Some FTP servers allow you to limit the port range, others don't. From what I remember each connection to the FTP server requires it's own port.

      It's just a sucky protocol all around from a security perspective. It's fine if, like I said you don't care about data security or limiting port access to a server running FTP. Hell, it's a sucky protocol from a hosting perspective too. The only way to distinguish www.myftpsite.org from www.myotherftpsite.org is by IP address. So no virtual hosting for ftp.

      --
      AccountKiller
    62. Re:misleading... by Blkdeath · · Score: 2, Insightful

      Honestly, I might be in the classification of people who don't understand, but I resent the implication of "incompetent". I really hate the idea that you have to be an all-knowledgeable ubergeek, or else stay completely away from computers.

      No, you don't have to be an "all-knowledgeable ubergeek", but if you're going to discuss security in a technical forum you should enter into it with some level of knowledge that grants you entry. People who operate at level 10 don't want to hold people's hands through levels 1 through 3 all the time, they want to discuss level 8 through 12 problems to broaden their own understanding. So find yourself a forum more appropriate to your level of expertise (a classroom might be a good start) and move up when you're ready.

      If you don't want to spend all that time furthering your education and developing your skills you could atleast use some basic research abilities and garner some knowledge on the subject so you can ask pointed questions about various implementations rather than generalities about what you could do.

      For the record, you don't like the "ubergeek" approach - well on the flip side of the coin people who have studied, researched and practiced computer/network administrative security for years (decades) don't appreciate every newbie firing a distro onto a spare partition and considering themselves "administrators". For the record, it's thousands/millions of your type who set up inherently insecure servers who contribute greatly to the spread of malware on the Internet through open proxies and relays, so there's a little bit of ire on the other side of the fence.

      So if you're going to unleash your services on the open Internet, please, get some education first, open ports second.

      --
      BD Phone Home!

      Shameless plug. Like you weren't expecting it.

    63. Re:misleading... by Anonymous Coward · · Score: 0

      It seems like a simple issue: people have obviously felt the need to jail users for security reasons. They've been lead by someone to believe that chroot is a solution. If chroot isn't the solution, then why not give people a better solution instead of calling them incompetent.


      Well said. It sure seems like a case of someone being whiny that something turned out to have more uses than they expected. That's a software developer's highest goal -- to create something that has unforeseen uses. Sure, it means you have to support usages you didn't envision or design for. Suck it up and be glad you're useful. Don't be all, "I don't approve of that usage so I'm going to break it."
    64. Re:misleading... by JasterBobaMereel · · Score: 1

      It's very simple chroot was originally not a jail for a process, but it can be used like that (as a side effect), but you should not use it to jail a process that you have given root privilege to ...

      root by definition can do anything including breaking out of chroot ..if you want to restrict a process then do one of two things use chroot but run the process as an ordinary process, or run as root and use a proper security tool to restrict it. The problem seems to be processes that have to be run as root and people misguidedly attempt to restrict using chroot

      The simple message is that security done badly is worse than no security since it gives the impression that a system is secure when it is not ...

      --
      Puteulanus fenestra mortis
    65. Re:misleading... by Anonymous Coward · · Score: 0

      Failing to win yourself any points here, viper. Give it up as lost and move on.

    66. Re:misleading... by Phroggy · · Score: 1

      IMHO, FTP should be upgraded in order to be secure and encrypted (at least in authentication), FTP is a horrible protocol and needs to die.

      or someone should write a good daemon to run a SFTP server that allows jailed SFTP sessions, even if it needs to be totally separated from the SSH daemon. This would neatly solve the problem... except that the security parts of SSH are pretty complex, and it would probably be difficult to write a stand-alone SFTP server that wasn't buggy. This is the best solution, but it would be difficult to do well. I would suggest starting with OpenSSH, hacking it to behave the way you want, then stripping out the parts you don't need until you've got something reasonable, and packaging it up to make it easy to administer.

      Or, as a third option, someone could write something entirely new that would allow easy CLI-based file transfers in a secure method. Bad idea. SFTP is already widely supported on the client end, and is perfectly appropriate for servers where users have full shell access (in fact, it's great for those environments because the system administrator has to do absolutely nothing - SFTP just works by default).

      someone suggested to me that I should be looking at webdav instead. You'll have similar issues with WebDAV. I'm not aware of a stand-alone WebDAV server; most people run Apache configured with mod_dav. It works fine for a single-user environment, where all files are owned by the user Apache runs as, and user logins are handled with an htpasswd file. In a multi-user environment where each user owns their own stuff, mod_dav won't work. Other server options are listed here. Writing an HTTP server designed to run as root, accept a connection, spawn a child process, parse a request, authenticate against /etc/passwd and friends, setuid to that user, then handle the request (or whatever other order things would need to be done in) without huge gaping security holes is non-trivial. It could be done, but not by me.
      --
      $x='S24;r)>63/* h@<5+oZ)32"5cz';$me='phroggy'x$];
      $x=~y+ -xz+\0-Tx+;print$_^chop$me for split'',$x;
    67. Re:misleading... by bn557 · · Score: 1

      And proftpd supports using mysql (and others I'm sure) for all of these parameters. At one point I had written a simple (read, not nice) little UI for managing users where they'd log into a webpage, then it'd assign a temporary login for them that was expired once they were idle for some time. I still have my proftpd config lying around, but it's not hard with basic SQL skills to set up on your own.

      --
      Humans are slow, innaccurate, and brilliant; computers are fast, acurrate, and dumb; together they are unbeatable
    68. Re:misleading... by kevinadi · · Score: 1

      Calling people idiots for not understanding something and asking some logical explanation has been a staple for some online communities. Apparently it's easier to say someone's an idiot through a keyboard rather than saying it to their face. After all, the VR technology is not advanced enough to let you punch someone in the face through the internet (although the availability of this VR technology WILL drive down useless name-calling on said communities, but I'm not holding my breath).

    69. Re:misleading... by kensan · · Score: 1

      Honestly, I might be in the classification of people who don't understand, but I resent the implication of "incompetent". I really hate the idea that you have to be an all-knowledgeable ubergeek, or else stay completely away from computers. I understand your reaction but it might be worth noting that this discussion was not lead on some average joe internet forum but on the *rather* technical Linux Kernel Mailing List. It is fair to assume that the audience discussing this patch is able to follow the reasoning that preceded that statement. Alan Cox' reply did not just entail that one sentence. It might be worth to RTFA...
    70. Re:misleading... by jrumney · · Score: 1

      without jailing users

      You need to go back and read the GP's post again.

    71. Re:misleading... by jimicus · · Score: 1

      So all I wanted was to know how to do something, and everyone thought it was a lot of fun to tell me how incompetent I was. If the answer is so obvious, why not explain it? More to the point, if you're such a fricken genius, why not figure out a way to get people the functionality they want in a form they'll understand? I still don't understand why secure authentication is a silly thing to want.

      Sounds like you ran right into the sort of mailing list which gives Linux support a bad name. Most mailing lists have got a lot better in the last 5 years, and you're generally in a much stronger position if you already know what product you want to use and you can direct your question at the mailing list dedicated to that product.

      There remain, however, one or two which I'd don an asbestos suit before asking a question of. And at least one of those is the users mailing list for a commonly used server application.

    72. Re:misleading... by Bert64 · · Score: 1

      You could always use vsftpd, it supports FTPS (ftp over ssl) and lets you chroot the users into their homedirs...

      --
      http://spamdecoy.net - free throwaway anonymous email - avoid spam!
    73. Re:misleading... by Anonymous Coward · · Score: 0

      Did you look at rssh?
      http://www.pizzashack.org/rssh/
      it might be worth a google

    74. Re:misleading... by Eunuchswear · · Score: 1

      Simply, I see no reason why an FTP or SFTP server needs to be tied to the filesystem at all. Why are FTP permissions associated with the files; they should be associated with the FTP server! (In a config file, say). And why does an FTP user need to be a 'nix user, anyway?
      It doesn't.

      It's pretty easy using perl's Net::FTPServer to make a ftp site where users aren't Unix users, directories aren't Unix directories and files aren't Unix files.

      There are doubtless other ways of doing it, but that's the way I've done it in the past.

      --
      Watch this Heartland Institute video
    75. Re:misleading... by Aladrin · · Score: 2, Insightful

      Of course I'm assuming he isn't lying here. If you simply assume everyone's lying, there'd be no point in ever responding.

      As for 'they should be the one to search'... Of course they should. But then, most people that can type without using contractions like 'ur' know that, and do. The problem is that if you only have a need, and no idea how to solve that need, what do you search for? Quite often the 'obvious' solution has a non-obvious name. He assumed that 'secure ftp' would be what he wanted. It wasn't what he wanted, though, and they insulted him for it. It would have been my first guess, too.

      In my experience, when people complain about the uncivil responses they've gotten, they really did get them, deserved or not. If he's an ass, there's no need for them to be asses, too. That's what moderators are for. People that get no response generally complain about that, instead.

      --
      "If you make people think they're thinking, they'll love you; But if you really make them think, they'll hate you." - DM
    76. Re:misleading... by uglyduckling · · Score: 2, Informative
      See, the majority of "open source" development is all about scratching an itch. Most developers don't have that same itch that you're having. They don't have "users" - they run their own machines, maybe give accounts to a few friends/colleagues, but they don't have the problem that you have. Therefore, the secure FTP with jailing is probably not on the horizon.


      Don't be silly, there are open source developers producing and using open source software in 1001 different scenarios. Many people are using Linux or BSDs in university computer labs, small companies, running web servers with shell access. You're right that no-one has developed this yet but there are thousands of network utilities in the Debian source tree and BSD Ports that demonstrate that developers are producing high-quality software for large-scale networked environments.

    77. Re:misleading... by Velaki · · Score: 2, Insightful

      "Honestly, I might be in the classification of people who don't understand, but I resent the implication of "incompetent". I really hate the idea that you have to be an all-knowledgeable ubergeek, or else stay completely away from computers."

      With respect to technology, one is incompetent if that individual is unable to bring appropriate knowledge or skill to bear regarding a specific task. As for the prerequisite of being an omnipotent transnerd, I find your logic sadly off base. That would be akin to whining, "I can't have beef so I MUST have fish!" What about chicken? Stop the black and white thinking.

      "If you can't, please refrain from name-calling because they want to do something that you can't figure out how to accomplish."

      I almost was rendered incontinent while reading this statement, esspecially after the obvious hurt and angry statement, "all-knowledgeable ubergeek," above.

      "More to the point, if you're such a fricken genius, why not figure out a way to get people the functionality they want in a form they'll understand? I still don't understand why secure authentication is a silly thing to want."

      More anger? I think that you want a toaster. You know, press the button, and poof! Toast. Linux is NOT Windows or any other typical one-stop-shopping system. In its early days, you needed to understand DOS, and how to manage your system in Windows, but over time it's been streamlined to appeal to the kiosk-seeking, text-messaging, instant-gratification-needing, pseudo-efficiency-requiring brat. (Substitute "boss," "manager," or "teenager" here.)

      If you wish to help with the effort of easing people's use of essentially free systems, then roll up your sleeves, learn the inner workings, and participate in development. If not, at least take the time to learn how to manage your system in a safe and effective manner. After all, do you simply drive your car until it overheats, seizes, or runs out of gas? Or do you take the time to ensure it has enough antifreeze, oil, and gas?

      Pardon the brusqueness of my post, but I am rather hurt by the perjorative comments of the self-entitled, whose lack of patience in taking time to even attempt to understand the barest mininum regarding their own system, demonstrates clear incompetence.

      Riposte!
      -v

    78. Re:misleading... by Freultwah · · Score: 1

      I chose Pure-FTPd. Authentication over TLS (or not, depending on how you set them up), users jailed (or not, depending on their level of trust). I hear there are quite a few other solutions that can do what you asked, so it must be you asked your question quite a long time ago.

    79. Re:misleading... by vtcodger · · Score: 1
      This has to be a first. You post an articulate thoughtful post on Slashdot (On Slashdot!!! My first thought was that this guy has to be nuts). You get bashed. And provoke a storm of articulate answers defending on-line civility and bashing the arrogant jackasses who prevail in some Unix communities.

      You sir, are a miracle worker. Have you given any thought running for God in the next elections in your country?

      BTW, did you read the whole thread on Kerneltrap? Down near the end someone points out that chroot(2) and chroot(8) are not the same thing -- something that most of the participants in the argument probably knew, but seem not to have considered relevant. Turns out that much of the snapping and snarling over there in this case is looks to be caused by the fact that Unix has two related things that have the same name but behave differntly and are not the same thing.

      --
      You can't see ANYTHING from a car, You've got to get out of the goddamned contraption and walk...Edward Abbey
    80. Re:misleading... by Icy · · Score: 1

      I have to agree. Security is like an onion, it is made up of layers. chroot is just one of those layers.

      If a process is not running as root, and there are no suid binaries or kernel exploits, then it is much harder to break out, especially using the second chroot() method. If you do have kernel exploits or suid binaries laying around and not using chroot, then you are just as vulnerable. At least adding a chroot environment adds the possibility of being more secure.

      If someone wants to hack your server, and they have enough skill, then they will. Why make it easier for them? If they don't have enough skill, you stopped them from making a mess. It's not a cure, but it is better then nothing.

    81. Re:misleading... by Anonymous Coward · · Score: 0

      What can I say? Awesome response. I got a good laugh. Some people want everyone else to do all of the work to match their own inconstancies all the while complaining how everyone else is in the wrong. Cheers to you on nailing this one. :)

    82. Re:misleading... by Bearhouse · · Score: 1

      Know how you feel. It's just so much easier for these bozos to say "you're dumb", rather than risk getting flamed themselves by offering a 'solution' that exposes their own incompetence. I see lots of comments (when being asked to meta-mod here) that have been marked 'flamebait' etc. that were really quite honest or, at worse, just a little naïve...

    83. Re:misleading... by ahodgson · · Score: 1

      look for pure-ftpd. You can have virtual users in databases or whatever. It's also written very securely.

    84. Re:misleading... by Anonymous Coward · · Score: 0

      To answer your question, SSL is awkward to fold into FTP. So is SSH: the sftp protocol and tools are extremely nasty and entirely mishandle symbolic links. It's really the antique rcp protocol, with an interactive text interface, and as such is far stupider than modern FTP services and clients.

      There are some workable rsync-over-SSH approaches that suffer from the lack of a real chroot in OpenSSH: the authors of OpenSSH have the same sort of attitude as Alan Cox, and don't seem to acknowledge that we want to use SSH without giving a user a real shell. I know, because I used to publish patches, and they proudly ignored them with the same nonsense quoted by the Subversion authors. "If you don't trust what users can do with access to the system, you shouldn't be running anything on it." Admittedly, the OpenSSH authors do so for the server side and the Subversion authors do it on the client side, but it's the same fundamental misunderstanding of security.

      The workable alternative is WebDAV over HTTPS: you get all the chroot and user access tools of a typical Apache HTTPS setup, and you can upload files with typical tools like the Windows Network Neighborhood, lftp for Linux and UNIX, and numeroug Java based GUI's for lots of operating systems. It works very well at eliminating the firewall and proxy craziness of FTP setups, and providing a simpler HTTPS proxy setup.

    85. Re:misleading... by idontgno · · Score: 2, Insightful

      Did you really read the exchange? I mean, from a perspective not blurred by a glaze of sympathetic indignation?

      makjls's cardinal sin was not asking a question in ignorance. The true error was arguing with knowledgeable people from a position of ignorance.

      Alan Cox didn't get snippy until the Peanut Gallery began to presume they understood the rationale for chroot(2) better than he did.

      Really, folks, ire is no substitute for understanding. Argue from a false presumption ("chroot is a security tool") and you will always lose, and make everyone involved look like jerks in the process.

      I've been there, on the vehement-but-wrong side of the argument. (With Eric Raymond, if you can believe it.) I've had to publicly apologize. It's still out there for all digital eternity, thanks to Google Groups. (No, I'm not citing the URL. I use a pseudo on /. for a reason)

      Truly, truly, when you approach acknowledged experts on a subject with a concern, don't get offended if they don't agree with you. Odds are good that they're right, and you might learn something if you listen instead of raising your voice.

      --
      Welcome to the Panopticon. Used to be a prison, now it's your home.
    86. Re:misleading... by Anonymous Coward · · Score: 0

      Nope, youre wrong. Its bad management of feelings and feelings of inadequacy. To compensate these people tend to negate what other people say, and then in the same breath manage to say almost the exact same thing. God, I hate those people!

      The more secure people are, the more humble they tend to be in my experience.

    87. Re:misleading... by smannell · · Score: 1

      I'll second the vote for pure-ftpd. I can use virtual users for my friends who understand ftp, anonymous logins for relatives who only know how to use a browser, and an actual unix account for myself so I can access the majority of the file tree. Of course it doesn't offer encrypted logins that the original post was asking about, but it's great for a simple FTP server where you don't want to give out actual unix accounts. Initial setup is easy; you can use the included commands for adding virtual users, or you can edit the config files if you prefer.

    88. Re:misleading... by Anonymous Coward · · Score: 0

      You missed the point that chroot is not the same as a jail.

    89. Re:misleading... by Anonymous Coward · · Score: 0

      WebDAV over SSL ?

    90. Re:misleading... by Anonymous Coward · · Score: 0
    91. Re:misleading... by Captain_Carnage · · Score: 1

      I posted to a forum asking what the best method was to jail SFTP users. I wanted something like FTP, but secure, and I didn't want users to be able to browse the whole filesystem. Some security expert chimed in basically calling me a moron, that if I didn't want people to browse the whole filesystem, I should use FTP and jail people. A lot of people in the forum agreed.

      Maybe they're not as expert as they think... at least two programs exist which provide this. One is called scponly. The other is called rssh, which is what I recommend you use, mainly because I wrote it. :)

      As problems go, security sucks... to be effective, you DO just about need to be an expert, generally; and if you're not, you're probably just wasting your time. So, if you need security, be prepared to read ALL the documentation THOROUGHLY, and then when you're done, read it again. And then hope you didn't miss anything important when you configure your solution, or at least that no one is particularly hell-bent on breaking into your stuff. Otherwise, you'll lose.
    92. Re:misleading... by ancalikorn_pk073892 · · Score: 1

      chroot is to change root directory and its restricted to the root user only. The problem affects chroot inside of an SMB-mounted filesystem ('smbfs'). A local attacker who is bounded by the chroot can exploit this issue to bypass the chroot restriction and gain unauthorized access to the filesystem. This is why chroot is not a security device.

    93. Re:misleading... by kevinadi · · Score: 1

      Believe me I know the wisdom of not arguing against people with more knowledge than me (I had my share of that experience although not as spectacular as yours :). Even if you apparently have more knowledge than them, it's wise not to flaunt it anyway just in case you're actually wrong. In my post I was merely responding to the parent regarding people in some forum calling him an idiot for asking a valid question, and mentioned that I also had similar experiences and sometimes I do wish to be able to punch them in the face. On topic, I know Cox is definitely correct and he wouldn't say those words lightly unless he has a good reason to, and there's also a good reason why he is one the primary kernel developers.

    94. Re:misleading... by RK077208 · · Score: 1

      it can prevent attacker to attack root directory..and also can prevent user's directory itself from others..only a particular user can access the directory.

  3. A fate worse then death... by newgalactic · · Score: 1

    Documentation, NOOOOOO!!!!!!! ...it's a dirty job, but someone better do it.

  4. Or is it? by phorm · · Score: 4, Interesting

    The problem is that - for many root-running processes - running chroot has often been recommended as a security practice. This has often been the recommendation of the daemon authors, in the documentation, as a way to improve security.

    I think that this was once (or may currently be) the case with bind and various MTA's. Standard practice for many daemons now is to start as root and fork as another non-privileged user, but not every daemon has this option.

    1. Re:Or is it? by Niten · · Score: 2, Interesting

      I think that this was once (or may currently be) the case with bind and various MTA's. Standard practice for many daemons now is to start as root and fork as another non-privileged user, but not every daemon has this option.

      Any good sysadmin knows not to rely on a chroot jail to contain a process running as root. And if your MTA has to run as root, then it's a problem with the design of the MTA, not with the chroot mechanism. (If your MTA insists on running with root privileges, I highly recommend switching to Postfix if possible.)

      Chroot is an excellent tool. But as with all security devices, it's up to the administrator to know precisely what it can and cannot do, rather than relying on it blindly. That's sort of what sysadmins are paid for.

    2. Re:Or is it? by TheRaven64 · · Score: 2, Informative

      For daemons that run as root, the user should not be using the chroot command. Instead, the daemon should be doing cwd(), chroot(), setuid(). For other processes, you should (as root) do something like chroot su user command, so you drop privileges as soon as you are inside the chroot and can't escape.

      --
      I am TheRaven on Soylent News
    3. Re:Or is it? by bfields · · Score: 1

      The problem is that - for many root-running processes - running chroot has often been recommended as a security practice.

      Reference? A quick google search for "bind chroot" finds several howto's explaining how to run bind under chroot as a non-root user. None that I can find suggest chroot and root.

    4. Re:Or is it? by TheRaven64 · · Score: 1

      And, by cwd() I, of course, mean chdir(). By the way, anyone using FreeBSD can set the kern.chroot_allow_open_directories sysctl to prevent chroot being called by any process which has open file descriptors outside the jail, which will block the discussed exploit. It will not, however, prevent any process with root privilege from creating a new device node pointing at the block device on which the root filesystem is mounted and accessing it this way, or accessing kernel memory to modify its process table entry directly. There are probably a hundred other ways of escaping from a chroot if you are root, but these are the first two that come to mind.

      --
      I am TheRaven on Soylent News
    5. Re:Or is it? by esaul · · Score: 1

      True that, but think it, - what was the original purpose for chroot? How did this "feature" come to be? Ever tried to update your glibc by hand? binutils? This is where one would get the most use of it. Given a chance won't you test something new before pitching?
      People love chroot, and some insist on chrooting MTAs, Apache and others, and I am loving it (do what I say, not what I do)! I like this trend. It is not really about security. This is the K&R OOP principle of encapsulation creeping on from programming to system administration.

    6. Re:Or is it? by dfn_deux · · Score: 1
      Some of this is patched up in gr security patched versions of the linux kernel.

      * No attaching shared memory outside of chroot * No kill outside of chroot * No ptrace outside of chroot (architecture independent) * No capget outside of chroot * No setpgid outside of chroot * No getpgid outside of chroot * No getsid outside of chroot * No sending of signals by fcntl outside of chroot * No viewing of any process outside of chroot, even if /proc is mounted * No mounting or remounting * No pivot_root * No double chroot * No fchdir out of chroot * Enforced chdir("/") upon chroot * No (f)chmod +s * No mknod * No sysctl writes * No raising of scheduler priority * No connecting to abstract unix domain sockets outside of chroot * Removal of harmful privileges via capabilities * Exec logging within chroot
      And that doesn't even get into the RBAC model and PAX memory protections which are also rolled into the grsec patches. Rather easy to implement on gentoo, where I've used it before. I can't speak to other distros' though.

      I don't claim to be a security guru, but it seems like many other administration tasks security is best applied in layers which butress one another and dovetail into a complete solution. While chroot is not in and of itself much of security enhancement it can be used to further enforce existing measures and removes some of the lower hanging fruit that less skilled crackers oft use to wrest control of an environment.

      At any rate I'd be interested to see how many of your other "100 other ways" are easily protected against.

      --
      -*The above statement is printed entirely on recycled electrons*-
    7. Re:Or is it? by dfn_deux · · Score: 1

      Grrrr.... submit!=preview, sorry about the lack of proper linebreaks there...

      --
      -*The above statement is printed entirely on recycled electrons*-
    8. Re:Or is it? by kestasjk · · Score: 2, Interesting

      I'm one of the people who, up until now, thought that chroot was for security (Luckily I've never had to rely on it though).
      In OpenBSD chroot is used to sandbox the web server, and as someone else pointed out the documentation often encourages people to chroot daemons. Also similar software like Solaris containers and FreeBSD jails, which do pretty much the same thing as chroot, actually are for security (pretty much exclusively in the case of jails, not exclusively in the case of containers).

      Also you'll often find chroot even on distros where there are no development tools to be found, which also encourages people to think that it's use goes beyond development.

      I think a nice big bold sign in man chroot is required, as well as removing all the advice that's currently around to chroot processes, if chroot isn't actually for security.

      --
      // MD_Update(&m,buf,j);
    9. Re:Or is it? by Niten · · Score: 1

      In my opinion, FreeBSD jails stand too far to the right of the line between the simple chroot and all-out virtualization to be terribly useful for things like protecting a system against exploits of your MTA or your basic web server. It's just so much overhead... unless the jail mechanism has changed since the last time I tried it, you even have to set up separate IP addresses for each jail. I think a more appropriate comparison would be between FreeBSD jails and Linux-Vserver.

      OpenBSD's and Linux's chroot()s can be used to augment filesystem security, provided that you realize they're useless if the jailed process is running as root (or if it runs in fertile grounds for privilege escalation). I use OpenBSD's chroot in this capacity on my home router, for isolation of my OpenVPN and BIND server daemons. Just don't run as root and keep your chroot directories free of any setuid binaries with the potential for exploit, and you should be golden.

      On the other hand, both FreeBSD jails and regular Unix chroots are inelegant and bear unnecessary complexity when contrasted with the mandatory access control approach of SELinux. It does take some effort to set up properly, but once you've fine-tuned your SELinux policy you can share the same root directory and all the same libraries and configuration files between your server's daemons, yet have the kernel restrict each daemon's behavior down to the granularity of individual files and network sockets, entirely independently of Linux's built-in discretionary access control mechanisms. Once the Distribution Gods figure out the art of simple MAC policy management (and it seems to me that Red Hat is getting close), I think we'll begin to look at *nix server security in a whole new light.

    10. Re:Or is it? by h4rm0ny · · Score: 4, Informative

      as well as removing all the advice that's currently around to chroot processes, if chroot isn't actually for security.


      Well a good place to start would be at http://en.wikipedia.org/wiki/Chroot because one of the first things I did when this article came up was to double-check my understanding of chroot right there. FTFW:

      This provides a convenient way to sandbox an untrusted, untested or otherwise dangerous program. It is also a simple kind of jail mechanism.

      --

      Aide-toi, le Ciel t'aidera - Jeanne D'Arc.
    11. Re:Or is it? by KiloByte · · Score: 1

      .. and most of the above badly break anything chroot is actually useful for. Rescuing a system from a LiveCD? Doing a build? Using a different set of libraries (like, i386 on an amd64 box)?

      For security, use vserver/jails/etc, as they were actually designed for security. With chroot, these "100 other ways" mean it's just a feel-good measure.

      --
      The creatures outside looked from Alt-Right to Antifa; but already it was impossible to say which was which.
    12. Re:Or is it? by dfn_deux · · Score: 1
      *Some* of them *may* break chroot in *some* ways, but not all are required to be enabled (nor likely intended to be). Your example of using chroot to rescue a system from a live-CD for instance is a clear red herring, as the compile time options of the kernel being rescued have ZERO impact on the chroot functionaility of the kernel on your rescue CD. And who runs 32bit daemons on a 64 bit server AND runs a 64 bit kernel with multi-libs configured? You are making a very strange argument and not actually addressing what vserver or jails provide in the way of security that would be mutually exclusive to having stronger chroot jails through additional limits on the chroot environment.Your argument seems to be something like, race cars are built for speed, so even though a modified car can go as fast it is worthless because race cars exist.

      Are you perhaps intending to mean something which I have completely missed?

      Seems like the people arguing against chroot as a security layer are arguing something like, "don't trust your users, so you should stick them in root and concentrate on fundamentals" which isn't entirely flawed, but just a few tweaks to the chroot environment will have blackhats scratching their heads and not even realizing they are in a chroot jail even if they are able to shake out a privilege escalation. Things like "mkdir foo;chroot foo;cd ../.." as cited in the lkml thread will be useless and "Your princess is in another castle!"

      --
      -*The above statement is printed entirely on recycled electrons*-
    13. Re:Or is it? by Rigrig · · Score: 4, Informative
      By the time I read your comment someone already fixed the Wikipedia entry:

      This is often misunderstood to be a security device, used in an attempt to sandbox an untrusted, untested or otherwise dangerous program, as if chroot was a working jail mechanism.
      --
      **TODO** [X] Steal someone elses sig.
    14. Re:Or is it? by ZekeSpeak · · Score: 1

      True that, but think it, - what was the original purpose for chroot? How did this "feature" come to be? Ever tried to update your glibc by hand? binutils? This is where one would get the most use of it. Given a chance won't you test something new before pitching? Installation of a Gentoo system requires chroot. You boot from your live CD, untar your basic directory setup (and toolchain) onto your hard drive then chroot into your new system to install (emerge) programs, setup the bootloader and build your new kernel (among other things).

      I've never really thought about chroot as a security feature. I think of it as a necessary tool for moving from one filesystem hierarchy to another, for the purpose of building a new system.
    15. Re:Or is it? by Fordiman · · Score: 1

      "The problem is that - for many root-running processes - running chroot has often been recommended as a security practice. This has often been the recommendation of the daemon authors, in the documentation, as a way to improve security."

      Which isn't even valid; if the process guards against users going above the chroot'd /, it can just as easily guard against going above a configured root. As such, it would add nothing to security, and possibly break a program that has misbehaved - and provide a nice hearty headache for someone trying to replicate the error and debug it.

      --
      110100 1101000 1101000 1100110 0 1101111 1101000 1100011 1
    16. Re:Or is it? by TheRaven64 · · Score: 1

      It's just so much overhead... unless the jail mechanism has changed since the last time I tried it, you even have to set up separate IP addresses for each jail. You can use a NAT'd IP address, and use pf to forward external ports to the jail if you need to. The same is true of Open/NetBSD's sysjail, which is an implementation of jails on top of systrace. They are nice because they are conceptually simple; you have a cheap mechanism for creating a virtual machine, and you know that nothing goes in or out of that virtual machine unless you explicitly allow it.

      Once the Distribution Gods figure out the art of simple MAC policy management Simple MAC does not exist. This is, in my opinion, a huge reason why UNIX tends to be more secure than Windows NT, even though the latter has had fine-grained access control on any kernel-controlled objects (ports, filesystem components, etc) since it was created. The UNIX approach to permissions is much more coarse-grained, but it's much simpler to understand, and thus use correctly.
      --
      I am TheRaven on Soylent News
    17. Re:Or is it? by PeterHammer · · Score: 1

      The keyword in the wikipedia article is "simple kind" of jail mechanism. Yes indeed it is. As others above have pointed out, if you do not run the processes as root, and do not have setuid processes in the chroot'ed env, then it is a "simple kind" of jail mechanism. However, do silly things like run daemons as root , by all accounts not something that should be considered part of the "simple" realm in Unix, and due diligence would dictate that you re-examine your simple assumptions.

      All over the web, man pages, O'Reilly books, and university courses it is said that root is dangerous and must be treated with the utmost respect and care. I think it is obvious from the very philosophy of root that that warning should supersede any other information you may read on a man page of a program.

      Also from Wikipedia http://en.wikipedia.org/wiki/Root_user

      Software defects which allow a user to "gain root" (to execute with superuser privileges code supplied by that user) are a major security issue, and the fixing of such software is a major part of maintaining a secure system. One common way of gaining root is to cause a buffer overflow in a program already running with superuser privileges. This is often subsided in modern operating systems by running critical services, such as httpd, under a unique limited account.

      And in the same wikipedia article referenced, http://en.wikipedia.org/wiki/Chroot, ignoring the changes from today in obvious reaction to this slashdot posting, you will read under limitations:

      Only the root user can perform a chroot. This is intended to prevent users from putting a setuid program inside a specially-crafted chroot jail (for example, with a fake /etc/passwd file) that would fool it into giving out privileges.

      The chroot mechanism itself is not entirely secure on all systems. On some systems, for example, chroot contexts do not stack properly and chrooted programs may perform a second chroot to break out.

      This warning or some variant of it, has been part of the article on chroot since July of 2005 http://en.wikipedia.org/w/index.php?title=Chroot&diff=19562594&oldid=19544086

    18. Re:Or is it? by LurkerXXX · · Score: 1

      I think a nice big bold sign in man chroot is required, as well as removing all the advice that's currently around to chroot processes, if chroot isn't actually for security.

      Did you even bother to read the OpenBSD man page?

      "CAVEATS
              chroot should never be installed setuid root, as it would then be possible to exploit the program to gain root privleges."

      chroot certainly can be used to add security, providing it is used correctly. As with most things, how good the tools works depend on the competency of the guy using the tool.

    19. Re:Or is it? by DShard · · Score: 1

      Chroot does not increase security, it obscures it. Obscurity is not security. Say it ten times.

      Ppeople who think chroot has increased their systems security are living in a fools paradise. If the daemon can't be trusted on the real system root, why in the heck would you trust it on the system at all?

    20. Re:Or is it? by DShard · · Score: 1

      You are confusing chroot the cli wrapper and chroot the system call. The system call requires root to even work. chroot can never be used to increase security. It only ever can be used to obscure it. I'll let you in on a little secret, the people your trying to obscure it from, they already know that you did this. They already have scripts to handle it. You've already lost.

    21. Re:Or is it? by Anonymous Coward · · Score: 0

      You don't have to use a separate IP address for a jail in FreeBSD, even if you don't use the NAT option. It is entirely possible to assign the same IP address to multiple jails.

    22. Re:Or is it? by Anonymous+Psychopath · · Score: 1

      If you have a look at RFC 1631 (http://www.ietf.org/rfc/rfc1631.txt), NAT wasn't designed for security either. Not arguing a point here, just thought it was interesting to see a parallel.

      --

      Eagles may soar, but weasels don't get sucked into jet engines.

    23. Re:Or is it? by Bearhouse · · Score: 1

      Damn these editable sources! How can a decent man win an argument anymore! More seriously, although wikipedia is great, as with any reference doc., I'd never use as a sole source for info.

    24. Re:Or is it? by gid · · Score: 1

      On a related note, I noticed that most locks can be easily picked by someone with the right know how. So in response, I now keep all the doors on my house and car unlocked, with signs stating this.

      Security isn't always so black and white. With security, you usually have to deal with trade offs. If I give someone an sftp account that's chrooted so they can only see their files and they break out of it to download information they're not supposed to, then I have the grounds for a legal battle under the DMCA or whatever--as long as I can find whomever did it. At least I made an attempt, however futile it may have been, to thwart them.

      Sure security through obscurity isn't the ultimate, but on top of other layers of security, I'll can sure help.

      Take another example, I write an ftp application that stores login information in a file. It would be stupid to store all that data in plain text so anyone can see it, so you obscure it somehow. You could encrypt it for real, but then you'd need a master password just to start the ftp program, which most people would hate. So you obscure the data instead, it's a decent trade off that I'm willing to bet, most programs that store login information take.

    25. Re:Or is it? by DoubleDownOnEleven · · Score: 1

      Take another example, I write an ftp application that stores login information in a file. It would be stupid to store all that data in plain text so anyone can see it, so you obscure it somehow. You could encrypt it for real, but then you'd need a master password just to start the ftp program, which most people would hate. So you obscure the data instead, it's a decent trade off that I'm willing to bet, most programs that store login information take.
      This is fine, but don't assume that login information is in any way secure.

      Security has always been about finding a balance between usability and security. They are somewhat opposing goals, and people have to make decisions about which is more important.

      But obscurity adds such a SMALL layer of security, it's not something that should be touted. It gives people a false sense of security, which is more dangerous than no security at all. (If a bank told you they had no security, you would rightly not use their online banking services. If they falsely told you they were secure, and you used their system, bad things could happen).

    26. Re:Or is it? by Lobster+Quadrille · · Score: 1

      Did you even bother to read the OpenBSD man page? No, I didn't bother to read the OpenBSD man page. I did, however, just check Ubuntu, CentOS, and FreeBSD's man pages for chroot, and none had the line you referenced. I suppose my manpage collection is incomplete, and I should check OpenBSD too.
      --
      "The cup is in turn designed for holding hot or cold liquids, and has an open rim and closed base." --US Patent #5425497
    27. Re:Or is it? by idontgno · · Score: 1

      Damn these editable sources! How can a decent man win an argument anymore!

      Umm.... by editing Wikipedia to support you?

      The whole argument in TFA comes from people believing the slogan "Chroot jail your daemons" without understanding (A) chroot isn't the security part of the arrangement (priv separation is more important) and, in this particular argument, (B) chroot's behavior isn't a bug, and "solving" it is solving the wrong problem.

      The real problem is treating chroot as a one-stop security tool.

      The meta-problem is accepting slogans and one-line advice as a valid substitute for actually understanding the mechanisms involved.

      --
      Welcome to the Panopticon. Used to be a prison, now it's your home.
    28. Re:Or is it? by osu-neko · · Score: 1

      Your argument seems to be something like, race cars are built for speed, so even though a modified car can go as fast it is worthless because race cars exist.

      Manager: Okay, I need the B car, we need to do some off-road work.
      Mechanic: Uh, okay, you can take the B car, but you might not to be able to drive it everywhere you could before. We've made some modifications to make is go as fast as the A car.
      Manager: Oh dear, is the A car broken?
      Mechanic: Hmm? No, the A car works fine. But I noted that if we made these modifications to the B car, it would go just as fast as the A car! Nifty, eh?
      Manager: But now it doesn't do the job we originally created it for as well as it did!
      Mechanic: But look! You can race with it now! A lot of people were kinda racing around in it anyway, so we figured we better modify it to be a racer just like the A car.
      Manager: Did you consider just telling people who want to race to use the A car? It's meant to be a race car, after all.
      Mechanic: Yes, but you're missing the point! With just these modifications, B became just as good as racer as A! Why not make B a racer if it can do the job just as well as A, once the modifications are made?
      Manager: ...
      Manager: Okay... well, I need an off-road vehicle now, and with these modifications, B no longer does the job as well. What would you suggest I do?
      Mechanic: Hmm. Tricky. Wait, I know. Get the C car out.
      Manager: Isn't that the one we designed for fuel economy?
      Mechanic: Yes, but once I make these modifications here, it'll be just as good an off-road vehicle as B once was before we turned it into a racer!
      Manager: Okay... and what will we do when we need an economy car?
      Mechanic: Hmm. Oh, I know! If we take the A car and make these modifications, it'll be a wonderful economy car. Of course, it won't go as fast...
      Manager: ...
      Manager: You're fired.

      --
      "Convictions are more dangerous enemies of truth than lies."
    29. Re:Or is it? by norton_I · · Score: 1



      I don't think I have ever heard someone claim that chroot is complex when contrasted with SELinux. Actually, I don't think I have ever heard someone claim that X is complex when contrasted with SELinux, for any value of X.

      Elegant? maybe. Depends on your point of view. But SELinux is more complex that essentially every security architecture commercially deployed outside the defense and intelligence sectors. With a considerable amount of effort, RedHat has managed to contain some of that complexity as long as you stick to the default configuration.

    30. Re:Or is it? by Niten · · Score: 1

      What in the Hell are you talking about?

      It's not a matter of trusting or not trusting your server's software. It's a matter of saying, "OK, I realize that like all software, this program has the potential to be exploited someday. It would be best exercise foresight, configuring the system so that the damage will be minimized should an attacker take over this daemon."

      One way to minimize the potential for such damage is to limit server processes' access to a minimal subset of the file system. This way if my OpenVPN server is exploited, for example, the attacker wouldn't be able to extract the list of valid usernames from /etc/passwd, because /etc/passwd isn't accessible from within the chroot jail. More importantly, the attacker also wouldn't have access to any number of setuid system software which, while not at all necessary in the normal chrooted operation of OpenVPN, might provide the grounds for privilege escalation, turning the attacker's possession of a single limited user account into ownership of the entire system. And vice versa, the attacker cannot escape the chroot jail without becoming root to begin with. The only "obscurity" about it is your apparent lack of understanding of what chroot() really does on modern BSD and Linux systems.

      Of course by your reasoning, you wouldn't run server daemons under limited user accounts to begin with. After all, if you can't trust the software to run as root, then why the heck would you trust it to run on the system at all?

    31. Re:Or is it? by Sancho · · Score: 1

      Interestingly, though, unidirectional NAT can be useful as a security tool. Because most implementations of NAT require that ports be explicitly forwarded, it's similar to having a firewall.

    32. Re:Or is it? by marcosdumay · · Score: 1

      "Also you'll often find chroot even on distros where there are no development tools to be found, which also encourages people to think that it's use goes beyond development."

      It is also usefull for system administration... For things like mounting a disk that is the root of some other system and using it (from a live-CD, for example), or avoiding incompatibilities on your libraries (like what the Debian-i64 did at their begining).

      What chroot is useless is for jailing a potentialy malign program. If it is not running as root, you simply doesn't need a jail, plain file permissions should be enough (and if they aren't, use another permission scheme). If it is running as root, the program can break it any time it want.

    33. Re:Or is it? by Sancho · · Score: 1

      Some form of protection is essential due to the epidemic of careless software developers. MAC certainly works, but as someone else posted, there's just no way to make it simple for the end-user. MAC simplicity means that the vendor has used sane defaults for common applications. Jails are good for doing things that people usually try to do with chroot, and they're improving all the time. I've never noticed an overhead problem, myself--can you elaborate?

      As for complexity, this has been addressed using third-party applications. ez-jail http://erdgeist.org/arts/software/ezjail/ makes management a snap, though it slightly increases the overhead and complexity of backups (it uses nullfs to mount read-only copies of system binaries into the jail.) Of course, it's only suitable for a full system within the jail--something which is certainly not required, if all you want to do is jail a single process/service.

    34. Re:Or is it? by Bearhouse · · Score: 1

      Thank for the reply.

      No & Yes.

      1. No, (editing Wikipedia), well, that was my point. Kinda like the posting here (funny) ages ago where - faced with Wikip's cash probs., somebody edited their entry to say that they had gazillions of bucks. Funny, but dunna make it true, Cap'n.

      2. Yeah, for Chroot, what do you do? People will always use their superficial knowledge to look for superficial solutions, and then complain that it does not work as they wanted. But then again, as an old fart, (started on a S/3), what would I say. These kiddies have it too easy, GUIs are for fags, blah blah...

    35. Re:Or is it? by Anonymous Coward · · Score: 0

      WTF? How does "don't install this suid root" imply that it's for security? You could say the same about rm, but that doesn't mean it's a security tool, does it?

    36. Re:Or is it? by thanasakis · · Score: 1

      On the other hand, both FreeBSD jails and regular Unix chroots are inelegant and bear unnecessary complexity when contrasted with the mandatory access control approach of SELinux. It does take some effort to set up properly, but once you've fine-tuned your SELinux policy you can share the same root directory and all the same libraries and configuration files between your server's daemons, yet have the kernel restrict each daemon's behavior down to the granularity of individual files and network sockets, entirely independently of Linux's built-in discretionary access control mechanisms. Once the Distribution Gods figure out the art of simple MAC policy management (and it seems to me that Red Hat is getting close), I think we'll begin to look at *nix server security in a whole new light.

      Take a look at Solaris Zones. They do exactly what you are describing. Been around for several years.
    37. Re:Or is it? by nuzak · · Score: 1

      > Obscurity is not security.

      You can say it a million times, doesn't make it true. The only reason I can't hax0r your box is because your ssh key is really really really really obscure.

      --
      Done with slashdot, done with nerds, getting a life.
    38. Re:Or is it? by Niten · · Score: 1

      You're right of course, SELinux is a lot more complex to initially configure than a simple chroot. The "complexity" I was referring to was the additional administrative complexity of managing system changes and software updates down the road when you have multiple copies of your system libraries and executables living in various chroot jails, which is best done with specialized software like ezjail or something from your own personal script toolbox. On the other hand, you might wind up having to tweak a couple SELinux policies down the road as well...

  5. FreeBSD Jails by cstdenis · · Score: 3, Informative

    FreeBSD has a system called jails that do provide the security people are looking for in chroot. In addition to doing a chroot, they also prevent processes from seeing each other and can restrict network functionality.

    Its like a virtual machine, but shares the same kernel (with restrictions) so there isn't the performance of full emulation.

    --
    1984 was not supposed to be an instruction manual.
    1. Re:FreeBSD Jails by TheNetAvenger · · Score: 0

      This is also like protected processes in Vista, but in the FOSS world, people think it is DRM, when it is actually security and doesn't have anything to do with the Video protected path for HDCP...

      So why should we expect anyone to understand security when they can't figure out simple differences and easily confuse security with DRM?

    2. Re:FreeBSD Jails by cstdenis · · Score: 1, Informative

      If its used to lock you the computer owner out of the program, its DRM.

      If its used to lock the hackers out of the program (or in the program out of the rest of the system) its security.

      The big difference between protected processes and Jails is root on the main system can access anything in a jail where as I doubt you can do that in windows (if you can that its useless as DRM so the argument is moot).

      --
      1984 was not supposed to be an instruction manual.
    3. Re:FreeBSD Jails by BiggerIsBetter · · Score: 1

      So pretty similar to Solaris Zones then?

      --
      Forget thrust, drag, lift and weight. Airplanes fly because of money.
    4. Re:FreeBSD Jails by mevets · · Score: 1

      In the same way that "blues is like rock", not better, not worse, but earlier....

    5. Re:FreeBSD Jails by TheCoelacanth · · Score: 1

      If it's done at the choice of the box's owner then it's security, otherwise it's DRM.

    6. Re:FreeBSD Jails by BiggerIsBetter · · Score: 1

      Okay, I think I get it... Just trying to learn a bit more about the options available without resorting to Xen or VMWare virtualization.

      --
      Forget thrust, drag, lift and weight. Airplanes fly because of money.
    7. Re:FreeBSD Jails by skeeto · · Score: 1

      OpenBSD also uses chroot for security.

      OpenBSD puts Apache in a chroot jail by default ... for security. A compromised Apache server doesn't lead to a compromised system. The OpenBSD guys are considered by many to be extremely competent with security. They are only incompetent at being nice. :-P

    8. Re:FreeBSD Jails by bs7rphb · · Score: 1

      And a bit like Linux vservers, from the sound of it.

    9. Re:FreeBSD Jails by Anonymous Coward · · Score: 0

      Yes, but OpenBSD chroot is written as a security tool. Linux chroot isn't.

    10. Re:FreeBSD Jails by TheRaven64 · · Score: 1
      Fairly close. They both basically extend chroot() to isolate kernel resources. The big limitation with FreeBSD Jails is that the kernel still uses a single namespace for SysV IPC. This gives you the option of either disabling sysV IPC in a Jail, or providing a mechanism for using it outside. Since the SysV IPC mechanisms were deprecated almost a decade ago by POSIX versions with more sane function names in the filesystem namespace (rather than 32-bit tokens), there is no real excuse for using them now, but a lot of people still seem to (probably the same crowd who refuse to set their compiler to use C99).

      Solaris Zones were created later, and allow more fine-grained control. They also have the rather neat option of being tied to the foreign ABI subsystem. This means you can set up a zone that uses a foreign system call interface, such as a Linux zone containing an install of (for example) Fedora, where Linux programs can run. FreeBSD often uses chroot() for this kind of thing, where it is intended to fix up library paths in binary applications, rather than as a security measure.

      A third option is sysjail. This is a reimplementation of FreeBSD Jails, based on top of the systrace mechanism available for NetBSD and OpenBSD (and Darwin/OS X with a third-party kernel module). Systrace is a system for validating system calls. Whenever a process run under systrace issues a system call, it will check th arguments and either allow it, deny it, allow it with modified arguments, or allow it with elevated privileges. The latest version of sysjail has the ability to run foreign jails, which are equivalent to branded zones on Solaris.

      Note there was recently a concurrency-related exploit shown for systrace (and other systems that work in the same way). The exploit works, basically, in the following way:

      1. Process issues system call, passing a pointer to a data structure as an argument.
      2. Systrace validates the arguments.
      3. Process modifies the data structure containing the argument to something systrace would not have allowed.
      4. Kernel reads the (modified) argument structure.
      Note that this doesn't affect single processor systems where system calls are not interruptible. The simplest solution to this would probably be to have systrace perform the copy on behalf of the kernel before performing the validation. Another option might be to mark the page containing the arguments as read-only for the duration of the system call. This attack is based on a fundamental issue with UNIX-like systems, where system calls are assumed to be atomic, even though they may not be.
      --
      I am TheRaven on Soylent News
    11. Re:FreeBSD Jails by phoenix_rizzen · · Score: 1

      The Linux VServer project offers kernel patches that accomplish roughly the same thing.

      In the resource-separation spectrum, it's something like:
          chroot syscall
          linux vserver / freebsd jail / solaris containers
          vmware / virtualbox / qemu / other hardware emulating vms
          xen / vmware esx / solaris zones (or partitions or whatever it's called)
          separate physical boxes

    12. Re:FreeBSD Jails by Anpheus · · Score: 1

      If we had to ask users to implement every security feature in every OS written to date, said OS would never get off the ground or we'd have an online environment infinitely worse than what it is now. "Do you want to not allow remote users to exploit your computer?" [Yes] [No] [Help With This Option]

    13. Re:FreeBSD Jails by TheNetAvenger · · Score: 1

      An admin on Vista CAN access protect processes, they just cannot access them while they are executing, except to kill them.

      NO OTHER PROCESS in the system can access them while active, this is why they are security and has nothing to do with Admin access to the processes.

      And yes this is security... (Even by your definition)

  6. it isn't for security? by Anonymous Coward · · Score: 0

    Well, what the living fuck is it for then? Just extra shit in the kernel, more hassle for admins?

    "My code isn't broken, you're just stupid." is what this sounds like.

  7. Not for security use? by kcbrown · · Score: 3, Interesting

    A quick search on the terms 'chroot+security' quickly reveals that many people have long thought (wrongly) that chroot's purpose was for improving security.

    Not for improving security, huh?

    OK, genius, then explain why chroot() requires root privileges (or chroot capability) to execute.

    It's only in the context of security that such a restriction makes any sense at all.

    --
    Use 'slashdot stuff' in the subject line in any email you send me if you want to get past the spam filter.
    1. Re:Not for security use? by cperciva · · Score: 4, Informative

      If chroot didn't require root privileges, the following exploit would be possible:

      1. Create ~/etc/master.passwd with an empty root password.
      2. Hard link /usr/bin/su to ~/usr/bin/su. (Yes, you can create hard links to files which you don't own.)
      3. Copy /bin/sh, /bin/chmod, and the necessary libraries to the corresponding places under ~.
      4. chroot ~ /usr/bin/su root /bin/chmod 4555 /bin/sh
      5. ~/bin/sh is now an unrestricted root shell.

    2. Re:Not for security use? by EvanED · · Score: 1

      2. Hard link /usr/bin/su to ~/usr/bin/su. (Yes, you can create hard links to files which you don't own.)

      Preventable if ~ and usr are on separate file systems, but that still seems fragile.

      4. chroot ~ /usr/bin/su root /bin/chmod 4555 /bin/sh

      I would say that this could be as easily viewed as a problem with the implementation of chroot as a reason to not allow non-root users to chroot.

    3. Re:Not for security use? by QuantumG · · Score: 2, Interesting

      Hard link /usr/bin/su to ~/usr/bin/su. (Yes, you can create hard links to files which you don't own.) Yes, and there's the bug.. which hasn't been fixed for 40 years.

      try for yourself:

      $ id
      uid=1000(you) gid=1000(you)
      $ cd /tmp
      $ ls -l /bin/bash
      -rwxr-xr-x 1 root root 700560 2007-04-11 09:32 /bin/bash
      $ ln /bin/bash foo
      $ ls -l foo
      -rwxr-xr-x 2 root root 700560 2007-04-11 09:32 foo

      Uhhh, why is a regular user allowed to create a file owned by root?

      $ rm -f /bin/bash
      rm: cannot remove `/bin/bash': Permission denied
      $ rm -f foo
      rm: cannot remove `foo': Operation not permitted

      Awesome, the semantics of directory permissions are not even honored anymore.. anyone else smell a kludge here?

      --
      How we know is more important than what we know.
    4. Re:Not for security use? by e9th · · Score: 2, Informative

      Awesome, the semantics of directory permissions are not even honored anymore.. anyone else smell a kludge here?
      Remove the sticky bit from /tmp & try again.
    5. Re:Not for security use? by Breakfast+Pants · · Score: 1

      Wrong; that exploit is only available because you chose to set up an insecure system by allowing a user into the wheel group.

      --

      --

      WHO ATE MY BREAKFAST PANTS?
    6. Re:Not for security use? by evilviper · · Score: 2, Insightful

      Uhhh, why is a regular user allowed to create a file owned by root?

      ln doesn't create files, just POINTERS to them. Creating a link to bash, which was owned by you, would presumably allow to modify the contents of bash, owned by root.

      And that trick only works in /tmp to begin with, where the sticky bit is set on the folder, and only if /bin is on the same mount point as /tmp.

      I can see how it would be a minor annoyance, not much of a bug.
      --
      Slashdot gets worse every day... Pipedot: News for nerds, without the corporate slant
    7. Re:Not for security use? by kfstark · · Score: 5, Insightful

      $ cd /tmp
      $ ls -l /bin/bash
      -rwxr-xr-x 1 root root 700560 2007-04-11 09:32 /bin/bash
      $ ln /bin/bash foo
      $ ls -l foo
      -rwxr-xr-x 2 root root 700560 2007-04-11 09:32 foo

      Uhhh, why is a regular user allowed to create a file owned by root? Apparently, you don't know what a hard link is.

      You haven't created a file owned by root. You've created an i-node pointing to the data blocks of a file owned by root.

      If root were to rm /bin/bash, the file would still exist and have the proper ownership and be accessed through /tmp/foo

      Your way, I could do the following on a file with 600 permission:

      cd /tmp
      ln /sbin/protected_file mine
      chmod 666 mine
      cat mine

      Nice and easy way to get around a 600 permission.

      The behavior is correct, not a bug.

      Regards,

      --Keith
    8. Re:Not for security use? by MSG · · Score: 3, Informative

      Uhhh, why is a regular user allowed to create a file owned by root?

      They're not. They are, however, allowed to create a name in a directory (a link) that points to an existing inode. Since the inode has all of the owner and permission data, and the user is not allowed to modify the inode, allowing them to create a link to it is not an inherent risk.

      Awesome, the semantics of directory permissions are not even honored anymore.. anyone else smell a kludge here?

      Yes, they are. /tmp has the "sticky bit" set in its permissions. That means that users aren't allowed to remove or rename a file (link) unless they are the owner. Arguably, that is an odd semantic; since links don't have owners -- only files do -- it's not possible to allow users to remove or rename links that they created. However, claiming that the semantics of directory permissions aren't honored simply shows that you're ignorant of what the semantics are.

    9. Re:Not for security use? by QuantumG · · Score: 1

      actually, my recommendation would be to make ln /bin/bash foo fail.

      No hardlinks to files you don't own.

      --
      How we know is more important than what we know.
    10. Re:Not for security use? by Anonymous Coward · · Score: 0

      another reason to have /tmp on its own partition with noexec set.

    11. Re:Not for security use? by quenda · · Score: 1

      > Apparently, you don't know what a hard link is.
      > You haven't created a file owned by root. You've created an i-node pointing to the data blocks of a file owned by root.

      Ah no, actually a hard link is just a directory entry pointing to the SAME i-node.
      You knew that really?

    12. Re:Not for security use? by QuantumG · · Score: 1

      simply shows that you're ignorant of what the semantics are. Or I forgot about the sticky bit. Thanks.

      allowing them to create a link to it is not an inherent risk. 'cept it makes it looks like the owner of the file created it in that directory. What's even more neat is this:

      $ ls -l bobs_file
      -rw------- 3 bob bob 10815 2007-05-01 18:53 bobs_file
      $ ln bobs_file /tmp/lock_bobs_quota
      $ ls -l /tmp/lock_bobs_quota
      -rw------- 3 bob bob 10815 2007-05-01 18:53 lock_bobs_quota

      now when bob needs some space and he goes to rm -f bobs_file the link to the file will go away, but the file will hang around and unless bob looks in /tmp he'll have no idea why.

      These are not security concerns, to be sure, but they are mischievous.
      --
      How we know is more important than what we know.
    13. Re:Not for security use? by Jah-Wren+Ryel · · Score: 1

      Uhhh, why is a regular user allowed to create a file owned by root? A regular user is not allowed to create a file owned by root. You have created a hard link, it is only a directory entry in a directory you have permission to write to, and directory entries do not contain file ownership information, that is stored in the inode for the file. There is only one inode no matter how many hard links there are.

      Awesome, the semantics of directory permissions are not even honored anymore.. anyone else smell a kludge here? No. But I do smell a newbie ranter.

      $ ls -ld /tmp
      drwxrwxrwt 14 root root 69632 2007-09-27 21:25 /tmp/

      See that 't' in the directory permissions on /tmp?
      That's the sticky bit. When set on a directory, it means that only file owners and delete the directory entries for their files.

      Take away the sticky bit and you will be able to delete the foo hard link just fine.
      --
      When information is power, privacy is freedom.
    14. Re:Not for security use? by Anonymous Coward · · Score: 1, Informative

      > Apparently, you don't know what a hard link is.
      > You haven't created a file owned by root. You've created an i-node pointing to the data blocks of a file owned by root.

      Ohh Keith, clearly you have meager understanding of what an inode is (or a hard link is for that mater). A hard link is NOT an inode but a new name-to-inode pointer contained in the directory's data blocks (remember a directory is just a file). When you create a hard link, you just increase the link count on the already existing inode and add an entry (pointer to the inode) in the link's parent directory's "file."

      Now a soft link IS a new inode.

      Hope that cleared things up for you. I LOVE asking this question during interviews because most Unix Sysadmins don't really know it.

      --AC

    15. Re:Not for security use? by Harik · · Score: 1

      you're the idiot - the exploit works because _IF NON ROOT USERS_ can call chroot, _THEY_ setup the /etc/group and /etc/passwd, so the (hardlinked, suid) copy of su sees the user copies. Notice how they get to pick the root password? Right. Now you get it. This is the "security" reason why a convienience/testing feature got made root-only.

    16. Re:Not for security use? by QuantumG · · Score: 1

      No. But I do smell a newbie ranter. Oh FUCK OFF. Can't a guy *forget* something now and then?

      --
      How we know is more important than what we know.
    17. Re:Not for security use? by Jah-Wren+Ryel · · Score: 1

      Oh FUCK OFF. Can't a guy *forget* something now and then? Don't be so smug in your posts and you won't get flamed when you make a mistake.
      You set yourself up for it. It's not like I was the only one to bite.
      --
      When information is power, privacy is freedom.
    18. Re:Not for security use? by QuantumG · · Score: 1

      How about just not being an asshole about it? Seriously.. you're like a bunch of wolves. Just because you have no confidence in anything you say doesn't mean the rest of don't.

      --
      How we know is more important than what we know.
    19. Re:Not for security use? by Phroggy · · Score: 1

      Wrong; that exploit is only available because you chose to set up an insecure system by allowing a user into the wheel group. What the hell are you talking about?
      --
      $x='S24;r)>63/* h@<5+oZ)32"5cz';$me='phroggy'x$];
      $x=~y+ -xz+\0-Tx+;print$_^chop$me for split'',$x;
    20. Re:Not for security use? by Jah-Wren+Ryel · · Score: 1

      How about just not being an asshole about it? Seriously.. you're like a bunch of wolves. Just because you have no confidence in anything you say doesn't mean the rest of don't. Lol! Poor little quanta, doesn't know the difference between being confident and being smug.
      If you were really such a manly man speaker, you wouldn't be whining right now.
      --
      When information is power, privacy is freedom.
    21. Re:Not for security use? by putaro · · Score: 1

      Well, the reason that you can't remove the file is because you created it in /tmp which typically is set so that directory entries can only be removed by their owners. If you have made the link in a regular directory you would have been able to remove it.

    22. Re:Not for security use? by bigstrat2003 · · Score: 2, Insightful

      Just because he set himself up for it doesn't mean you have to bite. Be gracious to people, even when they're wrong and you're right (or try to, at least)... it makes the world a better place.

      --
      "16MB (fuck off, MiB fascists)" - The Mighty Buzzard
    23. Re:Not for security use? by Jah-Wren+Ryel · · Score: 1, Offtopic

      Just because he set himself up for it doesn't mean you have to bite. I thought my response was rather mild. His post had at least three cases of "false I know better than anyone else-itis" and not only did I succinctly and correctly explain the situation - as did many of the other responses, some less accurately than others, he only got one word-play jab back.

      But when he comes along with the self-righteous indignation, obscenities, and nerd-macho strutting about "confidence" -- that's not just setting himself up, that's begging for it. Then to really make an ass of himself, he decides to put me on his "foes" list. As if that means anything beyond a public declaration of a playground tantrum -- "I HATE you Billy! Wah!"

      Be gracious to people, even when they're wrong and you're right (or try to, at least)... it makes the world a better place. Sure right and wrong is part of it, but its more about turnabout being fair play. The kid dishes it out, but he's a got a real thin skin.
      --
      When information is power, privacy is freedom.
    24. Re:Not for security use? by JesseMcDonald · · Score: 1

      now when bob needs some space and he goes to rm -f bobs_file the link to the file will go away, but the file will hang around and unless bob looks in /tmp he'll have no idea why.

      If you think that's an issue I have an even stranger use case: if a program is running and you unlink the executable file, the space won't be freed until the program exits even though no dentry links to it remain in the filesystem. Since this is normal and expected behavior -- at least if you expect it to allow the file to be removed, unlike on Windows -- I don't think too many people are going to complain about that space not being freed up. If "bob" really wanted to know whether he could easily free the space all he needed to do was look at the reference count before deleting the file. (In your example it should've changed from three to four after running ln.)

      --
      "The state is that great fiction by which everyone tries to live at the expense of everyone else." - Bastiat
    25. Re:Not for security use? by Anonymous Coward · · Score: 0

      now when bob needs some space and he goes to rm -f bobs_file the link to the file will go away, but the file will hang around and unless bob looks in /tmp he'll have no idea why

      If bob cares that much, then he can put his files in a subdirectory that only he has access to in the first place. It's not like that's the only way you can delete a file but have it still take up allocated disk space.

    26. Re:Not for security use? by kfstark · · Score: 1

      Damn...

      I was in such a rush to show off my superior skills that I didn't proofread.

      I'll do better next time (yeah, right).

      --Keith

    27. Re:Not for security use? by kocsonya · · Score: 4, Informative

      > Apparently, you don't know what a hard link is.
      >
      > You haven't created a file owned by root. You've created an i-node pointing to the
      > data blocks of a file owned by root.

      No, you didn't.
      You created a directory entry pointing to the i-node of the file which is also pointed
      by the 'sh' entry in the /bin directory file. In addition, the reference count in the i-node has been bumped up by 1. One file is one i-node and that inode contains the owner, permission and timestamp info as well as the disc blocks that the file uses. For all practical purposes the file and the i-node are the same thing. A dir entry contains a name for the file and a pointer to the inode. There can be as many dir entries in different directories to the same file as you wish. The i-node also contains a reference count of how many dir entries point to it. When you rm a file, it will remove the dir entry and decrement the refcount in the i-node. When the refcount reaches 0, the file is actually deleted (actually it will only be deleted if it is not open at the time, but that's a separate issue).

      You can delete a hard link to a file owned by anyone if you have write permission on the directory that contains a link:

      zoltan@gep:~> ln /bin/bash foo
      zoltan@gep:~> ls -l foo
      -rwxr-xr-x 2 root root 572200 2005-09-10 03:43 foo
      zoltan@gep:~> rm foo
      rm: remove write-protected regular file `foo'? y
      zoltan@gep:~>

      On the other hand, if you try it in /tmp:

      zoltan@gep:~> cd /tmp
      zoltan@gep:/tmp> ln /bin/bash foo
      zoltan@gep:/tmp> ls -l foo
      -rwxr-xr-x 2 root root 572200 2005-09-10 03:43 foo
      zoltan@gep:/tmp> rm foo
      rm: remove write-protected regular file `foo'? y
      rm: cannot remove `foo': Operation not permitted
      zoltan@gep:/tmp>

      The reason for that strange behaviour is this:

      zoltan@gep:/tmp> ls -ld /tmp /home/zoltan
      drwxr-x--- 114 zoltan users 16248 2007-09-28 14:23 /home/zoltan
      drwxrwxrwt 32 root root 3176 2007-09-28 14:25 /tmp

      The /tmp can be written by anyone. Note the 't' at the end of the permissons of /tmp: that is the sticky bit. Normally, if you have write permission on a directory, you can add, delete and rename files in that directory, no matter who actually owns those files (since you do not want to touch the file, you only change the directory file, which you have right to). If the sticky is set, however, an entry can only be removed (or, for that matter, renamed) by the owner of the file pointed by that entry. This is actually a trick (kludge, if you like) to solve the problem that sometimes you need to be able to create files in a common place (e.g. lock files) but you must not let anyone but the owner delete them and the basic UNIX acces right model is not enough for that. One such place is /tmp, an other prominent example is /var/lock. Since creating a hard link is to insert an entry to the directory file you can do it in such a directory - anyone can add entries, as the directory is word-writable. However, if the sticky is set, you can only remove (or rename) an entry if the i-node pointed by that entry is actually owned by you - which is not the case with /bin/bash. It is not because /bin/bash is owned by root, it is because it is not owned by you. It has nothing to do with the i-nodes or hard links, but the way the sticky bit works, which was a really neat trick to solve a problem, but it has this side effect.

      Is it a bug? Well, it's certainly a feature... Is it a security problem? I don't know, I am no security expert, but I haven't heard of an exploit based on links and the sticky bit yet.

    28. Re:Not for security use? by QuantumG · · Score: 1

      If you're so fuckin' tough, how about we meet up and discuss this personally? Chicken shit.

      --
      How we know is more important than what we know.
    29. Re:Not for security use? by Jah-Wren+Ryel · · Score: 1

      If you're so fuckin' tough, how about we meet up and discuss this personally? Chicken shit. Stop it man! Lol, you are killing me! Posting from australia like a roid rager!
      Hillfuckinglrious parody dood!!
      --
      When information is power, privacy is freedom.
    30. Re:Not for security use? by QuantumG · · Score: 1

      So is that a no?

      You're a big man when you've got your anonymity to hide behind.

      --
      How we know is more important than what we know.
    31. Re:Not for security use? by Jah-Wren+Ryel · · Score: 1

      You're a big man when you've got your anonymity to hide behind. "QuantumG?" Give me a break. You are more anonymous than I am -- Elijah Wren Ryel, that's my given name. You're the big man hiding behind the whole freaking pacific ocean. But you are sooo damn easy to bait.
      --
      When information is power, privacy is freedom.
    32. Re:Not for security use? by QuantumG · · Score: 1

      So you're in the US? I go there 5 times a year man.

      Drop me an email, we'll arrange a meet.

      --
      How we know is more important than what we know.
    33. Re:Not for security use? by Jah-Wren+Ryel · · Score: 2, Funny

      So you're in the US? I go there 5 times a year man.
      Drop me an email, we'll arrange a meet. Let me know when you get to Denver, no reason to do it in email.
      Of course you would be an idiot to show.
      You have no idea how many local gangbangers and thugs want to give you a beat-down for your lame unix skillz.
      They fuckin' hate people who can't use the sticky bit right.
      --
      When information is power, privacy is freedom.
    34. Re:Not for security use? by QuantumG · · Score: 1

      Denver? Shit man, I'm sorry, you've been punished enough already.

      --
      How we know is more important than what we know.
    35. Re:Not for security use? by Anonymous Coward · · Score: 0

      Hey, I'm in Brisbane. If you're near here, how about we meet up for some good old fight-club action? My entire family are black belt, although I'm not, but my teenage sons can provide security and will protect both of us from serious harm (they attend an honourable martial arts school). I'll battle on behalf of the non-ego-driven geeks who are cutting your tall poppy in half.

      How's that sound to you, big man? Sounds like you need it, and I'm in a place right now where I just want to destroy something beautiful.

      Win/win, eh?

    36. Re:Not for security use? by MSojka · · Score: 1

      > 2. Hard link /usr/bin/su to ~/usr/bin/su. (Yes, you can create hard links to files which you don't own.)

      Therein lies your security problem.

      Don't put user writeable directories (like ~/ or /tmp/) on the same damn partition as the system files.

    37. Re:Not for security use? by Anonymous Coward · · Score: 0

      It's not like I was the only one to bite.
      Has it occurred to you that this might be why he got annoyed? It wasn't really necessary for more than one person to tell him he was wrong, and yet you were, what, the sixth person who felt compelled to jump in and call him an idiot, even though five other people had already posted exactly the same correction?
    38. Re:Not for security use? by TheRaven64 · · Score: 1

      On a UNIX system, only members of the wheel group are allowed to su to root. The user's attempt to become root would fail, because they are not in the wheel group. GNU systems, including GNU/Linux, do not enforce this restriction, since RMS believes that not allowing users full control over systems is a violation of their freedoms.

      That said, you could still perform this kind of trick by going via an intermediate user who you put in the wheel group in your chroot, simply by creating a second user with a blank password.

      --
      I am TheRaven on Soylent News
    39. Re:Not for security use? by Jonner · · Score: 1

      Regardless of why GNU su was designed the way it is, I think most GNU/Linux systems actually use the su command supplied by the shadow password package. It also does not seem to care about the wheel group. In addition, why is requiring a user to be in the wheel group in order to su to root a big security improvement, since it still requires the user to enter the root password, just as the login command does? Restrictions like being in the wheel group are great for the sudo command, which requires users to supply their own passwords, but I don't really see the point for su.

    40. Re:Not for security use? by TheRaven64 · · Score: 1

      If an admin on a GNU system types su and enters the root password, then anyone who sees them do it can also become root. If, on the other hand, the admin is on a BSD system, then the root password is of no use to the user (I typically mark the console as insecure too, so you can't log in as root without a reboot there, which will be noticed, and disable remote root logins). This means that, in order to become root you need a valid account in the wheel group as well as a valid root password. For machines I don't have physical access to, I often disable password authentication for SSH too, so you need to steal the root password and the SSH key of a user in the wheel group, which is pretty hard.

      --
      I am TheRaven on Soylent News
    41. Re:Not for security use? by Jonner · · Score: 1

      OK, I can see there is some value to requiring a user to be in wheel to su to root. However, I again point out that there are probably very few GNU and Linux based systems that actually use GNU su, though other GNU coreutils are ubiquitous. It looks like you can configure wheel requirements via PAM, which is used on most GNU/Linux systems. I use passwordless SSH on my Ubuntu systems and sudo, which is also very configurable in required authentication.

    42. Re:Not for security use? by Phroggy · · Score: 1

      I understand that, but that has nothing to do with what we were talking about.

      If a non-root user could chroot, they could create their own root filesystem under their home directory, including their own ~/etc/passwd and ~/etc/group files that would put them in the wheel group when they ran "chroot ~". Fortunately, non-root users cannot chroot, and the above is a good example of why not.

      --
      $x='S24;r)>63/* h@<5+oZ)32"5cz';$me='phroggy'x$];
      $x=~y+ -xz+\0-Tx+;print$_^chop$me for split'',$x;
    43. Re:Not for security use? by Phroggy · · Score: 1

      Oh, by the way:  from /etc/login.defs on Linux:

      #
      # If "yes", the user must be listed as a member of the first gid 0 group
      # in /etc/group (called "root" on most Linux systems) to be able to "su"
      # to uid 0 accounts.  If the group doesn't exist or is empty, no one
      # will be able to "su" to uid 0.
      #
      SU_WHEEL_ONLY   no

      --
      $x='S24;r)>63/* h@<5+oZ)32"5cz';$me='phroggy'x$];
      $x=~y+ -xz+\0-Tx+;print$_^chop$me for split'',$x;
    44. Re:Not for security use? by Anonymous Coward · · Score: 0

      Yeah, I'm a day late, but this is some funny stuff. Here you are whining about people giving you a hard time about an arrogant mistake, and your signature says "it should be legal to kill vegetarians, so long as you intend to eat them."

      Apart from being "rude" (what you are complaining about others being toward you), its not even slightly original. I've heard variations on the same theme from too many rebels without a cause to count. Let me guess, you are proud of not wearing seatbelts, and can't tell enough people about how much of a bad-ass you are for hating "political correctness".

    45. Re:Not for security use? by arcade · · Score: 1

      The problem here is, again, users/admins who doesn't do things the right way.

      Why the flying fsck is /tmp part of / !?!

      So that any user should be able to fill up / ? /tmp should *always* be its own partition. *Always*. Any other configuration is utterly and completely b0rken.

      --
      "Rune Kristian Viken" - http://www.nwo.no - arca
    46. Re:Not for security use? by Anonymous Coward · · Score: 0

      It wasn't really necessary for more than one person to tell him he was wrong, That's the price one pays for being an ass, being wrong and getting modded up for it.
    47. Re:Not for security use? by Breakfast+Pants · · Score: 1

      It wouldn't matter because 'their' su wouldn't have the setuid bit set to root.

      --

      --

      WHO ATE MY BREAKFAST PANTS?
  8. Nothing Like... by Techman83 · · Score: 1

    the smell of flame war in the morning.

    Nothing to see here, move along.

    --
    # cat /dev/mem | strings | grep -i cat
    Damn, my RAM is full of cats. MEOW!!
  9. Duh. by wilymage · · Score: 3, Informative

    This isn't news.

    For those of you who weren't aware how easy it can be to break out of most chroots, here's a good description of a common process:

    http://www.bpfh.net/simes/computing/chroot-break.html

    --
    The secret to creativity is knowing how to hide your sources. -- Albert Einstein
    1. Re:Duh. by stox · · Score: 1
      This hasn't been a problem in FreeBSD for many years:

      Finally it should be noted that not all version of Unix are vulnerable to this attack. FreeBSD 4.x and above have a better chroot() system call. It can be made to fail if the process has any file descriptors open on a directory. This works by stopping the attack above which essentially works due to a file handle being open on a directory.
      --
      "To those who are overly cautious, everything is impossible. "
    2. Re:Duh. by Anonymous Coward · · Score: 1, Informative

      Not a terribly useful article. To quote:

      --
      For a user to do this, they would need access to:
        - C compiler or a Perl interpreter
        - Security holes to gain root access
      --

      So, the security tool isn't useful if there's a different security hole you can use to become root, especially when you can create and execute arbitrary code on the machine. No kidding.

      We already know that chroot() can be broken with superuser access; that's what superuser access is for. Security holes that grant root access completely destroy the Unix security model, since it really only comes in two levels, and root is by definition unlimited. If I'm allowed simply to assume a way to gain root access as one premise of my new 'sploit, then there is no possible way to secure Linux at all.

      Note that half of the discussion in TFA also falls into this trap. Most of the posts are discussing chroot as a shell command, and pointing out that if you're logged in as root it doesn't contain you. Again, no kidding. chroot is a way for a program to set up a samdbox for some other program; that's it. As a interactive shell command, it's mostly pointless.

    3. Re:Duh. by nuzak · · Score: 3, Insightful

      The explanation of that exploit is a good one, but it still requires root.

      Isn't it just easier to remount the device?

      News flash: root can break security. World ends at 10:00. Film at 11.

      --
      Done with slashdot, done with nerds, getting a life.
    4. Re:Duh. by wilymage · · Score: 1

      Interesting response, it will hopefully be modded informative. Things like mknod to create raw disk access or modifying kernel memory space do require root access. However, I think it's worth pointing out that there are methods that don't, such as following hardlinks (which continue to point outside the jail, unlike symlinks).

      Sure, it requires some tardy system administration to have hardlinks like this in place, but it's not possible for the most moronic of admins to make this mistake with virtual machines, as an example.

      --
      The secret to creativity is knowing how to hide your sources. -- Albert Einstein
  10. No, jails are for security by kevmeister · · Score: 0, Flamebait

    The correct answer is to use jail(8) for security. That's why they exist and what they are intended for. Does Linux have jails yet? Maybe you need to switch to a BSD based system.

    --
    Kevin Oberman, Network Engineer, Retired
    1. Re:No, jails are for security by cstdenis · · Score: 0

      "having all of my hardware work..."

      I guess you are a windows fan then.

      --
      1984 was not supposed to be an instruction manual.
    2. Re:No, jails are for security by TheCoelacanth · · Score: 1

      "having all of my hardware work..."

      I guess you are a windows XP fan then.
      There, fixed it for you.
    3. Re:No, jails are for security by Anonymous Coward · · Score: 0

      www.rsbac.org ;) has jail for linux

  11. Did someone say... by markov_chain · · Score: 1

    that a user at the root of the Linux tree exit out of a jail? The police are trying to locate a man that might be trying to cut his beard. Hopefully they will find him.

    --
    Tsunami -- You can't bring a good wave down!
  12. Yeah, okay. by Anonymous Coward · · Score: 4, Insightful

    And RAID isn't for safety of your data either, hey?

    Locks on your house aren't for security, they're just to keep the door closed if a cat pushes on it, right?

    Seatbelts aren't to prevent you from flying through a windshield, they're just there so you don't slide around while taking corners.

    Sorry, chroot *is* a security tool; it's very much useful for security. Maybe it wasn't written as one - maybe it was never intended to be one, but it *is* one now, no matter what Alan Cox says.

    Software, especially open source software, is a lot like language. Despite the best efforts of nitpicking English teachers everywhere, the meaning of both words and code are whatever the vast majority agrees upon. And regardless of that, you may call me crazy, but the ability to restrict what a user can and can't access; what a process can or can't access, sounds like a security tool to me.

    1. Re:Yeah, okay. by EvanED · · Score: 1

      And RAID isn't for safety of your data either, hey?

      Actually, to some extent, this is true. RAID is mostly there for speed and to eliminate downtime when the hardware breaks.

      Backups are for the safety of your data, not RAID, and RAID can't take the place of backup.

    2. Re:Yeah, okay. by AusIV · · Score: 1
      That was the point entirely. All of the things he pointed out were (good?) unintended consequences of the tool.


      Personally, I do backups of all of my important data, but use my RAID to store hundreds of gigabytes of stuff (recorded TV shows mainly) that I couldn't afford to backup otherwise. It gives me a great deal of comfort to know that my data is safe from a drive failure, and I keep close tabs to make sure my RAID isn't degraded.

      A raid may not be intended to replace backup, but it does keep your data safer than something that just stripes your data together for speed or LVM for combining volumes.

    3. Re:Yeah, okay. by Daishiman · · Score: 1

      And RAID isn't for safety of your data either, hey?

      Locks on your house aren't for security, they're just to keep the door closed if a cat pushes on it, right?

      Seatbelts aren't to prevent you from flying through a windshield, they're just there so you don't slide around while taking corners.

      Your thinking is exactly the reason why most users fail to use chroot correctly:
      RAID provides SOME data protection, but the RAID card itself is a point of failure and RAID by itself in no way replaces a backup and recovery solution.
      Locks keep honest people honest. A sufficiently determined lockpicker will work his way through almost any lock. The only thing it does is raise the difficulty of opening the door to the point where it's not worth it.
      Seatbels will preveny you from flying through a windshield, but without an appropiately designed car with functional airbags and good lateral protection their effectiveness is reduced considerably.
      Same thing with chroot. It's not the end-all-be-all solution, but alongside other things it is extremely appropiate.
    4. Re:Yeah, okay. by Ihlosi · · Score: 1
      And RAID isn't for safety of your data either, hey?



      You'll find out how much safety RAID provides once your data gets trashed by malware, deleted by a careless or disgruntled employee, the RAID box gets stolen, or your office burns down or gets flooded.

    5. Re:Yeah, okay. by Anonymous Coward · · Score: 0

      no matter what the current interpretation of chroot(), security is not monolithic. So if tool X provided func Y, which is security-related, it doesn't mean that X is good for any and all security.
      Chroot is intended to limit / control daemons that require root to run. NOT to jail users.
      If you fsck with that, and build a jail from chroot, you're on your way to M$ where every app is everything to all of their users. And the resulting security problems that come with that over time.

      If you want to limit your users, use the tools intended for that: account privileges, group membership, (extended ) ACLs, SElinux
      etc. After you've decided you don't trust them, but they still need to have an account, of course.

    6. Re:Yeah, okay. by M_Ryo-ohki_C · · Score: 1

      RAID is a high-availability feature. It does _NOT_ provide data-security!
      If your data gets trashed; that's written out to multiple disks.
      It's no different from a single disk. The difference is in down time.
      With RAID and a disk failure, you can keep going with nary a hiccup.

  13. lacing up my track shoes by v1 · · Score: 1

    "chroot manages security like DRM manages your digital rights".

    ok I better run now. Give me a head start, wouldja?

    --
    I work for the Department of Redundancy Department.
  14. Chroot as a non-security tool by BurningSpiral · · Score: 5, Insightful

    The purpose of chroot is to change the root directory. Chroot is particularly useful for recovery and diagnostics.

    If you system that won't boot due to a boot sector problem Boot from a CD, mount your partitions, chroot to your root partition and run lilo/grub/... to rewrite your boot sector.

    If you system that won't boot due to init script problems Boot from a CD, mount your partitions, chroot to your root partition and run run your full init process. If you run into problems, rerun your init scripts rather than rebooting.

    Unfortunately, many people think chroot is a security tool so many people don't think it in non-security contexts.

    1. Re:Chroot as a non-security tool by LSD-OBS · · Score: 2, Insightful

      I must be oldschool. What you described is the only thing I've ever used chroot for.

      --
      Today's weirdness is tomorrow's reason why. -- Hunter S. Thompson
    2. Re:Chroot as a non-security tool by xenocide2 · · Score: 3, Informative

      Chroot is also used in building Debian packages. pbuilder sets up a seperate install to chroot into and ensure that build dependencies are correct by copying a base install, installing the build deps and attempting to build the package, eliminating some of those "works for me" FTBFS problems.

      --
      I Browse at +4 Flamebait

      Open Source Sysadmin

    3. Re:Chroot as a non-security tool by Anonymous Coward · · Score: 0

      Some people think sudo is for desktop distros (instead of being for environments with multiple sysadmins needing delegating and auditing), no wonder people have no idea what chroot is for...

  15. I'll bite by feld · · Score: 1

    Where can someone show me the proper way to use a JAIL on Linux? Do we actually have that capability? And if not, why the hell not?

    1. Re:I'll bite by TheRaven64 · · Score: 1, Funny

      I believe the correct procedure is to install this helper utility first.

      --
      I am TheRaven on Soylent News
    2. Re:I'll bite by larry+bagina · · Score: 2, Informative

      linux doesn't have jail. However, user mode linux and the like accomplish the same thing.

      I've also seen attempts to fake a jail using LD_PRELOAD funstion stubs to filter system calls. However, since the filtering is not done in the kernel, it's possible for another thread to modify the arguments after they've been verified but before they actual system call takes place (ie, a race condition).

      There was a slashdot article about this a couple months ago, but damned if I can find it now.

      --
      Do you even lift?

      These aren't the 'roids you're looking for.

    3. Re:I'll bite by Anonymous Coward · · Score: 0

      Check out http://linux-vserver.org/

      If you're using Debian Etch then there are prebuilt kernels with the patches applied. It seems basically the same concept as FreeBSD jails or Solaris Zones to me. I've been using it for a while with great success :)

      On Debian, setup is like this:
      # apt-get install linux-image-2.6-vserver-686 util-vserver vserver-debiantools
      # reboot

      You can build a new jail like this:
      # vserver NAME build --force -m debootstrap -- -d etch -m http://ftp.debian.org/debian

      Then set up a network interface for it according to the docs (put some stuff in /etc/vservers/NAME/interfaces)

      Works great :)

  16. Re:misleading...Re:Asshole Stereotype by gerf · · Score: 2, Insightful

    'incompetent people implementing security solutions are a real problem.'

    Man, things like this make me want to NOT switch to Linux... Even though I had a better experience with Ubuntu that I did Vista.

    Heck, I don't even know what chroot is, which must make me dried dog piss on a hot fire hydrant in this guy's eyes.

  17. Who is he anyway? by ByTor-2112 · · Score: 0, Flamebait

    Just because someone has written some code and has poor personal hygiene doesn't mean what they think is the end-all of a topic, much less that everything that comes out of their mouth is some fantastic headline.

  18. Genius? by Anonymous Coward · · Score: 0

    Geez guys. chroot was not designed as a security tool even though you may be using it as such. Don't be calling people names because you don't know as much as you think you do. chroot is for exactly what it's named for changing the root directory.

    For instance, say you are using Fedora and muck up your boot loader so the system doesn't boot. Usually you boot the rescue CD, mount the root file system under /mnt/sysimage. From there you can "chroot /mnt/sysimage" and then it will be much like you booted directly from the hard drive (there are a few other things that you should do as well) and can run any command from the hard drive as if you booted from the hard drive. For instance, you can now "vi /etc/grub.conf" or reinstall your boot loader "grub-install /dev/sda", etc.

    Another example is you can build a root file system under a subdirectory and then chroot to that system image to test things as if you booted that system image before writing it to CD.

  19. For daemons that don't run as root by benhocking · · Score: 0

    Yes, however, for daemons that don't run as root, the user cannot use the chroot command. Per the man page: "This command can be run only by the super-user."

    --
    Ben Hocking
    Need a professional organizer?
    1. Re:For daemons that don't run as root by TheRaven64 · · Score: 5, Informative
      Yes you can. As I said, you launch them with:

      # chroot directory su nobody daemon
      This will chroot into directory, and run daemon as the nobody user. As long as the version of su inside your jail doesn't have any security holes, you will be fine. If you don't trust it, I've written a modified version of chroot, which calls setuid() and setgid() to a named user and group before executing the named process. This eliminates the need for a working su inside the chroot, typically removing the need for any setuid programs in the chroot.

      Just because you can only run a command as a superuser doesn't mean that all of the child processes of that command have to be run as the superuser. If this were the case, since init runs as root you would not have a multiuser system.

      --
      I am TheRaven on Soylent News
    2. Re:For daemons that don't run as root by VGPowerlord · · Score: 1

      Of course, that causes a problem if the service in question needs to listen on a port < 1024, on only root can bind those... which makes me wonder why non-essential services such as httpd have low port numbers.

      You can get around that by having it listen on a higher port number and having the kernel reroute packets, but that gets messy if you have to do it for a bunch of services.

      --
      GLaDOS for President 2016! "Well here we are again. It's always such a pleasure." -- GLaDOS, 2011
    3. Re:For daemons that don't run as root by dfn_deux · · Score: 1

      I think you are pretty much out of luck on changing the standard ports numbers for 1024. That is one of the older and more sticky RFC memes upon which the internet is built upon. Wait for the next internet to get rid of some of the kludgier house of cards type constructions.

      --
      -*The above statement is printed entirely on recycled electrons*-
    4. Re:For daemons that don't run as root by Mysticalfruit · · Score: 1

      I wonder if you setup a forwarding rule to push traffic from some low port to some high port you could get around this problem? Then just have your non root running chrooted process listening on that high port.

      It's 11:34pm where I am so I can't my brain is currently in low power mode... this could be wrong or not make sense...

      --
      Yes Francis, the world has gone crazy.
    5. Re:For daemons that don't run as root by sgifford · · Score: 1

      That works if you have a copy of the application, su, some version of /etc/passwd, and all of the libraries needed by both programs inside the chroot area. To avoid that, you can use chroot_safe, which is a clever LD_PRELOAD hack to start the program, load all shared libraries, then do the chroot. For many programs, this is enough to make it work without copying anything into the chroot area. It's very handy; I use it for all sorts of things.

    6. Re:For daemons that don't run as root by the_womble · · Score: 1

      Yes you can. I have done it for a webserver in the past. It is a pretty good security precaution without chroot as well.

      The only potential problems I know of are:

      1) on a multi-user machine, any user can, in effect, grab the low port (by grabbing the port it is rerouted to).
      2) I am not sure how to configure init scripts for this, Presumably you need wrapper scripts that do run as root. I cannot remember what I did about this at the time.

    7. Re:For daemons that don't run as root by vranash · · Score: 1

      I haven't actually dicked with setting it up, but there's actually a security model in linux now for ALLOWING processes to be bindable to 'root' ports, either via SELINUX or seperately (It's in the kernel source, but since I'm too lazy to actually go through and set up policies and tools of ANY kind I haven't looked much beyond that.) But regardless the support is intended for EXACTLY this sort of setup, keeping processes unprivileged while allowing them the tools they need to operate properly.

    8. Re:For daemons that don't run as root by Anonymous Coward · · Score: 0

      Yep. If only everyone understood that restricting privileges too tightly diminishes security by resulting in many individuals having extremely high privileges. This issue is widely misunderstood across the board, from computer security to accounting. No system or organization ends up failing to operate because nobody has security privileges; human psychology doesn't allow that. What happens is that systems that try to be too restrictive ends up with random lowly individuals (clerks, web servers) having ludicrously lofty privileges.

    9. Re:For daemons that don't run as root by jhol13 · · Score: 1

      As long as the version of su inside your jail doesn't have any security holes [...] Actually this is not a requirement - the su inside the jail should not have setuid flag set.

      After all it is used only to change away from root. There is no (general) need for a single setuid program inside the jail.
    10. Re:For daemons that don't run as root by caluml · · Score: 1

      Or we could scrap this ridiculous requirement that you should be root to bind to low ports. It's antiquated, and serves no purpose at all.

    11. Re:For daemons that don't run as root by Phil+John · · Score: 1

      You could do what Zimbra used to and use IPTables to forward to non-sys ports on Linux.

      --
      I am NaN
    12. Re:For daemons that don't run as root by TheRaven64 · · Score: 1
      Well, the correct way of doing this is for the daemon to perform the following steps:
      1. Bind to the port.
      2. chdir() to the part of the system it needs.
      3. chroot() to the current directory.
      4. setuid() and setgid() to a non-root user specified in the config file.
      Hacks that will work for daemons that don't include forwarding the port using pf (or iptables if you are a Linux person) to an unprivileged port. I think pf allows you to tag traffic per UID, so you could reinforce this and only allow processes running as that daemon's user to access that port. Another option is to use a privilege elevation mechanism, like systrace, to allow it to call bind() as root if the port is set to the port the daemon requires.
      --
      I am TheRaven on Soylent News
    13. Re:For daemons that don't run as root by Aeiri · · Score: 1

      I've just always used chrootuid, since there's a Debian package for it. Made by Wietse.

      ftp://ftp.porcupine.org/pub/security/index.html
      http://packages.debian.org/chrootuid

    14. Re:For daemons that don't run as root by Anonymous Coward · · Score: 0

      How does this work if the daemon needs to bind to a low port number or take some other action that traditionally requires root?

    15. Re:For daemons that don't run as root by profplump · · Score: 1

      It's not the concept that's flawed, it's the implementation. Having well-known ports be protected is a good idea. Requiring full root access to bypass that protection is not.

      The good thing about having well-known ports be protected is that unprivileged users can't grab them. Imagine this scenario:
              1. Web server running on an unprotected port 80
              2. Non-root user does something to make web server crash (consumes all memory, etc.)
              3. Non-root user launches on own web server on port 80
              4. Restarted system web server can't bind
      The non-root user has now effectively taken over web services on the machine. That's what the protected well-known ports is supposed to prevent.

      The implementaiton flaw is that privileges are so broad. In traditional UNIX there's no way to say "allow this user program to bind to port X, but grant them no additional permissions beyond those of normal users". That's one of things SELinux is working to fix -- fine-grained access controls for privileged operations.

    16. Re:For daemons that don't run as root by T-Ranger · · Score: 1

      The question should not be "why do (some) standard services bind to ports 1024?" but "why is the test for opening 1024 rootness?". Or to put things another way, why is there not a file (/etc/ports, say) in the format of (port:[udp|tcp]:uid[,uid]*:gid[,gid]*)? which details which ports can be opened by who? Or even make it dead simple and only allow for a single user per port. It would seem to me to be a relatively trivial kernel change....

    17. Re:For daemons that don't run as root by bugg · · Score: 1

      The reason you don't let users bind to ports <1024 is that many of the privileged ports offer significant authentication mechanisms, and you want to indicate that their daemons are running with privilege.

      For instance - let's say I had a shell account and used telnet to log into it. My host isn't running sshd. If the sshd port weren't privileged, I could start running sshd as my user, and happily capture all attempted passwords and then use them later to steal privileges of any user that 'tried' to log in via ssh.

      Similarly, if I connect to http://host.university.edu/ I'm under the impression that I'm connecting to a service ran by host.university.edu - not some random user who happened to grab port 80.

      --
      -bugg
    18. Re:For daemons that don't run as root by bugg · · Score: 1

      Actually, you don't need anything that fancy - the daemon can just drop root for each connection.

      My apache threads run as user apache, not as user root.

      Daniel

      --
      -bugg
    19. Re:For daemons that don't run as root by nuzak · · Score: 1

      > 4. Restarted system web server can't bind

      I submit that part 4 of that scenario is a weakness in current TCP/IP stack implementations: that a sufficient privileged process cannot forcibly steal a port. It's not like they couldn't do it the long roundabout way anyway. The overall problem being that resources like ports are way too tightly coupled with processes.

      --
      Done with slashdot, done with nerds, getting a life.
    20. Re:For daemons that don't run as root by T-Ranger · · Score: 1

      Re point 1: If you had read my comment, I proposed a way to allow specific users to bind to 1024, not everyone. On point 2:, Remote hosts should not be trusted.. Why are you trusting the remote admins in this case, anyway?

    21. Re:For daemons that don't run as root by bugg · · Score: 1

      Well, I'm explaining the historical context in which points under 1024 are privileged. That restriction makes a lot more sense still than a lot of other things which have persisted (like identd)

      Remote hosts shouldn't be 'trusted' in the authentication sense, but my statement was the port restriction allows you to infer that services listening on ports 1024 were started by someone who has privilege on the machine --- that's very different from stating that they should gain any privilege on your hosts or network.

      There is a very important distinction here. I am asserting that the port restriction allows you to know that services on remote hosts were created by someone with privilege on the system -- I am NOT asserting that it allows for any trust of the remote machine or of the administrators of the remote machine. To appreciate this, you need to think of the machines that have non-administrator users -- say, people who buy a shell account at shellserver.isp.com. You don't want them starting their own SMTP server on port 25 and accepting mail on behalf of that machine, do you?

      --
      -bugg
    22. Re:For daemons that don't run as root by it072312 · · Score: 1

      isn't this bad since i have to run as root from the beginning?

    23. Re:For daemons that don't run as root by T-Ranger · · Score: 1

      You assertions are invalid. First off, not all OSs have this restriction. It assumes that only smart and non-evil people are host administrators. And for the majority of hosts on the internet, neither of theses is true.

      The can is open, there are worms everywhere. Its has been at least 25 years (if ever) since you could make the assumption that remote hosts were run by smart people and against a policy that was similar to yours. Your assertion might only be valid in some magical fairy land, which I doubt has ever existed.

    24. Re:For daemons that don't run as root by bugg · · Score: 1

      Security is the result of multiple layers of security. This is one that's very weak, very unreliable, and hasn't really been the case for quite some time. I agree with all of this.

      But, if I'm running www.ebay.com, and someone is able to log in as an unprivileged user and kill apache, I don't want them to be able to start their own web server on port 80. The restriction on ports forces them to break root if they want to do it.

      It is valuable. It is not very valuable, but it has value as one additional requirement that is placed on an attacker.

      --
      -bugg
    25. Re:For daemons that don't run as root by T-Ranger · · Score: 1

      Then don't put any settings in (e.g.) /etc/ports, and continue on as you are now. Don't use the option.

      In your thought experiment one must become root to to bind to :80, preventing users from launching their own web server. In my idea, one must become apache (or wwwrun) (or also root) to bind to :80. "Getting wwwrun" may be slightly easier then getting root, but I think about the same. Slight loss in security there. On the flip side, Apache now never needs to be root. Slight increase in security there. Apache might not be a good test, its reasonably trusted. But what about Apache with local users running CGI or PHP scripts? Or one of your alternate http servers? Or a written-in-perl spam proxy on :25?

      I consider not running things as root a more significant risk then the possibility of "users" breaking a nologin user account. On any "important" system, the only users would be administrators anyway, wouldn't it?

    26. Re:For daemons that don't run as root by bugg · · Score: 1

      I consider not running things as root a more significant risk then the possibility of "users" breaking a nologin user account. On any "important" system, the only users would be administrators anyway, wouldn't it?

      I don't think so, said machine would be utterly useless.... If there is a lesson of the last 30 years, it's that if you are supplying any sort of input data, you are a 'user' of the application. If you send an email to a host, you are using that host's MTA, if you are visiting a website, you are a user of apache. It needn't matter that you aren't a user with your own account on the system. Vulnerabilities are real - format string, buffer overflow, lack of validation, injection...

      Really, it's security in layers. I think AppArmor is the type of solution that lets you do what you really want --- limit the syscalls that the application can execute with root privilege -- and then there's yet another layer of security.

      --
      -bugg
  20. chroot IS an effective layer by sdsucks · · Score: 2, Insightful

    Sorry folks,

    Chroot IS an effective layer when you are also dropping privileges from superuser.

    Obviously chrooting a "root" process does no good.

    But hey, this is slashdot not reality. Go ahead and mod me down.

    1. Re:chroot IS an effective layer by Anonymous Coward · · Score: 0

      Ok, you're modded down. What you do is irrelevant; it's what the attacker does that counts, and an attacker who obtains root privs from your non-root process blows snot in your general direction for thinking that chroot protects you.

    2. Re:chroot IS an effective layer by Anonymous Coward · · Score: 0

      an attacker who obtains root privs from your non-root process From one coward to another - put up or shut up. I challenge you to cite even one documented exploit that involves obtaining root privs from a non-root process.
    3. Re:chroot IS an effective layer by Anonymous Coward · · Score: 0

      If I've got root privileges in the first place I'd be inserting kernel modules (or other ultra-nasty things like creating a dev node to some I/O device, like your harddisk, and read/write to it) right away. Do you think I'd care about your chroot anymore?

    4. Re:chroot IS an effective layer by Anonymous Coward · · Score: 0

      There have been a number of kernel bugs which allow for escalation of privileges, and they can be exploited from any program which can be convinced to run them. Since I'm posting anonymously due to having moderated in this thread, you can search for them yourself.

      Another likely attack vector is to use bugs in a suid program. Or, if you can't convince the network-facing process you're attacking to make arbitrary system calls of your choosing, you might be able to get it to invoke another program which will.

      These are both good reasons for using chroot's though, as they make it harder for an attacker to find something to exploit. If you're running Apache under a chroot, they need to make Apache execute the vulnerable sytem calls. If you're running it without the chroot, they may be able to choose from any other program on the system to exploit. It also provides more possibilities of using multiple exploits, e.g. use a crappy PHP script one of your lusers has in their homedir to upload a program of your choice, and then exploit a bug in your mail server to actually execute that code using elevated privileges.

      chroot() isn't the "answer to security", but as part of a "defence in depth" strategy it makes sense.

  21. Not suprising, Linux avoid pathname-based security by salahx · · Score: 1

    The Linux developers generally looked down pathname-based security (for what I think are good reasons). That's one of the reasons like SELinux is venerated and AppArmor is snubbed. So this is no surprise. Especially given the VFS and namespace games you can play in Linux (bind mounts, slave mounts, /proc ).

    So this is no surpise. chroot() is certainly useful, but not for keep root in jail; use SELinux for that.

  22. What the hell is wrong with these people? by Epistax · · Score: 4, Insightful

    Do all OS developers become assholes? I've done a lot with VxWorks and I hope I don't become as twisted as these folk. I better just stay away from authoring my own kernel.

    1. Re:What the hell is wrong with these people? by smcn · · Score: 2, Insightful

      I think it's more like all unemployed programmers become assholes, no matter how trivial their "expertise". Case in point: most of the developers and community of WoWAce, a set of libraries for World of Warcraft mod development. Any question or suggestion made on their wiki is immediately met with responses from "the experts" telling you why you don't need what you think you do, and why you're an idiot for wanting such. I'm quite positive many development-related forums exist solely for the purpose of torturing "newbs".

    2. Re:What the hell is wrong with these people? by Anonymous Coward · · Score: 0

      Do all OS developers become assholes?

      They're all just a bunch of Cox.
    3. Re:What the hell is wrong with these people? by Per+Abrahamsen · · Score: 1

      > Do all OS developers become assholes?

      No, just you. You are calling others assholes, something none of the people in the original thread did.

    4. Re:What the hell is wrong with these people? by Per+Abrahamsen · · Score: 2, Insightful

      I see it mostly from the other side, a few users who ask for something that makes no sense, and when you explain that it makes no sense they get extremely rude. It sounds like you are a MMORPG player, and judging from the fora for those they are among the absolutely worst users. They seem to be convinced that the whole world (virtual and real) revolves around them, and that every aspect of the game should satisfy their immediate desires.

      Anyone writing free software for that community have my sympathy.

      [ The MMORPG companies hire community contacts who are incredible patient and polite, no matter the amount of insane insults and demands the players spit out. Which I find worrisome, as they are teaching a generation that they can get by in with the social skills of a 1 year old. I fear the time when they grow old enough to use my software. ]

    5. Re:What the hell is wrong with these people? by Anonymous Coward · · Score: 0

      Yeah, that's probably a good idea.

    6. Re:What the hell is wrong with these people? by Epistax · · Score: 2, Insightful

      No, they'll just do it implicitly along with many other things. Passive aggression serves to antagonize and make others A) feel bad, B) feel bad for feeling bad, and C) Look bad to others when being explicit.

      Sorry, when but when I read or hear things implicit, they come out as screaming explicit. That particular conversation would be no less civil if laced with expletives and "your mom" comments.

    7. Re:What the hell is wrong with these people? by quantaman · · Score: 1

      Do all OS developers become assholes? I've done a lot with VxWorks and I hope I don't become as twisted as these folk. I better just stay away from authoring my own kernel. I didn't read the full thread though I read a good portion of it and the kerneltrap summary.

      In total I thought the responses of the kernel devs were fairly measured and restrained. Basically people (well one guy in particular) was arguing that chroot should successfully jail root. Then when several immensely qualified people said they were wrong, and pointed out why, they continued to argue.

      When you claim X and the expert claims Y, if you want to continue to argue you'd better be very sure, and have done some real research into your position, before claiming the answer is still X. In the thread several times I could see the experts had done more thorough research to show that the current chroot functionality was correct than the people claiming otherwise. It's the responsibility of the person disproving the expert to do the research, if the expert is doing more research do prove the non-expert wrong than I feel the expert has a very legitimate reason to get mad at the non-expert for wasting their time.
      --
      I stole this Sig
    8. Re:What the hell is wrong with these people? by Kitanin · · Score: 1

      Oh, so all us plebians can work on your OS kernel, but you're too good for that? Asshole. ;)



      --


      Teach your kids: "C++ made baby Jesus cry."
  23. mean by Anonymous Coward · · Score: 0

    kernel hackers seem to be mean :( at least in my experience...

    before you reply, please consider that it would take as much effort to go out of your way to be police as going out of your way to be mean and talk down to someone

  24. Excellent explanation by benhocking · · Score: 1

    I was wondering how that statement made sense. Obviously, I've never used chroot. (Correctly or incorrectly.)

    --
    Ben Hocking
    Need a professional organizer?
    1. Re:Excellent explanation by SL+Baur · · Score: 2, Interesting

      It doesn't make sense. Using chroot(2) for security is like trying to fit a round peg into a square hole that it was never intended to go into.

      It also doesn't make sense that certain inbound TCP ports are restricted to being bound only by root, but that's the reality we have to live with.

      <Thought-experiment>
      Wrap your mind around the fact that it is Microsoft Windows userland now that causes most of its insecurity. If you could cleanly separate Microsoft Windows userland and run it under an Open BSD kernel, it would still be insecure. Conversely, if you could run an Open BSD userland under a Microsoft Windows kernel, it most likely would be more secure (sans Microsoft programming and design errors).
      </Thought-experiment>

      Chroot will not and cannot defend against the ill-advised practice of running binaries ("trusted" or not) received off host. Yes, I'm also looking at you Mac OS X, which is otherwise a lovely system.

    2. Re:Excellent explanation by MobyDisk · · Score: 2, Insightful
      You're reply demonstrates the very complaint many posters are making, and the issue with the article:

      It doesn't make sense. Using chroot(2) for security is like trying to fit a round peg into a square hole that it was never intended to go into. You say that chroot isn't good, then make a cool analogy, but don't actually explain why it is wrong. That analogy doesn't explain to anyone what is wrong with chroot. You then go off on a totally unrelated tangent about Windows security and TCP ports.

      So what's wrong with chroot?
    3. Re:Excellent explanation by SL+Baur · · Score: 1
      Al Viro posted the source code to the Version 7 Unix implementation of chroot on the cited lkml thread, by the way.

      Networking has everything to do with it. Chroot restricts a process' view of the file system. Only. While an original Unix design goal was "everything is a(n untyped) file", this was never achieved. Device nodes, while they are files, are special kinds of files. BSD-style networking while accessed through file descriptors are in a different namespace, actually multiple namespaces because TCP and UDP have different namespaces. These both represent corner cases that must be dealt with specially if they are to be restricted in a chroot environment. Lastly, root has traditionally been all powerful and allowed to do anything, however much it may not make sense. You put all this together and you end up with an interface with dozens of holes in it that must all be coded for specially. This is a fruitless and error prone task and much like attempting to kill off an infestation of cockroaches by killing a handful at a time while the queen is busy laying 10s of thousands of new eggs somewhere hidden.

      It is better to forget about chroot and all its "problems" and leave it for what it's best at, more or less restricting the filename namespace. I posted two examples of my own usage of this earlier. If you want a secure jail, design for it and code for it in a different interface. The BSDs have a jail (which I don't know anything about other than it's not chroot). On the Linux side, there are several ongoing projects that handle the universe of restricted namespaces as part of their original design. Either of those two, can be made secure. Virtualization via hypervisor is another more promising with respect to security approach.

      So what's wrong with chroot? Nothing is wrong with chroot. What's wrong are people's misconceptions of it. It is not a security function.
    4. Re:Excellent explanation by MobyDisk · · Score: 1

      Nothing is wrong with chroot. What's wrong are people's misconceptions of it. It is not a security function. Well said.

      Then, do you think that using chroot decreases security because it increases the perception that something is secure? In that case, should it not be used in a secure app because it might fool the designer into thinking they have secured the system when they have not? Or do you think it is still an incremental improvement and that secure apps should still use chroot, so long as they know it is an extra layer that may help rather than a solution unto itself?
  25. Re:misleading...Re:Asshole Stereotype by visualight · · Score: 5, Informative

    I think his comment was directed specifically at people who do not have enough understanding to implement a security solution on linux but think they do. Would the same comment coming from an official MS authority on security make you not want to use Vista?

    Anyway, I do understand the perspective behind your reaction, but it doesn't fit in this specific case.

    --
    Samsung took back my unlocked bootloader because Google wants me to rent movies. They're both evil.
  26. Oversimplified... by evilviper · · Score: 2, Informative

    It's terribly oversimplified to say that chroot is useless. What's stupid is to chroot a process running as root. Most programs that have the built-in ability to chroot themselves (eg. Apache) immediately drop root privileges and drop to a non-privileged account.

    That said, even done properly chroot really only provides a little protection, and only in the case of horribly configured systems... IMHO, the sole benefit of chrooting a process is that anyone who successfully breaks-in can't execute SUID/SGID applications located elsewhere on the filesystem, which very, very commonly have security holes. Proper use of either sudo, or setting-up groups that are the only ones allowed to exec SUID/SGID applications, eliminates this big security hole.

    People like to say that chroot prevents attackers from running anything within the chroot, but it really doesn't... No doubt the exploit code used to break-in directly overwrites locations in memory. A similar method can be used to run any code you wish, no matter what is or isn't available inside the chroot. It certainly won't stop someone from exploiting kernel bugs, generating/reading network traffic, etc.

    Of course, these are the same types of people that think their systems are safer for having removed the compilers, and other (non-SUID/SGID) binaries that harmlessly occupy HDD space.

    --
    Slashdot gets worse every day... Pipedot: News for nerds, without the corporate slant
  27. CHROOT Manual says it all : by zukinux · · Score: 1

    man chroot :
    [codee]
    CHROOT(1)                        User Commands                       CHROOT(1)
    NAME
           chroot - run command or interactive shell with special root directory
    SYNOPSIS
           chroot NEWROOT [COMMAND...]
           chroot OPTION
    DESCRIPTION
           Run COMMAND with root directory set to NEWROOT.
           --help display this help and exit
           --version
                  output version information and exit
           If no command is given, run ``${SHELL} -i'' (default: /bin/sh).
    AUTHOR
           Written by Roland McGrath.
    [/code]

    Well.. the manual sums it all up.

    1. Re:CHROOT Manual says it all : by TheRaven64 · · Score: 1

      Wow, what kind of archaic system are you running? Even the 4.3BSD man page had more information than that, back in 1986.

      --
      I am TheRaven on Soylent News
    2. Re:CHROOT Manual says it all : by zukinux · · Score: 1

      I actually use the latest slackware... Slackware 12.0! RESPECT!

  28. Are they serious? by GiMP · · Score: 4, Insightful

    Please tell me that none of those bone-heads on LKVM advocating that chroot should be 'root proof' haven't had any patches accepted!

    Of course chroot() doesn't do any good if a process inside of it is running as root. This is very well known. However, that doesn't make chroot() useless, it is still plenty useful. If you execute chroot() and then a seteuid(uid) where uid>0, then you prevent a hole/bug in your program from being exploited in a way that will allow file access/execution outside the chroot. That *is* a security advantage.

    The point of "chroot security", cases where chroot is used to improve security, isn't to contain a malicious root user. The point is to prevent privilege escalation. You can create a chroot without any directories with mode 7771 privileges (a la /tmp), that is free of any setuid binaries, and without "useful" utilities like wget or curl that can make exploiting the system child's play. If your program runs inside of a chroot as a non-root user, and your chroot has no setuid binaries, and your kernel has no privilege escalation vulns, then you can be reasonably sure that nobody will break the chroot or achieve privilege escalation. Without a chroot, you would have to clear your entire server of setuid binaries and mode 7771 directories -- not to mention the potential for intentionally world-readable files that can lead to information exposure. Quite simply, a chroot prevents an arbitrary-execution vulnerability in bind (or other process) from exploiting a privilege escalation vulnerability in apache (or other process).

    What some people think, apparently due to pure ignorance, is that chroot() is an end-all solution that will prevent even a root-owned process from accessing files outside the chroot, or worse, thinking that it protects the memory subsytem in any way. It doesn't. Even if the discussed patch was applied to the kernel, a root-owned process could still alter kernel memory, access raw devices, etc.

    Improvements in ACLs under Linux minimize some of the needs for a chroot, other than the fact that a chroot is still much easier to configure and ACLs do not handle all of the use-cases that a chroot can solve. (and visa-versa, chroot cannot solve all of the problems solved by ACLs) Additionally, a chroot *and* ACLs can be used together for further-improved security.

    1. Re:Are they serious? by BobKagy · · Score: 1
      If you execute chroot() and then a seteuid(uid) where uid>0, then you prevent a hole/bug in your program from being exploited in a way that will allow file access/execution outside the chroot. That *is* a security advantage.

      According to the page about breaking out of chroot linked from the discussion, the seteuid() is not effective because the process still has a real UID of 0 and can call seteuid(0) at any time.

      You can create a chroot without any directories with mode 7771 privileges (a la /tmp), that is free of any setuid binaries, and without "useful" utilities like wget or curl that can make exploiting the system child's play. If your program runs inside of a chroot as a non-root user, and your chroot has no setuid binaries, and your kernel has no privilege escalation vulns, then you can be reasonably sure that nobody will break the chroot or achieve privilege escalation.

      I'd agree, but it sounds like doing this is nearly impossible in practice. Others in the linked article suggested jail() on *BSD or vserver on Linux are tools actually designed for security even when privilege escalation is possible.
    2. Re:Are they serious? by GiMP · · Score: 1

      According to the page about breaking out of chroot linked from the discussion, the seteuid() is not effective because the process still has a real UID of 0 and can call seteuid(0) at any time.


      Perhaps, but I believe that type of vulnerability can be limited through means such as privilege separation (as in OpenSSH)
    3. Re:Are they serious? by Anonymous Coward · · Score: 0

      I wonder what he would say about cat /proc/version for example...

      "NOOOO, YOU'RE DOING IT WRONG MAN, HALP!11"

    4. Re:Are they serious? by 44BSD · · Score: 1
      "7771 privileges (a la /tmp)"

      What is the endianness of your filesystem? :^)

    5. Re:Are they serious? by phoenix_rizzen · · Score: 1

      Small correction: 7771 should be written as 1777.

      7771 would give permissions rwsrws--t
      1777 would give permissions rwxrwxrwt

  29. Re:misleading...Re:Asshole Stereotype by Anonymous Coward · · Score: 0

    The comment was directed at system administrators, not desktop users. You're safe :)

  30. Overtaken by virualization by flyingfsck · · Score: 3, Interesting

    Basically chroot was an early attempt at virtualization. It allowed one to keep servers separated and contained, which improved reliability and availability. It has a minor positive effect on security, but not really all that much. There is a good argument to be made for not using chroot since it increases the maintenance effort, which frequently results in chrooted servers being neglected which reduces security. As for myself, I avoid using it, due to the maintenance issues.

    --
    Excuse me, but please get off my Pennisetum Clandestinum, eh!
    1. Re:Overtaken by virualization by Anonymous Coward · · Score: 0

      no it was never intended as an attempt at virtualization. really.
      it's purpose is something different

    2. Re:Overtaken by virualization by igb · · Score: 1

      ``Basically chroot was an early attempt at virtualization. It allowed one to keep servers separated and contained, '' chroot() appears in seventh edition (http://minnie.tuhs.org/UnixTree/V7/usr/src/libc/sys/chroot.s.html), released in January 1979. It's written in PDP11 assembler. It's a hell of a stretch to argue it was meant for virtualisation, server containment or whatever use it might be put to today.

  31. Re:misleading...Re:Asshole Stereotype by gerf · · Score: 1

    Thanks, as this was not explicitly said, I am confuzzed. It happens waaayyy too easily, I must say.

  32. Re:misleading...Re:Asshole Stereotype by Anonymous Coward · · Score: 0

    Please don't. The last thing Linux needs is a bunch of idiots whining every time they're offended by something on the internet. In fact, I don't think any OS needs that.

  33. Re:misleading...Re:Asshole Stereotype by evilviper · · Score: 0, Troll

    Man, things like this make me want to NOT switch to Linux... Even though I had a better experience with Ubuntu that I did Vista.

    You think Windows is better, just because there isn't a public record of every screaming rant Microsoft's heads deliver to their employees?

    As a beginner, you certainly shouldn't be mailing the Linux Kernel lists, and suggesting security methods...
    --
    Slashdot gets worse every day... Pipedot: News for nerds, without the corporate slant
  34. Re:misleading...Re:Asshole Stereotype by Jah-Wren+Ryel · · Score: 5, Insightful

    'incompetent people implementing security solutions are a real problem.'

    Man, things like this make me want to NOT switch to Linux... Even though I had a better experience with Ubuntu that I did Vista. What's your problem with that statement?
    It's absolutely true and it is not limited to linux.

    Let's take it a few more steps further as an example:

    'incompetent people designing bridges are a real problem.'

    'incompetent people performing surgery are a real problem.'

    'incompetent people running the government are a real problem.'
    Do you have a problem with any of those statements?

    If you don't even know what chroot() is, then you are not the target of the man's complaint.
    --
    When information is power, privacy is freedom.
  35. Re:misleading...Re:Asshole Stereotype by Anonymous Coward · · Score: 0

    You're doubly safe because Ubuntu does not by default have any open ports. This article is directed at administrators who run web servers that have processes that do things. Ubuntu Desktop does not do these things, so you're super safe, unless you download a virus and run it, a rare thing in the Linux world indeed.

  36. chroot, security and other uses by jmorris42 · · Score: 3, Informative

    > A process running as a regular user can break out too.

    Only if it can get access to a broken SUID program, etc. I always though the point of a chroot in a security context was that the chroot only had the absolute minimum environment the task being isolated had to have, thus there shouldn't be too much in there to worry about getting exploited. Which is very useful.

    Of course there are lots of uses for chroot that have nothing to do with security. Like keeping a whole 32bit environment seperate from the main 64bit install, wonderful tools like mock which allow keeping multiple distros on multiple arches installed and usable for building packages, etc.

    --
    Democrat delenda est
    1. Re:chroot, security and other uses by QuantumG · · Score: 1

      Only if it can get access to a broken SUID program, etc. Or kernel exploits.

      --
      How we know is more important than what we know.
    2. Re:chroot, security and other uses by Anonymous Coward · · Score: 0

      Then don't keep an exploitable kernel in your chroot! Oh, er..

    3. Re:chroot, security and other uses by Anonymous Coward · · Score: 0

      > Only if it can get access to a broken SUID program,

      Or, say, if any program outside the jail shares the same UID. Just attach with a debugger
      to that or you are effectively out.

      There are probably more ors.

  37. In theory yes by renegadesx · · Score: 1, Insightful

    I agree that you shouldn't be running something like an MTA at a root level but like the above said, not every daemon has an option of being run at a lower level.

    Sure its not good practice but if you need something working now you are not going to wait for the developers to change the code: especially if they have no intention on doing so.

    Developers of many high level process I think have relied on chroot as a crutch, its more than just "up to the administrator" its more so up to the dev's to give you the option of not having to run the process as root in the first place.

    --
    Make SELinux enforcing again!
  38. Then there's people on the other side of the fence by MeditationSensation · · Score: 1

    who don't even want to think about security. I've got a coworker who detests Ubuntu and swears he'll never use it because he doesn't want to use sudo all the time (i.e. the distribution doesn't have an administrator user by default apparently).

  39. chroot is awesome for... by Anonymous Coward · · Score: 0

    1. making a compact flash bootable.
    2. see 1.

  40. chroot neither is nor isn't a security tool by drfireman · · Score: 3, Insightful

    Any discussion that revolves around whether or not chroot "is a security tool" is just another one of those meaningless semantic merry-go-rounds, and will never accomplish anything. We know what chroot does, and we know what it doesn't do. Whether or not it's deemed to be an official card-carrying security tool, it's undeniable that there are cases where it's useful, and it's likely that there exist programs that (a) use chroot appropriately and (b) are less vulnerable as a result. I don't care if it's a security tool or not, I care if it provides functionality that will make my code do what I need, and one of my needs is security. I'll bet some very talented programmers also use the assignment operator ("=") in code that needs to be secure, and I'll bet it sometimes plays a role in the code's functionality, part of which is being secure. Is it a security tool? Who could possibly care?

  41. Possible solutions by SanityInAnarchy · · Score: 1

    There's not likely to be anything really simple, depending on what kind of functionality you're offering.

    You could do ssh access, without necessarily sftp (KDE's fish works with scp, I think), and deny them an actual login shell -- only allow sftp (or scp, or whatever). You could then block access to the rest of the filesystem with Unix file permissions or ACLs. Most things that they could access either aren't dangerous or are only visible to root (and maybe the file owner).

    It's not easy, but consider: There are actually a few places online that offer free shell access. That is, you can actually ssh in and get a commandline on a Linux box. I'm assuming they have decent protection.

    I believe FTP does encrypted authentication, and it may even be possible to run the entire session over SSL. I'm not sure how secure this is.

    Speaking of SSL, another possibility is WebDAV. Linux has a driver, I believe (probably FUSE), and there's probably client software for others. Basically, strip out any http urls and replace with https. Bonus over ssh is, your public key is signed by a source they probably already trust -- but if you don't want to pay for that service, you can always self-sign.

    Next on the list, and this is a big one: VPN. There are all kinds of ways to do this -- my favorite is OpenVPN. You can prevent client-to-client connections, and use any server-side firewall to deny them access to the rest of the network. The only trick is, you have to either guess a very unlikely-to-be-used private network (something like 10.0.1.0, maybe), or you would have to provide more than one instance of OpenVPN, on different private subnets. But it wouldn't be automatic -- they would have to select VPN A or VPN B.

    Either way, once you have that VPN connection, you can use pretty much any old insecure protocol. Straight FTP, Samba, NFS, or all of the above. All you need is plain old password authentication, or even IP-based authentication (NFS), given OpenVPN allows you to guarantee that a given IP is only owned by / routable to a given client (with a given key).

    And finally, you could always do some sort of secure system (GPG, encfs, TrueCrypt, etc) on top of an insecure system. Some lamer could always intercept your traffic and corrupt your files, but you'd know about it. However, this would force you to write software if you wanted to protect the system from abuse, and not just the data.

    --
    Don't thank God, thank a doctor!
  42. Re:misleading...Re:Asshole Stereotype by bfields · · Score: 5, Insightful

    Man, things like this make me want to NOT switch to Linux... Even though I had a better experience with Ubuntu that I did Vista.

    Go ahead. One of the (many) differences between Vista and Linux is that if you want to, you can march up to any of the core Linux kernel architects and tell them they have some fundamental long-standing unix interface totally wrong. The flip side of that is that they also won't stop anyone from flaming you if you do that.

    And that's exactly what happened here. This guy wasn't posting a question on a local LUG. He was posting to the Linux kernel mailing list--the place where people actually meet to do kernel development. And he wasn't asking a question, he was arguing with people like Al Viro, a primary architect of the Linux filesystem api's. Which would be great if he was correct. But in fact he was totally wrong. And even that would be OK if he took the time to do his homework and to listen carefully when people explained the issue to him.

    But he didn't really, so as a result he got a few flames. Some of the posters to lkml aren't polite in such a situation. I think that's kind of understandable, though actually agree that that's a problem. Are the core Vista kernel developers any better? Who knows? Does the general public doesn't have the option of participating in their development forums?

  43. Re:misleading...Re:Asshole Stereotype by VGPowerlord · · Score: 3, Funny

    "You think Windows is better, just because there isn't a public record of every chair Microsoft's heads throw at their employees?"

    Fixed that for you.

    --
    GLaDOS for President 2016! "Well here we are again. It's always such a pleasure." -- GLaDOS, 2011
  44. Citation by BobKagy · · Score: 5, Informative

    Actually, Bill Joy invented <tt>chroot</tt> as a hack to use a custom /usr/include directory in a compiler that didn't support alternate include paths.

    http://blogs.sun.com/chrisg/tags/chroot

    Dr. Marshall Kirk Mckusick, private communication: ``According to the SCCS logs, the chroot call was added by Bill Joy on March 18, 1982 approximately 1.5 years before 4.2BSD was released. That was well before we had ftp servers of any sort (ftp did not show up in the source tree until January 1983). My best guess as to its purpose was to allow Bill to chroot into the /4.2BSD build directory and build a system using only the files, include files, etc contained in that tree. That was the only use of chroot that I remember from the early days.''
  45. chroot + unprivileged is fine by Anonymous Coward · · Score: 0
    This thread is so ridiculous. On the one hand, I think Alan Cox is getting slightly misquoted, because the original thread (you RTFA'ed didn't you?) was mainly about whether the ability to chdir() out of a chroot was considered a bug or not. But, on the other hand, Alan was being so abrasively, unnecessarily rude in that thread ("... come back and admit your error", etc.), that he probably deserves to have his broad, sweeping statement nailed up on Slashdot for public derision.

    The truth of the matter, of course, is a) chroot is used as a security tool, whether misguidedly or not, b) superuser can break out of chroot, anyone who thinks otherwise is misguided or misinformed, c) when used in the sequence

    • bind to a privileged port
    • chroot
    • drop superuser privileges
    • interact with untrusted entities via protocol X (where X could be HTTP, DNS, whatever)
    the unprivileged chroot containment has proven to be quite useful and practical as a security tool. Short of administrator incompetence (e.g. leaving naughty device nodes laying around in the chroot area) or clearly-admitted kernel bugs (e.g. http://secunia.com/advisories/15339/ from our favorite OS vendor), I'm not sure that anyone has ever "cracked" this set of precautions.
    1. Re:chroot + unprivileged is fine by irc.goatse.cx+troll · · Score: 1

      * bind to a privileged port
              * chroot
              * drop superuser privileges
              * interact with untrusted entities via protocol X (where X could be HTTP, DNS, whatever) ..

              * regain superuser privileges (either via exploit in kernel, setuid app inside chroot, or some way of interacting with another root-owned process locally, or even just seteuid(0) if you're still in a process owned by root that just changed euid.)
              * get out of chroot

      --
      Pain lasts, kid. Its how you know you're alive. Sometimes I think this growing up thing is just pain management-TheMaxx
    2. Re:chroot + unprivileged is fine by marcosdumay · · Score: 1

      How does that system differ from one where you su the deamon for some user that owns no files?

      And, yes, one can break that set of precautions the same way one would break my precaution. And both were already done, and fixed, and done again...

      Chroot can be very usefull if your deamon can be buggy and corrupt something, but it simply can't protect against an intentional attack.

  46. Non-root. by SanityInAnarchy · · Score: 1

    I believe you still can't chroot out without being root.

    Thus, the only point of jail is if you are either running an app as root, or you are putting setuid binaries in the chroot (and you don't trust those setuid binaries to be secure).

    We also have selinux, which is a much better solution overall, if a bit overly complex. (For example, does jail prevent that root process from being able to grab privileged ports?)

    --
    Don't thank God, thank a doctor!
  47. Not to be rude... by Slashdot+Parent · · Score: 1

    Not to be rude, but I found a chroot'ed SSH HOWTO in 3 seconds by googling 'ssh chroot'.

    I'm not the type of person to actually come out and call someone an idiot, in so many words. So I'll just leave it at that.

    --
    They don't grade fathers, but if your daughter's a stripper, you fucked up. --Chris Rock
    1. Re:Not to be rude... by ChadAmberg · · Score: 2, Insightful

      All you need to do now is go back three to four years and see if the search results come up with anything then.

    2. Re:Not to be rude... by Slashdot+Parent · · Score: 1

      All you need to do now is go back three to four years Well, you never said it was 3 or 4 years ago. You said a while ago.

      Also, you have to admit, one of your solutions was a bit self-contradictory. FTP, but with secure login. I mean, really, what's the point? If I can sniff your traffic, I can impersonate your machine. I don't need your password when I can take over your in-progress session.

      This is why you probably will never see an FTP program that only secures the login process (that, and the fact that secure logins are not part of the FTP protocol).

      SSH/scp/sftp secure the whole session. If you're going to bother with any security, why not just do it right? By way of analogy, FTP with secure login is about as secure as installing a high-security door with reinforced door jambs and 5 high security deadbolts as your front door, but leaving the ground floor window right next to it wide open. This is not a common way to do security.
      --
      They don't grade fathers, but if your daughter's a stripper, you fucked up. --Chris Rock
  48. the whole point.. by Anonymous Coward · · Score: 0

    of using chroot is/was to isolate compromised processes. It would be pretty pointless to chroot a process that you knew for a fact could never run as root; you could just use ordinary permissions for such a process. You only do it if you fear an attacker could compromise the process and somehow obtain root privileges. If chroot were foolproof, such an attack would be emasculated. If root privileges allow a process to escape the chroot, then it is ineffective. Pretty simple.

    1. Re:the whole point.. by Anonymous Coward · · Score: 0

      [the whole point...] of using chroot is/was to isolate compromised processes. It would be pretty pointless to chroot a process that you knew for a fact could never run as root; you could just use ordinary permissions for such a process

      Perhaps you've never heard of Defense in Depth? "Ordinary permissions" are fine and good, but trapping a potentially-compromised-but-unprivileged process within a particular part of your filesystem hierarchy, with no ability to see any of the rest of the hierarchy, is an extra, desirable level of security. Not to mention, there are some things that are required to be visible on any given Unix/Linux system (e.g. /etc/passwd), but which you wouldn't necessarily want untrusted eyes to see, since it gets them incrementally closer to a compromise. Chroot allows you to "hide" all of that stuff, even in the event that a process gets compromised. Multiple layers of security is a Good Thing.
  49. and the question is: by Anonymous Coward · · Score: 0

    why?

    1. Re:and the question is: by Anonymous Coward · · Score: 0

      why?

      So he can salvage a shred of all that enormously precious dignity
      he lost by posting while off his meds.

  50. For the love of Freshmeat... by msimm · · Score: 1

    I've wondered about this myself, but ages ago. Since then I've found that in my particular situation it's not needed (VPN/SSH/WEBDAV). But a quick check on Freshmeat shows at least 2 possibilities: scponly, rssh.

    I get that using a wrapper program like either of these is kind of cockeyed, but SFTP *is* the most commonly supported secure transfer protocol (webdav/ssh, but not nearly as drop-in for Dreamweaver users, etc).

    Anyway, I think it's safe to say the *nix community is now big enough that most itches have at least been attempted to scratch. And FTR, there are assholes in every community, sounds like you just had a spot of bad luck.

    --
    Quack, quack.
  51. Thoughts on Jailkit by Free_Trial_Thinking · · Score: 1

    Does Jailkit eliminate all of these problems of chroot?

    1. Re:Thoughts on Jailkit by Free_Trial_Thinking · · Score: 1

      Does anyone have an answer. I'd rather know than not know.

  52. The correct word would have been ignorant by lena_10326 · · Score: 2, Insightful

    Not incompetent. You can't blame admins who haven't been instructed properly, but you can certainly blame kernel developers who haven't clearly communicated what their tools are to be used for. Adrian ought to spend his time educating not insulting.

    I'm rather weary of the "I have a bigger pen^H^H^H brain than you do" bullshit that goes on in IT.

    --
    Camping on quad since 1996.
    1. Re:The correct word would have been ignorant by RegularFry · · Score: 1

      The correct word would have been ignorant

      Ignorance leads to incompetence. I don't view incompetence as an insult here - it's a simple statement of fact. Security is one of those fields where almost everyone is incompetent, but most don't know it yet. It *is* that hard.

      You can't blame admins who haven't been instructed properly, but you can certainly blame kernel developers who haven't clearly communicated what their tools are to be used for.

      It's not the kernel devs' job to explain the POSIX spec. It is the downstream admins' job to check the spec of the system they're administrating.

      I'm rather weary of the "I have a bigger pen^H^H^H brain than you do" bullshit that goes on in IT.

      In this case, Alan does have a bigger pen than most of us.
      --
      Reality is the ultimate Rorschach.
    2. Re:The correct word would have been ignorant by lena_10326 · · Score: 1

      It's not the kernel devs' job to explain the POSIX spec. It is the downstream admins' job to check the spec of the system they're administrating.
      Oh yes... every admin reads a spec for developers. By the way, chroot is not POSIX.

      opengroup.org

      The following features, marked legacy or obsolescent in the base documents, are not carried forward into IEEE Std 1003.1-2001. Other features from the base documents marked legacy or obsolescent are carried forward unless otherwise noted.

      From XSH5, the following legacy interfaces, headers, and external variables are not carried forward:

      advance(), brk(), chroot(), compile(), cuserid(), gamma(), getdtablesize(), getpagesize(), getpass(), getw(), putw(), re_comp(), re_exec(), regcmp(), regex(), sbrk(), sigstack(), step(), ttyslot(), valloc(), wait3(), <re_comp.h>, <regexp.h>, <varargs.h>, loc1, __loc1, loc2, locs
      --

      Root Directory

      This definition permits the operation of chroot(), even though that function is not in POSIX.1; see also File Hierarchy.
      I bothered to check.

      --
      Camping on quad since 1996.
  53. There are four options: by Ayanami+Rei · · Score: 1

    You can do application isolation in one of four ways. The lighter-weight of the three require installing kernel patches and/or additional management tools but are not particularly invasive.

    Linux VServer is the closest to FreeBSD jails; it uses a few kernel patches to add isolation contexts to processes and views of network interfaces. Unlike jail(8) you need to start a new init(8) in each context. But like jail all processes share the original scheduler and VM, and use the host system's filesystem natively, only chroot'd.

    Another more comprehensive solution is OpenVZ. This is OS-level virtualization that is similar to Solaris Zones. It requires more extensive kernel patches and provisioning tools. It is designed primarily for dedicated server hosting scenarios.

    Then there is UML (User Mode Linux). This is linux on linux emulation that runs a special version of the kernel as a userspace process. You give the UML guest a file which behaves like a hard disk from the perspective of that guest, or you can choose to use a special filesystem driver that uses a "real" directory up on the host. This is close to VMWare or Xen-like solutions except it can't run an unmodified OS, only one given a special UML kernel which doesn't really have hardware drivers -- it shunts the actual work in syscalls up to the host OS.

    Finally there is KVM, which is included in the Linux kernel as of recently without patches. This is a lightweight hardware-assisted virtualization solution in the style of Xen that can run unmodified guest operating systems.

    I hope this helps.

    --
    THIS THING CAN TURN ON A DIME, MACROSSZERO STYLE ALSO FUCK BETA, ~NYORON
    1. Re:There are four options: by Anonymous Coward · · Score: 0

      Then there is UML (User Mode Linux). This is linux on linux emulation that runs a special version of the kernel as a userspace process. You give the UML guest a file which behaves like a hard disk from the perspective of that guest, or you can choose to use a special filesystem driver that uses a "real" directory up on the host. This is close to VMWare or Xen-like solutions except it can't run an unmodified OS, only one given a special UML kernel which doesn't really have hardware drivers -- it shunts the actual work in syscalls up to the host OS.

      I looked into using UML as a way to isolate untrusted processes. I found that it wasn't actually much use. The problem is that if you can become root inside the UML system, you can become the user that the UML kernel is running as on the host system. (UML is not designed to prevent this - indeed if kernel module loading is enabled, it cannot be prevented.) So UML doesn't actually give you any more security than just running the untrusted process as a restricted user on the host system. Like chroot, UML is not really designed to be secure.

  54. *cough* by msimm · · Score: 2, Informative

    Of course now that I'd done the simple search I find it coincidentally, everywhere.

    --
    Quack, quack.
  55. Here's what you need: by montjoy0 · · Score: 1
    Here's what you need, scponly. No need to recompile openssh or anything, just compile scponly, copy a few libs to your user's dir, change the user's shell to scponly and you're done. It even works with Solaris 9's version of openssh. I've used it a bit and I'm happy with it.

    As to the discussion - nerds generally have low self-esteem and poor social skills. It's makes them friggin' fabulous to communicate with. :/ Good luck. I suspect you've already solved the problem above anyway.

    1. Re:Here's what you need: by TheRaven64 · · Score: 1
      I looked at using scponly a while back. If all you want is to provide file transfer access, then you can just set sftp-server as the user's shell. The commercial SSH implementation from HP provides an ssh-dummy-shell, which accepts a -c argument. This is how sftp-server is usually launched; by telling the remote user's login shell to run it. The dummy shell only allows the sftp-server (sftp-shell in their version) command to be launched. I reimplemented this, with a symbolic link in /etc indicating the default shell to be used (sftp-server) and a .conf file containing a list of other commands that may be launched. I use it for some limited accounts on one of my systems to allow people to change their passwords (passwd is in the .conf file) and upload files to their public_html folder, but nothing else.

      I offered it to the OpenSSH devs, but they couldn't see a use-case for it. If anyone wants a copy, I can put it online somewhere.

      --
      I am TheRaven on Soylent News
  56. Re:misleading...Re:Asshole Stereotype by Nazlfrag · · Score: 1

    I don't think you were in fact at the receiving end of his scorn. chroot is only something you would worry about on a large scale multiuser system, so it was directed to those whose job in part is to secure large systems. It's one of those things with kernel developers chatting on open mailing lists, it's easy to be taken out of context. In this regard, chroot has no problems - to break out you need superuser access, and by then it's too late. Simply put, it's something you would never have to worry about.

  57. When not to use chroot by c0d3h4x0r · · Score: 4, Funny

    When Not to Use chroot 1. While trying to get a date.
    2. While operating a motor vehicle.
    3. While dining at an expensive restaurant.
    4. While dancing.
    5. While urinating.
    6. While defending yourself against a murder charge.
    7. While picking fleas off a gorilla's back.
    8. While seasoning a fine hamburger patty.
    9. While being arrested.
    10. While having sex.
    --
    Moderator hint: a comment is neither "Flamebait" nor "Troll" if it is true.
    1. Re:When not to use chroot by Anonymous Coward · · Score: 0
      While I can agree with 1-9, according to the man page:

      chroot - run command or interactive shell with special root directory I'd say #10 depends on the girl.
    2. Re:When not to use chroot by just_another_sean · · Score: 1

      * Warning: Pregnant women, the elderly and children under 10 should avoid prolonged exposure to chroot.
      * Caution: chroot may suddenly accelerate to dangerous speeds.
      * chroot Contains a liquid core, which, if exposed due to rupture, should not be touched, inhaled, or looked at.
      * Do not use chroot on concrete.

      Discontinue use of chroot if any of the following occurs:

              * Itching
              * Vertigo
              * Dizziness
              * Tingling in extremities
              * Loss of balance or coordination
              * Slurred speech
              * Temporary blindness
              * Profuse sweating
              * Heart palpitations

      If chroot begins to smoke, get away immediately. Seek shelter and cover head.

      chroot may stick to certain types of skin.

      When not in use, chroot should be returned to its special container and kept under refrigeration...

      Failure to do so relieves the makers of chroot, Wacky Products Incorporated, and its parent company Global Chemical Unlimited, of any and all liability.

      Ingredients of chroot include an unknown glowing substance which fell to Earth, presumably from outer space.

      chroot has been shipped to our troops in Saudi Arabia and is also being dropped by our warplanes on Iraq.

      Do not taunt chroot.

      chroot comes with a lifetime guarantee.

      chroot

      ACCEPT NO SUBSTITUTES!

      Phil Hartman (September 24, 1948 - May 28, 1998), may he rest in peace...

      --
      Creationist Textbook Stickers Declared Unconstitutional by CowboyNeal
    3. Re:When not to use chroot by Tetsujin · · Score: 1

      When Not to Use chroot
      10. While having sex. I dunno, man... this one time I chrooted this girl without changing my working directory - it was wild.
      --
      Bow-ties are cool.
  58. Re:misleading...Re:Asshole Stereotype by tnk1 · · Score: 0, Redundant

    Heck, I don't even know what chroot is, which must make me dried dog piss on a hot fire hydrant in this guy's eyes.


    On the other hand, you aren't trying to post a fix to a part of the OS that relies on knowledge you don't appear to have.

    My guess is that its okay to be ignorant of the internals of the OS and system commands, just as long as you don't go trying to tell other people how they are supposed to work. I think that's probably fair.

  59. Read the words of the security master by Anonymous Coward · · Score: 0
  60. Re:misleading...Re:Asshole Stereotype by heinousjay · · Score: 1

    If the best you can come up with is "but they probably do it too" then you really ought to either think harder or give up on the reply. Just friendly advice, take it as you wish.

    --
    Slashdot - where whining about luck is the new way to make the world you want.
  61. sticky bits and inodes by Michael+Wardle · · Score: 1

    To clarify, the thing that's unique about /tmp is the last step of your trick. You can't delete the file in /tmp after creating it, because only the owner of a file can delete a file in /tmp. More information

    The owner is set to root since the owner and permissions are determined by the underlying entry in the file system called an inode. In your example, /tmp/bash and /bin/bash are just file names that point to the same inode. This means the new link, /tmp/bash, gets the same permissions as the original link, /bin/bash, and changing the permissions on one changes the permissions on both. More information

  62. chrootexec by RAMMS+EIN · · Score: 1

    It is my understanding that chroot _can_ be an effective security tool. It just has its limitations. One such limitation is that processes run as root can break out of the "chroot jail" (why is this, by the way?). Another limitation is that you have to be root to use chroot (and why is this?).

    I wrote a little program called chrootexec which allows you to run commands in chroot jails as a normal user, circumventing both these limitations. To do this, it must have the capability to do chroot, setuid to the real user id, and setgid to the real user id; this can be accomplished by installing it suid root.

    --
    Please correct me if I got my facts wrong.
    1. Re:chrootexec by Slashcrap · · Score: 1

      Another limitation is that you have to be root to use chroot (and why is this?).

      Apparently you also need to be root to run fdisk and mkfs. I can't imagine why this is. Only a malicious person could do any damage with those commands and I don't give user accounts to malicious people.

    2. Re:chrootexec by RAMMS+EIN · · Score: 1

      ``Apparently you also need to be root to run fdisk and mkfs.''

      Err, no? Not on my system...

      --
      Please correct me if I got my facts wrong.
    3. Re:chrootexec by Anonymous Coward · · Score: 0

      There is a reason why chroot is limited to root only. See comment #20776605. Your program allows any user to become root using that trick.

  63. incompetent people running the government are a re by Chrisq · · Score: 1

    incompetent people running the government are a real problem

    I thought it was called democracy.

  64. chroot is like a window lock. by rdebath · · Score: 2, Insightful

    A window lock will never keep out a thief. But it will make them go elsewhere, or decide it's not worth it.
    If you're root you have a master key, so the lock has no meaning. But if you've not got your key yet it makes your attack a lot more obvious.
    Without the lock the thief can make a tiny hole in the window and flip open the latch; once they're in they close the window and nobody can see the difference. With the lock the thief has no option but to smash the window, leaving lots of evidence that something is wrong. Likewise a computer attacker has to make themselves a lot more obvious if they want to get out of a chroot. They also have to know if another process will respond badly to a signal or if there's some IPC they can interfere with or a process they can attach with ptrace() or a local root exploit. They might have to wait around for the oppotunity to get to root or out of the chroot while all the time the logs build up.
    So a chroot will discourage an attacker, just like window locks discourage a thief but they are not a security device because they don't actually add security they just strengthen the existing security a little ... and every little helps!

  65. Understanding must be complete (RAID and locks) by Sits · · Score: 1

    Disclaimer: I happen to know Alan and he's a bright chap. You shouldn't blindly believe everything bright people tell you but that doesn't mean they're always talking rubbish either.

    I'm going to just chime in and say RAID (as most people use the phrase) is not a backup. Again - RAID (as most people use the phrase) is NOT a backup. As you suggested RAID (I assuming you are discounting "RAID0" as I don't think it helps your argument) helps safety - but only a particular type of safety. If you delete a file on most RAID systems the file is "deleted" from all the disks. The RAID did what you told it - it only distributed the data you told it to keep but sometimes mistakes happen and we would like to recover from them with minimal cost. Many people are told about RAID and conclude that it solves all possible data issues but it isn't that simple.

    Additionally I have first hand experience of seeing hardware RAID5 fail due to a failing disk. It really does happen but at the moment it doesn't happen often and I was able to go back to backups. All I can say is - it is important to understand the scope and limitations of whatever system you are putting in place. A lack understanding on a given topic can really come back and hurt you. My understanding must be complete if I always want the correct answer and in those cases where it is not, just because I believe something to be true it need not be true (or even possible).

    Finally I've been told that many locks you get today can be picked by a good lockpicker with decent tools in a relatively low amount of time. Further if someone REALLY wants to break into your house maybe they won't try and break the lock on the door but they will instead just smash a window round the back. I think there's a phrase "Locks only keep honest people honest" - they are only there to stop people casually getting into your house, not keep out the determined.

  66. It should be *easier* to escape chroot by renoX · · Score: 1

    chroot is very useful when you're running software version N and you want to change into version N+1: you install the N+1 version on a partition and you use chroot so that the N+1 version believes it is alone.

    The issue is for migration: when you want to migrate some data from N to N+1, it is useful in the N+1 version to escape the chroot to access the N version and chroot makes it too difficult currently, I'd like to have a 'mount -chroot /mount_point' this way by default the N+1 version doesn't see the chroot and the migration scripts can work without problem.

    1. Re:It should be *easier* to escape chroot by Anonymous Coward · · Score: 0
      Shouldn't it be possible to just re-mount the original root in a subdirectory before doing chroot? That is:

      mkdir newroot/originalroot
      mount -t yourfs /dev/yourrootpartition newroot/originalroot
      chroot newroot
    2. Re:It should be *easier* to escape chroot by renoX · · Score: 1

      The issue of this scheme is that it requires the original software version to know which data is needed by the new SW version.
      It always happen that developers of the original SW version underestimate the need of the new SW version..

    3. Re:It should be *easier* to escape chroot by demon · · Score: 1

      Well, at least on Linux, there's always bind mounts (mount -o bind /directory /target_directory)...

      --

      Sam: "That was needlessly cryptic."
      Max: "I'd be peeing my pants if I wore any!"
    4. Re:It should be *easier* to escape chroot by renoX · · Score: 1

      I don't see how a bind mount allow to escape from the chroot, could you elaborate?

  67. Re:misleading...Re:Asshole Stereotype by pimpimpim · · Score: 1

    Hmmm, make that 'incompetent people maintaining bridges are a real problem'.

    --
    molmod.com - computing tips from a molecular modeling
  68. Don't understand something from the article by bakreule · · Score: 1

    The superuser can escape from a chroot jail by doing "mkdir foo; chroot foo; cd .."

    It could be because I went out drinking last night, but I don't really understand how that line of code would break out of a chroot.... Can anyone shed some light into my gin-induced fog?

    --

    Buses stop at a bus station
    Trains stop at a train station
    On my desk there's a workstation....

    1. Re:Don't understand something from the article by crimsun · · Score: 1
  69. Production environment? by weierstrass · · Score: 1

    It's nice to hear that you're putting into practice security policies based on information you're getting from Wikipedia.

    --
    my password really is 'stinkypants'
  70. Wrong and Wrong again (mod parent wrong) by IBitOBear · · Score: 1

    You are "more right" than him, but you are wrong.

    "ln /dir1/file1 /dir2/file2" _doesn't_ create any kind of inode at all. It causes the system go to "/dir1/" and find the inode number in the directory entry that contains the text "file1" and then uses that number to create an entry in the relevant directory (/dir2/) that contains the new name "file2" and the previously mentioned inode number (and it "coincidentally" increases the reference count in the inode so the file system knows that the inode previously referenced by the name /dir1/file1 now has two names. NOTE that the inode doesn't know it's "name" or "names" which is why, if you trash your file system and then do an integrity check, the system will reattach lost inodes in lost+found (in ext2/3/4 and similar file systems) and only give them a number (the inode's actual number) as the "file name".

    It would be _DISASTEROUS_ to create a second inode who's data pointers pointed to the same data blocks as another inode. Among other things, you could _never_ know when a particular data block was finially deleted. Another problem is that the two inodes could end up owned by different accounts and possess contradictory times, permissions, and sizes. Dang disastrous.

    BUT... if you "ln -s /dir1/file1 /dir2/file2" you are making a symbolic link. In _this_ case you make a new inode which references (typically) one single data block that contains the string "/dir1/file1" and the number of that new inode is put in a directory slot within /dir2/ tagged by the string "file2" so when the os comes by, and you open/cd/whatever that file /dir2/file2, the request becomes a name lookup of text "/dir1/file1". This leads to the various symlink shenanigans, particularly with chroot and friends.

    STILL, a _hard_ link (the first example) just adds a name and number pair to a directory that is a _hard_ alias to the original file, and the _soft_ link is a reference by name.

    Consider:

    echo "First Name" > file1
    ln file1 file2
    ln -s file1 file3
    rm file1
    echo "Second Name" > file1

    "cat file1" produces "Second Name"
    "cat file2" produces "First Name"
    "cat file3" produces "Second Name"

    When you understand why, and you understand that the above exercise has involved 3 inodes (four if you count the current directory), but that the third (fourth if you count the current directory) inode doesn't come into use/existence until the second echo.... then and only then grasshopper should you again correct someone's understanding of inodes in a public forum.

    8-)

    ASIDE: words like "create" and "come into existence" are used here in the vernacular, for simplicity. In fact, for most current file systems, the inodes are created when the file system is created on the disk, and are allocated from and returned to the free inode pool(s) as opposed to being "created" or "destroyed" but that is a separate conversation...

    --
    Innocent people shouldn't be forced to pay for inferior software development.
    --"Code Complete" Microsoft Press
  71. FTP over SSL... by Anonymous Coward · · Score: 0

    Use FTP over SSL, not the same as SFTP, it usese plain old FTP over an SSL connection (same way HTTPS is HTTP over an SSL connection). I can think of a bunch of different reasons why you would want to do that. We do it because we have users who need to transfer moderately sensitive data, they're trusted not to be malicious but also trusted to get confused by weird sounding directory names like 'usr' and 'etc' and 'bin'.

    If you don't want to use SSL, you could use FTP over an SSH tunnel, which would probably be a little trickier to implement (don't know of any FTP clients off the top of my head which can do this).

    Man, if I'd seen that forum post I'd of ripped those guys apart - but that's because I'm a prick, just like them.

  72. Re:Then there's people on the other side of the fe by Anonymous Coward · · Score: 0

    Like Penn would phrase it: "And then there's this asshole..."

  73. Re:misleading...Re:Asshole Stereotype by Jessta · · Score: 1

    umm...yeah, it's much better to do what they do in the Windows world, were they ignore the fact that users are doing the wrong thing and instead of pointing that out and teaching them developers make hacks to work around the users incompetence. eg. personal firewalls, anti-virus, anti-malware, preventing administrators from deleting specific files that the system thinks shouldn't be modified.

    --
    ...and that is all I have to say about that.
    http://jessta.id.au
  74. Smoking cheroots is bad for you. by Anonymous Coward · · Score: 0

    I wouldn't ever do it -- while using Linux or Windows or OS/9 or even Multics, for that matter.

  75. Present in AT&T Unix prior to BSD by cbunix23 · · Score: 1, Interesting

    Actually Bill Joy got it from AT&T.

    My November 1979 edition of the CB/UNIX 2.3 manual pages has a chroot(1) and chroot(2) man page. It probably was not a CB add on and instead came from AT&T.

    Here's the entire desccription of chroot(2)

    NAME
            chroot - change root directory

    SYNOPSIS
            chroot (rootname)

    DESCRIPTION
            Rootname is the address of the pathname of a directoyr, terminated by a null byte. Chroot
            causes this directory to become the process root directory. This smeans that any references to
            filename beginning with slash are not relative to the real root of the UNIX file system, but
            relative to the new root directory specified in this system call. The current working directory
            remains unchanged. Notice, however, that a chdir to slash ("/") following the chroot system
            call wiill change the working directory to the new root directory. Arguments to chroot are always
            absolute: no special meaning is given to initial slashes even if a chroot is currently in effect.

            This system call is restricted to the super-user.

    SEE ALSO
            chroot(1)

    DIAGNOSTICS
            The error bit (c-bit) is set if the given name is not that of a directory or that is not searchable
            (executable) or the current user is not the super user. From C, a -1 returned value indicates an
            error, 0 indicates success

    ASSEMBLER
            (chroot = 61)
            sys chroot; dirname

    ====

    One of the things we used to chroot for was in support of buildiing many releases of our products, chroot pointed the compiler to the right set of files.

  76. Re:misleading...Re:Asshole Stereotype by Anonymous Coward · · Score: 0

    Because you read a comment and automatically thought is was about YOU YOU YOU ...duck and cover

  77. Re:Not suprising, Linux avoid pathname-based secur by Anonymous Coward · · Score: 0

    And apparmour is being included by default in ubuntu, which speaks volumes about the knowledge of their security team.

  78. Re:Then there's people on the other side of the fe by Anonymous Coward · · Score: 0

    sudo is a pain and has itself seen it's fair share of security holes. Unknowledgeable users being discouraged from logging in as (or su to) root is a good thing but the "all shalt disable root logins and use sudo" mindset is silly. You can't say that someone who doesn't care for sudo doesn't care about security. I know every SUID/SGID executable on my servers and sudo isn't one of them!

  79. securing chroots via setuid (with only 1 "e") by Rozzin · · Score: 1

    If you execute chroot() and then a seteuid(uid) where uid>0, then you prevent a hole/bug in your program from being exploited in a way that will allow file access/execution outside the chroot. That *is* a security advantage.

    According to the page about breaking out of chroot linked from the discussion, the seteuid() is not effective because the process still has a real UID of 0 and can call seteuid(0) at any time.

    So don't use seteuid--use setuid (without the "e"); this is what the article that you just cited indicates:

    If this [setuid to non-root] is done there should be no way to gain root privilages unless an attacker uses something within the chroot() jail to gain those privilages.

    --
    -rozzin.
  80. Re:misleading...Re:Asshole Stereotype by pak9rabid · · Score: 1

    I see where he's coming from. A lot of non-Linux users see Linux users as egotistical elitists who view the technical "normies" out there as incompetence, and I don't blame them. A good chunk of Linux users act as if they're god's gift to IT. The last place I worked at was full of people like this, and let me tell you how excited they made non-Linux users out there about trying out Linux. You can be a knowledgeable Linux user without being a douche about it....I am.

  81. Re:misleading...Re:Asshole Stereotype by NotALamer · · Score: 1

    After reading that thread it sounds like at least half of the 'kernel hackers' are self-absorbed jerks that are incapable of communicating with other human beings except to say, 'I'm better than you.' It definitely turns me off to contributing code to the kernel, I guess I'll have to find a friendlier open source project to work on. Shouldn't we encourage people to contribute to the community instead of showing them what huge idiots they are and telling them to crawl back into whatever hole they came from because we are perfectly capable of writing an operating system without them?

    'Go try them, then come back and admit your error,' congratulations Alan Cox, you're an asshole!

    As for the parent, the post you responded to is right. Not everyone can be a genius, and calling someone incompetent because it makes him feel better about the fact that no one likes him in real life isn't particularly constructive behavior. Who cares if the comment was directed at that guy or not, it's still a stupid thing to say. All he's doing is provoking people so he can 'burn' them even more. Welcome to Flaming 101.

  82. Re:chroot, security vs. BUFFER OVERFLOW Priv Esc by Anonymous Coward · · Score: 0

    What about buffer overflow privelege escalations? If an app is vulnerable to this, can't it (or rather, the code it can then use/run) potentially escalate the user entity it runs under/as, is it not possible to 'break out' of a chroot jail??

  83. Re:Then there's people on the other side of the fe by Anonymous Coward · · Score: 0

    sudo adduser --uid 0 --gid 0 myveryownroot

    Problem solved for your coworker.

  84. Re:Then there's people on the other side of the fe by Hatta · · Score: 1

    Of course Ubuntu has a root user. There's just no valid password for it. So you can't log in or su to root. You can 'sudo su' and get a root shell. It's really no different. Sure you have to type 4 more characters, but you have to remember one less password. Big deal.

    --
    Give me Classic Slashdot or give me death!
  85. Re:Then there's people on the other side of the fe by Anonymous Coward · · Score: 0

    If you read the ubuntu specific docs, it would tell you to enable the root account by running sudo passwd root.

  86. Re:misleading...Re:Asshole Stereotype by Panaflex · · Score: 1

    Are the core Vista kernel developers any better? No, Microsoft takes EVERY stupid idea VERY seriously! From my experience writing windows kernel drivers - I can say with a straight face that each and every one of those idiot ideas has been implemented directly into the NT kernel.
    --
    I said no... but I missed and it came out yes.
  87. So... the same people? by Anonymous Coward · · Score: 0

    So are the same idiots claiming chroot is security the same people who have been puling for decades that Microsoft's security was supposedly "broken" for now emulating teh Lunix's chroot-based "security model"?

  88. there's no difference by nomadic · · Score: 1

    One of the (many) differences between Vista and Linux is that if you want to, you can march up to any of the core Linux kernel architects and tell them they have some fundamental long-standing unix interface totally wrong.

    You can do that to the Vista kernel architect, too. In either case they're not going to do anything about it.

  89. Secure by design. by steeviant · · Score: 1

    So true, chroot was never designed for security, neither was the internet.

    Lets stop using them both.

  90. Re:misleading...Re:Asshole Stereotype by Kidbro · · Score: 1

    In this case, a technical "normie" is incompetent.

    The word incompetent is not necessarily an insult. You can call me an incompetent surgeon, bridge designer, president or security solution designer, and I won't take offence.
    It is simply an (accurate) description of my lack of competence in these areas.

  91. Re:misleading...Re:Asshole Stereotype by andreyw · · Score: 1

    Feh, not everyone gets to be a rocket scientist. Does that mean that rocket scientists should listen to every burger flipper that wants to "contribute to rocket science?".

    Not everyone CAN contribute to "the community" that is the linux kernel. This is a bit different level of software engineering that your typical program. I realize you were probably brought up by the feel-good "everyone can reach for the stars" american educational system, but that's not how the world works. Do you seriously think you can contribute to a project JUST BECAUSE YOU THINK SO? No. You can't. Either because it's not your specialization, or because you don't have the talent or inherited traits for it. I thought it was obvious. You think you can play at the same level of the NHL or NBA just because you think you can or want to? Don't kid yourself.

    And additionally, the person complaining about chroot had an attitude. He was put back into place.

    Here is another POV - the person thought he had the shots to go and bother busy individuals who are experts in their field, complaining to them about THEM misunderstanding something. This is equivalent to some country rube bitching to rocket scientist about the space ship looking not the way he imagined... Why should your voice be heard? Why should anyone care? Why should Alan Cox care? Respect is earned, and guy with the rant to Alan Cox didn't earn it by behaviour, nor by having done something of value...

  92. Depends on the context by Tarlus · · Score: 1

    Take advantage of the chroot ability in vsftpd and try to break out of that one using an FTP client. It must be impossible. Which is good, because I'd hate to have users inadvertently find their way into other system directories (even if they do lack write privileges).

    --
    /* No Comment */
  93. Security through depth by Black+Copter+Control · · Score: 1
    The purpose of security is not to prevent an intrusion. It is to make an intrusion difficult and dangerous enough that an expected attacker will prefer to find a 'softer' target.

    A good example of that is presidential security.... How many millions (billions?) of dollars have gone into presidential security, yet attackers with minimum resources were still able to get through to Ronald Regan and Jimmy Carter.

    That it's enough deterrent to deter most sane attackers is proven by the fact that nobody has had serious success in attacking George Bush Jr.
    ____

    Chroot certainly doesn't, inherently, hurt security (except to the extent to which it gives some users a false sense of security). It does, however, provide an extra barrier to hackers who might trick (for example) FTP into doing something stupid -- they then need to do even more work to do damage outside of the processes' chroot jail.

    It may not be foolproof, but it can provide enough of a barrier to cause an attacker to go find an easier target (which is, again, the real purpose of security).

    Using chroot to contain root users, on the other hand is like having a maximum security prison with really secure doors -- remotely controlled with intelligent cameras, etc.... and an emergency key under every mat. As was mentioned by Cox: there are just so many holes in tha model that it's better to educate users about the impropriety than to try and fix what is an inherently broken process.

    --
    OS Software is like love: The best way to make it grow is to give it away.
  94. chroot, in this case, is exactly what you want. by Medievalist · · Score: 1

    Do this Google search and see if it's any help.

    You'll need a privilege-separated sshd (such as OpenSSH versions 3+) because chrooting daemons that run with high levels of access provides little or no security (which, I suspect, is the point Alan was making, but in grand /. tradition I haven't read his posts yet). You'll then need to patch the SFTP subsystem to provide the chroot function and rebuild it.

    With a privsep'd sshd, a process with the uid/gid of the authenticated user will be spawned once authentication completes. Obviously, during authentication elevated access is required (though not necessarily root superuser) so that authentication data (LDAP, passwd file, shadow suite, NIS, whatever floats your boat) can be accessed for validating the password, but the communication stream from the user can be handed off to a less privileged process before anything other than user/password is processed. SSH isn't like telnet, you have to authenticate before you can get a real interactive session.

    I'm not going to pretend this isn't hard. You should consider yourself pretty competent if you can whip up a chrooted sftp in less than a few hours. If you can do that and you also understand all the security implications without having to extensively study the mechanisms of SSH authentication, your chosen OS's chroot() implementation, and your specific application and user needs, you are a veteran security expert. If your system can be used in ways that would cause someone to be jailed or killed, you should have a veteran security expert on your staff.

    The first major distribution to ship a chrootable SFTP with a priv-sep sshd will gain quite a bit of marketshare from HIPAA, SOX, and FDA regulated industries. There are costs associated with having to maintain your own packages outside distribution channels that corporations and hospitals would like to avoid.

    Eh, lunch break's over. Good luck!

  95. I'm going to try my best to explain by arete · · Score: 1

    I'm going to try my best to explain; please forgive whichever parts are redundant for you.

    --- SFTP
    As I'm pretty sure you know, there already is a protocol - SFTP - that connects via the SSH daemon on most any Linux box, and provides secure, FTP-like file transfers supported by most (but not all) FTP clients. Plus it doesn't have all the multi-port trouble with firewalls that FTP sometimes does.

    Overall, I think SFTP DOES what you're mainly looking for, and I'll explain a bit more below.

    --- Userbases
    It's not impossible, but is annoying, to have one Linux OS image super-securely managing two different SETS of users who have totally different profiles of what they're allowed to do and what files are relevant to them. For example, if you have a mailserver and a webserver with totally different userbases, you really want two Virtual Private Servers and therefore two different root accounts so even a root escalation on one server won't compromise the stuff on the other. Of course, this is not necessarily relevant if you're mostly giving webspace and mail to the same set of users.

    --- fake security is really bad
    What you really, REALLY don't want is what chroot generally provides - a facility where the admin FEELS like it's safe but really it's not.

    --- Real User Accounts

    ssh as a nonroot user into a server, then type:
    ps -elf | grep ssh

    You'll note that you connected to an ssh daemon which then, immediately, downgraded part of itself to run as your non-root user. This is really important - after the initial, hopefully minimal connection, everything you do is as your user. So it's totally constrained by all the things in the OS that constrain that user.

    This is superior because:
    You can only do the same stuff your user SHOULD be able to do.
    No bug in the main part of ssh can let you perform an action with higher/wrong permissions than that - because it can't give you MORE permission than it has itself.
    No bug in the child part of ssh can let you escalate privileges up to root, because IT can't do that.
    No administrator has to know a "special way" to disable a user - if the user's account is disabled OR they don't have access to a file, they can't get to it.

    I think there are other reasons along these lines, but I'll conclude this section with saying "real user accounts are usually A Good Thing (tm)"

    --- Setting up chroot isn't much easier than setting up a VPS
    If you take to heart the user account thing, then you don't want a "fake" jail that only works for the FTP-like access; you want a jail that jails the whole FTP-like PROCESS, too, in case there turns out to be an exploit in it.

    However, you then need to personally make sure the jailed FTP-like process also has access to anything it might need. Like "ls", and who knows what else.

    The general case of this is to setup an entire virtual linux installation for them inside chroot and then rip out what functionality you don't want them to have, which is a lot of work.

    Because of how chroot is designed, this also just isn't secure, but it's not a trivial piece of software to totally jail a process, and it's not cheap to do so. You have to make lots of things secure in an way that's entirely unlike other stuff in Linux.

    At the core, this process still has permission to do whatever your user has permission to do in Linux. AND, if your user has too much control they're going to be able to do Bad Things even in a chroot jail.

    But you could go a step further and setup a virtual private server - like Xen, User Mode Linux, OpenVZ or VMWare. This guarantees (to the limit of the security of the virtualization software!) that not only are the files protected but the process is totally contained in it's own space and can't "escape" to the root OS. Essentially this IS the software you're looking for; it totally jails processes.

    Certainly, while there's really no cheap way to totally isolate a process, there could be a way in Linux more

    --
    Looking for freelance Actionscript (Flash/Flex) or ColdFusion work and/or freelance developers. Email me, put Slashdot
  96. Re:incompetent people running the government are a by crimsun · · Score: 1

    Well, if the country in which you abide purports to be a democracy, then you have a stake in ensuring that incompetent people don't run the government.

  97. What is Chroot by TT077129 · · Score: 1

    A chroot on Unix operating systems is an operation that changes the root directory. It affects only the current process and its children. "chroot" itself can refer to the chroot(2) system call or the chroot(8) wrapper program. The "chroot" system call was invented during development of Version 7 Unix, in order to provide a realistic test environment of the distribution being prepared. A program that is re-rooted to another directory cannot name files outside that directory. This is often misunderstood to be a security device, used in an attempt to sandbox an untrusted, untested or otherwise dangerous program, as if chroot was a working jail mechanism. In practice, chrooting is complicated by programs expecting at startup to find scratch space, configuration files, device nodes and shared libraries at certain preset locations. To allow programs to spawn inside the chroot directory, it must be populated with a minimum set of these files. Programs are allowed to carry open file descriptors (for files, pipelines and network connections) into the chroot, which can simplify jail design by making it unnecessary to leave working files inside the chroot directory. This also works as a simple capability system, in which the program is explicitly granted access to resources outside the chroot based on the descriptors it can carry in.

  98. The use of chroot by TT077129 · · Score: 1

    A chroot is actually can be use as isolation, recovery, privilege separation, and honeypotting. 1) Isolation A chroot environment can be used to create and host a separate copy of the operating system. Testing and development A test environment can be set up in the chroot for software that would otherwise be too risky to deploy on a production system. Dependency control Software can be developed, built and tested in a chroot populated only with its expected dependencies. This can prevent some kinds of linkage skew that can result from developers building projects with different sets of program libraries installed. Compatibility Legacy software or software using a different ABI must sometimes be run in a chroot because their supporting libraries or data files may otherwise clash in name or linkage with those of the host system. 2) Recovery Should a system be rendered unbootable, a chroot can be used to move back into the damaged environment after bootstrapping from an alternate root file system (such as from installation media) 3) Privilege separation Chroots are often used as a pre-emptive way of containing a security breach by preventing an unprivileged attacker from doing any damage or probing the host system with a compromised program. An attacker with root privileges, however, may trivially defeat this separation because the chroot does not bar system calls, shield processes outside the chroot from tracing or disallow access to block devices. 4) Honeypotting In a version of the above, a chroot directory can be populated so as to simulate a real system running network services. However, unlike an actual jail mechanism, chroot does not virtualize system calls, access to block devices or virtual file systems (such as /proc and /sys on Linux). This may make it difficult to conceal the presence of the system outside the chroot.

  99. Is it time to change? by WheelDweller · · Score: 1

    I've seen the chroot utility for decades; I generally thought it to be a good idea for those working in really hardened environments, though I've not used it myself, since I don't have a solid understanding of it. (Avoiding what he talks about).

    But maybe this would be a good time to start using the virtualization tools that come with Linux; Xen and the like. Maybe it's time we (strategically) replace chroot with virtualization? It would seem easy to 'flush and fill' the guest machine if it ever gets hacked, and it'd seem pretty tough to 'get outside' of it, aye?

    --
    --- For a good time mail uce@ftc.gov
  100. Good action by TT077129 · · Score: 1

    wow.. Using a chroot actually a good action to improve internet security and this should be continued

  101. wtf? by toadlife · · Score: 1

    Microsoft has never emulated chroot in Windows. Windows uses things like tokens and ACLs and policies to secure resources.

    --
    I don't always use unix-like operating systems; but when I do, I prefer FreeBSD.
  102. W3C Security FAQ disagrees by pfedor · · Score: 1

    Lincoln Stein, the author of CGI.pm and GD.pm and a few books, and the co-author of the WWW Security FAQs, wrote a tool called sbox that is used for securely running untrusted CGI scripts. And sbox does use the chroot() system call (in addition to other security measures) to confine the process to the CGI script owner's home directory.

    Also, from the aforementioned FAQ: "You can't make your server completely safe, but you can increase its security significantly in a Unix environment by running it in a chroot environment."

    So, the words, "chroot is not and never has been a security tool" are simply wrong. Unless you are willing to argue that Lincoln Stein belongs to "incompetent people implementing security solutions" and that W3C publishes bullshit on their web site.

  103. Re:misleading...Re:Asshole Stereotype by Captain_Carnage · · Score: 1
    'Incompetent people implementing security solutions are a real problem.'

    Man, things like this make me want to NOT switch to Linux... Even though I had a better experience with Ubuntu that I did Vista.

    You have to understand the reality of that comment... The fact is, lots of people try to implement security solutions (or solutions of all sorts) without taking the time to really understand how they work, and the ramifications of using them. Often such people are inexperienced system administrators, or worse still they are people who are not system administrators at all, but nevertheless are tasked with maintaining some piece of infrastructure and keeping it secure. This is a fact of life, but such people rarely succeed in truly securing the infrastructure in question; they simply lack the knowledge and experience required. Due to other requirements being given to them, they simply lack the time to do the required investigation to understand the software enough to sufficiently provide the requisit level of security. Often enough, their efforts are sufficient, mainly because no one sufficiently competent at breaking into computers actually cares about getting into the resource in question. Nevertheless, a competent and determined attacker will succeed at bypassing their efforts to secure the resource. If you're such a person, you shouldn't take the comment above as a personal insult -- you're in a tough position. But instead, you might take away from such a comment that security is extremely complex, and a cursory knowledge of security probably just won't help you out all that much... If you are responsible for managing the security of, well, anything, then you need to completely understand the thing you're securing and the solution you're using to secure it. If you don't, you can't possibly know what holes you're leaving open, nor the potential impact of getting it wrong. Most people simply don't understand this aspect of security.

    I wrote a piece of security software (which happens to make use of chroot to improve security), and I see this all the time. The e-mail thread that spawned this article is a prime example: people complain about a particular behavior being broken, but in actuality there's nothing wrong with the behavior; it's their own knowledge that is lacking.

    I don't completely agree with Alan; chroot() can effectively be used as a security tool under specific circumstances. But this can only be true if (along with other limitations) the code running inside the jail is not running as root, and the essence of what he said is correct. Don't forget: root is essentially the god of his system; he can bypass file system permissions, alter running programs running in memory, and (if he's sufficiently clever) even change the way the kernel works at a whim; and yes, he can break out of a chroot jail, which is less drastic a change (or intrusion) than some of that other stuff. The root user can do anything, by design.

    My software does the best it can to maintain security by calling a special SUID helper program to create the chroot jail, calling the chroot() system call as soon as it programmatically is able to do so, and immediately dropping root privileges after that. In such a way, chroot() can be an effective security tool. But it is NOT magic... you need to know what you're doing, and take great care to get it right. Certain types of misconfiguration of my software can easily result in a system that is easy to exploit. This is not a flaw in my software per se; it's just a fact of life. Most people -- even experienced programmers -- just don't have the required detailed knowledge that is needed to get it right. This doesn't make them bad people, and it doesn't even make them bad programmers. It simply makes them uninformed about a particular aspect of system behavior and programming. Any programmer, no matter how experienced, will have such gaps in knowledge. By definition, they are incompetent to program a solution which makes use of them. That statement isn't necessarily meant as an insult; it's just a fact.

  104. chroot is not equivalent to secure by TT077121 · · Score: 1

    chroot will only address the application using it while other vulnerabilities is remain, if the system is running unpatched. If a chrooted program has a file handle open before the chroot call is invoked, that file handle remains open across the chroot and could potentially become a gateway out of the sandbox. Of course, that presumes that a vulnerability exists that can exploit the file handle.

  105. Re:incompetent people running the government are a by Chrisq · · Score: 1

    Well, if the country in which you abide purports to be a democracy, then you have a stake in ensuring that incompetent people don't run the government.

    Fascist! Incompetent people deserver representation too. In my country they certainly are!

  106. Re:misleading...Re:Asshole Stereotype by RK077208 · · Score: 1

    i rather have been use windows...