Re: install rpm\'s as root or ...? was Re: Custom Kernel Creation Documentation Online

From: Aleksandar Milivojevic (amilivojevic_at_pbl.ca)
Date: 02/09/05

  • Next message: Rodolfo J. Paiz: "Re: Wow! A useful archive of this mailing list. Thank-you Rodolfo J. Paiz!"
    Date: Wed, 09 Feb 2005 09:37:32 -0600
    To: For users of Fedora Core releases <fedora-list@redhat.com>
    
    

    Paul Howarth wrote:
    > It's a security issue. The person writing the spec for the RPM, or
    > indeed the upstream package maintainer, could have put "rm -rf /" as a
    > command in the installation script for instance. There are a wide
    > variety of similar issues to consider. When building as a regular user,
    > the worst that can happen is whatever damage the building user has
    > permission to do to the system, which will usually mean only deleting or
    > overwriting their own files.

    While I agree with this security point, it is actually minor. Somebody
    can implant "rm -rf /" or whatever into pre/post-install script in way
    more subtle ways, or it might be carefully implanted somewhere in the
    source of the program you are about to build/install (so when you
    finally attempt to install binary RPM, something you normally do as
    root, or run the program as root (for example, it's a service, or
    utility you might want to execute as root) it gets executed). So, that
    is basically the issue if you trust something downloaded from network in
    general.

    The more usual reason is to avoid damange from bugs either present in
    original tarbal/SRPM or introduced by you. Consider for example that
    you are creating SRPM from existing tarbal, and had to make a patch that
    adds a line like this to install target of generated Makefile (for
    whatever reason):

            rm -rf ${PREFIX}/${DIRFORSOMETHING}

    Probably not a good idea to do something like that without checking that
    those two variables are defined and evaluating to something reasonable,
    but let ignore it for a moment. You made two typos when writing the
    patch (maybe you are lousy typer, or you missed your morning coffe, of
    it was 5 am, and you missed your 2, 3, and 4am coffies), and what you
    actually wrote in your patch is something like this:

            rm -rf ${PRFIX}/${DIRFORSOMETHNG}

    Since PRFIX and DIRFORSOMETHNG are not defined (PREFIX and
    DIRFORSOMETHING are), this will evaluate to "rm -rf /". If you build as
    root, you just wiped out your system. If you build as normal user, the
    damange is less severe (and if you noticed tons of permission denied
    errors on your terminal and pressed ctrl-c fast enough, maybe you were
    lucky enough that "rm -rf /" hasn't got to any of the files you own).

    This, of course, is true for any software development. Development
    should not be done as root (unless you are doing it on a system
    disconnected from network, and are not going to bug your sysadmin when
    you screw it, and you are going to screw it sooner or later). There is
    a good reason for that. Since building binary packages from SRPMs is
    really one of the development steps (even if you are not "developing"
    anything, and all you want is to simply compile SRPM made by somebody
    else), it shouldn't be done as root either.

    -- 
    Aleksandar Milivojevic <amilivojevic@pbl.ca>    Pollard Banknote Limited
    Systems Administrator                           1499 Buffalo Place
    Tel: (204) 474-2323 ext 276                     Winnipeg, MB  R3T 1L7
    -- 
    fedora-list mailing list
    fedora-list@redhat.com
    To unsubscribe: http://www.redhat.com/mailman/listinfo/fedora-list
    

  • Next message: Rodolfo J. Paiz: "Re: Wow! A useful archive of this mailing list. Thank-you Rodolfo J. Paiz!"

    Relevant Pages

    • Re: [SLE] trbl installing an rpm
      ... >> possibly due to the display options in rpm. ... To install or remove packages you need to be root, ... It turns out that some programs, including dosemu, ...
      (SuSE)
    • Re: FC4, FC6, F7 what works, and dont
      ... no bbder found using root instead. ... When you install the rpm is it the fact that rpm runs ... building the package. ...
      (Fedora)
    • Re: installing source rpm packages (.src.rpm) via yum and yumex?
      ... desirable to install or build source rpms as root. ... See the draft building packages ... why is this superior to building the rpm as root? ...
      (Fedora)
    • Re: storing root password rpm spec file
      ... Except for special cases where you can install as a user, ... normally running as root when you install an RPM. ... Now, as far as configuring the database, that is a different problem ...
      (Fedora)
    • Re: [SLE] trbl installing an rpm
      ... >> I am supposed to install it as a user, not root, ... dosemu is included in 9.3 ... If suggesting "rpm -e dosemu" was a trick to get get me to re-read the man ...
      (SuSE)

    Loading