[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[RFC] userdeb - user accounts as .debs



I've been looking for a solution to the problem of duplicating my user
environment across different machines. My search has included anything
I could find between the extremes of "manual copying" to "cfengine",
but until now I've not been lucky in finding anything that integrates
nicely with Debian.

So I've written my own tool (currently called 'userdeb') which I am
offering up here for comments. It generates a debian/* tree that when
built bundles the files and configuration that make up a user account.

The man page is below, and the (Perl and shell) code can be retrieved
via:

    git clone git://github.com/mlawren/userdeb.git

I'm open to any kind of feedback from "great! let's package it" (I am
not a DD) to "already done - see <alternative>" to "go away - you've
barstardized the packaging system".  Just as welcome of course would be
patches and/or constructive critism.

Please Cc me on any replies as I am not subscribed to debian-devel.

Thanks,
Mark.



NAME
       userdeb - pack a user account into a Debian package

SYNOPSIS
         userdeb [options] <login>

DESCRIPTION
       userdeb bundles a user account (login information, home
       directory files, and desired dependencies) into a Debian
       package. This can be useful as a complete backup, or as a
       way of duplicating your personal environment across
       multiple machines.

       As sensitive data may be included (for example gpg/ssh
       keys), all files are encrypted inside the package.
       userdeb prompts for a password during the build phase,
       and the same password given during package installation
       decrypts the files.

       The generated package can be safely removed after it is
       installed, leaving all of your files in place. Purging
       the package is a more complete version of ’userdel -f
       -r’.  Re-installation behavior - how to handle conflicts
       between locally modified files and new package files - is
       configurable.

       A normal user account can call userdeb but the resulting
       package will be missing some pieces of information which
       are only accessable by root.  You should never install a
       userdeb-generated package unless you completely trust the
       source.

       In addition to the packages defined in the ’depends’ file
       (see CONFIGURATION below), any userdeb-generated package
       requires the ’ccrypt’ package in order to be unlocked.

   Installation Actions
       The following steps take place during the installation of
       the generated package.

       Account Creation
           The user account is created with the same gecos and
           shell as on the current system. If userdeb was run as
           root then the password is also set.

       Account Groups
           The user is added to the same groups as the current
           system, provided they already exist on the target
           system.

       Email Address
           If an entry for the user was found in
           /etc/email-addresses it is duplicated on the target
           system.

       Email Aliases
           Any entries matching the login name in /etc/aliases
           are duplicated on the target system.

       Sudoers Entry
           Any entries for the user in /etc/sudoers are
           duplicated on the target system (only if userdeb was
           run as root)

       Crontabs
           If the user had a crontab on the source system it is
           also installed on the target (only if userdeb was run
           as root).

       File Decryption & Replacement
           All files in the package are decrypted. If the ’-o’
           option has been used then existing files are
           unconditionally overwritten. Otherwise new
           conflicting files are installed as $file.userdeb-new.

       Custom actions can also be specified (see CONFIGURATION
       below).

   Options
       The following command-line options are recognized by
       userdeb.

       -d  Turn on debug output during source package creation.

       -v  Turn on verbose output during the package build

       -s  Source only - do not build the package. You should
           only use this if you are interested in the details of
           how the package source is created.  Future
           invocations of userdeb will clobber any changes!

       -k  Keep the package source around after the build phase.
           You should only use this if you are interested in the
           details of how the package was built. Future
           invocations of userdeb will clobber any changes!

       -o  Unconditionally overwrite existing files on the
           target system with new ones.

CONFIGURATION
       Customization of the package can be made through the
       following configuration files located in ~/.userdeb/
       (automatically created on the first run).

       Lines beginning with ’#’ and those that are empty are
       ignored.

       manifest
           The manifest file specifies which paths to include in
           the package. It contains a list of paths (one per
           line) relative to the users home directory. They are
           expanded using the standard ’glob’ method allowing
           you to use constructs such as ’.bash*’.  If a path
           expands to a directory then all files underneath are
           included.

           The default is a single ’.*’ - i.e. all configuration
           files (and configuration directories) under
           /home/<login>/ are included.

           To include everything in your home directory you add
           a line containing ’*’.  However, be aware that
           building a package requires twice the amount of space
           on the disk as the included files, so you will not be
           able to build this if your /home is on a filesystem
           that is more than one-third full.

       depends
           A list of package names, one per line, upon which
           this package will depend. Version information can be
           specified exactly the same way as in a debian/control
           file. userdeb automatically adds the users shell to
           the dependency list.

       conflicts
           A list of package names, one per line, with which
           this package will conflict. Version information can
           be specified exactly the same way as in a
           debian/control file.

FILES
       The ’/usr/share/user-<login>/unlock’ script included in
       the new package is responsible for the decryption of
       files. It can be used in the event that things do not
       succeed during installation (wrong password, unattended
       install, etc).

SEE ALSO
       debuild(1), ccrypt(1)

AUTHOR
       Mark Lawrence <nomad@null.net>

COPYRIGHT AND LICENSE
       Copyright (C) 2009 Mark Lawrence <nomad@null.net>

       This program is free software; you can redistribute it
       and/or modify it under the terms of the GNU General
       Public License as published by the Free Software
       Foundation; either version 3 of the License, or (at your
       option) any later version.


-- 
Mark Lawrence

Attachment: signature.asc
Description: Digital signature


Reply to: