[system-tools-backends-clone] Support encrypted home directories



commit 7409d11c596eb36804787bb26cad67ad494ba56d
Author: Milan Bouchet-Valat <nalimilan club fr>
Date:   Mon Jan 25 13:29:32 2010 +0100

    Support encrypted home directories
    
    When 'mount.ecryptfs' is in the path on Debian platforms, tell the clients we support encrypted home dirs for new users. Use this with the "--encrypt-home" argument to adduser.

 Users/Users.pm |    7 +++++++
 UsersConfig.pm |    7 +++++--
 2 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/Users/Users.pm b/Users/Users.pm
index 5a00012..a3d12fc 100644
--- a/Users/Users.pm
+++ b/Users/Users.pm
@@ -596,6 +596,13 @@ sub add_user
       push (@command, ("--shell", $$user[$SHELL])) if ($$user[$SHELL]);
       push (@command, ("--uid", $$user[$UID])) if ($real_uid);
       push (@command, ("--gid", $$user[$GID])) if ($real_gid);
+
+      # Allow encrypted home if the tool is present
+      if ($$user[$ENC_HOME] && &Utils::File::locate_tool ("mount.ecryptfs"))
+      {
+        push (@command, "--encrypt-home");
+      }
+
       push (@command, $$user[$LOGIN]);
 
       &Utils::File::run (@command);
diff --git a/UsersConfig.pm b/UsersConfig.pm
index 562aca1..9812d6e 100644
--- a/UsersConfig.pm
+++ b/UsersConfig.pm
@@ -55,16 +55,19 @@ dbus_method ("set", $set_format, []);
 sub get
 {
   my ($self) = @_;
-  my $logindefs, $users, $shells;
+  my $logindefs, $users, $shells, $ecryptfs_support;
   $self->SUPER::reset_counter ();
 
   $logindefs = &Users::Users::get_logindefs ();
   $users = &Users::Users::get ();
   $shells = &Users::Shells::get ();
+  $ecryptfs_support = (&Utils::File::locate_tool ("mount.ecryptfs") ne "")
+    && ($Utils::Backend::tool{"platform"} =~ /^debian/);
 
   return ($users, $shells, $$logindefs{"umin"},
           $$logindefs{"umax"}, $$logindefs{"home_prefix"},
-          $$logindefs{"shell"}, $$logindefs{"group"}, 0);
+          $$logindefs{"shell"}, $$logindefs{"group"},
+          $ecryptfs_support);
 }
 
 sub set



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