Code

Updated encryption script to encrypt snapshot passwords too.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 29 Jun 2009 13:59:35 +0000 (13:59 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 29 Jun 2009 13:59:35 +0000 (13:59 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13822 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/bin/gosa-encrypt-passwords

index 05568bdb81b41babee787ad7f8e7cc294eb62292..7d5c69d1ba7712a11752fce1e3dc078745bbf47c 100755 (executable)
@@ -64,14 +64,24 @@ $conf = new DOMDocument();
 $conf->load("/etc/gosa/gosa.conf") or die ("Cannot read /etc/gosa/gosa.conf - aborted\n");
 $conf->encoding = 'UTF-8';
 $referrals= $conf->getElementsByTagName("referral");
-echo "* encrypting existent passwords with master key\n";
 foreach($referrals as $referral){
   $user = $referral->attributes->getNamedItem("adminDn");
-  echo "* encrypting password for: ".$user->nodeValue."\n";
+  echo "* encrypting GOsa password for: ".$user->nodeValue."\n";
   $pw= $referral->attributes->getNamedItem("adminPassword");
   $pw->nodeValue= cred_encrypt($pw->nodeValue, $master_key);
 }
 
+# Encrypt the snapshot passwords 
+$locations= $conf->getElementsByTagName("location");
+foreach($locations as $location){
+  $name = $location->attributes->getNamedItem("name"); 
+  $node = $location->attributes->getNamedItem("snapshotAdminPassword"); 
+  if($node->nodeValue){
+    echo "* encrypting snapshot pasword for location: ".$name->nodeValue."\n";
+    $node->nodeValue = cred_encrypt($node->nodeValue, $master_key);;
+  }
+}
+
 # Move original gosa.conf out of the way and make it unreadable for the web user
 echo "* creating backup in /etc/gosa/gosa.conf.orig\n";
 rename("/etc/gosa/gosa.conf", "/etc/gosa/gosa.conf.orig");