]> git.immae.eu Git - perso/Immae/Projets/Puppet.git/commitdiff
Add ldap ssha script
authorIsmaël Bouya <ismael.bouya@normalesup.org>
Fri, 19 Oct 2018 14:12:50 +0000 (16:12 +0200)
committerIsmaël Bouya <ismael.bouya@normalesup.org>
Fri, 19 Oct 2018 14:12:50 +0000 (16:12 +0200)
modules/base_installation/files/scripts/ldap_ssha [new file with mode: 0755]
modules/role/manifests/caldance.pp

diff --git a/modules/base_installation/files/scripts/ldap_ssha b/modules/base_installation/files/scripts/ldap_ssha
new file mode 100755 (executable)
index 0000000..cdbea1b
--- /dev/null
@@ -0,0 +1,13 @@
+#! /usr/bin/perl
+use strict;
+use Digest::SHA qw(sha1);
+use MIME::Base64;
+
+print 'Password: ';
+system ( "stty -echo");
+my $secret = <STDIN>;
+chomp $secret;
+my $salt;
+$salt .= ('.','/',0..9,'A'..'Z','a'..'z')[rand 64] foreach(1..8);
+
+print "\nHashed string for LDAP:\nuserPassword: {SSHA}" . encode_base64(sha1($secret . $salt) . $salt, '') . "\n";
index b7948e65647e59288f7950c7bab5a7569b8d8ab1..63dda1fd8cac3c9178c799e8932128cd6ee7773c 100644 (file)
@@ -9,4 +9,15 @@ class role::caldance (
   include "profile::monitoring"
 
   ensure_packages(["python-pip", "python-virtualenv", "python-django"])
+
+  # pour le script de génération de mdp
+  ensure_packages(["perl-digest-sha1"])
+
+  file { "/usr/local/bin/ldap_ssha":
+    owner   => "root",
+    group   => "root",
+    mode    => "0755",
+    source  => "puppet:///modules/base_installation/scripts/ldap_ssha",
+    require => Package["perl-digest-sha1"],
+  }
 }